private SearchResult <CBRUnitUIModel> GetSearchResult(CBRUnitSearchModel searchModel) { var predicate = PredicateBuilder.True <t_D_UserTableTen>(); int pos = searchModel.posStart.HasValue ? searchModel.posStart.Value : 0; int count = searchModel.count.HasValue ? searchModel.count.Value : 30; //if (!string.IsNullOrWhiteSpace(searchModel.CheckUnitName)) //{ // predicate = predicate.And(t => t.unitCode == searchModel.CheckUnitName); //} string orderby = string.Empty; string orderByAcs = string.Empty; bool isDes = true; string sortProperty = "id"; //string[] columns = { "CheckBox", "SeqNo", "NAME", "UNITNAME" }; //if (searchModel.orderColInd.HasValue // && !string.IsNullOrWhiteSpace(searchModel.direct) // && searchModel.orderColInd.Value <= columns.Length) //{ // if (searchModel.direct == "asc") // { // sortProperty = orderby = columns[searchModel.orderColInd.Value]; // isDes = false; // } // if (searchModel.direct == "des") // { // sortProperty = orderByAcs = columns[searchModel.orderColInd.Value]; // isDes = true; // } //} PagingOptions <t_D_UserTableTen> pagingOption = new PagingOptions <t_D_UserTableTen>(pos, count, sortProperty, isDes); var customs = repTen.GetByConditionSort <CBRUnitUIModel>(predicate, r => new { r.id, r.pid, r.zjsp1, r.zjsp2, r.slr, r.slbh, r.cbr, r.@static, r.outstaticinfo }, pagingOption); return(new SearchResult <Models.CBRUnitUIModel>(pagingOption.TotalItems, customs)); }
public ActionResult Search(CBRUnitSearchModel searchModel) { var data = GetSearchResult(searchModel); DhtmlxGrid grid = new DhtmlxGrid(); int pos = searchModel.posStart.HasValue ? searchModel.posStart.Value : 0; grid.AddPaging(data.TotalCount, pos); var buttons = GetCurrentUserPathActions(); var currentUserRole = GetCurrentUserRole(); for (int i = 0; i < data.Results.Count; i++) { var rowData = data.Results[i]; DhtmlxGridRow row = new DhtmlxGridRow(rowData.id.ToString()); row.AddCell(string.Empty); row.AddCell((pos + i + 1).ToString());//序号 var tbOne = repOne.GetById(rowData.pid); if (tbOne != null) { row.AddCell(tbOne.unitname); } else { row.AddCell(""); } if (rowData.zjsp1.HasValue) { var user = repUser.GetById(rowData.zjsp1); var ueu = repEU.GetByCondition(r => r.userid == user.Id && r.pid == rowData.pid).FirstOrDefault(); if (ueu != null) { if (ueu.qualifystatus == 1) { row.AddLinkJsCell(user.UserDisplayName + "/[建设工程质量检测资质机构审核表]", "DetailUnitBuildingQualify(\"{0}\",\"{1}\")".Fmt(ueu.shid, ueu.pid)); } else { row.AddCell(""); } if (ueu.speicalstatus == 1) { row.AddLinkJsCell(user.UserDisplayName + "/[专项检测备案审核表]", "DetailSpecialQualify(\"{0}\",\"{1}\")".Fmt(ueu.scid, ueu.pid)); } else { row.AddCell(""); } } else { row.AddCell(""); row.AddCell(""); } } else { row.AddCell(""); row.AddCell(""); } if (rowData.zjsp2.HasValue) { var user = repUser.GetById(rowData.zjsp2); var ueu = repEU.GetByCondition(r => r.userid == user.Id && r.pid == rowData.pid).FirstOrDefault(); if (ueu != null) { if (ueu.qualifystatus == 1) { row.AddLinkJsCell(user.UserDisplayName + "/[建设工程质量检测资质机构审核表]", "DetailUnitBuildingQualify(\"{0}\",\"{1}\")".Fmt(ueu.shid, ueu.pid)); } else { row.AddCell(""); } if (ueu.speicalstatus == 1) { row.AddLinkJsCell(user.UserDisplayName + "/[专项检测备案审核表]", "DetailSpecialQualify(\"{0}\",\"{1}\")".Fmt(ueu.scid, ueu.pid)); } else { row.AddCell(""); } } else { row.AddCell(""); row.AddCell(""); } } else { row.AddCell(""); row.AddCell(""); } row.AddCell(rowData.slr); row.AddCell(rowData.cbr); if (rowData.@static == 1) { row.AddCell("受理人受理"); } else if (rowData.@static == 2) { row.AddCell("已分配专家"); } else if (rowData.@static == 3) { row.AddCell("专家审批完成"); } else if (rowData.@static == 4) { row.AddCell("承办人审批通过"); } else if (rowData.@static == 5) { row.AddCell("承办人审批不通过"); } else if (rowData.@static == 6) { row.AddCell("申诉复核通过"); } else if (rowData.@static == 7) { row.AddCell("申诉复核不通过"); } else { row.AddCell(""); } var tbCS = repCS.GetByCondition(r => r.pid == rowData.pid).FirstOrDefault(); if (rowData.@static >= 3) { if (tbCS != null) { row.AddLinkJsCell("查看初审表", "Detail(\"{0}\")".Fmt(tbCS.id)); } else { row.AddLinkJsCell("填写初审表", "FillIn(\"{0}\")".Fmt(rowData.pid)); } } else { row.AddCell(string.Empty); } if (rowData.@static == 3) { if (HaveButtonFromAll(buttons, "Approval") && tbCS != null) { row.AddLinkJsCell("审批", "Approval(\"{0}\",\"{1}\")".Fmt(rowData.id, rowData.pid)); } else { row.AddCell(string.Empty); } } else if (rowData.@static == 5) { row.AddLinkJsCell("查看原因", "Reason(\"{0}\")".Fmt(rowData.outstaticinfo)); } grid.AddGridRow(row); } string str = grid.BuildRowXml().ToString(System.Xml.Linq.SaveOptions.DisableFormatting); return(Content(str, "text/xml")); }