public static List <ModulePermission> ModulePermission_SelectPage(SystemPermissionSearchInfo search, int pageIndex, int pageSize, out int rowCount) { using (SystemDAL access = new SystemDAL()) { return(access.ModulePermission_SelectPage("*", pageIndex, pageSize, search.DefaultOrder, search.ToWhereString(), out rowCount)); } }
public ActionResult PermissionListView() { string m_gid = Request["m_gid"] ?? string.Empty; int rowCount; //查询所有的模块 SystemPermissionSearchInfo search = new SystemPermissionSearchInfo() { p_m_gid = m_gid }; List <ModulePermission> list = SystemSeviceClass.ModulePermission_SelectPage(search, 1, 100, out rowCount); ViewData["window"] = Request["window"] ?? string.Empty; ViewData["list"] = list; ViewData["m_gid"] = m_gid; return(View()); }
//查询角色 对应的 模块下的 所有权限 public ActionResult PerListView() { //模块gid string m_gid = Request["m_gid"] ?? string.Empty; //角色gid string ruid = Request["ruid"] ?? string.Empty; //查询 角色 已有该模块下的 哪些权限 List <ModulePermission> rpList = SystemSeviceClass.ModulePermission_SelectModulePerByRoleGid(ruid, m_gid); SystemPermissionSearchInfo search = new SystemPermissionSearchInfo() { p_m_gid = m_gid }; int rowcount; //模块下的所有权限 List <ModulePermission> pList = SystemSeviceClass.ModulePermission_SelectPage(search, 1, 100, out rowcount); //bool:角色是否有该权限 Dictionary <ModulePermission, bool> mbDic = new Dictionary <ModulePermission, bool>(); foreach (ModulePermission item in pList) { if (rpList.Where(u => u.p_gid == item.p_gid).Count() > 0) { mbDic.Add(item, true); } else { mbDic.Add(item, false); } } ViewBag.mbDic = mbDic; ViewBag.ruid = ruid; ViewBag.m_gid = m_gid; return(PartialView()); }