public ActionResult List(GridCommand command, MrpExScrapSearchModel 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 View();
 }
 public ActionResult _AjaxList(GridCommand command, MrpExScrapSearchModel searchModel)
 {
     this.GetCommand(ref command, searchModel);
     SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<MrpExScrap>(searchStatementModel, command));
 }
        /// <summary>
        /// Search Statement
        /// </summary>
        /// <param name="command">Telerik GridCommand</param>
        /// <param name="searchModel">MrpExScrap Search Model</param>
        /// <returns>return Search Statement</returns>
        private SearchStatementModel PrepareSearchStatement(GridCommand command, MrpExScrapSearchModel searchModel)
        {
            string whereStatement = string.Empty;

            IList<object> param = new List<object>();
            searchModel.DateFrom = searchModel.DateFrom == DateTime.MinValue ? DateTime.Today.AddDays(-1) : searchModel.DateFrom;
            searchModel.DateTo = searchModel.DateTo == DateTime.MinValue ? DateTime.Today.AddDays(1) : searchModel.DateTo;
            HqlStatementHelper.AddEqStatement("Id", searchModel.Id, "u", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Flow", searchModel.Flow, "u", ref whereStatement, param);
            HqlStatementHelper.AddBetweenStatement("CreateDate", searchModel.DateFrom, searchModel.DateTo.AddDays(1), "u", ref whereStatement, param);
            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);
            if (command.SortDescriptors.Count == 0)
            {
                sortingStatement = " order by u.Id desc";
            }
            SearchStatementModel searchStatementModel = new SearchStatementModel();
            searchStatementModel.SelectCountStatement = selectCountStatement;
            searchStatementModel.SelectStatement = selectStatement;
            searchStatementModel.WhereStatement = whereStatement;
            searchStatementModel.SortingStatement = sortingStatement;
            searchStatementModel.Parameters = param.ToArray<object>();
            return searchStatementModel;
        }