private void Btn_search_book_Click(object sender, EventArgs e) { if (txt_search_book.Text == "") { MessageBox.Show("Given Book ID is Empty", "Search ID Empty", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { Classes.Book bk = new Classes.Book(); DataTable dt = bk.searchbk(Convert.ToInt32(txt_search_book.Text)); if (dt.Rows.Count == 0) { MessageBox.Show("No Book For the Given ID", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { foreach (DataRow row in dt.Rows) { txt_bookname_change.Text = row["book_name"].ToString(); txt_auther_change.Text = row["auther"].ToString(); cmb_se.Text = row["genre"].ToString(); txt_price_change.Text = row["price"].ToString(); txt_fineDay_change.Text = row["fine_day"].ToString(); txt_location_change.Text = row["bklocation"].ToString(); cmb_status_change.Text = row["bkstatus"].ToString(); } } } }
private void Btn_search_Click(object sender, EventArgs e) { Classes.Book bk = new Classes.Book(); if (txt_Keywords.Text == "") { MessageBox.Show("NO Keywords", "Keyords Empty", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (combo_choice.Text == "") { MessageBox.Show("Category Not Selected", "NO Category", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { DataTable ds = bk.bookSearch(combo_choice.Text, txt_Keywords.Text); if (ds.Rows.Count == 0) { MessageBox.Show("No Books By that Search Parameters", "NO Book", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { searchView1.DataSource = ds; } } }
private void Btn_addBook_Click(object sender, EventArgs e) { if ((txt_bookName.Text == "") || (txt_auther.Text == "") || (txt_price.Text == "") || (txt_fineDay.Text == "") || (txt_location.Text == "") || (cmb_status.Text == "")) { MessageBox.Show("Required Fields are Empty", "Empty Fields", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { Classes.Book book = new Classes.Book(); string bname = txt_bookName.Text; string auth = txt_auther.Text; string genre = txt_genre.Text; float price = (float)Convert.ToDouble(txt_price.Text); float fine = (float)Convert.ToDouble(txt_fineDay.Text); string location = txt_location.Text; string status = cmb_status.Text; //int r = book.testAdd(bname, auth); int r = book.addBook(bname, auth, genre, price, fine, location, status); if (r != 0) { MessageBox.Show("New Book is added", "Data Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Error ading Book", "Details are incorrect Try again", MessageBoxButtons.OK, MessageBoxIcon.Error); } clear_all(); } }
private void Btn_confirm_edit_Click(object sender, EventArgs e) { if ((txt_bookname_change.Text == "") || (txt_auther_change.Text == "") || (txt_price_change.Text == "") || (txt_fineDay_change.Text == "") || (txt_location_change.Text == "") || (cmb_status_change.Text == "") || (txt_search_book.Text == "")) { MessageBox.Show("Required Fields are Empty", "Empty Fields", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { Classes.Book book = new Classes.Book(); string bname = txt_bookname_change.Text; string auth = txt_auther_change.Text; string genre = cmb_se.Text; float price = (float)Convert.ToDouble(txt_price_change.Text); float fine = (float)Convert.ToDouble(txt_fineDay_change.Text); string location = txt_location_change.Text; string status = cmb_status_change.Text; int bid = Convert.ToInt32(txt_search_book.Text); //int r = book.testAdd(bname, auth); int r = book.updateBook(bid, bname, auth, genre, price, fine, location, status); if (r != 0) { MessageBox.Show("Book Details are Updated", "Data Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Error Updating Book", "Details are incorrect Try again", MessageBoxButtons.OK, MessageBoxIcon.Error); } clear_search(); } }
private void Btn_delete_book_Click(object sender, EventArgs e) { Classes.Book bk = new Classes.Book(); int r = bk.delete_book(Convert.ToInt32(txt_search_book.Text)); if (r != 0) { MessageBox.Show("Data Deleted", "Corretly Deleted Book", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Data NOT Deleted", "Error Deleting Book", MessageBoxButtons.OK, MessageBoxIcon.Error); } clear_search(); }
protected void btnSend_Click(object sender, EventArgs e) { Classes.Book b = new Classes.Book(); b.bookName = txtBookName.Text; b.authorId = int.Parse(drpAuthors.SelectedValue); b.bookIsbn = txtIsbn.Text; b.publisherId = int.Parse(drpProducer.SelectedValue); b.bookIndex = txtIndex.Text; b.bookNotes = txtNotes.Text; if (chkIsDigitized.Checked) { b.isDigitized = 1; } else { b.isDigitized = 0; } b.addBook(); Response.Redirect("addBook.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { drpAuthors.DataSource = Classes.Author.getAuthors(); drpAuthors.DataValueField = "authorId"; drpAuthors.DataTextField = "authorName"; drpAuthors.DataBind(); drpProducer.DataSource = Classes.Publisher.getProducers(); drpProducer.DataValueField = "publisherId"; drpProducer.DataTextField = "publisherName"; drpProducer.DataBind(); int bookId = 0; if (Request.QueryString["bookId"] == null) { Response.Redirect("~/default.aspx"); } bookId = int.Parse(Request.QueryString["bookId"].ToString()); Session["bookId"] = bookId; Classes.Book b = Classes.Book.getBook(bookId); txtBookName.Text = b.bookName; drpAuthors.SelectedValue = b.authorId.ToString(); txtIsbn.Text = b.bookIsbn; drpProducer.SelectedValue = b.publisherId.ToString(); txtIndex.Text = b.bookIndex; txtNotes.Text = b.bookNotes; if (b.isDigitized == 1) { chkIsDigitized.Checked = true; } else { chkIsDigitized.Checked = false; } } }