public ActionResult _AjaxList(GridCommand command, ShipmentMasterSearchModel searchModel) { this.GetCommand(ref command, searchModel); if (!this.CheckSearchModelIsNull(searchModel)) { return PartialView(new GridModel(new List<ShipmentMaster>())); } SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel); return PartialView(GetAjaxPageData<ShipmentMaster>(searchStatementModel, command)); }
private SearchStatementModel PrepareSearchStatement(GridCommand command, ShipmentMasterSearchModel searchModel) { IList<object> param = new List<object>(); string whereStatement = string.Empty; //SecurityHelper.AddPartyFromAndPartyToPermissionStatement(ref whereStatement, "i", "OrderType", "i", "PartyFrom", "i", "PartyTo", com.Sconit.CodeMaster.OrderType.Procurement, false); if (searchModel.IsGoout) { HqlStatementHelper.AddEqStatement("Status", com.Sconit.CodeMaster.BillMasterStatus.Submit, "s", ref whereStatement, param); } HqlStatementHelper.AddLikeStatement("ShipmentNo", searchModel.ShipmentNo, HqlStatementHelper.LikeMatchMode.Anywhere, "s", ref whereStatement, param); HqlStatementHelper.AddLikeStatement("Shipper", searchModel.Shipper, HqlStatementHelper.LikeMatchMode.Start, "s", ref whereStatement, param); HqlStatementHelper.AddLikeStatement("Driver", searchModel.Driver, HqlStatementHelper.LikeMatchMode.Anywhere, "s", ref whereStatement, param); HqlStatementHelper.AddLikeStatement("VehicleNo", searchModel.VehicleNo, HqlStatementHelper.LikeMatchMode.Anywhere, "s", ref whereStatement, param); if (searchModel.StartDate != null & searchModel.EndDate != null) { HqlStatementHelper.AddBetweenStatement("CreateDate", searchModel.StartDate, searchModel.EndDate, "s", ref whereStatement, param); } else if (searchModel.StartDate != null & searchModel.EndDate == null) { HqlStatementHelper.AddGeStatement("CreateDate", searchModel.StartDate, "s", ref whereStatement, param); } else if (searchModel.StartDate == null & searchModel.EndDate != null) { HqlStatementHelper.AddLeStatement("CreateDate", searchModel.EndDate, "s", ref whereStatement, param); } string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors); if (command.SortDescriptors.Count == 0) { if (searchModel.IsGoout) { sortingStatement = " order by s.CreateDate desc"; } else { sortingStatement = " order by s.CreateDate asc"; } } SearchStatementModel searchStatementModel = new SearchStatementModel(); searchStatementModel.SelectCountStatement = selectCountStatement; searchStatementModel.SelectStatement = selectStatement; searchStatementModel.WhereStatement = whereStatement; searchStatementModel.SortingStatement = sortingStatement; searchStatementModel.Parameters = param.ToArray<object>(); return searchStatementModel; }
public ActionResult GooutList(GridCommand command, ShipmentMasterSearchModel searchModel) { SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel); if (this.CheckSearchModelIsNull(searchCacheModel.SearchObject)) { TempData["_AjaxMessage"] = ""; } else { SaveWarningMessage(Resources.SYS.ErrorMessage.Errors_NoConditions); } ViewBag.PageSize = base.ProcessPageSize(command.PageSize); return View(); }