Esempio n. 1
0
 public int addBook(string name, string author = "", bookTypes bookType = bookTypes.Unknown,
     ReadingBook.bookCategories Category = ReadingBook.bookCategories.Unknown)
 {
     LibraryBook newBook;
     switch (bookType)
     {
         case bookTypes.Unknown:
             newBook = new LibraryBook(name, author);
             break;
         case bookTypes.Enrichment:
             newBook = new EnrichmentBook(name, author);
             break;
         case bookTypes.Reading:
             newBook = new ReadingBook(name, author, Category);
             break;
         default:
             newBook = null;
             break;
     }
     if (newBook == null || newBook.BookID == 0)
         return -1;
     int counter = books.Count;
     books.Add(newBook);
     return (books.Count == counter + 1) ? newBook.BookID : -1;
 }
Esempio n. 2
0
 public ReadingBook(string name, string author = "", ReadingBook.bookCategories Category = ReadingBook.bookCategories.Unknown)
     : base(name, author)
 {
     this.bookCategory = Category;
     this.lastBorrowing = DateTime.Now;
 }