Beispiel #1
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);
            }
        }
        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);
            }
        }
        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);
            }
        }