protected void btnAlreadyBookedRooms_OnClick(object sender, EventArgs e) { if (Session["LoggedInUser"] != null) { if (ddlAirbus.SelectedValue != null) { HotelBL abl = new HotelBL(); DataTable dt = (DataTable)Session["LoggedInUser"]; gvBookedRooms.DataSource = abl.GetBookedRooms(dt.Rows[0]["hotel_user_name"].ToString(), dt.Rows[0]["hotel_password"].ToString(), int.Parse(ddlRooms.SelectedValue), DateTime.Parse(txtRoomBookDate.Text)); gvBookedRooms.DataBind(); } } }
private void RoomBinding() { if (Session["LoggedInUser"] != null) { if (ddlHotels.Items.Count > 0 && ddlHotels.SelectedValue != null && ddlHotels.SelectedValue != "") { HotelBL cbl = new HotelBL(); DataTable dt = (DataTable)Session["LoggedInUser"]; ddlRooms.DataSource = cbl.GetRooms(dt.Rows[0]["hotel_user_name"].ToString(), dt.Rows[0]["hotel_password"].ToString(), int.Parse(ddlHotels.SelectedValue)); ddlRooms.DataValueField = "room_id"; ddlRooms.DataTextField = "room_number"; ddlRooms.DataBind(); } } }
private void HotelBinding() { if (Session["LoggedInUser"] != null) { HotelBL cbl = new HotelBL(); DataTable dt = (DataTable)Session["LoggedInUser"]; ddlHotels.DataSource = cbl.GetHotels(dt.Rows[0]["hotel_user_name"].ToString(), dt.Rows[0]["hotel_password"].ToString()); ddlHotels.DataValueField = "hotel_id"; ddlHotels.DataTextField = "hotel_name"; ddlHotels.DataBind(); } }
protected void gvBookedRooms_RowCommand(object sender, GridViewCommandEventArgs e) { int id = int.Parse(e.CommandArgument.ToString()); if (e.CommandName.Equals("Update RoomBId") && e.CommandArgument != null) { if (txtRoomBookDate.Text.Length == 0) { lblRoomError.Text = "Please select date."; return; } if (ddlHotels.SelectedValue == null || ddlHotels.SelectedValue == "") { lblRoomError.Text = "Please select Hotel."; return; } if (ddlAvailableRooms.SelectedValue == null || ddlAvailableRooms.SelectedValue == "") { lblRoomError.Text = "Please select Available Room."; return; } if (ddlRooms.SelectedValue == null || ddlRooms.SelectedValue == "") { lblRoomError.Text = "Please select Room."; return; } HotelBL abl = new HotelBL(); DataTable dt = (DataTable)Session["LoggedInUser"]; abl.UpdateSlot(dt.Rows[0]["hotel_user_name"].ToString(), dt.Rows[0]["hotel_password"].ToString(), id, int.Parse(ddlHotels.SelectedValue),int.Parse(ddlAvailableRooms.SelectedValue), DateTime.Parse(txtRoomBookDate.Text)); } else if (e.CommandName.Equals("Delete RoomBId") && e.CommandArgument != null) { HotelBL abl = new HotelBL(); DataTable dt = (DataTable)Session["LoggedInUser"]; abl.DeleteSlot(dt.Rows[0]["hotel_user_name"].ToString(), dt.Rows[0]["hotel_password"].ToString(), id); } else if (e.CommandName.Equals("Confirm") && e.CommandArgument != null) { if (txtRoomAmountPaid.Text.Length == 0) { lblRoomError.Text = "Please enter amount."; return; } int amt = 0; int.TryParse(txtRoomAmountPaid.Text, out amt); if (amt == 0) { lblRoomError.Text = "Please enter correct amount."; return; } HotelBL abl = new HotelBL(); DataTable dt = (DataTable)Session["LoggedInUser"]; abl.ConfirmSlot(dt.Rows[0]["hotel_user_name"].ToString(), dt.Rows[0]["hotel_password"].ToString(), id, Decimal.Parse(txtRoomAmountPaid.Text)); } btnAlreadyBookedRooms_OnClick(null, null); }
protected void btnRoomBook_OnClick(object sender, EventArgs e) { if (Session["LoggedInUser"] != null) { if (ddlAirbus.SelectedValue != null) { HotelBL cbl = new HotelBL(); DataTable dt = (DataTable)Session["LoggedInUser"]; lblTicketNumber.Text = "Booking Refeence Number" + cbl.BookRoom(dt.Rows[0]["hotel_user_name"].ToString(), dt.Rows[0]["hotel_password"].ToString(), int.Parse(ddlAvailableRooms.SelectedValue), ddlAvailableRooms.SelectedItem.Text, int.Parse(ddlHotels.SelectedValue), DateTime.Parse(txtRoomBookDate.Text), false, txtPassSSNRoom.Text, dt.Rows[0]["hotel_user_name"].ToString()).ToString(); btnRoomBookedSearch_OnClick(null, null); btnAlreadyBookedRooms_OnClick(null, null); } } }
protected void btnRoomBookedSearch_OnClick(object sender, EventArgs e) { if (Session["LoggedInUser"] != null) { if (ddlAirbus.SelectedValue != null) { HotelBL cbl = new HotelBL(); DataTable dt = (DataTable)Session["LoggedInUser"]; ddlAvailableRooms.DataSource = cbl.GetAvailableRooms(dt.Rows[0]["hotel_user_name"].ToString(), dt.Rows[0]["hotel_password"].ToString(), int.Parse(ddlHotels.SelectedValue), int.Parse(ddlRooms.SelectedValue), DateTime.Parse(txtRoomBookDate.Text)); ddlAvailableRooms.DataValueField = "room_id"; ddlAvailableRooms.DataTextField = "room_number"; ddlAvailableRooms.DataBind(); } } }