public async Task <IActionResult> QueryOrgList(SearchOrgModel search) { if (string.IsNullOrEmpty(search.pcode)) // 根组织 { //判断用户是否为超级管理员,如果是超级管理员则 获取所有的组织结构,否则获取当前用户的可见组织结构 bool admin = await this._contextService.IsInRole(base.UserId, Constans.SUPPER_ADMIN_ROLE); if (!admin) { var user = await base.GetSignedUser(); if (!string.IsNullOrEmpty(user.ViewRootCode)) { search.pcode = user.ViewRootCode; } } } if (search.pcode == rootId) { search.pcode = ""; } List <IOrganization> list = await this._service.QueryOrgListByParentCode(search.pcode); var ret = JsonQTable.ConvertFromList(list, search.colkey, search.colsArray); return(Json(ret)); }
public FuncResult GetListPagination(SearchOrgModel model) { FuncResult fr = new FuncResult() { IsSuccess = true, Message = "操作成功" }; try { var query = from o in context.ApdDimOrg select o; query = query.Where(f => (string.IsNullOrEmpty(model.orgname) || f.OrgName.Contains(model.orgname)) && (string.IsNullOrEmpty(model.orgcode) || f.OrgCode.Contains(model.orgcode)) && (string.IsNullOrEmpty(model.year) || f.PeriodYear.Equals(Convert.ToDecimal(model.year)))); int count = query.Count(); if (model.limit * model.page >= count) { model.page = 0; } var data = query.Skip(model.limit * model.page).Take(model.limit); fr.Content = new { data = data, total = count }; return(fr); } catch (Exception) { throw; } }
public FuncResult GetListPagination([FromBody] SearchOrgModel model) { try { model.page--; if (model.page < 0) { model.page = 0; } return(orgBll.GetListPagination(model)); } catch (Exception) { throw; } }