//查询输出数据库中所有权限列表 public void GetAllAuthorityList(ref Role2AuthorityViewModel r2aInfoVM) { List<Authority> authorityList = new List<Authority>(); int Row = 0; System.Data.DataTable authorityListDT = _ServicesSoapClient.GetAuthorityList().Tables[0]; foreach (DataRow row in authorityListDT.Rows) { authorityList.Add(new Authority { Code = row["AuthorityCode"].ToString(), Name = row["AuthorityName"].ToString() }); Row++; } r2aInfoVM.AuthorityList = authorityList; r2aInfoVM.AuthorityRowCount = Row; }
public ActionResult r2aPartialView(Role2AuthorityViewModel r2aVM) { try { GetRoleAuthorityList(r2aVM.RoleNameSelected, ref r2aVM); return View(r2aVM); } catch (Exception ex) { return Content(ex.ToString()); } }
//权限分配 public ActionResult RoleToAuthority() { Role2AuthorityViewModel role2AuthorityVM = new Role2AuthorityViewModel(); GetAllAuthorityList(ref role2AuthorityVM); return View(role2AuthorityVM); }
//查询输出该角色(roleCode)已有权限列表 public void GetRoleAuthorityList(string roleCode, ref Role2AuthorityViewModel r2aVM) { List<AuthorityDetail> roleAuthorityList = new List<AuthorityDetail>(); int Row = 0; System.Data.DataTable roleAuthorityListDT = _ServicesSoapClient.GetRoleAuthorityList(roleCode).Tables[0]; foreach (DataRow row in roleAuthorityListDT.Rows) { roleAuthorityList.Add(new AuthorityDetail { AuthorityCode = row["AuthorityCode"].ToString(), AuthorityName = row["AuthorityName"].ToString(), SubAuthorityCode = row["SubAuthorityCode"].ToString(), SubAuthorityName = row["SubAuthorityName"].ToString() }); Row++; } r2aVM.RoleAuthorityList = roleAuthorityList; r2aVM.RoleAuthorityRowCount = Row; }