/// <summary> /// Adds the sermon. /// </summary> /// <param name="newSermon">The new sermon.</param> /// <returns></returns> /// <exception cref="ParameterNullException">newSermon</exception> public int AddSermon(ISermon newSermon) { if (newSermon == null) { throw new ParameterNullException("newSermon"); } var sermonId = this.sermonRepository.Add(newSermon); newSermon.SermonId = sermonId; if ((HttpContext.Current.Cache != null) && (HttpContext.Current.Cache["Sermons"] != null)) { var sermonsCollection = (List<ISermon>)HttpContext.Current.Cache["Sermons"]; sermonsCollection.Add(newSermon); HttpContext.Current.Cache["Sermons"] = sermonsCollection; } return sermonId; }
public IndexModel(ISermon sermon) { _sermon = sermon; }
public CreateModel(ISermon sermon) { _sermon = sermon; }
public DeleteModel(ISermon sermon) { _sermon = sermon; }
public EditModel(ISermon sermon) { _sermon = sermon; }
private void SetFacebookHeaders(ISermon sermon) { var url = new UriBuilder(Request.Url.Scheme, Request.Url.Host, Request.Url.Port).Uri; var tagsService = ServiceLocator.Instance.Locate<IOpenGraphTagsService>(); tagsService.AddOpenTags(this, new OpenGraphTags { Type = "article", Section = "Sermons", Url = UrlService.MakeFullUrl(sermon.SermonUrl), Title = sermon.Title, Description = sermon.ScriptureReference.ToString(), }); }
/// <summary> /// Updates the sermon. /// </summary> /// <param name="sermonToUpdate">The sermon to update.</param> /// <returns></returns> /// <exception cref="ParameterNullException">sermonToUpdate</exception> public bool UpdateSermon(ISermon sermonToUpdate) { if (sermonToUpdate == null) { throw new ParameterNullException("sermonToUpdate"); } try { this.sermonRepository.Update(sermonToUpdate); this.RemoveCollectionFromCache(); } catch (Exception) { return false; } return true; }
public void SetMp3FileTags(string fileName, ISermon sermon) { if (!string.IsNullOrEmpty(fileName)) return; if (sermon.RecordingDate.HasValue) { var mp3File = TagLib.File.Create(HttpContext.Current.Server.MapPath(fileName)); mp3File.Tag.Clear(); mp3File.Tag.Album = sermon.RecordingSession; mp3File.Tag.AlbumArtists = new[] { sermon.SpeakerName }; mp3File.Tag.Comment = "Providence Presbyterian Church - " + sermon.RecordingDate.Value.ToShortDateString() + " - " + sermon.RecordingSession; mp3File.Tag.Genres = new[] { "Speech" }; mp3File.Tag.Title = sermon.Title; mp3File.Tag.Year = (uint)sermon.RecordingDate.Value.Year; mp3File.Tag.Copyright = "Providence Presbyterian Church - " + sermon.RecordingDate.Value.Year; var id3v2Tags = (TagLib.Id3v2.Tag)mp3File.GetTag(TagLib.TagTypes.Id3v2); // The 'Official artist/performer webpage' frame is a URL pointing at the artists official webpage. id3v2Tags.RemoveFrames("WOAR"); var frame = new TagLib.Id3v2.UnknownFrame("WOAR"); frame.Data = Encoding.ASCII.GetBytes("www.providence-pca.net"); id3v2Tags.AddFrame(frame); // The 'Official audio file webpage' frame is a URL pointing at a file specific webpage. id3v2Tags.RemoveFrames("WOAF"); frame = new TagLib.Id3v2.UnknownFrame("WOAF"); frame.Data = Encoding.ASCII.GetBytes(sermon.SermonUrl); id3v2Tags.AddFrame(frame); // Sub title id3v2Tags.RemoveFrames("TIT3"); var textFrame = new TagLib.Id3v2.TextInformationFrame("TIT3", TagLib.StringType.Latin1); textFrame.Text = new[] { sermon.ScriptureReference.ToString() }; id3v2Tags.AddFrame(textFrame); } }
public DetailsModel(ISermon sermon) { _sermon = sermon; }