/// <summary> /// Opens a BookCopiesDialog dialog window and removes the result of the dialog into the total copies of the book /// </summary> private void RemoveCopies() { BookCopiesDialog bcd = new BookCopiesDialog(this, BookCopiesDialog.AddOrRemove.Remove); if ((bool)bcd.ShowDialog()) //if dialog result returns true (changes confirmed) { Book.NumberOfCopies -= bcd.CopiesResult; //subtract the total copies controller.Save(); //save changes to the database //Update controls to reflect change CopiesAvailableTextBox.Text = Book.CopiesAvailable.ToString(); TotalCopiesTextBox.Text = Book.NumberOfCopies.ToString(); //set edited to true edited = true; } }
/// <summary> /// Opens a BookCopiesDialog dialog window and adds the result of the dialog into the total copies of the Book /// </summary> private void AddCopies() { //show dialog BookCopiesDialog bcd = new BookCopiesDialog(this, BookCopiesDialog.AddOrRemove.Add); if ((bool)bcd.ShowDialog()) //if the dialog returns a true (changes are confirmed) { Book.NumberOfCopies += bcd.CopiesResult; //add the copies controller.Save(); //save changes to the database //Update the controls to reflect changes CopiesAvailableTextBox.Text = Book.CopiesAvailable.ToString(); TotalCopiesTextBox.Text = Book.NumberOfCopies.ToString(); //set edited flag to true. edited = true; } }