public DbVerse(BibleBook book, ChapterVerse from, ChapterVerse to, string title, string body, DateTime date, DbTranslation translation) { if (to == null) throw new ArgumentNullException("to", "to cannot be null."); if (from == null) throw new ArgumentNullException("from", "from cannot be null."); if (book == null) throw new ArgumentNullException("book", "book cannot be null."); if (from.CompareTo(to) > 0) throw new ArgumentException("The To reference should be after the From reference."); if (title == null) throw new ArgumentNullException("title", "title cannot be null."); if (body == null) throw new ArgumentNullException("body", "body cannot be null."); Id = -1; Book = book; From = from; To = to; Title = title; Body = body; Date = date; if (translation == null) Translation = DbTranslation.Default; else Translation = translation; }
public TranslationViewModel(DbTranslation fromDb) { if (fromDb == null) throw new ArgumentNullException("fromDb", "fromDb cannot be null."); _fromDb = fromDb; }
public DbVerse(IDictionary<string, object> dbRecord) { if (dbRecord == null) throw new ArgumentNullException("dbRecord", "dbRecord cannot be null."); var bookId = dbRecord.ValidateField<int>(BookField); if (!BibleBook.IsValidBook(bookId)) throw new FormatException(string.Format("The '{0}' field does not refer to a valid book", BookField)); var id = dbRecord.ValidateField<int>(VerseIdField); var fromChapter = dbRecord.ValidateField(BeginChapterField, 1); var fromVerse = dbRecord.ValidateField(BeginVerseField, 1); var toChapter = dbRecord.ValidateField(EndChapterField, fromChapter); var toVerse = dbRecord.ValidateField(EndVerseField, 1); Id = id; Book = BibleBook.GetBook(bookId); From = new ChapterVerse(fromChapter, fromVerse); To = new ChapterVerse(toChapter, toVerse); Title = dbRecord.ValidateField<string>(TitleField); Body = dbRecord.ValidateField<string>(BodyField); Date = dbRecord.ValidateDateField(DateField); if (From.CompareTo(To) > 0) throw new FormatException("The From reference should be before the To reference."); Translation = new DbTranslation(dbRecord); }