Exemplo n.º 1
0
        public async Task <IActionResult> GetQuests(string searchPattern, int start, int pageSize)
        {
            GoNorthProject project = await _projectDbAccess.GetDefaultProject();

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

            if (string.IsNullOrEmpty(searchPattern))
            {
                queryTask = _questDbAccess.GetQuestsByProjectId(project.Id, start, pageSize);
                countTask = _questDbAccess.GetQuestsByProjectIdCount(project.Id);
            }
            else
            {
                queryTask = _questDbAccess.SearchQuests(project.Id, searchPattern, start, pageSize);
                countTask = _questDbAccess.SearchQuestsCount(project.Id, searchPattern);
            }
            Task.WaitAll(queryTask, countTask);

            QuestQueryResult queryResult = new QuestQueryResult();

            queryResult.Quests  = queryTask.Result;
            queryResult.HasMore = start + queryResult.Quests.Count < countTask.Result;
            return(Ok(queryResult));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }