/// <summary> /// 分页得到回收的权限 /// </summary> /// <param name="page"></param> /// <param name="rows"></param> /// <returns></returns> public ActionResult GetRecycles(int page, int rows) { DGModel<vPermission> dgModel = new DGModel<vPermission>(); List<Permission> _permissions = new List<Permission>(); List<vPermission> permissions = new List<vPermission>(); int count = 0; try { IPermissionBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetPermissionBLL; _permissions = bll.LoadPageEntity(page, rows, out count, p => p.IsDelete == true, p => p.AddTime, false).ToList(); foreach (var permission in _permissions) { permissions.Add(new vPermission(permission)); } dgModel.total = count; dgModel.rows = permissions; } catch { dgModel.total = count; dgModel.rows = null; } return Json(dgModel); }
/// <summary> /// 分页得到权限列表 /// </summary> /// <param name="page"></param> /// <param name="rows"></param> /// <returns></returns> public ActionResult GetPermissions(int page, int rows) { DGModel<vPermission> dgModel = new DGModel<vPermission>(); List<Permission> permissions = new List<Permission>(); List<vPermission> _permissions = new List<vPermission>(); try { IPermissionBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetPermissionBLL; // permissions = bll.GetPagedList(0, 10, p => p.IsDelete == false,p=>p.AddTime); int count = 0;//= bll.GetListBy(p => p.PName == p.PName).ToList().Count(); permissions = bll.LoadPageEntity(page, rows, out count, p => p.IsDelete == false, p => p.AddTime, false).ToList(); foreach (var permission in permissions) { _permissions.Add(new vPermission(permission)); } dgModel.rows = _permissions; dgModel.total = count; } catch { dgModel.total = 0; dgModel.rows = null; } return Json(dgModel); }
/// <summary> /// 分页的得到部门 /// </summary> /// <param name="page"></param> /// <param name="rows"></param> /// <returns></returns> public ActionResult GetDepartments(int page, int rows) { DGModel<vDepartment> dgModel = new DGModel<vDepartment>(); List<Department> _departments = new List<Department>(); List<vDepartment> departments = new List<vDepartment>(); int count = 0; try { IDepartmentBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetDepartmentBLL; _departments = bll.LoadPageEntity(page, rows, out count, d => d.IsDelete == false, p => p.AddTime, false).ToList(); foreach (var department in _departments) { departments.Add(new vDepartment(department)); } dgModel.total = count; dgModel.rows = departments; } catch { dgModel.total = count; dgModel.rows = null; } return Json(dgModel); }
/// <summary> /// 分页得到角色名称 /// </summary> /// <param name="page"></param> /// <param name="rows"></param> /// <returns></returns> public ActionResult GetRoles(int page, int rows) { List<Role> _roles = new List<Role>(); List<vRole> roles = new List<vRole>(); DGModel<vRole> dgModel = new DGModel<vRole>(); int count = 0; try { IRoleBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetRoleBLL; _roles = bll.LoadPageEntity(page, rows, out count, r => r.IsDelete == false, r => r.AddTime, false).ToList(); foreach (var role in _roles) { roles.Add(new vRole(role)); } dgModel.rows = roles; dgModel.total = count; } catch { dgModel.rows = null; dgModel.total = count; } return Json(dgModel); }
/// <summary> /// 按页获取用户 /// </summary> /// <param name="page"></param> /// <param name="rows"></param> /// <returns></returns> public ActionResult GetUsers(int page, int rows) { DGModel<User> dgModel = new DGModel<User>(); List<User> users = new List<User>(); int count = 0; try { IUserBLL bll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetUserBLL; users = bll.LoadPageEntity(page, rows, out count, u => u.IsDelete == false, u => u.AddTime, false).ToList(); dgModel.rows = users; dgModel.total = count; } catch { dgModel.rows = null; dgModel.total = count; } return Json(dgModel); }
/// <summary> /// 得到用户角色 /// </summary> /// <returns></returns> public ActionResult GetUserRoles(int uid) { DGModel<vRole> dgModel = new DGModel<vRole>(); List<UserRole> userRoles = new List<UserRole>(); List<vRole> vroles = new List<vRole>(); Role role = new Role(); try { IUserRoleBLL urbll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetUserRoleBLL; IRoleBLL rbll = OperationContext.GetBLLSessionFactory().GetBLLSession().GetRoleBLL; userRoles = urbll.GetListBy(ur => ur.UserID == uid && ur.IsDelete == false, ur => ur.AddTime); foreach (var ur in userRoles) { role = rbll.GetListBy(r => r.ID == ur.RoleID).SingleOrDefault(); vroles.Add(new vRole(role)); } dgModel.rows = vroles; dgModel.total = vroles.Count(); } catch { dgModel.rows = null; dgModel.total = 0; } return Json(dgModel); }