コード例 #1
0
        public void WriteGroups(XElement root)
        {
            Load();

            string allGroupsUrl = GetAllGroupsUrl();

            SitemapItemWriter.WriteUrlToResult(root, allGroupsUrl, 1);

            IGroupsQuery        groupsQuery   = new GroupsQuery(_languageId);
            List <GroupForUser> visibleGroups = groupsQuery.GetVisibleGroups(GroupType);

            foreach (GroupForUser visibleGroup in visibleGroups)
            {
                string name = visibleGroup.Name;
                string url  = GetUrlByName(name);
                SitemapItemWriter.WriteUrlToResult(root, url, 0.9m);

                url = GetSmartTrainerUrl(name);
                SitemapItemWriter.WriteUrlToResult(root, url, TRAINER_GROUP_PRIORITY, ChangeFrequency.YEARLY);

                url = GetManualTrainerUrl(name);
                SitemapItemWriter.WriteUrlToResult(root, url, INNER_GROUP_PRIORITY, ChangeFrequency.YEARLY);
                //записать содержимое группы
                WriteGroupContent(root, visibleGroup.Id, name);
            }
        }
コード例 #2
0
ファイル: UserTasksWriter.cs プロジェクト: AndreyShp/StudyFun
        public void WriteTasks(XElement root)
        {
            _sitemapItemWriter.WriteUrlToResult(root, UrlBuilder.GetUserTasksUrl(), 0.5m);

            RepositoryFactory   repositoryFactory   = WebSettingsConfig.Instance.GetRepositoryFactory();
            UserTasksRepository userTasksRepository = repositoryFactory.CreateUserRepository(IdValidator.INVALID_ID);
            List <UserTask>     tasks = userTasksRepository.GetTasks();

            foreach (UserTask userTask in tasks)
            {
                string url = UrlBuilder.GetUserTaskUrl(userTask.AuthorId, userTask.Id);
                _sitemapItemWriter.WriteUrlToResult(root, url, 0.4m);
            }
        }
コード例 #3
0
ファイル: VideosWriter.cs プロジェクト: AndreyShp/StudyFun
        public void WriteVideos(XElement root, VideoType type)
        {
            _sitemapItemWriter.WriteUrlToResult(root, UrlBuilder.GetVideosUrl(), 1, ChangeFrequency.WEEKLY);

            IVideosQuery        videosQuery = new VideosQuery(_languageId);
            List <VideoForUser> videos      = videosQuery.GetVisible(type);

            foreach (VideoForUser video in videos)
            {
                string title = video.Title;
                string url   = UrlBuilder.GetVideoDetailUrl(title);
                _sitemapItemWriter.WriteUrlToResult(root, url, 0.9m);
            }
        }
コード例 #4
0
        public void WriteComparisons(XElement root)
        {
            string url = UrlBuilder.GetComparisonsUrl();

            SitemapItemWriter.WriteUrlToResult(root, url, 1);

            IComparisonsQuery        comparisonsQuery = new ComparisonsQuery(_languageId);
            List <ComparisonForUser> comparisons      = comparisonsQuery.GetVisibleWithoutRules();

            foreach (ComparisonForUser comparison in comparisons)
            {
                url = UrlBuilder.GetComparisonUrl(comparison.Title);
                SitemapItemWriter.WriteUrlToResult(root, url, 0.9m);
            }
        }
コード例 #5
0
        public void WriteDictionaries(XElement root, ISalesSettings salesSettings)
        {
            _sitemapItemWriter.WriteUrlToResult(root, UrlBuilder.GetVisualDictionariesUrl(), 1, ChangeFrequency.MONTHLY);

            IRepresentationsQuery        representationsQuery = new RepresentationsQuery(_languageId);
            List <RepresentationForUser> visibleDictionaries  = representationsQuery.GetVisibleWithoutAreas();

            foreach (RepresentationForUser visibleDictionary in visibleDictionaries)
            {
                string title = visibleDictionary.Title;
                string url   = UrlBuilder.GetVisualDictionaryUrl(title);
                _sitemapItemWriter.WriteUrlToResult(root, url, 0.9m);

                url = UrlBuilder.GetVisualDictionaryTrainerUrl(title);
                _sitemapItemWriter.WriteUrlToResult(root, url, 0.4m, ChangeFrequency.YEARLY);
            }
        }
コード例 #6
0
ファイル: HomeWriter.cs プロジェクト: AndreyShp/StudyFun
        public void Write(XElement root)
        {
            _sitemapItemWriter.WriteUrlToResult(root, UrlBuilder.GetSentenceHomeUrl(), 0.75m, ChangeFrequency.MONTHLY);

            ISentencesQuery sentencesQuery = new SentencesQuery();
            List <SourceWithTranslation> sourcesWithTranslation = sentencesQuery.GetByCount(_userLanguages,
                                                                                            SentenceType.Separate,
                                                                                            COUNT_SENTENCES);

            foreach (SourceWithTranslation sourceWithTranslation in sourcesWithTranslation)
            {
                string url =
                    UrlBuilder.GetSentenceHomeTrainerUrl(
                        sourceWithTranslation.Source.Id.ToString(CultureInfo.InvariantCulture),
                        sourceWithTranslation.Translation.Id.ToString(CultureInfo.InvariantCulture));
                _sitemapItemWriter.WriteUrlToResult(root, url, 0.2m, ChangeFrequency.YEARLY);
            }
        }
コード例 #7
0
        public void WriteTVSeries(XElement root)
        {
            var tvSeriesQuery          = new TVSeriesQuery(_languageId);
            List <TVSeriesInfo> covers = tvSeriesQuery.GetSeriesCovers();

            foreach (TVSeriesInfo tvSeriesInfo in covers)
            {
                string baseUrlPart = tvSeriesInfo.GetUrlPart();
                _sitemapItemWriter.WriteUrlToResult(root, UrlBuilder.GetTVSeriesUrl(baseUrlPart), 0.7m,
                                                    ChangeFrequency.WEEKLY);

                List <TVSeriesWatch> watches = tvSeriesQuery.GetSeriesWatches(tvSeriesInfo.GetId(),
                                                                              IdValidator.INVALID_ID);
                foreach (TVSeriesWatch tvSeriesWatch in watches)
                {
                    Tuple <string, string, string> pars = TVSeriesQuery.GetUrlParts(tvSeriesWatch.GetUrlPart());
                    string url = UrlBuilder.GetTVSeriesDetailUrl(pars.Item1, pars.Item2, pars.Item3);
                    _sitemapItemWriter.WriteUrlToResult(root, url, 0.6m, ChangeFrequency.MONTHLY);
                }
            }
        }
コード例 #8
0
        public void Write(XElement root)
        {
            _sitemapItemWriter.WriteUrlToResult(root, UrlBuilder.GetAudioWordsUrl(), 0.75m, ChangeFrequency.MONTHLY);

            /*var shuffleWordsQuery = new ShuffleWordsQuery(WordType.Default, ShuffleType.Audio);
             * List<SourceWithTranslation> sourcesWithTranslation = shuffleWordsQuery.GetByCount(_userLanguages, COUNT_SENTENCES);
             * foreach (SourceWithTranslation sourceWithTranslation in sourcesWithTranslation) {
             *  string url =
             *      UrlBuilder.GetAudioWordsTrainerUrl(
             *          sourceWithTranslation.Source.Id.ToString(CultureInfo.InvariantCulture),
             *          sourceWithTranslation.Translation.Id.ToString(CultureInfo.InvariantCulture));
             *  _sitemapItemWriter.WriteUrlToResult(root, url, 0.2m, ChangeFrequency.YEARLY);
             * }*/
        }
コード例 #9
0
        protected override void WriteGroupContent(XElement root, long groupId, string name)
        {
            List <SourceWithTranslation> words;

            if (!_wordsForAllGroups.TryGetValue(groupId, out words))
            {
                return;
            }
            foreach (SourceWithTranslation wordFromGroup in words)
            {
                string wordForUrl = UrlBuilder.GetSpecialWordsTrainerUrl(name, wordFromGroup.Source.Text, wordFromGroup.Translation.Text);
                SitemapItemWriter.WriteUrlToResult(root, wordForUrl, INNER_GROUP_PRIORITY, ChangeFrequency.YEARLY);
            }
        }
コード例 #10
0
        protected override void WriteGroupContent(XElement root, long groupId, string name)
        {
            List <SourceWithTranslation> sentences;

            if (!_sentencesForAllGroups.TryGetValue(groupId, out sentences))
            {
                return;
            }
            foreach (SourceWithTranslation sentenceFromGroup in sentences)
            {
                string sentenceForUrl = UrlBuilder.GetSpecialSentencesTrainerUrl(name,
                                                                                 sentenceFromGroup.Source.Id.ToString(
                                                                                     CultureInfo.InvariantCulture),
                                                                                 sentenceFromGroup.Translation.Id.
                                                                                 ToString(
                                                                                     CultureInfo.InvariantCulture));
                SitemapItemWriter.WriteUrlToResult(root, sentenceForUrl, INNER_GROUP_PRIORITY, ChangeFrequency.YEARLY);
            }
        }
コード例 #11
0
        private static void WriteUrls(XElement root)
        {
            var sitemapItemWriter = new SitemapItemWriter();

            sitemapItemWriter.WriteUrlToResult(root, "", 1);

            UserLanguages userLanguages = WebSettingsConfig.Instance.DefaultUserLanguages;
            long          languageId    = WebSettingsConfig.Instance.GetLanguageFromId();

            if (UserLanguages.IsInvalid(userLanguages) || IdValidator.IsInvalid(languageId))
            {
                return;
            }

            var visualDictionariesSalesSettings = WebSettingsConfig.Instance.GetSalesSettings(SectionId.VisualDictionary);

            if (WebSettingsConfig.Instance.IsSectionAllowed(SectionId.VisualDictionary))
            {
                var visualDictionariesWriter = new VisualDictionariesWriter(languageId);
                visualDictionariesWriter.WriteDictionaries(root, visualDictionariesSalesSettings);
            }

            if (WebSettingsConfig.Instance.IsSectionAllowed(SectionId.GroupByWords))
            {
                var groupWordsWriter = new GroupWordsWriter(userLanguages, languageId);
                groupWordsWriter.WriteGroups(root);
            }

            if (WebSettingsConfig.Instance.IsSectionAllowed(SectionId.GroupByPhrases))
            {
                var groupSentencesWriter = new GroupSentencesWriter(userLanguages, languageId);
                groupSentencesWriter.WriteGroups(root);
            }

            if (WebSettingsConfig.Instance.IsSectionAllowed(SectionId.FillDifference))
            {
                var comparisonsWriter = new ComparisonsWriter(languageId);
                comparisonsWriter.WriteComparisons(root);
            }

            if (WebSettingsConfig.Instance.IsSectionAllowed(SectionId.PopularWord))
            {
                string knowledgeGeneratorUrl = UrlBuilder.GetPopularWordsUrl();
                sitemapItemWriter.WriteUrlToResult(root, knowledgeGeneratorUrl, 0.5m, ChangeFrequency.YEARLY);
            }

            if (WebSettingsConfig.Instance.IsSectionAllowed(SectionId.UserTasks))
            {
                var userTasksWriter = new UserTasksWriter();
                userTasksWriter.WriteTasks(root);
            }

            if (WebSettingsConfig.Instance.IsSectionAllowed(SectionId.KnowledgeGenerator))
            {
                string knowledgeGeneratorUrl = UrlBuilder.GetKnowledgeGeneratorUrl();
                sitemapItemWriter.WriteUrlToResult(root, knowledgeGeneratorUrl, 0.4m, ChangeFrequency.ALWAYS);
            }

            if (WebSettingsConfig.Instance.IsSectionAllowed(SectionId.Video))
            {
                var videosWriter = new VideosWriter(languageId);
                videosWriter.WriteVideos(root, VideoType.Clip);
                videosWriter.WriteVideos(root, VideoType.Movie);
            }

            if (WebSettingsConfig.Instance.IsSectionAllowed(SectionId.TVSeries))
            {
                var videosWriter = new TVSeriesWriter(languageId);
                videosWriter.WriteTVSeries(root);
            }

            if (WebSettingsConfig.Instance.IsSectionAllowed(SectionId.Sentences))
            {
                var homeWriter = new HomeWriter(userLanguages);
                homeWriter.Write(root);
            }

            if (WebSettingsConfig.Instance.IsSectionAllowed(SectionId.Audio))
            {
                var audioWordsWriter = new AudioWordsWriter(userLanguages);
                audioWordsWriter.Write(root);
            }

            if (WebSettingsConfig.Instance.IsSectionAllowed(SectionId.WordTranslation))
            {
                sitemapItemWriter.WriteUrlToResult(root,
                                                   UrlBuilder.GetTranslationDefaulUrl(
                                                       RouteConfig.WORDS_TRANSLATION_CONTROLLER), 0.1m,
                                                   ChangeFrequency.MONTHLY);
            }

            if (WebSettingsConfig.Instance.IsSectionAllowed(SectionId.PhraseVerbTranslation))
            {
                sitemapItemWriter.WriteUrlToResult(root,
                                                   UrlBuilder.GetTranslationDefaulUrl(
                                                       RouteConfig.PHRASAL_VERBS_TRANLATION_CONTROLLER), 0.1m,
                                                   ChangeFrequency.MONTHLY);
            }
        }