コード例 #1
0
        public async Task <IActionResult> SearchPages(string searchPattern, int start, int pageSize, string excludeId)
        {
            if (searchPattern == null)
            {
                searchPattern = "";
            }

            GoNorthProject project = await _projectDbAccess.GetDefaultProject();

            Task <List <KirjaPage> > queryTask;
            Task <int> countTask;

            queryTask = _pageDbAccess.SearchPages(project.Id, searchPattern, start, pageSize, excludeId);
            countTask = _pageDbAccess.SearchPagesCount(project.Id, searchPattern, excludeId);
            Task.WaitAll(queryTask, countTask);

            PageQueryResult queryResult = new PageQueryResult();

            queryResult.Pages   = queryTask.Result;
            queryResult.HasMore = start + queryResult.Pages.Count < countTask.Result;
            return(Ok(queryResult));
        }
コード例 #2
0
        /// <summary>
        /// Checks if a project is empty
        /// </summary>
        /// <param name="project">Project to check</param>
        /// <returns>True if the project is empty, else false</returns>
        private async Task <bool> IsProjectEmpty(GoNorthProject project)
        {
            int rootKortistoFolderCount = await _kortistoFolderDbAccess.GetRootFolderCount(project.Id, CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);

            if (rootKortistoFolderCount > 0)
            {
                return(false);
            }

            int rootNpcCount = await _npcDbAccess.GetFlexFieldObjectsInRootFolderCount(project.Id, CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);

            if (rootNpcCount > 0)
            {
                return(false);
            }

            int rootStyrFolderCount = await _styrFolderDbAccess.GetRootFolderCount(project.Id, CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);

            if (rootStyrFolderCount > 0)
            {
                return(false);
            }

            int rootItemCount = await _itemDbAccess.GetFlexFieldObjectsInRootFolderCount(project.Id, CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);

            if (rootItemCount > 0)
            {
                return(false);
            }

            int rootEvneFolderCount = await _evneFolderDbAccess.GetRootFolderCount(project.Id, CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);

            if (rootEvneFolderCount > 0)
            {
                return(false);
            }

            int rootSkillCount = await _evneSkillDbAccess.GetFlexFieldObjectsInRootFolderCount(project.Id, CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);

            if (rootSkillCount > 0)
            {
                return(false);
            }

            int kirjaPageCount = await _kirjaPageDbAccess.SearchPagesCount(project.Id, string.Empty, string.Empty, CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);

            if (kirjaPageCount > 1)
            {
                return(false);
            }
            else if (kirjaPageCount == 1)
            {
                KirjaPage defaultPage = await _kirjaPageDbAccess.GetDefaultPageForProject(project.Id);

                if (defaultPage == null)
                {
                    return(false);
                }
            }

            int chapterDetailCount = await _chapterDetailDbAccess.GetChapterDetailsByProjectIdCount(project.Id);

            if (chapterDetailCount > 0)
            {
                return(false);
            }

            int questCount = await _questDbAccess.GetQuestsByProjectIdCount(project.Id, CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);

            if (questCount > 0)
            {
                return(false);
            }

            List <KartaMap> maps = await _mapDbAccess.GetAllProjectMaps(project.Id);

            if (maps != null && maps.Count > 0)
            {
                return(false);
            }

            int taskBoardCount = await _taskBoardDbAccess.GetOpenTaskBoardCount(project.Id, CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);

            taskBoardCount += await _taskBoardDbAccess.GetClosedTaskBoardCount(project.Id, CultureInfo.CurrentUICulture.TwoLetterISOLanguageName);

            if (taskBoardCount > 0)
            {
                return(false);
            }

            return(true);
        }
コード例 #3
0
        /// <summary>
        /// Checks if a project is empty
        /// </summary>
        /// <param name="project">Project to check</param>
        /// <returns>True if the project is empty, else false</returns>
        private async Task <bool> IsProjectEmpty(GoNorthProject project)
        {
            int rootKortistoFolderCount = await _kortistoFolderDbAccess.GetRootFolderCount(project.Id);

            if (rootKortistoFolderCount > 0)
            {
                return(false);
            }

            int rootNpcCount = await _npcDbAccess.GetFlexFieldObjectsInRootFolderCount(project.Id);

            if (rootNpcCount > 0)
            {
                return(false);
            }

            int rootStyrFolderCount = await _styrFolderDbAccess.GetRootFolderCount(project.Id);

            if (rootStyrFolderCount > 0)
            {
                return(false);
            }

            int rootItemCount = await _itemDbAccess.GetFlexFieldObjectsInRootFolderCount(project.Id);

            if (rootItemCount > 0)
            {
                return(false);
            }

            int kirjaPageCount = await _kirjaPageDbAccess.SearchPagesCount(project.Id, string.Empty, string.Empty);

            if (kirjaPageCount > 0)
            {
                return(false);
            }

            int chapterDetailCount = await _chapterDetailDbAccess.GetChapterDetailsByProjectIdCount(project.Id);

            if (chapterDetailCount > 0)
            {
                return(false);
            }

            int questCount = await _questDbAccess.GetQuestsByProjectIdCount(project.Id);

            if (questCount > 0)
            {
                return(false);
            }

            List <KartaMap> maps = await _mapDbAccess.GetAllProjectMaps(project.Id);

            if (maps != null && maps.Count > 0)
            {
                return(false);
            }

            int taskBoardCount = await _taskBoardDbAccess.GetOpenTaskBoardCount(project.Id);

            taskBoardCount += await _taskBoardDbAccess.GetClosedTaskBoardCount(project.Id);

            if (taskBoardCount > 0)
            {
                return(false);
            }

            return(true);
        }