public IReadOnlyList <WinformToolbarGroup> GetAllToolbarGroups(bool tenancyFilter = true)
 {
     return(this.ToolbarGroups.Values.WhereIf(tenancyFilter, t => t.MultiTenancySides.HasFlag(AbpSession.MultiTenancySide))
            .Where(t => string.IsNullOrEmpty(t.Permission) ||
                   AbpSession.MultiTenancySide == MultiTenancySides.Host ||
                   (!string.IsNullOrEmpty(t.Permission) && _permissionChecker.IsGranted(t.Permission))).ToImmutableList());
 }
Exemple #2
0
        public async Task DeleteTeam(long teamId)
        {
            var currentTeam = await _teamRepository.GetAllIncluding(x => x.Players).FirstOrDefaultAsync(x => x.Id == teamId);

            if (currentTeam == null)
            {
                throw new UserFriendlyException("Komanda su tokiu id neegzistuoja!");
            }

            if (!(currentTeam.LeaderId == _userManager.AbpSession.UserId ||
                  _permissionChecker.IsGranted("Pages.Users")))
            {
                throw new AbpAuthorizationException("Jūs neturite teisių trinti šios komandos!");
            }

            var teamPlayers = await _userManager.Users
                              .IgnoreQueryFilters()
                              .Where(x => x.TeamId == teamId)
                              .ToListAsync();

            foreach (var player in teamPlayers)
            {
                player.Team           = null;
                player.IsActiveInTeam = false;
            }

            await _registrationRepository.DeleteAsync(x => x.TeamId == teamId);

            await _teamRepository.DeleteAsync(currentTeam);
        }
Exemple #3
0
        /// <summary>
        /// Checks if given user is granted for given permission.
        /// </summary>
        /// <param name="permissionChecker">Permission checker</param>
        /// <param name="user">User</param>
        /// <param name="requiresAll">True, to require all given permissions are granted. False, to require one or more.</param>
        /// <param name="permissionNames">Name of the permissions</param>
        public static bool IsGranted(this IPermissionChecker permissionChecker, UserIdentifier user, bool requiresAll, params string[] permissionNames)
        {
            if (permissionNames.IsNullOrEmpty())
            {
                return(true);
            }

            if (requiresAll)
            {
                foreach (var permissionName in permissionNames)
                {
                    if (!(permissionChecker.IsGranted(user, permissionName)))
                    {
                        return(false);
                    }
                }

                return(true);
            }
            else
            {
                foreach (var permissionName in permissionNames)
                {
                    if (permissionChecker.IsGranted(user, permissionName))
                    {
                        return(true);
                    }
                }

                return(false);
            }
        }
 public virtual IReadOnlyList <WinformMenu> GetAllMenus(bool tenancyFilter = true)
 {
     return(Menus.Values
            .WhereIf(tenancyFilter, m => m.MultiTenancySides.HasFlag(AbpSession.MultiTenancySide))
            .Where(m =>
                   string.IsNullOrEmpty(m.Permission) ||
                   AbpSession.MultiTenancySide == MultiTenancySides.Host ||
                   (!string.IsNullOrEmpty(m.Permission) && _permissionChecker.IsGranted(m.Permission))
                   ).ToImmutableList());
 }
        public async Task <PagedResultDto <ReportTemplateOutputDto> > GetReportList(ReportListInputDto input)
        {
            var templateEntities = await _ReportTemplateManager.GetAllReportTemplatesAsync();

            var categoryEntity = await _ReportCategoryManager.GetCategoryByIdAsync(input.CategoryId);

            var entities = await Task.FromResult(templateEntities.Where(t => t.Category_Id == input.CategoryId &&
                                                                        _PermissionChecker.IsGranted("Pages.ReportManager.Reports." + categoryEntity.CategoryName + "." + t.TemplateName)
                                                                        ));


            if (string.IsNullOrEmpty(input.Sorting))
            {
                input.Sorting = "Id";
            }
            var orderEntities = await Task.FromResult(entities.OrderBy(input.Sorting));

            var pageEntities = await Task.FromResult(orderEntities.Skip(input.SkipCount).Take(input.MaxResultCount));

            var listDto = pageEntities.MapTo <List <ReportTemplateOutputDto> >();

            return(new PagedResultDto <ReportTemplateOutputDto>(
                       orderEntities.Count(),
                       listDto.ToList()
                       ));
        }
Exemple #6
0
        public async Task ChangePassword(long userId, string plainPassword)
        {
            if (!_permissionChecker.IsGranted("Pages.Users"))
            {
                throw new UserFriendlyException("Neturite teisių redaguoti vartotojo duomenų!");
            }

            if (plainPassword.IsNullOrEmpty())
            {
                throw new UserFriendlyException("Nurodytas slaptažodis tuščias!");
            }

            if (plainPassword.Length < 4)
            {
                throw new UserFriendlyException("Nurodytas slaptažodis turi būti sudarytas iš daugiau nei 3 simbolių!");
            }

            var user = await _userManager.GetUserByIdAsync(userId);

            if (user == null)
            {
                throw new UserFriendlyException("Vartotojas su tokiu id nerastas!");
            }

            user.Password          = _passwordHasher.HashPassword(user, plainPassword);
            user.LockoutEndDateUtc = null;

            CurrentUnitOfWork.SaveChanges();
            await _userManager.UpdateAsync(user);
        }
Exemple #7
0
        public void AssignTaskToPerson(Task task, User user)
        {
            //已经分配,就不再分配
            if (task.AssignedPersonId.HasValue && task.AssignedPersonId.Value == user.Id)
            {
                return;
            }

            if (task.State != TaskState.Open)
            {
                throw new ApplicationException("处于非活动状态的任务不能分配!");
            }

            //获取是否有【分配任务给他人】的权限
            bool canAssignTaskToOther = _permissionChecker.IsGranted(PermissionNames.Pages_Tasks_AssignPerson);

            if (user.Id != _abpSession.GetUserId() && !canAssignTaskToOther)
            {
                throw new AbpAuthorizationException("没有分配任务给他人的权限!");
            }


            task.AssignedPersonId = user.Id;

            //使用领域事件触发发送通知操作
            _eventBus.Trigger(new TaskAssignedEventData(task, user));
        }
 // GET: Document
 public ActionResult Index()
 {
     if (_permissionChecker.IsGranted("admindocumentmvc_permission", "write"))
     {
         return(RedirectToAction("List"));
     }
     return(RedirectToAction("List", "OperationData"));
 }
        public void CheckPermission(int dynamicParameterId)
        {
            var dynamicParameter = _dynamicParameterManager.Get(dynamicParameterId);

            if (dynamicParameter == null)
            {
                throw new EntityNotFoundException(typeof(DynamicParameter), dynamicParameterId);
            }

            if (dynamicParameter.Permission.IsNullOrWhiteSpace())
            {
                return;
            }

            if (!_permissionChecker.IsGranted(dynamicParameter.Permission))
            {
                throw new Exception($"Permission \"{dynamicParameter.Permission}\" is not granted");
            }
        }
Exemple #10
0
        private void RegisterFakePermissionChecker()
        {
            Startup.IocManager.Value = new IocManager();

            _permissionChecker = Substitute.For <IPermissionChecker>();
            _permissionChecker.IsGrantedAsync(Arg.Any <string>()).Returns(false);
            _permissionChecker.IsGranted(Arg.Any <string>()).Returns(false);

            Startup.IocManager.Value.IocContainer.Register(
                Component.For <IPermissionChecker>().Instance(
                    _permissionChecker
                    ).IsDefault()
                );
        }
Exemple #11
0
        public async Task <long> CreateMindfight(MindfightCreateDto mindfight)
        {
            if (!(_permissionChecker.IsGranted("CreateMindfights") ||
                  !_permissionChecker.IsGranted("ManageMindfights")))
            {
                throw new AbpAuthorizationException("Jūs neturite teisės sukurti naują protmūšį!");
            }

            var user = _userManager.Users.IgnoreQueryFilters().FirstOrDefault(u => u.Id == _userManager.AbpSession.UserId);

            if (user == null)
            {
                throw new UserFriendlyException("Vartotojas neegzistuoja!");
            }

            var newMindfight = new Models.Mindfight(user, mindfight.Title, mindfight.Description, mindfight.TeamsLimit,
                                                    mindfight.StartTime, mindfight.PrepareTime);

            return(await _mindfightRepository.InsertAndGetIdAsync(newMindfight));
        }
Exemple #12
0
        public async Task UpdatePlayerInfo(PlayerDto playerInfo, long userId)
        {
            if (!(_permissionChecker.IsGranted("Pages.Users") || _userManager.AbpSession.UserId == userId))
            {
                throw new UserFriendlyException("Neturite teisių redaguoti vartotojo duomenų!");
            }

            var player = await _userManager.Users
                         .IgnoreQueryFilters()
                         .FirstOrDefaultAsync(x => x.Id == userId);

            if (player == null)
            {
                throw new UserFriendlyException("Vartotojas su nurodytu id neegzistuoja!");
            }

            var playerWithSameUsername = await _userManager.Users
                                         .IgnoreQueryFilters()
                                         .FirstOrDefaultAsync(user => user.NormalizedUserName == playerInfo.UserName.ToUpper() && userId != user.Id);

            if (playerWithSameUsername != null)
            {
                throw new UserFriendlyException("Vartotojas su tokiu slapyvardžiu jau egzistuoja id neegzistuoja!");
            }

            var playerWithSameEmail = await _userManager.Users
                                      .IgnoreQueryFilters()
                                      .FirstOrDefaultAsync(user => user.NormalizedEmailAddress == playerInfo.UserName.ToUpper() && userId != user.Id);

            if (playerWithSameEmail != null)
            {
                throw new UserFriendlyException("Vartotojas su tokiu el. paštu jau egzistuoja id neegzistuoja!");
            }

            var city = await _cityRepository.FirstOrDefaultAsync(c => c.Id == playerInfo.CityId);

            player.Name         = playerInfo.Name;
            player.Surname      = playerInfo.Surname;
            player.EmailAddress = playerInfo.EmailAddress;
            player.UserName     = playerInfo.UserName;
            player.City         = city;
            player.Birthdate    = playerInfo.Birthdate;

            await _userManager.UpdateAsync(player);
        }
Exemple #13
0
        public async Task <List <TourDto> > GetAllMindfightTours(long mindfightId)
        {
            var user = await _userManager.Users.IgnoreQueryFilters().FirstOrDefaultAsync(u => u.Id == _userManager.AbpSession.UserId);

            if (user == null)
            {
                throw new UserFriendlyException("Vartotojas neegzistuoja!");
            }

            var currentMindfight = await _mindfightRepository
                                   .GetAllIncluding(x => x.Tours, x => x.Evaluators)
                                   .FirstOrDefaultAsync(x => x.Id == mindfightId);

            if (currentMindfight == null)
            {
                throw new UserFriendlyException("Protmūšis su nurodytu id neegzistuoja!");
            }

            if (!(currentMindfight.CreatorId == _userManager.AbpSession.UserId ||
                  _permissionChecker.IsGranted("ManageMindfights") ||
                  currentMindfight.Evaluators.Any(x => x.UserId == _userManager.AbpSession.UserId)))
            {
                throw new AbpAuthorizationException("jūs neturite visų turų gavimo teisių");
            }

            var toursDto = new List <TourDto>();
            var tours    = await _tourRepository
                           .GetAllIncluding(tour => tour.Questions)
                           .Where(x => x.MindfightId == mindfightId)
                           .OrderBy(x => x.OrderNumber)
                           .ToListAsync();

            foreach (var tour in tours)
            {
                var tourDto = new TourDto();
                _objectMapper.Map(tour, tourDto);
                tourDto.QuestionsCount = tour.Questions.Count;
                toursDto.Add(tourDto);
            }
            if (toursDto.Count > 0)
            {
                toursDto[toursDto.Count - 1].IsLastTour = true;
            }
            return(toursDto);
        }
Exemple #14
0
        public async Task UpdateConfirmation(long mindfightId, long teamId, bool isConfirmed)
        {
            var currentMindfight = await _mindfightRepository
                                   .FirstOrDefaultAsync(x => x.Id == mindfightId);

            if (currentMindfight == null)
            {
                throw new UserFriendlyException("Protmūšis su nurodytu id neegzistuoja!");
            }

            if (!(currentMindfight.CreatorId == _userManager.AbpSession.UserId ||
                  _permissionChecker.IsGranted("ManageMindfights")))
            {
                throw new AbpAuthorizationException("Jūs neturite teisių patvirtinti komandas!");
            }

            var currentTeam = await _teamRepository
                              .GetAll()
                              .FirstOrDefaultAsync(x => x.Id == teamId);

            if (currentTeam == null)
            {
                throw new UserFriendlyException("Komanda su nurodytu id neegzistuoja!");
            }

            var currentRegistration = await _registrationRepository
                                      .FirstOrDefaultAsync(x => x.MindfightId == mindfightId && x.TeamId == teamId);

            if (currentRegistration == null)
            {
                throw new UserFriendlyException("Komanda nėra užsiregistravusi į protmūšį!");
            }

            currentRegistration.IsConfirmed = isConfirmed;
            await _registrationRepository.UpdateAsync(currentRegistration);
        }
Exemple #15
0
        public async Task <List <QuestionDto> > GetAllTourQuestions(long tourId)
        {
            var currentTour = await _tourRepository
                              .GetAll()
                              .Include(x => x.Mindfight)
                              .ThenInclude(x => x.Evaluators)
                              .FirstOrDefaultAsync(x => x.Id == tourId);

            if (currentTour == null)
            {
                throw new UserFriendlyException("Turas su nurodytu id neegzistuoja!");
            }

            if (!(currentTour.Mindfight.CreatorId == _userManager.AbpSession.UserId ||
                  _permissionChecker.IsGranted("ManageMindfights") ||
                  currentTour.Mindfight.Evaluators.Any(x => x.UserId == _userManager.AbpSession.UserId)))
            {
                throw new AbpAuthorizationException("Jūs neturite teisės peržiūrėti šio klausimo!");
            }

            var questionsDto = new List <QuestionDto>();
            var questions    = await _questionRepository
                               .GetAll()
                               .Where(x => x.TourId == currentTour.Id)
                               .ToListAsync();

            foreach (var question in questions)
            {
                var questionDto = new QuestionDto();
                _objectMapper.Map(question, questionDto);
                questionsDto.Add(questionDto);
            }
            if (questionsDto.Count > 0)
            {
                questionsDto[questionsDto.Count - 1].IsLastQuestion = true;
            }
            return(questionsDto);
        }
Exemple #16
0
        public async Task UpdateResult(long mindfightId, long teamId)
        {
            var currentMindfight = await _mindfightRepository
                                   .GetAll()
                                   .Include(x => x.Registrations)
                                   .ThenInclude(x => x.Team)
                                   .FirstOrDefaultAsync(x => x.Id == mindfightId);

            if (currentMindfight == null)
            {
                throw new UserFriendlyException("Protmūšis su nurodytu id neegzistuoja!");
            }

            if (!(currentMindfight.CreatorId == _userManager.AbpSession.UserId ||
                  _permissionChecker.IsGranted("ManageMindfights")))
            {
                throw new AbpAuthorizationException("Jūs neturite teisių kurti rezultatus!");
            }

            var currentTeam = await _teamRepository
                              .GetAll()
                              .FirstOrDefaultAsync(x => x.Id == teamId);

            if (currentTeam == null)
            {
                throw new UserFriendlyException("Komanda su nurodytu id neegzistuoja!");
            }

            if (!currentMindfight.Registrations.Any(x => x.TeamId == teamId && x.IsConfirmed))
            {
                throw new UserFriendlyException("Nurodytos komandos registracija nėra patvirtinta!");
            }

            var teamRegistration = _registrationRepository
                                   .GetAll()
                                   .FirstOrDefaultAsync(x => x.TeamId == teamId && x.MindfightId == mindfightId);

            if (teamRegistration == null)
            {
                throw new UserFriendlyException("Komanda neužsiregistravo į protmūšį!");
            }

            var teamResult = await _resultRepository
                             .GetAllIncluding(x => x.Team)
                             .FirstOrDefaultAsync(x => x.MindfightId == mindfightId && x.TeamId == teamId);

            if (teamResult == null)
            {
                throw new UserFriendlyException("Komanda dar nebaigė žaisti protmūšio!");
            }

            var mindfightTours = await _tourRepository
                                 .GetAll()
                                 .Where(tour => tour.MindfightId == currentMindfight.Id)
                                 .ToListAsync();

            if (mindfightTours.Count <= 0)
            {
                throw new UserFriendlyException("Protmūšis neturi nei vieno turo!");
            }

            var questions = await _questionRepository
                            .GetAll()
                            .Where(question => mindfightTours.Any(tour => tour.Id == question.TourId))
                            .OrderByDescending(x => x.OrderNumber)
                            .ToListAsync();

            if (questions.Count <= 0)
            {
                throw new UserFriendlyException("Protmūšis neturi nei vieno klausimo!");
            }

            var teamAnswers = await _teamAnswerRepository
                              .GetAll()
                              .Where(teamAnswer => questions.Any(y => y.Id == teamAnswer.QuestionId) && teamAnswer.TeamId == teamId)
                              .ToListAsync();

            if (questions.Count != teamAnswers.Count)
            {
                throw new UserFriendlyException("Komanda dar nebaigė žaisti protmūšio!");
            }

            if (teamAnswers.Any(x => !x.IsEvaluated))
            {
                throw new UserFriendlyException("Nevisi komandos klausimai yra įvertinti!");
            }

            var earnedPoints = teamAnswers.Sum(teamAnswer => teamAnswer.EarnedPoints);

            var teamPlayers = await _userManager.Users
                              .Include(x => x.Team)
                              .Include(u => u.MindfightResults)
                              .Where(u => u.TeamId == teamId && u.IsActiveInTeam)
                              .ToListAsync();

            var currentResult = await _resultRepository
                                .FirstOrDefaultAsync(result => result.TeamId == currentTeam.Id && result.MindfightId == currentMindfight.Id);

            if (currentResult != null)
            {
                currentResult.EarnedPoints = earnedPoints;
                currentResult.Team         = currentTeam;
                currentResult.Mindfight    = currentMindfight;
                currentResult.IsEvaluated  = true;
            }
            else
            {
                currentResult = new MindfightResult(earnedPoints, true, currentTeam, currentMindfight);
            }

            await _resultRepository.InsertOrUpdateAsync(currentResult);

            await UpdateMindfightPlaces(mindfightId);

            foreach (var player in teamPlayers)
            {
                var currentUserMindfightResult = player.MindfightResults.FirstOrDefault(result => result.MindfightResultId == currentResult.Id);
                var userMindfightResult        = new UserMindfightResult(player, currentResult);
                if (currentUserMindfightResult != null)
                {
                    currentUserMindfightResult.MindfightResult   = currentResult;
                    currentUserMindfightResult.MindfightResultId = currentResult.Id;
                }
                else
                {
                    player.MindfightResults.Add(userMindfightResult);
                }
            }
        }
Exemple #17
0
        public async Task <TeamAnswerDto> GetTeamAnswer(long questionId, long teamId)
        {
            var user = await _userManager.Users
                       .IgnoreQueryFilters()
                       .Include(x => x.Team)
                       .FirstOrDefaultAsync(u => u.Id == _userManager.AbpSession.UserId);

            if (user == null)
            {
                throw new UserFriendlyException("Vartotojas neegzistuoja!");
            }

            var currentQuestion = await _questionRepository
                                  .GetAll()
                                  .Include(x => x.Tour)
                                  .ThenInclude(x => x.Mindfight)
                                  .ThenInclude(x => x.Evaluators)
                                  .FirstOrDefaultAsync(x => x.Id == questionId);

            if (currentQuestion == null)
            {
                throw new UserFriendlyException("Klausimas su nurodytu id neegzistuoja!");
            }

            var currentTeam = await _teamRepository
                              .GetAll()
                              .FirstOrDefaultAsync(x => x.Id == teamId);

            if (currentTeam == null)
            {
                throw new UserFriendlyException("Komanda su nurodytu id neegzistuoja!");
            }

            if (!(currentQuestion.Tour.Mindfight.CreatorId == _userManager.AbpSession.UserId ||
                  _permissionChecker.IsGranted("ManageMindfights") ||
                  currentQuestion.Tour.Mindfight.Evaluators.Any(x => x.UserId == _userManager.AbpSession.UserId) ||
                  user.TeamId == teamId))
            {
                throw new AbpAuthorizationException("Jūs neturite teisių gauti šiuos atsakymus!");
            }

            var teamAnswer = await _teamAnswerRepository
                             .GetAll()
                             .Include(answer => answer.Evaluator)
                             .Include(answer => answer.Question)
                             .ThenInclude(question => question.Tour)
                             .FirstOrDefaultAsync(x => x.QuestionId == questionId && x.TeamId == teamId);

            if (teamAnswer == null)
            {
                throw new UserFriendlyException("Komandos atsakymas neegizstuoja!");
            }

            var teamAnswerDto = new TeamAnswerDto();

            _objectMapper.Map(teamAnswer, teamAnswerDto);
            teamAnswerDto.Evaluator       = teamAnswer.Evaluator?.EmailAddress.ToLower();
            teamAnswerDto.TourOrderNumber = teamAnswer.Question.Tour.OrderNumber;
            teamAnswerDto.Answer          = currentQuestion.Answer;
            return(teamAnswerDto);
        }
        private ModuleMenuItems BuildDocumentMenu()
        {
            ModuleMenuItems moduleMenuItems = new ModuleMenuItems();

            ModuleMenuItem moduleMenuItem = new ModuleMenuItem();

            moduleMenuItem.Name        = MenuNameConstants.DocumentManagement;
            moduleMenuItem.DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.ApplicationName);
            moduleMenuItem.Order       = 0;

            if (_permissionChecker.IsGranted("admindocumentmvc_permission", "write"))
            {
                #region Release Document

                MenuItem menuReleaseDocument = new MenuItem();
                menuReleaseDocument.Name        = MenuNameConstants.ReleaseDocument;
                menuReleaseDocument.DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuReleaseDocument);
                menuReleaseDocument.Order       = 0;
                menuReleaseDocument.Url         = "#";
                menuReleaseDocument.Icon        = "fa fa-cog";
                menuReleaseDocument.CssClass    = "treeview";

                menuReleaseDocument.Items.Add(new MenuItem
                {
                    Name        = MenuNameConstants.ReleaseNewDocument,
                    DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuReleaseNewDocument),
                    Url         = "/document/index",
                    Order       = 0
                });

                menuReleaseDocument.Items.Add(new MenuItem
                {
                    Name        = MenuNameConstants.ReviewDocument,
                    DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuReviewDocument),
                    Url         = "/document/reviewdocument",
                    Order       = 1
                });
                #endregion
                moduleMenuItem.Items.Add(menuReleaseDocument);
                #region Appendice
                MenuItem menuAppendiceDocument = new MenuItem();
                menuAppendiceDocument.Name        = MenuNameConstants.ReleaseAppendice;
                menuAppendiceDocument.DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuReleaseAppendice);
                menuAppendiceDocument.Order       = 0;
                menuAppendiceDocument.Url         = "#";
                menuAppendiceDocument.Icon        = "fa fa-cog";
                menuAppendiceDocument.CssClass    = "treeview";

                menuAppendiceDocument.Items.Add(new MenuItem
                {
                    Name        = MenuNameConstants.ReleaseNewAppendice,
                    DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuReleaseNewAppendice),
                    Url         = "/appendice/index",
                    Order       = 0
                });

                menuAppendiceDocument.Items.Add(new MenuItem
                {
                    Name        = MenuNameConstants.ReviewAppendice,
                    DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuReviewAppendice),
                    Url         = "/document/reviewdocument",
                    Order       = 1
                });
                #endregion
                moduleMenuItem.Items.Add(menuAppendiceDocument);

                #region Categories
                MenuItem menuCategory = new MenuItem();
                menuCategory.Name        = MenuNameConstants.Category;
                menuCategory.DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuCategory);
                menuCategory.Order       = 0;
                menuCategory.Url         = "#";
                menuCategory.Icon        = "fa  fa-list";
                menuCategory.CssClass    = "treeview";

                menuCategory.Items.Add(new MenuItem
                {
                    Name        = MenuNameConstants.Module,
                    DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuModule),
                    Url         = "/module/index",
                    Order       = 0
                });

                menuCategory.Items.Add(new MenuItem
                {
                    Name        = MenuNameConstants.DocumentType,
                    DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuDocumentType),
                    Url         = "/documenttype/index",
                    Order       = 1
                });

                menuCategory.Items.Add(new MenuItem
                {
                    Name        = MenuNameConstants.PromulgateStatus,
                    DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuPromulgateStatus),
                    Url         = "/promulgatestatus/index",
                    Order       = 2
                });
                #endregion
                moduleMenuItem.Items.Add(menuCategory);
            }

            #region Operation Data
            MenuItem menuOperationData = new MenuItem();
            menuOperationData.Name        = MenuNameConstants.OperationData;
            menuOperationData.DisplayName = _localizationManager.GetString(DocumentResourceNames.DocumentResourceName, DocumentResourceNames.MenuOperationData);
            menuOperationData.Order       = 0;
            menuOperationData.Url         = "#";
            menuOperationData.Icon        = "fa  fa-list";
            menuOperationData.CssClass    = "treeview";

            var documentTypes = SimpleCache.DocumentTypes;
            if (documentTypes != null && documentTypes.Any())
            {
                foreach (var documentType in documentTypes)
                {
                    menuOperationData.Items.Add(new MenuItem
                    {
                        Name        = documentType.Code,
                        DisplayName = documentType.Name,
                        Url         = $"/OperationData/list?code={documentType.Code}",
                        Order       = 2
                    });
                }
            }

            #endregion
            moduleMenuItem.Items.Add(menuOperationData);

            moduleMenuItems.Add(moduleMenuItem);

            return(moduleMenuItems);
        }