protected void Button1_Click(object sender, EventArgs e) { Model.BookTable Mbook = new Model.BookTable(); Mbook.BookId = Convert.ToInt32(TextBox1.Text); Mbook.BookName = TextBox2.Text; Mbook.BookPrice = TextBox3.Text; Mbook.BookCategory = DropDownList2.SelectedValue.ToString(); Mbook.BookPress = DropDownList1.SelectedValue.ToString(); Mbook.BookLendDate = DateTime.Now; Mbook.BookynLend = "否"; Mbook.BookynMake = "否"; Bll.BookTable book = new Bll.BookTable(); bool tianjia; tianjia = book.insert(Mbook); if (tianjia) { Response.Write("<script>alert('添加成功');</script>"); Response.Redirect("BookAdminWeb.aspx"); } else { Response.Write("<script>alert('添加失败');</script>"); } }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { Bll.BookTable books = new Bll.BookTable(); Model.BookTable Mbook = new Model.BookTable(); Mbook.BookName = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim(); Mbook.BookPrice = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim(); Mbook.BookPress = ((DropDownList)(GridView1.Rows[e.RowIndex].Cells[4].Controls[1])).Text.ToString().Trim(); Mbook.BookCategory = ((DropDownList)(GridView1.Rows[e.RowIndex].Cells[3].Controls[1])).Text.ToString().Trim(); Mbook.BookLendDate = Convert.ToDateTime(((TextBox)(GridView1.Rows[e.RowIndex].Cells[5].Controls[0])).Text.ToString().Trim()); Mbook.BookynLend = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].Controls[0])).Text.ToString().Trim(); Mbook.BookynMake = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[7].Controls[0])).Text.ToString().Trim(); books.update(Mbook, int.Parse(((TextBox)(GridView1.Rows[e.RowIndex].Cells[0].Controls[0])).Text.ToString().Trim())); GridView1.EditIndex = -1; bang(); //books.update(); }
protected void btn_add_Click(object sender, EventArgs e) { Model.BorrowTable borr = new Model.BorrowTable(); borr.BookId = Convert.ToInt32(txt_bookid.Text); borr.BookName = txt_bookname.Text; borr.BorId = Convert.ToInt32(txt_broid.Text); borr.BorName = txt_broname.Text; borr.BorData = DateTime.Now; // TimeSpan tis = new TimeSpan(30, 0, 0); borr.YingData = DateTime.Now.AddDays(30); borr.AisoData = "未还书"; borr.BorFine = "0"; Model.BookTable book = new Model.BookTable(); book.BookId = Convert.ToInt32(txt_bookid.Text);; book.BookynLend = "是"; Bll.BorrowTable Bor = new Bll.BorrowTable(); if (Bor.huigun(borr, book) != 0) { Response.Write("<script>alert('成功借书');</script>"); Response.Redirect("jiehuan.aspx"); } }