protected void Page_Load(object sender, EventArgs e) { userDAL Users = new userDAL(); houseDAL Houses = new houseDAL(); bookingDAL Bookings = new bookingDAL(); lblHouses.Text = Houses.TotalHouses().ToString(); lblUsers.Text = Users.TotalUsers().ToString(); lblBookings.Text = Bookings.TotalBookings().ToString(); }
protected void btnBook_Click(object sender, EventArgs e) { //Get VAlues from UI book.house_id = id; book.first_name = txtFirstName.Text; book.last_name = txtLastName.Text; book.email = txtEmail.Text; book.contact = txtContact.Text; book.address = txtAddress.Text; book.booked_date = DateTime.Now; //Object for DAL bookingDAL dal = new bookingDAL(); bool success = dal.AddBooking(book); if (success == true) { //Update Booking Table and set is_active to no houseDAL housedal = new houseDAL(); bool change = housedal.ActivityChange(id); if (change == true) { lblUpdate.Text = "Updated."; } else { lblUpdate.Text = "Update Failed."; } lblBook.Text = "Your House Successfully Booked."; Clear(); } else { lblBook.Text = "Failed to book your house."; } }