public bool Equals(Sermon test) { if (test == null) { return(false); } return(this.Content == test.Content && this.Title == test.Title && this.DateCreated == test.DateCreated); }
/// <summary> /// Builds a list of sermons from a more generic list returned by the database class. /// </summary> /// <param name="rows">List of data rows.</param> /// <returns>List of sermons if the parameter has data; null otherwise.</returns> private static List <Sermon> BuildFromReader(List <Dictionary <string, object> > rows) { if (rows != null) { List <Sermon> result = new List <Sermon>(); foreach (Dictionary <string, object> row in rows) { if (row.Count == 10) { Sermon sermon = new Sermon { id = (long)row["sermonId"], guid = (string)row["sermonGuid"], title = (string)row["sermonTitle"], locationId = (long)row["locationId"], locationName = (string)row["locationName"], dateCreated = (long)row["sermonDateCreated"], lastAccessed = (long)row["sermonLastAccessed"], keyVerse = (string)row["sermonKeyVerse"], otherMetadata = (string)row["sermonOtherMetadata"], content = (string)row["sermonContent"] }; sermon.Themes = Theme.GetSermonThemes(sermon.ID); sermon.Speakers = Speaker.GetSermonSpeakers(sermon.ID); result.Add(sermon); } else { continue; } } if (result.Count < 1) { return(null); } else { return(result); } } else { return(null); } }
/// <summary> /// Build sermon from GUID. /// </summary> /// <param name="guid">The GUID of the sermon to search.</param> public Sermon(string guid) { Sermon sermon = Read(guid); this.CommonInit(sermon.ID, sermon.GUID, sermon.Title, sermon.Location.ID, sermon.Location.Name, sermon.Location, sermon.Themes, sermon.Speakers, sermon.DateCreated.Ticks, sermon.DateLastAccessed.Ticks, sermon.KeyVerse, sermon.OtherMetaData, sermon.Content); }