public ActionResult List(GridCommand command, StandardWorkingCalendarSearchModel searchModel)
        {
            SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
            ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
            ViewBag.SearchShift = searchModel.SearchShift;
            ViewBag.SearchRegion = searchModel.SearchRegion;
            IList<CodeDetail> workingCalendarTypeList = systemMgr.GetCodeDetails(CodeMaster.CodeMaster.WorkingCalendarType);
            ViewData["WorkingCalendarType"] = base.Transfer2DropDownList(CodeMaster.CodeMaster.WorkingCalendarType, workingCalendarTypeList);

            // 判断是否有编辑生产线标准工作日历的权限
            var user = SecurityContextHolder.Get();
            var q = user.UrlPermissions.Where(p => p.Contains("Url_StandardWorkingCalendar_Edit")).ToList();
            ViewBag.NoEditPermission = q == null || q.Count() == 0;

            return View();
        }
 public ActionResult _AjaxList(GridCommand command, StandardWorkingCalendarSearchModel searchModel)
 {
     SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
     return PartialView(GetAjaxPageData<StandardWorkingCalendar>(searchStatementModel, command));
 }
        /// <summary>
        /// Search Statement
        /// </summary>
        /// <param name="command">Telerik GridCommand</param>
        /// <param name="searchModel">StandardWorkingCalendar Search Model</param>
        /// <returns>return StandardWorkingCalendar search model</returns>
        private SearchStatementModel PrepareSearchStatement(GridCommand command, StandardWorkingCalendarSearchModel searchModel)
        {
            string whereStatement = string.Empty;

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

            HqlStatementHelper.AddEqStatement("Category", (int)WorkingCalendarCategory.Region, "swc", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Region", searchModel.SearchRegion, "swc", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Shift", searchModel.SearchShift, "swc", ref whereStatement, param);

            if (command.SortDescriptors.Count > 0)
            {
                if (command.SortDescriptors[0].Member == "DayOfWeekDescription")
                {
                    command.SortDescriptors[0].Member = "DayOfWeek";
                }
                else if (command.SortDescriptors[0].Member == "TypeDescription")
                {
                    command.SortDescriptors[0].Member = "Type";
                }
            }

            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);

            if (string.IsNullOrEmpty(sortingStatement))
            {
                sortingStatement = " order by swc.Region asc, swc.DayOfWeek asc ";
            }

            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 _Update(int id, StandardWorkingCalendar standardWorkingCalendar, StandardWorkingCalendarSearchModel searchModel, GridCommand command)
        {
            try
            {
                ModelState.Remove("Region");
                ModelState.Remove("DayOfWeek");
                var newWorkingCalendar = base.genericMgr.FindById<StandardWorkingCalendar>(id);
                newWorkingCalendar.Shift = standardWorkingCalendar.Shift;
                newWorkingCalendar.Type = standardWorkingCalendar.Type;
                newWorkingCalendar.Category = WorkingCalendarCategory.Region;
                base.genericMgr.Update(newWorkingCalendar);
                //SaveSuccessMessage(Resources.PRD.StandardWorkingCalendar.StandardWorkingCalendar_Updated);
            }
            catch (BusinessException ex)
            {
                SaveBusinessExceptionMessage(ex);
            }
            catch (Exception ex)
            {
                SaveErrorMessage(ex);
            }

            SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
            return PartialView(GetAjaxPageData<StandardWorkingCalendar>(searchStatementModel, command));
        }