public ActionResult RccpPlanMasterList(GridCommand command, RccpPlanMasterSearchModel 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 _AjaxRccpPlanMasterList(GridCommand command, RccpPlanMasterSearchModel searchModel)
 {
     string replaceFrom = "_AjaxRccpPlanMasterList";
     string replaceTo = "_AjaxRccpPlanMasterList";
     this.GetCommand(ref command, searchModel, replaceFrom, replaceTo);
     SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<RccpPlanMaster>(searchStatementModel, command));
 }
        public ActionResult TreeViewList(RccpPlanMasterSearchModel searchModel)
        {
            var rccpTransGroups = new List<RccpTransGroup>();
            TempData["RccpPlanMasterSearchModel"] = searchModel;
            ViewBag.SearchModel = searchModel;
            if (string.IsNullOrWhiteSpace(searchModel.Item) || !searchModel.PlanVersion.HasValue || string.IsNullOrWhiteSpace(searchModel.DateIndex))
            {
                SaveErrorMessage(Resources.EXT.ControllerLan.Con_PlanTypeVersionTimeItemCodeTimeIndexCanNotBeEmpty);
            }
            else
            {
                string hql = "from Item  where IsActive = 1 and Code = ? ";
                IList<Item> items = this.queryMgr.FindAll<Item>(hql, searchModel.Item, 0, 20);

                foreach (var item in items)
                {
                    var rccpTransGroup = this.genericMgr.FindAll<RccpTransGroup>
                    ("from RccpTransGroup where DateIndex = ? and DateType =? and Item =? and PlanVersion =? ",
                    new object[] { searchModel.DateIndex, searchModel.DateType, searchModel.Item, searchModel.PlanVersion }).FirstOrDefault();
                    if (rccpTransGroup != null)
                    {
                        rccpTransGroup.ItemDescription = item.Description;
                        rccpTransGroup.IsDown = searchModel.IsDown.HasValue ? searchModel.IsDown.Value : false;
                        rccpTransGroups.Add(rccpTransGroup);
                    }
                }
            }
            return View(rccpTransGroups);
        }
        private SearchStatementModel PrepareSearchStatement(GridCommand command, RccpPlanMasterSearchModel searchModel)
        {
            string whereStatement = string.Empty;

            IList<object> param = new List<object>();
            if (searchModel.DateType != null)
            {
                whereStatement += " where r.DateType=? ";
                param.Add(searchModel.DateType);
            }

            HqlStatementHelper.AddEqStatement("Status", searchModel.Status, "r", ref whereStatement, param);

            HqlStatementHelper.AddEqStatement("SnapTime", searchModel.SnapTime, "r", ref whereStatement, param);


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

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

            return searchStatementModel;
        }