public ActionResult _AjaxList(GridCommand command, DefectCodeSearchModel searchModel) { SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel); return PartialView(GetAjaxPageData<DefectCode>(searchStatementModel, command)); }
/// <summary> /// Search Statement /// </summary> /// <param name="command">Telerik GridCommand</param> /// <param name="searchModel">RoutingMaster Search Model</param> /// <returns>Search Statement</returns> private SearchStatementModel PrepareSearchStatement(GridCommand command, DefectCodeSearchModel searchModel) { string whereStatement = string.Empty; IList<object> param = new List<object>(); HqlStatementHelper.AddLikeStatement("Code", searchModel.Code, HqlStatementHelper.LikeMatchMode.Start, "r", ref whereStatement, param); HqlStatementHelper.AddLikeStatement("ProductCode", searchModel.ProductCode, HqlStatementHelper.LikeMatchMode.Start, "r", ref whereStatement, param); if (searchModel.CreateDateStart != null & searchModel.CreateDateEnd != null) { HqlStatementHelper.AddBetweenStatement("CreateDate", searchModel.CreateDateStart, searchModel.CreateDateEnd, "r", ref whereStatement, param); } else if (searchModel.CreateDateStart != null & searchModel.CreateDateEnd == null) { HqlStatementHelper.AddGeStatement("CreateDate", searchModel.CreateDateStart, "r", ref whereStatement, param); } else if (searchModel.CreateDateStart == null & searchModel.CreateDateEnd != null) { HqlStatementHelper.AddLeStatement("CreateDate", searchModel.CreateDateEnd, "r", ref whereStatement, param); } string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors); 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 List(GridCommand command, DefectCodeSearchModel searchModel) { this.ProcessSearchModel(command, searchModel); ViewBag.PageSize = base.ProcessPageSize(command.PageSize); return View(); }