[HttpPost]//查询 public ViewModel List(VIEW_SYS_ROLE data) { int pageSize = int.Parse(data.rows); int pageIndex = int.Parse(data.page); string sort = data.sort; string order = data.order; //查询条件 IQueryable <SYS_ROLE> SYS_ROLEEntity = oc.BllSession.ISYS_ROLEService.Entities; if (data.NAME != null && data.NAME != "") { SYS_ROLEEntity = SYS_ROLEEntity.Where(u => u.NAME.IndexOf(data.NAME) > -1); } int total = 0; total = SYS_ROLEEntity.Count(); var listROLE = SYS_ROLEEntity.OrderBy(u => u.ROLE_ID) .Skip(pageSize * (pageIndex - 1)).Take(pageSize) .Select(mb => new { ROLE_ID = mb.ROLE_ID, name = mb.NAME, note = mb.NOTE }).ToList(); return(ObjToJson.ViewModelToJson(listROLE, total)); }
[HttpPost]//查询 public ViewModel List(VIEW_SYS_USER data) { int pageSize = int.Parse(data.rows); int pageIndex = int.Parse(data.page); string sort = data.sort; string order = data.order; //查询条件 Expression <Func <SYS_USER, bool> > slamda = u => u.DEPT_CODE.StartsWith(oc.CurrentUser.SYS_DEPT.DEPT_CODE); if (data.DEPT_CODE != null && data.DEPT_CODE != "") { slamda = u => u.DEPT_CODE.StartsWith(data.DEPT_CODE); } int total = 0; total = oc.BllSession.ISYS_USERService.Entities.Where(slamda).Count(); var listMenus = oc.BllSession.ISYS_USERService.Entities.Include("SYS_USER_ROLE_MAP").Where(slamda).OrderBy(u => u.DEPT_CODE) .Skip(pageSize * (pageIndex - 1)).Take(pageSize).Select(mb => new { deptcode = mb.DEPT_CODE, deptname = mb.SYS_DEPT.DEPT_NAME, depticon = mb.SYS_DEPT.C_ICO, username = mb.USER_NAME, zsname = mb.ZSNAME, uptime = mb.UPDATE_DATE, upuser = mb.UPDATE_USER, mb.SYS_USER_ROLE_MAP } ).ToList(); List <UserRoleModel> listMenu = new List <UserRoleModel>(); foreach (var item in listMenus) { string rolename = string.Empty; foreach (var itemx in item.SYS_USER_ROLE_MAP) { if (rolename != "") { rolename += ","; } rolename += itemx.SYS_ROLE.NAME; } listMenu.Add(new UserRoleModel { deptcode = item.deptcode, deptname = item.deptname, USER_NAME = item.username, ZSNAME = item.zsname, uptime = item.uptime, upuser = item.upuser, rolename = rolename, depticon = item.depticon }); } return(ObjToJson.ViewModelToJson(listMenu, total)); }
[HttpPost]//查询 public ViewModel List(VIEW_SYS_MEMBER data) { int pageSize = int.Parse(data.rows); int pageIndex = int.Parse(data.page); string sort = data.sort; string order = data.order; //查询条件 IQueryable <SYS_MEMBER> SYS_MEMBEREntity = oc.BllSession.ISYS_MEMBERService.Entities; if (!string.IsNullOrEmpty(data.MOBILE)) { SYS_MEMBEREntity = SYS_MEMBEREntity.Where(u => u.MOBILE.Contains(data.MOBILE) && u.DEL_FLAG == "0"); } else { if (data.DEPT_CODE != null && data.DEPT_CODE != "") { SYS_MEMBEREntity = SYS_MEMBEREntity.Where(u => u.DEPT_CODE.StartsWith(data.DEPT_CODE) && u.DEL_FLAG == "0"); } else { SYS_MEMBEREntity = SYS_MEMBEREntity.Where(u => u.DEPT_CODE.StartsWith(oc.CurrentUser.SYS_DEPT.DEPT_CODE) && u.DEL_FLAG == "0"); } } int total = 0; total = SYS_MEMBEREntity.Count(); var listMEMBER = SYS_MEMBEREntity.OrderBy(u => u.DEPT_CODE) .Skip(pageSize * (pageIndex - 1)).Take(pageSize).Select(mb => new { MEMBER_ID = mb.MEMBER_ID, deptname = mb.SYS_DEPT.DEPT_NAME, depticon = mb.SYS_DEPT.C_ICO, deptcode = mb.SYS_DEPT.DEPT_CODE, name = mb.NAME, mobile = mb.MOBILE, update = mb.UPDATE_DATE, upuser = mb.UPDATE_USER, job = mb.JOB, phone = mb.PHONE, loctionflag = mb.LOCATION_FLAG, intelligence = mb.SYS_INTELLIGENCE_DIC.DIC_NAME, poslevel = mb.SYS_POSLEVEL_DIC.DIC_NAME, state = mb.MOBILE_STATE } ).ToList(); //return ObjToJson.GetToJson(listMenu, total, true); return(ObjToJson.ViewModelToJson(listMEMBER, total)); }