Ejemplo n.º 1
0
        /// <summary>
        /// 获取当前用户具有的菜单列表
        /// </summary>
        /// <returns></returns>
        public List <MenuTierVM> GetCurrentMenu()
        {
            string            key          = string.Format("{0}_{1}", cache_menu, CurrentUser.SysNo.ToString());
            List <MenuTierVM> menuTierList = EngineContext.Current.CacheManager.Get(key, CurrentUser.SysNo.ToString())
                                             as List <MenuTierVM>;

            if (menuTierList != null)
            {
                return(menuTierList);
            }

            List <PermissionVM> permissionList       = GetCurrentPermission();
            List <string>       moduleControllerList = permissionList.Select(x => x.PermissionController).Distinct().ToList();

            IMenuBizProcess permissionProcess = EngineContext.Current.Resolve <IMenuBizProcess>();

            menuTierList = permissionProcess.GetMenuTier(moduleControllerList);
            if (menuTierList != null && menuTierList.Count > 0 && !menuTierList.Exists(x => x.IsSelected))
            {
                menuTierList[0].IsSelected = true;
            }

            EngineContext.Current.CacheManager.Add(key, CurrentUser.SysNo.ToString(),
                                                   menuTierList, new TimeSpan(0, 0, 20, 0));

            return(menuTierList);
        }
Ejemplo n.º 2
0
 public MenuController(IMenuBizProcess moduleBizProcess)
 {
     _moduleBizProcess = moduleBizProcess;
 }