protected void btnHotelCityStateSearch_Click(object sender, EventArgs e) { HotelServiceRef.HotelService pxy = new HotelServiceRef.HotelService(); DataSet myDS = pxy.GetHotels(txtHotelCity.Text, ddlHotelState.SelectedValue); ddlHotelNames.DataSource = myDS; ddlHotelNames.DataValueField = "HotelID"; ddlHotelNames.DataTextField = "Name"; ddlHotelNames.DataBind(); divHotelDetails.Visible = true; }
protected void btnHotelNameSearch_Click(object sender, EventArgs e) { HotelServiceRef.HotelService pxy = new HotelServiceRef.HotelService(); HotelServiceRef.Hotel hotel = new HotelServiceRef.Hotel(); hotel.City = txtHotelCity.Text; hotel.Id = Convert.ToInt32(ddlHotelNames.SelectedValue); hotel.Name = ddlHotelNames.SelectedItem.Text; hotel.State = ddlHotelState.SelectedItem.Text; DataSet myDS = pxy.GetRooms(hotel); rptHotelResults.DataSource = myDS; rptHotelResults.DataBind(); divHotelResults.Visible = true; }
protected void btnHotelAmenitiesSearch_Click(object sender, EventArgs e) { HotelServiceRef.HotelService pxy = new HotelServiceRef.HotelService(); HotelServiceRef.Amenities amenities = new HotelServiceRef.Amenities(); amenities.FreeBreakfast = Convert.ToInt32(ddlBreakfast.SelectedValue); amenities.Gym = Convert.ToInt32(ddlGym.SelectedValue); amenities.PoolsideBar = Convert.ToInt32(ddlPoolBar.SelectedValue); amenities.Smoking = Convert.ToInt32(ddlSmoking.SelectedValue); amenities.ValetParking = Convert.ToInt32(ddlValet.SelectedValue); amenities.Wifi = Convert.ToInt32(ddlWifi.SelectedValue); DataSet myDS = pxy.GetRoomsByAmenities(amenities, txtHotelCity.Text, ddlHotelState.SelectedItem.Text); rptHotelResults.DataSource = myDS; rptHotelResults.DataBind(); divHotelResults.Visible = true; }
protected void btnCheckout_Click(object sender, EventArgs e) { if (Session["VacationPackage"] != null) { VacationPackage vacation = (VacationPackage)Session["VacationPackage"]; SqlCommand objCommand = new SqlCommand(); objCommand.CommandType = CommandType.StoredProcedure; objCommand.CommandText = "GetUser"; objCommand.Parameters.AddWithValue("@email", Session["UserName"]); DBConnect objDB = new DBConnect(); DataSet myDS = objDB.GetDataSetUsingCmdObj(objCommand); DataRow user = myDS.Tables[0].Rows[0]; CarServiceRef.Customer carCustomer = new CarServiceRef.Customer(); carCustomer.customerID = (int)user["UserID"]; carCustomer.firstName = (string)user["firstName"]; carCustomer.lastName = (string)user["lastName"]; carCustomer.email = (string)user["email"]; carCustomer.address = ""; carCustomer.age = 0; carCustomer.phoneNumber = ""; EventServiceRef.Customer eventCustomer = new EventServiceRef.Customer(); eventCustomer.ID = (int)user["UserID"]; eventCustomer.CustomerFirstName = (string)user["firstName"]; eventCustomer.CustomerLastName = (string)user["lastName"]; eventCustomer.CustomerEmail = (string)user["email"]; eventCustomer.CustomerPhone = ""; HotelServiceRef.Customer hotelCustomer = new HotelServiceRef.Customer(); hotelCustomer.CustID = (int)user["UserID"]; hotelCustomer.FirstName = (string)user["firstName"]; hotelCustomer.LastName = (string)user["lastName"]; hotelCustomer.Address = (string)user["email"]; CarServiceRef.CarService carService = new CarServiceRef.CarService(); EventServiceRef.EventService eventService = new EventServiceRef.EventService(); HotelServiceRef.HotelService hotelService = new HotelServiceRef.HotelService(); AirServiceRef.AirService airService = new AirServiceRef.AirService(); string emailBody = "<h1>You have reserved</h1>"; emailBody += "<h2>Cars</h2>"; bool reservedCars = true; for (int i = 0; i < vacation.cars.Count; i++) { CarServiceRef.Car currCar = vacation.cars[i]; if (!carService.Reserve(carCustomer, currCar)) { reservedCars = false; } else { emailBody += "<p>" + currCar.year + " " + currCar.make + " " + currCar.model + " ($" + currCar.price + ")</p>"; } } emailBody += "<h2>Events</h2>"; bool reservedEvents = true; for (int i = 0; i < vacation.events.Count; i++) { EventServiceRef.Event currEvent = vacation.events[i]; if (!eventService.Reserve(currEvent, eventCustomer)) { reservedEvents = false; } else { emailBody += "<p>" + currEvent.Name + " ($" + currEvent.Price + ")</p>"; } } emailBody += "<h2>Hotels</h2>"; bool reservedHotels = true; for (int i = 0; i < vacation.rooms.Count; i++) { HotelServiceRef.Room currRoom = vacation.rooms[i]; if (!hotelService.Reserve(currRoom, hotelCustomer)) { reservedHotels = false; } else { emailBody += "<p>" + currRoom.RoomNumber + " ($" + currRoom.Price + ")</p>"; } } emailBody += "<h2>Flights</h2>"; bool reservedFlights = true; for (int i = 0; i < vacation.flights.Count; i++) { Flight currFlight = vacation.flights[i]; emailBody += "<p>" + currFlight.carrierName + " ($" + currFlight.price + ") could not be reserved because the AirService does not accept reservations</p>"; } emailBody += "<br><br><p>Thank you,<br>Vacation-O-City Team</p>"; if (reservedCars) { vacation.cars.Clear(); vacation.carsQuantity.Clear(); } if (reservedEvents) { vacation.events.Clear(); vacation.eventsQuantity.Clear(); } if (reservedHotels) { vacation.events.Clear(); vacation.roomsQuantity.Clear(); } if (reservedFlights) { vacation.flights.Clear(); vacation.flightsQuantity.Clear(); } Email emailSender = new Email(); emailSender.SendMail((string)Session["UserName"], "*****@*****.**", "Reservation Confirmation", emailBody, "*****@*****.**"); clearCartCount(); Session["VacationPackage"] = vacation; vacation = (VacationPackage)Session["VacationPackage"]; Serialize objSerialize = new Serialize(); objSerialize.WriteCartToDB(vacation, Session["UserName"]); } displayCart(); }