//ADD THE BOOKS DETAILS INTO BOOK TABEL =>PL private void BtnSubmit_Click(object sender, RoutedEventArgs e) { if (tbBName.Text != string.Empty && tbBAuthor.Text != string.Empty && tbBISBN.Text != string.Empty && tbBPrice.Text != string.Empty && tbBCopy.Text != string.Empty ) { try { BookBL bookBL = new BookBL(); string isDone = bookBL.AddBookBL(tbBName.Text, tbBAuthor.Text, tbBISBN.Text, double.Parse(tbBPrice.Text), int.Parse(tbBCopy.Text)); if (isDone == "true") { MessageBox.Show("Book added successfuly.."); this.Close(); } else { MessageBox.Show(isDone + "Try again.."); } } catch (FormatException) { MessageBox.Show("Invalid Book price or Book copy!!!,\nThey should not be a string, Try again.."); } catch (Exception) { MessageBox.Show("Some unknown exception is occured!!!, Try again.."); } } else { MessageBox.Show("Enter the fields properly!!!, Every field is required.."); } }
//ADD THE BOOKS DETAILS INTO BOOK TABEL =>PL private void btnAdd_Click(object sender, EventArgs e) { if (tbBName.Text != string.Empty && tbBAuthor.Text != string.Empty && tbBISBN.Text != string.Empty && tbBPrice.Text != string.Empty && tbBCopy.Text != string.Empty ) { try { BookBL bookBL = new BookBL(); string isDone = bookBL.AddBookBL(tbBName.Text, tbBAuthor.Text, tbBISBN.Text, double.Parse(tbBPrice.Text), int.Parse(tbBCopy.Text)); if (isDone == "true") { MessageBox.Show("Book added successfuly.."); } else { MessageBox.Show(isDone + "Try again.."); } } catch (Exception) { MessageBox.Show("Enter the fields properly..."); } } else { MessageBox.Show("Enter the fields properly.."); } /*if (tbBName.Text!=string.Empty && tbBAuthor.Text!= string.Empty && tbBISBN.Text != string.Empty && tbBPrice.Text != string.Empty && * tbBCopy.Text != string.Empty * ) * { * try * { * BookBL bookBL = new BookBL(); * bool isDone = bookBL.AddBookBL(tbBName.Text, tbBAuthor.Text, tbBISBN.Text, double.Parse(tbBPrice.Text), int.Parse(tbBCopy.Text)); * if (isDone) * { * MessageBox.Show("Book added successfuly.."); * } * else * { * MessageBox.Show("Try later.."); * } * } * catch (Exception) * { * MessageBox.Show("Enter the fields properly..."); * } * } * else * { * MessageBox.Show("Enter the fields properly.."); * }*/ }