Пример #1
0
 public ActionResult List(GridCommand command, MrpSnapMasterSearchModel 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();
 }
Пример #2
0
        private SearchStatementModel PrepareSearchStatement(GridCommand command, MrpSnapMasterSearchModel searchModel)
        {
            string whereStatement = string.Empty;

            IList<object> param = new List<object>();

            HqlStatementHelper.AddEqStatement("IsRelease", searchModel.IsRelease, "m", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Type", searchModel.SnapType, "m", ref whereStatement, param);
            if (searchModel.SnapTimeStart != null & searchModel.SnapTimeEnd != null)
            {
                HqlStatementHelper.AddBetweenStatement("SnapTime", searchModel.SnapTimeStart, searchModel.SnapTimeEnd, "m", ref whereStatement, param);
            }
            else if (searchModel.SnapTimeStart != null & searchModel.SnapTimeEnd == null)
            {
                HqlStatementHelper.AddGeStatement("SnapTime", searchModel.SnapTimeStart, "m", ref whereStatement, param);
            }
            else if (searchModel.SnapTimeStart == null & searchModel.SnapTimeEnd != null)
            {
                HqlStatementHelper.AddLeStatement("SnapTime", searchModel.SnapTimeEnd, "m", ref whereStatement, param);
            }

            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);
            if (command.SortDescriptors.Count == 0)
            {
                sortingStatement = " order by SnapTime desc";
            }

            SearchStatementModel searchStatementModel = new SearchStatementModel();
            searchStatementModel.SelectCountStatement = selectCountStatement;
            searchStatementModel.SelectStatement = selectStatement;
            searchStatementModel.WhereStatement = whereStatement;
            searchStatementModel.SortingStatement = sortingStatement;
            searchStatementModel.Parameters = param.ToArray<object>();

            return searchStatementModel;
        }
Пример #3
0
 public ActionResult _AjaxList(GridCommand command, MrpSnapMasterSearchModel searchModel)
 {
     this.GetCommand(ref command, searchModel);
     SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<MrpSnapMaster>(searchStatementModel, command));
 }