private void btnreturn_Click(object sender, EventArgs e) { Book myBook = (Book)lstbooks.SelectedItem; myBook.copies++; BookFile.SaveBook(myBook, cwid, "edit"); LoadList(); }
private void btndelete_Click(object sender, EventArgs e) { Book myBook = (Book)lstbooks.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 btnsave_Click(object sender, EventArgs e) { myBook.title = txttitledata.Text; myBook.author = txtauthordata.Text; myBook.genre = txtgenredata.Text; myBook.copies = int.Parse(txtcopiesavailabledata.Text); myBook.isbn = txtISBNdata.Text; myBook.length = int.Parse(txtlengthdata.Text); myBook.cover = txtcoverdata.Text; myBook.cwid = cwid; BookFile.SaveBook(myBook, cwid, mode); MessageBox.Show("Content was saved.", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
private void LoadList() { myBooks = BookFile.GetAllBooks(cwid); lstbooks.DataSource = myBooks; }