/// <summary> /// <see cref="IDataService.GetSocialInformation(int)"/> /// </summary> /// <param name="podcastID"></param> /// <returns></returns> public SocialInformation GetSocialInformation(int podcastID) { SocialInformation data = new SocialInformation(); data.Name = "DevApps Podcasts"; data.Authors = "Denis Voituron / Christophe Peugnet"; data.Language = "fr-fr"; data.GoogleAnalyticsKey = "UA-65328357-1"; data.TwitterUrl = "https://twitter.com/DevAppsPodcast"; data.TwitterAccount = "@DevAppsPodcast"; data.CopyrightName = "Denis Voituron"; data.CopyrightUrl = "http://www.dvoituron.be"; data.CopyrightEmail = "*****@*****.**"; data.CategoriesKeywords = "Programming;Talk;Français;Podcast;Microsoft;Technology=Software How-To;Technology=Gadgets"; data.ImageUrl = "http://devapps.be/images/logo1400.png"; data.Creator = "@DevAppsPodcast"; data.FeedAudioUrl = "http://devapps.be/feed"; data.FeedVideoUrl = "http://devapps.be/video"; data.FeedTitle = "DevApps Podcasts, par Denis Voituron et Christophe Peugnet"; Podcast podcast = this.GetPodcast(podcastID); // Header for Home Page if (podcast == null) { data.Title = "DevApps Podcasts"; data.Description = "DevApps - Actualité, Développement et Architecture en technologies .NET. Présenté par Denis Voituron et Christophe Peugnet, ce podcast ce veut technique et convivial."; data.Url = "http://devapps.be"; } // Header for podcast else { data.Title = podcast.Summary.Title; data.Description = podcast.Summary.Description; data.Url = $"http://devapps.be/podcast/{podcast.PodcastID}"; } return(data); }
/// <summary> /// /// </summary> /// <param name="podcastID"></param> /// <returns></returns> public SocialInformation GetSocialInformation(int podcastID) { this.LoadConfigurationAndHeaders(); // Global social information SocialInformation socialInformation = new SocialInformation() { Name = _siteHeader.Name, Authors = _siteHeader.Authors, Language = _siteHeader.Language, GoogleAnalyticsKey = _siteHeader.GoogleAnalyticsKey, TwitterUrl = _siteHeader.TwitterUrl, TwitterAccount = _siteHeader.TwitterAccount, CopyrightName = _siteHeader.CopyrightName, CopyrightUrl = _siteHeader.CopyrightUrl, CopyrightEmail = _siteHeader.CopyrightEmail, CategoriesKeywords = _siteHeader.CategoriesKeywords, ImageUrl = _siteHeader.ImageUrl, Creator = _siteHeader.Creator, FeedAudioUrl = _siteHeader.FeedAudioUrl, FeedVideoUrl = _siteHeader.FeedVideoUrl, FeedTitle = _siteHeader.FeedTitle }; // Custom social information Podcast podcast = this.GetPodcast(podcastID); if (podcast != null) { socialInformation.Title = podcast.Summary.Title; socialInformation.Description = podcast.Summary.Description; socialInformation.Url = podcast.PodcastUri.ToString(); } return(socialInformation); }
/// <summary> /// Clear all data stored in cached objects. /// </summary> public void ClearCache() { _configuration = null; _siteHeader = null; _podcasts = null; }
/// <summary> /// Load all configurations parameters et Header values /// </summary> private void LoadConfigurationAndHeaders() { if (_configuration == null) { _configuration = new Configuration(); } if (_siteHeader == null) { _siteHeader = new SocialInformation(); } using (SqlDatabaseCommand cmd = this.GetDatabaseCommand()) { // Gets all configuration values cmd.CommandText.AppendLine(" SELECT Name, Value FROM Configuration "); var allConfigValues = cmd.ExecuteTable((row) => { return(new { Name = row.Field <string>("Name"), Value = row.Field <string>("Value") }); }); // Filtering Name / Value foreach (var item in allConfigValues) { switch (item.Name) { case "MaximumOfPodcastsOnHomePage": _configuration.MaximumOfPodcastsOnHomePage = Int32.Parse(item.Value); break; case "DisqusShortnameKey": _configuration.DisqusShortnameKey = item.Value; break; case "SiteUrl": _configuration.SiteUrl = new Uri(item.Value); _siteHeader.Url = item.Value; break; case "Version": _configuration.Version = new Version(item.Value); break; case "AzureStorageCredentials": string[] splitted = item.Value.Split(';'); _configuration.AzureStorageCredentials = new KeyValuePair <string, string>(splitted[0], splitted[1]); break; case "SiteName": _siteHeader.Title = item.Value; _siteHeader.Name = item.Value; break; case "SiteDescription": _siteHeader.Description = item.Value; break; case "SiteAuthor": _siteHeader.Authors = item.Value; break; case "SiteLanguage": _siteHeader.Language = item.Value; break; case "GoogleAnalyticsKey": _siteHeader.GoogleAnalyticsKey = item.Value; break; case "TwitterUrl": _siteHeader.TwitterUrl = item.Value; break; case "TwitterAccount": _siteHeader.TwitterAccount = item.Value; break; case "CopyrightName": _siteHeader.CopyrightName = item.Value; break; case "CopyrightUrl": _siteHeader.CopyrightUrl = item.Value; break; case "CopyrightEmail": _siteHeader.CopyrightEmail = item.Value; break; case "CategoriesKeywords": _siteHeader.CategoriesKeywords = item.Value; break; case "ImageUrl": _siteHeader.ImageUrl = item.Value; break; case "Creator": _siteHeader.Creator = item.Value; break; case "FeedAudioUrl": _siteHeader.FeedAudioUrl = item.Value; break; case "FeedVideoUrl": _siteHeader.FeedVideoUrl = item.Value; break; case "FeedTitle": _siteHeader.FeedTitle = item.Value; break; case "YoutubeStatisticsApiKey": _configuration.YoutubeStatisticsApiKey = item.Value; break; } } } }