/// <summary> /// Search Statement /// </summary> /// <param name="command">GridCommand Telerik</param> /// <param name="searchModel">UomConversion Search Model</param> /// <returns>Search Statement</returns> private SearchStatementModel PrepareSearchStatement(GridCommand command, UomConversionSearchModel searchModel) { string whereStatement = string.Empty; IList<object> param = new List<object>(); if (!string.IsNullOrEmpty(searchModel.Uom)) { whereStatement = " where (u.BaseUom = ? or u.AlterUom = ?)"; param.Add(searchModel.Uom); param.Add(searchModel.Uom); } HqlStatementHelper.AddLikeStatement("Code", searchModel.ItemCode, HqlStatementHelper.LikeMatchMode.Start, "i", ref whereStatement, param); if (command.SortDescriptors.Count > 0) { if (command.SortDescriptors[0].Member == "AlterUom") { command.SortDescriptors[0].Member = "u.AlterUom"; } else if (command.SortDescriptors[0].Member == "AlterQty") { command.SortDescriptors[0].Member = "u.AlterQty"; } else if (command.SortDescriptors[0].Member == "BaseUom") { command.SortDescriptors[0].Member = "u.BaseUom"; } else if (command.SortDescriptors[0].Member == "BaseQty") { command.SortDescriptors[0].Member = "u.BaseQty"; } else if (command.SortDescriptors[0].Member == "ItemCode") { command.SortDescriptors[0].Member = "u.Item"; } else if (command.SortDescriptors[0].Member == "ItemDescription") { command.SortDescriptors[0].Member = "i.Description"; } } string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors); SearchStatementModel searchStatementModel = new SearchStatementModel(); searchStatementModel.SelectCountStatement = uomConvertselectCountStatement; searchStatementModel.SelectStatement = uomConvertselectStatement; searchStatementModel.WhereStatement = whereStatement; searchStatementModel.SortingStatement = sortingStatement; searchStatementModel.Parameters = param.ToArray<object>(); return searchStatementModel; }
public ActionResult _AjaxUomConvertList(GridCommand command, UomConversionSearchModel searchModel) { SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel); GridModel<UomConversion> uomConvList = GetAjaxPageData<UomConversion>(searchStatementModel, command); foreach (var item in uomConvList.Data) { if (item.Item != null) { item.ItemCode = item.Item.Code; item.ItemDescription = item.Item.Description; } } return PartialView(uomConvList); }
public void ExportXLS(UomConversionSearchModel searchModel) { int value = System.Convert.ToInt32(base.systemMgr.GetEntityPreferenceValue(EntityPreference.CodeEnum.MaxRowSizeOnPage)); GridCommand command = new GridCommand(); command.Page = 1; command.PageSize = value; SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel); GridModel<UomConversion> uomConvList = GetAjaxPageData<UomConversion>(searchStatementModel, command); foreach (var item in uomConvList.Data) { if (item.Item != null) { item.ItemCode = item.Item.Code; item.ItemDescription = item.Item.Description; } } var fileName = string.Format("UomConversion.xls"); ExportToXLS<UomConversion>(fileName, uomConvList.Data.ToList()); }
public ActionResult _UomConvertList(GridCommand command, UomConversionSearchModel searchModel) { SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel); ViewBag.PageSize = base.ProcessPageSize(command.PageSize); return PartialView(); }
public ActionResult _UomConvertList(GridCommand command, UomConversionSearchModel searchModel) { SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel); if (searchCacheModel.isBack == true) { ViewBag.Page = searchCacheModel.Command.Page==0 ? 1 : searchCacheModel.Command.Page; } ViewBag.PageSize = base.ProcessPageSize(command.PageSize); return PartialView(); }