public ActionResult _AjaxList(GridCommand command, CreateDNSearchModel searchModel) { SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel); GridModel<CreateDN> gridlist = GetAjaxPageData<CreateDN>(searchStatementModel, command); if (gridlist.Data != null && gridlist.Data.Count() > 0) { string hql = string.Format(" from CancelCreateDN as c where c.IpDetConfirmId in ({0}) ", string.Join(",", gridlist.Data.Select(d => d.IpDetConfirmId).ToArray())); IList<CancelCreateDN> cancelList = this.genericMgr.FindAll<CancelCreateDN>(hql); foreach (var det in gridlist.Data) { det.DNSTRDesc = GetCreateDNDNSTRDesc(det.DNSTR); det.GISTRDesc = GetCreateDNGISTRDesc(det.GISTR); if (cancelList != null && cancelList.Count > 0) { var cDatas = cancelList.Where(d => d.IpDetConfirmId == det.IpDetConfirmId); if (cDatas != null && cDatas.Count() > 0) { CancelCreateDN cdata = cDatas.First(); det.CancelCreateDate = cdata.CreateDate; det.CancelDNSTRDesc = GetCancelCreateDNDNSTRDesc(cdata.DNSTR); det.CancelGISTRDesc = GetCancelCreateDNGISTRDesc(cdata.GISTR); det.CancelMessage = cdata.Message; det.CancelErrorCount = cdata.ErrorCount; det.CancelIpDetConfirmId = cdata.CancelIpDetConfirmId; } } } } return PartialView(gridlist); }
public ActionResult List(GridCommand command, CreateDNSearchModel searchModel) { SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel); ViewBag.PageSize =100; return View(); }
private SearchStatementModel PrepareSearchStatement(GridCommand command, CreateDNSearchModel searchModel) { string whereStatement = ""; IList<object> param = new List<object>(); HqlStatementHelper.AddEqStatement("IpNo", searchModel.IpNo, "t", ref whereStatement, param); HqlStatementHelper.AddEqStatement("MATNR", searchModel.MATNR, "t", ref whereStatement, param); HqlStatementHelper.AddEqStatement("EBELN", searchModel.EBELN, "t", ref whereStatement, param); HqlStatementHelper.AddEqStatement("EBELP", searchModel.EBELP, "t", ref whereStatement, param); HqlStatementHelper.AddEqStatement("LGORT", searchModel.LGORT, "t", ref whereStatement, param); HqlStatementHelper.AddEqStatement("VBELN_VL", searchModel.VBELN_VL, "t", ref whereStatement, param); HqlStatementHelper.AddEqStatement("DNSTR", searchModel.DNSTR, "t", ref whereStatement, param); HqlStatementHelper.AddEqStatement("GISTR", searchModel.GISTR, "t", ref whereStatement, param); if (searchModel.CreateDateFrom != null & searchModel.CreateDateTo != null) { HqlStatementHelper.AddBetweenStatement("CreateDate", searchModel.CreateDateFrom, searchModel.CreateDateTo, "t", ref whereStatement, param); } else if (searchModel.CreateDateFrom != null & searchModel.CreateDateTo == null) { HqlStatementHelper.AddGeStatement("CreateDate", searchModel.CreateDateFrom, "t", ref whereStatement, param); } else if (searchModel.CreateDateFrom == null & searchModel.CreateDateTo != null) { HqlStatementHelper.AddLeStatement("CreateDate", searchModel.CreateDateTo, "t", ref whereStatement, param); } string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors); if (command.SortDescriptors.Count == 0) { sortingStatement = " order by t.CreateDate desc"; } SearchStatementModel searchStatementModel = new SearchStatementModel(); searchStatementModel.SelectCountStatement = selectCountStatement; searchStatementModel.SelectStatement = selectStatement; searchStatementModel.WhereStatement = whereStatement; searchStatementModel.SortingStatement = sortingStatement; searchStatementModel.Parameters = param.ToArray<object>(); return searchStatementModel; }