Esempio n. 1
0
        public ActionResult Index(FunctionListModel model)
        {
            model = model ?? new FunctionListModel();

            //功能列表
            model.SearchFunction = model.SearchFunction ?? new SearchFunctionCriteria();
            var searchFunction = new SearchFunctionCriteria()
            {
                AdminFlag = model.SearchFunction.AdminFlag,
                FunctionCode = model.SearchFunction.FunctionCode,
                FunctionDSC = model.SearchFunction.FunctionDSC
            };

            //排序分页
            List<Comparison<Function>> compList = new List<Comparison<Function>>();
            compList.Add((x, y) => x.FuncCode.CompareTo(y.FuncCode));
            compList.Add((x, y) => x.Dsc.CompareTo(y.Dsc));
            //compList.Add((x, y) => x.Executable.CompareTo(y.Executable));
            //compList.Add((x, y) => x.SystemScope.CompareTo(y.SystemScope));
            compList.Add((x, y) => x.FuncType.CompareTo(y.FuncType));

            //返回列表内容并创建缓存
            model.FunctionList = SessionCache.Instance.GetOrSetCache<BusinessList<Function>>("FunctionList", () => BusinessPortal.Search<Function>(searchFunction), !this.IsSortingOrPageing());
            //设置默认排序
            PagerHelper.SetSortParamsToViewData(ViewData, new PageParams() { SortField = 0, sortDirection = SortDirectionEnum.Asc });
            //返回列表
            return ViewList(model, (pageparams) =>
            {
                int recordCount;
                model.FunctionList = model.FunctionList.Page(pageparams, out recordCount, compList);
                return recordCount;
            });
        }
Esempio n. 2
0
        public ActionResult IndexDefault(FunctionListModel model)
        {
            model = model ?? new FunctionListModel();

            return View("Index",model);
        }