Exemplo n.º 1
0
        public void AddNewTBRBook(IAddNewTBRBookView inForm, ITBRRepository tbrRepository)
        {
            if (inForm.ShowViewModal() == true)
            {
                try
                {
                    string   title         = inForm.Title;
                    string   author        = inForm.Author;
                    string   publisher     = inForm.Publisher;
                    DateTime datePub       = inForm.DatePublished;
                    int      numPages      = inForm.NumberOfPages;
                    string   genre         = inForm.Genre;
                    string   recommendedBy = inForm.RecommendedBy;

                    BookTBR newTBR = BookFactory.CreateBookTBR(title, author, publisher, datePub, numPages, genre, recommendedBy);

                    tbrRepository.AddBookTBR(newTBR);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("EXCEPTION: " + ex.Message);
                    throw;
                }
            }
        }
Exemplo n.º 2
0
        public void AddBookTBR(BookTBR bookTBR)
        {
            bookTBR._bookId = ++_lastId;

            _listBooks.Add(bookTBR);

            NotifyObservers();
        }
Exemplo n.º 3
0
        private void UpdateList()
        {
            for (int i = 0; i < _listBooks.Count(); i++)
            {
                BookTBR book = _listBooks[i];

                string bookAuthor        = book.Author;
                string bookPublisher     = book.Publisher;
                string bookDatePublished = book.DatePublished.ToString();
                string bookGenre         = book.Genre;
                string bookPages         = book.NumPages.ToString();
                string bookRecommended   = book.RecommendedBy;

                ListViewItem lvt = new ListViewItem(book.Title);
                lvt.SubItems.Add(bookAuthor);
                lvt.SubItems.Add(bookPublisher);
                lvt.SubItems.Add(bookDatePublished);
                lvt.SubItems.Add(bookPages);
                lvt.SubItems.Add(bookGenre);
                lvt.SubItems.Add(bookRecommended);

                listTBR.Items.Add(lvt);
            }
        }
Exemplo n.º 4
0
 public static GoalBook CreateBookGoal(string description, DateTime startDate, DateTime endDate, BookTBR bookToRead)
 {
     return(new GoalBook(description, startDate, endDate, bookToRead));
 }