private void ButtonReturn_Click(object sender, EventArgs e) { Book myBook = (Book)listBooks.SelectedItem; myBook.copies++; BookFile.SaveBook(myBook, cwid, "edit"); LoadList(); }
private void ButtonDelete_Click(object sender, EventArgs e) { Book myBook = (Book)listBooks.SelectedItem; DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete?", "Delete", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { BookFile.DeleteBook(myBook, cwid); LoadList(); } }
private void ButtonSave_Click(object sender, EventArgs e) { myBook.title = textTitle.Text; myBook.author = textAuthor.Text; myBook.genre = textGenre.Text; myBook.copies = int.Parse(textCopies.Text); myBook.length = int.Parse(textLength.Text); myBook.isbn = textISBN.Text; myBook.cover = textCover.Text; myBook.cwid = cwid; BookFile.SaveBook(myBook, cwid, mode); MessageBox.Show("Content Saved", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
private void LoadList() { myBooks = BookFile.GetAllBooks(cwid); listBooks.DataSource = myBooks; }