|
|
@ -87,9 +87,9 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
var result = await _sysApi.GetRoleInfoes(); |
|
|
|
|
|
|
|
var RoleItems = new List<SelectListItem>(); |
|
|
|
for (int i = 0; i < result.Count; i++) |
|
|
|
foreach (var item in result.Data) |
|
|
|
{ |
|
|
|
RoleItems.Add(new SelectListItem(result[i].RoleName, result[i].RoleID.ToString())); |
|
|
|
RoleItems.Add(new SelectListItem(item.RoleName, item.RoleID.ToString())); |
|
|
|
} |
|
|
|
ViewBag.RoleList = RoleItems; |
|
|
|
} |
|
|
@ -111,9 +111,9 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
var result = await _sysApi.GetUserInfoes(); |
|
|
|
|
|
|
|
var UserItems = new List<SelectListItem>(); |
|
|
|
for (int i = 0; i < result.Count; i++) |
|
|
|
foreach (var item in result.Data) |
|
|
|
{ |
|
|
|
UserItems.Add(new SelectListItem(result[i].UserNo + result[i].UserName, result[i].UserID.ToString())); |
|
|
|
UserItems.Add(new SelectListItem(item.UserNo + item.UserName, item.UserID.ToString())); |
|
|
|
} |
|
|
|
ViewBag.UserList = UserItems; |
|
|
|
} |
|
|
@ -340,6 +340,27 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
[HttpGet] |
|
|
|
public async Task<IActionResult> GetModuleInfoesBySystemAsync(int systemID, int page = 0, int limit = 10) |
|
|
|
{ |
|
|
|
var system_id = ""; |
|
|
|
HttpContext.Request.Cookies.TryGetValue("SystemID4SYS002", out system_id); |
|
|
|
if (system_id != null) |
|
|
|
{ |
|
|
|
if (systemID == 0) |
|
|
|
{ |
|
|
|
systemID = int.Parse(system_id.ToString()); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
HttpContext.Response.Cookies.Append("SystemID4SYS002", systemID.ToString()); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (systemID > 0) |
|
|
|
{ |
|
|
|
HttpContext.Response.Cookies.Append("SystemID4SYS002", systemID.ToString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var result = await _sysApi.GetModuleInfoesBySystem(systemID, page, limit); |
|
|
|
|
|
|
|
|
|
|
@ -419,14 +440,14 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
result = await _sysApi.PutProgramInfo(model.ProgramID, JsonConvert.SerializeObject(model)); |
|
|
|
} |
|
|
|
|
|
|
|
if (!result.Success) |
|
|
|
if (result.Success) |
|
|
|
{ |
|
|
|
var _msg = model.ProgramID == 0 ? "添加成功!" : "修改成功!"; |
|
|
|
return RedirectToAction("Refresh", "Home", new { msg = _msg }); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (result.Errors.Count > 0) |
|
|
|
if (result.Errors != null) |
|
|
|
{ |
|
|
|
ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); |
|
|
|
} |
|
|
@ -461,13 +482,32 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
[HttpGet] |
|
|
|
public async Task<IActionResult> GetProgramInfoesByModuleAsync(int moduleID, int page = 0, int limit = 10) |
|
|
|
{ |
|
|
|
var result = await _sysApi.GetProgramInfoesByMoudle(moduleID, page, limit); |
|
|
|
var result_total = await _sysApi.GetProgramInfoesByMoudle(moduleID, 0, limit); |
|
|
|
var module_id = ""; |
|
|
|
HttpContext.Request.Cookies.TryGetValue("ModuleID4SYS003", out module_id); |
|
|
|
if (module_id != null) |
|
|
|
{ |
|
|
|
if (moduleID == 0) |
|
|
|
{ |
|
|
|
moduleID = int.Parse(module_id.ToString()); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
HttpContext.Response.Cookies.Append("ModuleID4SYS003", moduleID.ToString()); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (moduleID > 0) |
|
|
|
{ |
|
|
|
HttpContext.Response.Cookies.Append("ModuleID4SYS003", moduleID.ToString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var result = await _sysApi.GetProgramInfoesByMoudle(moduleID, page, limit); |
|
|
|
|
|
|
|
if (result.Count > 0) |
|
|
|
if (result.DataTotal > 0) |
|
|
|
{ |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result, count = result_total.Count }); |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); |
|
|
|
} |
|
|
|
|
|
|
|
return Json(new Table() { count = 0, data = null }); |
|
|
@ -523,14 +563,14 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
result = await _sysApi.PutRoleInfo(model.RoleID, JsonConvert.SerializeObject(model)); |
|
|
|
} |
|
|
|
|
|
|
|
if (!result.Success) |
|
|
|
if (result.Success) |
|
|
|
{ |
|
|
|
var _msg = model.RoleID == 0 ? "添加成功!" : "修改成功!"; |
|
|
|
return RedirectToAction("Refresh", "Home", new { msg = _msg }); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (result.Errors.Count > 0) |
|
|
|
if (result.Errors != null) |
|
|
|
{ |
|
|
|
ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); |
|
|
|
} |
|
|
@ -552,11 +592,10 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
public async Task<IActionResult> GetRoleInfoesAsync(int page = 0, int limit = 10) |
|
|
|
{ |
|
|
|
var result = await _sysApi.GetRoleInfoes(page,limit); |
|
|
|
var result_total = await _sysApi.GetRoleInfoes(0,limit); |
|
|
|
|
|
|
|
if (result.Count > 0) |
|
|
|
if (result.DataTotal > 0) |
|
|
|
{ |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result, count = result_total.Count }); |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); |
|
|
|
} |
|
|
|
|
|
|
|
return Json(new Table() { count = 0, data = null }); |
|
|
@ -646,14 +685,14 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
result = await _sysApi.PutRoleModule(model.RoleModuleID, JsonConvert.SerializeObject(model)); |
|
|
|
} |
|
|
|
|
|
|
|
if (!result.Success) |
|
|
|
if (result.Success) |
|
|
|
{ |
|
|
|
var _msg = model.RoleModuleID == 0 ? "添加成功!" : "修改成功!"; |
|
|
|
return RedirectToAction("Refresh", "Home", new { msg = _msg }); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (result.Errors.Count > 0) |
|
|
|
if (result.Errors!=null) |
|
|
|
{ |
|
|
|
ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); |
|
|
|
} |
|
|
@ -689,11 +728,10 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
public async Task<IActionResult> GetRoleModulesByRoleAsync(int roleID, int page = 0, int limit = 10) |
|
|
|
{ |
|
|
|
var result = await _sysApi.GetRoleModulesByRole(roleID,page,limit); |
|
|
|
var result_total = await _sysApi.GetRoleModulesByRole(roleID, 0, limit); |
|
|
|
|
|
|
|
if (result.Count > 0) |
|
|
|
if (result.DataTotal > 0) |
|
|
|
{ |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result, count = result_total.Count }); |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); |
|
|
|
} |
|
|
|
|
|
|
|
return Json(new Table() { count = 0, data = null }); |
|
|
@ -783,14 +821,14 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
result = await _sysApi.PutRoleProgram(model.RoleProgramID, JsonConvert.SerializeObject(model)); |
|
|
|
} |
|
|
|
|
|
|
|
if (!result.Success) |
|
|
|
if (result.Success) |
|
|
|
{ |
|
|
|
var _msg = model.RoleProgramID == 0 ? "添加成功!" : "修改成功!"; |
|
|
|
return RedirectToAction("Refresh", "Home", new { msg = _msg }); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (result.Errors.Count > 0) |
|
|
|
if (result.Errors != null) |
|
|
|
{ |
|
|
|
ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); |
|
|
|
} |
|
|
@ -826,11 +864,10 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
public async Task<IActionResult> GetRoleProgramsByRoleAsync(int roleID, int page = 0, int limit = 10) |
|
|
|
{ |
|
|
|
var result = await _sysApi.GetRoleProgramsByRole(roleID, page, limit); |
|
|
|
var result_total = await _sysApi.GetRoleProgramsByRole(roleID,0,limit); |
|
|
|
|
|
|
|
if (result.Count > 0) |
|
|
|
if (result.DataTotal > 0) |
|
|
|
{ |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result, count = result_total.Count }); |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); |
|
|
|
} |
|
|
|
|
|
|
|
return Json(new Table() { count = 0, data = null }); |
|
|
@ -898,14 +935,14 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
result = await _sysApi.PutDeptInfo(model.DeptID, JsonConvert.SerializeObject(model)); |
|
|
|
} |
|
|
|
|
|
|
|
if (!result.Success) |
|
|
|
if (result.Success) |
|
|
|
{ |
|
|
|
var _msg = model.DeptID == 0 ? "添加成功!" : "修改成功!"; |
|
|
|
return RedirectToAction("Refresh", "Home", new { msg = _msg }); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (result.Errors.Count > 0) |
|
|
|
if (result.Errors!=null) |
|
|
|
{ |
|
|
|
ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); |
|
|
|
} |
|
|
@ -1006,14 +1043,14 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
result = await _sysApi.PutUserInfo(model.UserID, JsonConvert.SerializeObject(model)); |
|
|
|
} |
|
|
|
|
|
|
|
if (!result.Success) |
|
|
|
if (result.Success) |
|
|
|
{ |
|
|
|
var _msg = model.UserID == 0 ? "添加成功!" : "修改成功!"; |
|
|
|
return RedirectToAction("Refresh", "Home", new { msg = _msg }); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (result.Errors.Count > 0) |
|
|
|
if (result.Errors!=null) |
|
|
|
{ |
|
|
|
ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); |
|
|
|
} |
|
|
@ -1036,11 +1073,10 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
public async Task<IActionResult> GetUserInfoesAsync(int page = 0, int limit = 10) |
|
|
|
{ |
|
|
|
var result = await _sysApi.GetUserInfoes(page,limit); |
|
|
|
var result_total = await _sysApi.GetUserInfoes(0,limit); |
|
|
|
|
|
|
|
if (result.Count > 0) |
|
|
|
if (result.DataTotal > 0) |
|
|
|
{ |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result, count = result_total.Count }); |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); |
|
|
|
} |
|
|
|
|
|
|
|
return Json(new Table() { count = 0, data = null }); |
|
|
@ -1129,14 +1165,14 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
result = await _sysApi.PutUserRole(model.UserRoleID, JsonConvert.SerializeObject(model)); |
|
|
|
} |
|
|
|
|
|
|
|
if (!result.Success) |
|
|
|
if (result.Success) |
|
|
|
{ |
|
|
|
var _msg = model.UserRoleID == 0 ? "添加成功!" : "修改成功!"; |
|
|
|
return RedirectToAction("Refresh", "Home", new { msg = _msg }); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (result.Errors.Count > 0) |
|
|
|
if (result.Errors!=null) |
|
|
|
{ |
|
|
|
ModelState.AddModelError(result.Errors[0].Id, result.Errors[0].Msg); |
|
|
|
} |
|
|
@ -1172,11 +1208,10 @@ namespace AMESCoreStudio.Web.Controllers |
|
|
|
public async Task<IActionResult> GetUserRolesByUserAsync(int userID, int page = 0, int limit = 10) |
|
|
|
{ |
|
|
|
var result = await _sysApi.GetUserRolesByUser(userID,page,limit); |
|
|
|
var result_total = await _sysApi.GetUserRolesByUser(userID,0,limit); |
|
|
|
|
|
|
|
if (result.Count > 0) |
|
|
|
if (result.DataTotal > 0) |
|
|
|
{ |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result, count = result.Count }); |
|
|
|
return Json(new Table() { code = 0, msg = "", data = result.Data, count = result.DataTotal }); |
|
|
|
} |
|
|
|
|
|
|
|
return Json(new Table() { count = 0, data = null }); |
|
|
|