private void PopulateBooksList() { List <Book> booksList = BookDB.GetAllBooks(); cmbBooks.DataSource = booksList; cmbBooks.DisplayMember = nameof(Book.Title); }
private void btnCancel_Click(object sender, EventArgs e) { Book selbook = cmbBooks.SelectedItem as Book; if (BookDB.DeleteBook(selbook.BookInfo)) { PopulateBooksList(); } }
private void BtnAddBook_Click(object sender, EventArgs e) { if (isValidInt()) { Book book = new Book(); book.BookISBN = txtISBN.Text; book.BookPrice = Convert.ToDecimal(txtPrice.Text); book.BookTitle = txtTitle.Text; BookDB.AddBook(book); price = Convert.ToDecimal(txtPrice.Text); DialogResult = DialogResult.OK; } }
private void btnSaveBook_Click(object sender, EventArgs e) { Book book = new Book(); book.Title = txtTitle.Text; book.ISBN = txtISBN.Text; BookDB.AddBook(book); MessageBox.Show("Book Added!"); New_Book = book; DialogResult = DialogResult.OK; Close(); }
private void PopulateComboBoxes() { List <Book> allBooks = BookDB.GetAllBooks(); cbBookTitle.Items.Clear(); foreach (Book book in allBooks) { cbBookTitle.Items.Add(book); } List <Customer> allCustomers = CustomerDB.GetAllCustomers(); cbCustomer.Items.Clear(); foreach (Customer cust in allCustomers) { cbCustomer.Items.Add(cust); } }