Esempio n. 1
0
        protected virtual IEnumerable<MainMenuItemValue> ChangeMainMenuItemsByCommand(
            IEnumerable<MainMenuItemValue> mainMenuItemValues, GetMainMenuItemsCommand command)
        {
            var results = mainMenuItemValues.Where(value => value.MainMenuItem == command.ActivatedMainMenu)
                .OrderBy(value => value.MainMenuItem)
                .ToList();

            results.ForEach(value => value.IsActive = true);

            return mainMenuItemValues;
        }
Esempio n. 2
0
        public GetMainMenuItemsCommandAnswer GetMainMenuItems(GetMainMenuItemsCommand command)
        {
            var userFunctions = _userFunctionManager.GetFunctionsByToken(command.Token);

            var enumList = Enum.GetValues(typeof (MainMenuItem)).Cast<MainMenuItem>().ToList();

            var tabs = userFunctions
                .Select(model => new AccessItem
                {
                    IsEnabled = model.AccessType == AccessType.Accepted,
                    MainMenuItem = _functionsNameToMainMenuItemConverter.Convert(model.FunctionStorageModel.FunctionIdentityName)
                })
                .Where(item => enumList.Contains(item.MainMenuItem))
                .Select(item => new MainMenuItemValue { IsEnabled = item.IsEnabled, IsActive = false, MainMenuItem = item.MainMenuItem })
                .ToList();

            var resultTabs = ChangeMainMenuItemsByCommand(tabs, command).ToList();

            return new GetMainMenuItemsCommandAnswer
            {
                MainMenuTabs = resultTabs
            };
        }
        protected virtual GetMainMenuItemsCommandAnswer GetMainMenuItemsCommandAnswerByAnswer(AbstractTokenCommandAnswer answer)
        {
            var command = new GetMainMenuItemsCommand
            {
                Token = answer.Token,
                ActivatedMainMenu = GetActivatedMainMenuItem()
            };

            var mainMenuService = MainMenuServiceFactory.CreateMainMenuService();
            var result = mainMenuService.GetMainMenuItems(command);

            return result;
        }