//------------------------------------------------------------------------------------------------------------------------------------------ public bool UpdateBookTitle(BookTitleDTO bt) { string strCmd = "update_book_title"; SqlParameter id = new SqlParameter("@BookTitleID", bt.BookTitleID); SqlParameter name = new SqlParameter("@Title", bt.Title); SqlParameter author = new SqlParameter("@AuthorID", bt.AuthorID); SqlParameter category = new SqlParameter("@CategoryID", bt.CategoryID); try { return(_DataProvicer.ExecuteNonQuery(strCmd, CommandType.StoredProcedure, id, name, author, category)); } catch (Exception ex) { //throw new Exception(ex.Message); return(false); } }
private void btnSubmit_Click(object sender, EventArgs e) { if (check() == false) { return; } bool result = false; BookTitleDTO bt = new BookTitleDTO { BookTitleID = txtBookTitleID.Text, AuthorID = txtAuthorID.Text, CategoryID = txtCategoryID.Text, Title = txtTitle.Text }; if (AddOrEdit == 0) { result = bus.AddNewBookTitle(bt); if (result) { MessageBox.Show(this, "The New Book Title is added successful.", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); dr = DialogResult.OK; this.Close(); } else { MessageBox.Show(this, "The New Book Title is added fail. BookID is existed!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { result = bus.UpdateBookTitle(bt); if (result) { MessageBox.Show(this, "The Book Title is updated successful.", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); dr = DialogResult.OK; this.Close(); } else { MessageBox.Show(this, "The Book Title is updated fail. Please try again later.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public bool UpdateBookTitle(BookTitleDTO bt) { return dao.UpdateBookTitle(bt); }
public bool AddNewBookTitle(BookTitleDTO bt) { return dao.AddNewBookTitle(bt); }