private void addButton_Click(object sender, RoutedEventArgs e) { EditBookDialog editBookDialog = new EditBookDialog(); //Initiate Window String result; editBookDialog.ShowDialog(); if (editBookDialog.DialogResult == true) { try { string isbn = editBookDialog.isbnTextBox.Text; string title = editBookDialog.titleTextBox.Text; string author = editBookDialog.authorTextBox.Text; double price = double.Parse(editBookDialog.priceTextBox.Text); int quantity = int.Parse(editBookDialog.quantityTextBox.Text); string year = editBookDialog.yearTextBox.Text; string edition = editBookDialog.editionTextBox.Text; string publisher = editBookDialog.publisherTextBox.Text; int categoryID = int.Parse(editBookDialog.categoryTextBox.Text); int supplierID = int.Parse(editBookDialog.supplierTextBox.Text); result = bookAddEdit.AddBook(isbn, title, author, price, quantity, year, edition, publisher, categoryID, supplierID); this.UpdateData(); MessageBox.Show(result); } catch (Exception) { MessageBox.Show("All fields must be filled out in the correct data format"); //throw; } } }
public string AddBook( [PexAssumeUnderTest] BookAddEdit target, string ISBN, string title, string author, double price, int quantity, string year, string edition, string publisher, int categoryID, int supplierID ) { string result = target.AddBook (ISBN, title, author, price, quantity, year, edition, publisher, categoryID, supplierID); return(result); // TODO: add assertions to method BookAddEditTest.AddBook(BookAddEdit, String, String, String, Double, Int32, String, String, String, Int32, Int32) }