Ejemplo n.º 1
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.º 2
0
        protected void ButtonAddBook_Click(object sender, EventArgs e)
        {
            string title     = TextBoxTitle.Text.Trim();
            string author    = TextBoxAuthor.Text.Trim();
            string publisher = TextBoxPublisher.Text.Trim();
            int    number    = int.Parse(TextBoxNumber.Text.Trim());

            BookDAO.InsertBook(title, author, publisher, number);
            GridViewBook.DataBind();
        }
Ejemplo n.º 3
0
        public void refereshData()
        {
            string         query   = "Select * From Book";
            SqlCommand     command = new SqlCommand(query, dbConnection);
            SqlDataAdapter adapter = new SqlDataAdapter();

            adapter.SelectCommand = command;
            DataSet dataSet = new DataSet();

            adapter.Fill(dataSet, "Book");
            DataTable bookTable = dataSet.Tables["Book"];

            GridViewBook.DataSource = bookTable;
            GridViewBook.DataBind();
            command.Dispose();
        }
 protected void ButtonSearch_Click(object sender, EventArgs e)
 {
     if (TextBoxSearch.Text == "")
     {
         labDate.Text = "Please Enter What You search";
     }
     else
     {
         try
         {
             GridViewBook.DataSource = libEntity.searchBook(TextBoxSearch.Text);
             GridViewBook.DataBind();
         }
         catch (Exception)
         {
             labDate.Text = "Record Not found";
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     GridViewBook.DataBind();
 }//pageload
 public void showBook()
 {
     GridViewBook.DataSource = libEntity.showAllBooks();
     GridViewBook.DataBind();
 }