Ejemplo n.º 1
0
 public static Boolean DeleteBook(int id)
 {
     if (BookDAO.DeleteBook(id))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 2
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            BookDAO dao = new BookDAO();

            dao.DeleteBook(inBookID.Value);

            init();
        }
Ejemplo n.º 3
0
 protected void GridViewBook_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("DeleteRow"))
     {
         int bookID = int.Parse(e.CommandArgument.ToString());
         BookDAO.DeleteBook(bookID);
         GridViewBook.DataBind();
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// called when right click->Delete book is called
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void deleteBookToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to delete these books?", "Delete?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                MainForm parent = (MainForm)this.ParentForm.MdiParent;
                BookDAO  dao    = new BookDAO(parent.CurrentDatabase.FullName);
                foreach (string id in this.SelectedIds)
                {
                    dao.DeleteBook(id);
                }

                this.Refresh();
            }
        }
Ejemplo n.º 5
0
        private void btnDeleteBook_Click(object sender, EventArgs e)
        {
            BookDAO book   = new BookDAO();
            string  MaSach = txtMaSach.Text;

            if (book.DeleteBook(MaSach))
            {
                MessageBox.Show("Xóa thành công");
                ShowBook();
            }
            else
            {
                MessageBox.Show("Có lỗi khi xóa");
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Delete a book.
 /// </summary>
 /// <param name="isbn">string isbn</param>
 /// <returns>int rowsAffected</returns>
 /// <exception cref="ex">BusinnessException</exception>
 /// <exception cref="ex">Exception</exception>
 public int DeleteBook(string isbn)
 {
     try
     {
         _bookDAO = new BookDAO();
         return(_bookDAO.DeleteBook(isbn));
     }
     catch (DataAccessLayerException ex)
     {
         //Error log simulate
         Console.WriteLine(ex.ToString());
         Console.WriteLine(ex.GetBaseException().ToString());
         throw new BusinessLogicException(ex.Message);
     }
     catch (Exception ex)
     {
         //Error log simulate
         Console.WriteLine(ex.ToString());
         Console.WriteLine(ex.GetBaseException().ToString());
         throw;
     }
 }
Ejemplo n.º 7
0
 public void DeleteBook(int id)
 {
     dao.DeleteBook(this.GetBook(id));
 }