Esempio n. 1
0
        public ActionResult Create()
        {
            var rvm = CreateViewModel <RoleEditViewModel>();

            rvm.Role.PermissionItems = from p in EnumExtension.GetAllValues <Permission>()
                                       select
                                       new RoleMenuFoxsecAccessItem()
            {
                IsSelected      = false,
                IsItemAvailable = true,
                Text            = (string)_resourceManager.GetObject(Enum.GetName(typeof(Permission), p), Thread.CurrentThread.CurrentCulture),
                Value           = (int)p
            };

            rvm.Role.MenuItems = from m in EnumExtension.GetAllValues <Menu>()
                                 select
                                 new RoleMenuFoxsecAccessItem()
            {
                IsSelected      = false,
                IsItemAvailable = true,
                Text            = (string)_resourceManager.GetObject(Enum.GetName(typeof(Menu), m), Thread.CurrentThread.CurrentCulture),
                Value           = ((int)m)
            };

            rvm.Role.RoleTypeId        = RoleTypeEnum.U;
            rvm.Role.RoleBuildingItems = GetRoleBuildings(null, true);
            return(View(rvm));
        }
Esempio n. 2
0
        public ActionResult GetMenuesByRoleType(RoleTypeEnum roleType)
        {
            var rvm         = CreateViewModel <RoleEditViewModel>();
            var role_menues = _roleTypeRepository.FindById((int)roleType).Menues;
            var test1       = Enum.GetName(typeof(Menu), 17);
            var test2       = Thread.CurrentThread.CurrentCulture;

            rvm.Role.MenuItems = from m in EnumExtension.GetAllValues <Menu>()
                                 select
                                 new RoleMenuFoxsecAccessItem()
            {
                IsSelected      = false,
                IsItemAvailable = (role_menues[(int)m] != 0 && CurrentUser.Get().Menues.IsAvailabe((int)m)) || (roleType == RoleTypeEnum.CM && m == Menu.ViewMyCompanyMenu) || (((int)m) >= 17),
                Text            = (string)_resourceManager.GetObject(Enum.GetName(typeof(Menu), m), Thread.CurrentThread.CurrentCulture),
                Value           = ((int)m)
            };
            return(PartialView("MenuAccess", rvm));
        }
Esempio n. 3
0
 public List <string> GetValues()
 {
     return(EnumExtension.GetAllValues <SettingGroupKey>());
 }