protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("del")) { int bid = Convert.ToInt32(e.CommandArgument); Booking_Operation bo = new Booking_Operation(); int res = bo.Remove(bid); if (res > 0) { GridView2.DataSource = bo.View(); GridView2.DataBind(); } } if (e.CommandArgument.Equals("update")) { int bid = Convert.ToInt32(e.CommandArgument); Booking_Operation bo = new Booking_Operation(); int result = bo.Update(bid); if (result > 0) { GridView2.DataSource = bo.View(); GridView2.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { Booking_Operation bo = new Booking_Operation(); GridView2.DataSource = bo.View(); GridView2.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { string name = TextBox2.Text; int age = Convert.ToInt32(TextBox3.Text); long contactnumber = Convert.ToInt32(TextBox4.Text); string email = TextBox5.Text; string address = TextBox6.Text; string roomcategory = DropDownList1.SelectedItem.Value; int noofdays = Convert.ToInt32(TextBox7.Text); int rentalamount=0; if(roomcategory=="Single") { rentalamount = 1000 * noofdays; Response.Write(rentalamount); } else if(roomcategory == "double" || roomcategory=="Double") { rentalamount = 2500 * noofdays; Response.Write(rentalamount); } else if(roomcategory == "deluxe" || roomcategory=="Deluxe") { rentalamount = 5000 * noofdays; Response.Write(rentalamount); } else { Response.Write("error"); } Booking_Details bd = new Booking_Details(name,age,contactnumber,email,address,roomcategory,noofdays,rentalamount); Booking_Operation bo = new Booking_Operation(); int bookingid= bo.bookroom(bd); }