Esempio n. 1
0
        /// <summary>
        /// 获取所有功能模块,树结构
        /// </summary>
        /// <returns></returns>
        private List <ModuleSimpleViewModel> GetModulesForTree(HttpSessionStateBase session)
        {
            List <ModuleSimpleViewModel> listVM = new List <ModuleSimpleViewModel>();
            var roles  = session.GetRoleIds();
            var result = AppContext.EnableRBAC ?
                         ModuleSrv.FindByRolesWithSimpleInfo(roles) :
                         ModuleSrv.FindByPageWithSimpleInfo(m => m.Enabled,
                                                            query => query.OrderBy(m => m.Code),
                                                            new PageArgs {
                PageSize = 1000, PageIndex = 1
            });

            if (result.ResultType == OperationResultType.Success)
            {
                //获取所有模块数据
                var modules = result.AppendData as List <ModuleSimpleViewModel>;
                listVM = ModuleController.BuildModulesTree(modules);
            }
            return(listVM);
        }