Ejemplo n.º 1
0
        protected void btnSearchCarReqs_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtMaxCarPrice.Text))
            {
                txtMaxCarPrice.Text = "999999999";
            }

            if (String.IsNullOrEmpty(txtMaxCarMileage.Text))
            {
                txtMaxCarMileage.Text = "999999999";
            }

            CarServiceRef.Requirements requirements = new CarServiceRef.Requirements();
            requirements.price = float.Parse(txtMaxCarPrice.Text);
            requirements.gps = ddlCarGps.SelectedValue;
            requirements.type = ddlCarType.SelectedValue;
            requirements.carClass = ddlCarClass.SelectedValue;
            requirements.electric = ddlCarElectric.SelectedValue;
            requirements.passengers = int.Parse(ddlPassengers.SelectedValue);
            requirements.luggage = int.Parse(ddlLuggage.SelectedValue);
            requirements.doors = int.Parse(ddlDoors.SelectedValue);
            requirements.mileage = int.Parse(txtMaxCarMileage.Text);

            CarServiceRef.CarService pxy = new CarServiceRef.CarService();
            DataSet myDS = pxy.FindCars(requirements, txtCarCity.Text, ddlCarState.SelectedValue);
            rptCars.DataSource = myDS;
            rptCars.DataBind();

            divCarForm.Visible = false;
            divCarResults.Visible = true;
        }
        protected void btnTestGetRentalCarAgencies_Click(object sender, EventArgs e)
        {
            CarServiceRef.Agency agency = new CarServiceRef.Agency();

            CarServiceRef.CarService pxy = new CarServiceRef.CarService();
            DataSet myDS = pxy.GetRentalCarAgencies("Philadelphia", "PA");
            gvDisplayResults.DataSource = myDS;
            gvDisplayResults.DataBind();
        }
        protected void btnTestReserve_Click(object sender, EventArgs e)
        {
            CarServiceRef.Car car = new CarServiceRef.Car();
            CarServiceRef.Customer customer = new CarServiceRef.Customer();

            CarServiceRef.CarService pxy = new CarServiceRef.CarService();
            car.carID = 1;
            bool result = pxy.Reserve(customer, car);
            lblReserveResult.Text = "Reserve method executed: " + result.ToString();
        }
Ejemplo n.º 4
0
        protected void btnTestGetRentalCarAgencies_Click(object sender, EventArgs e)
        {
            CarServiceRef.Agency agency = new CarServiceRef.Agency();

            CarServiceRef.CarService pxy = new CarServiceRef.CarService();
            DataSet myDS = pxy.GetRentalCarAgencies("Philadelphia", "PA");

            gvDisplayResults.DataSource = myDS;
            gvDisplayResults.DataBind();
        }
Ejemplo n.º 5
0
        protected void btnCarSearch_Click(object sender, EventArgs e)
        {
            CarServiceRef.CarService pxy = new CarServiceRef.CarService();
            CarServiceRef.Requirements reqs = new CarServiceRef.Requirements();

            reqs.gps = ddlCarGps.SelectedValue;
            reqs.price = Convert.ToInt32(txtMaxCarPrice.Text);

            DataSet myDS = pxy.FindCars(reqs, txtCarCity.Text, ddlCarState.SelectedValue);
        }
Ejemplo n.º 6
0
        protected void btnTestReserve_Click(object sender, EventArgs e)
        {
            CarServiceRef.Car      car      = new CarServiceRef.Car();
            CarServiceRef.Customer customer = new CarServiceRef.Customer();

            CarServiceRef.CarService pxy = new CarServiceRef.CarService();
            car.carID = 1;
            bool result = pxy.Reserve(customer, car);

            lblReserveResult.Text = "Reserve method executed: " + result.ToString();
        }
        protected void btnTestGetCars_Click(object sender, EventArgs e)
        {
            CarServiceRef.Agency agency = new CarServiceRef.Agency();
            agency.agencyID = 1;
            agency.name = "Hertz";
            agency.phone = "";
            agency.email = "";
            agency.city = "";
            agency.state = "";

            CarServiceRef.CarService pxy = new CarServiceRef.CarService();
            DataSet myDS = pxy.GetCars(agency, "Philadelphia", "PA");
            gvDisplayResults.DataSource = myDS;
            gvDisplayResults.DataBind();
        }
Ejemplo n.º 8
0
        protected void btnTestGetCars_Click(object sender, EventArgs e)
        {
            CarServiceRef.Agency agency = new CarServiceRef.Agency();
            agency.agencyID = 1;
            agency.name     = "Hertz";
            agency.phone    = "";
            agency.email    = "";
            agency.city     = "";
            agency.state    = "";

            CarServiceRef.CarService pxy = new CarServiceRef.CarService();
            DataSet myDS = pxy.GetCars(agency, "Philadelphia", "PA");

            gvDisplayResults.DataSource = myDS;
            gvDisplayResults.DataBind();
        }
        protected void btnTestFindCars_Click(object sender, EventArgs e)
        {
            CarServiceRef.Requirements requirements = new CarServiceRef.Requirements();
            requirements.price = 100000000;
            requirements.gps = "";
            requirements.type = "";
            requirements.carClass = "";
            requirements.electric = "";
            requirements.passengers = 0;
            requirements.luggage = 0;
            requirements.doors = 0;
            requirements.mileage = 10000000;

            CarServiceRef.CarService pxy = new CarServiceRef.CarService();
            DataSet myDS = pxy.FindCars(requirements, "Las Vegas", "NV");
            gvDisplayResults.DataSource = myDS;
            gvDisplayResults.DataBind();
        }
Ejemplo n.º 10
0
        protected void btnTestFindCars_Click(object sender, EventArgs e)
        {
            CarServiceRef.Requirements requirements = new CarServiceRef.Requirements();
            requirements.price      = 100000000;
            requirements.gps        = "";
            requirements.type       = "";
            requirements.carClass   = "";
            requirements.electric   = "";
            requirements.passengers = 0;
            requirements.luggage    = 0;
            requirements.doors      = 0;
            requirements.mileage    = 10000000;

            CarServiceRef.CarService pxy = new CarServiceRef.CarService();
            DataSet myDS = pxy.FindCars(requirements, "Las Vegas", "NV");

            gvDisplayResults.DataSource = myDS;
            gvDisplayResults.DataBind();
        }
Ejemplo n.º 11
0
        protected void btnSearchCarAgencies_Click(object sender, EventArgs e)
        {
            CarServiceRef.CarService carService = new CarServiceRef.CarService();
            DataSet agencies = carService.GetRentalCarAgencies(txtCarCity.Text, ddlCarState.SelectedValue);
            CarServiceRef.Agency agency = new CarServiceRef.Agency();
            agency.agencyID = (int)agencies.Tables[0].Rows[ddlAgencies.SelectedIndex]["agencyID"];
            agency.name = ddlAgencies.SelectedValue;
            agency.phone = (string)agencies.Tables[0].Rows[ddlAgencies.SelectedIndex]["phone"];
            agency.email = (string)agencies.Tables[0].Rows[ddlAgencies.SelectedIndex]["email"];
            agency.city = (string)agencies.Tables[0].Rows[ddlAgencies.SelectedIndex]["city"];
            agency.state = (string)agencies.Tables[0].Rows[ddlAgencies.SelectedIndex]["state"];

            CarServiceRef.CarService pxy = new CarServiceRef.CarService();
            DataSet myDS = pxy.GetCars(agency, txtCarCity.Text, ddlCarState.SelectedValue);
            rptCars.DataSource = myDS;
            rptCars.DataBind();

            divCarForm.Visible = false;
            divCarResults.Visible = true;
        }
Ejemplo n.º 12
0
        protected void btnCarSelectCity_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtCarCity.Text))
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "Alert", "alert('Please enter a valid city.')", true);
                return;
            }

            if (ddlCarState.SelectedValue == "Select state")
            {
                Page.ClientScript.RegisterClientScriptBlock(GetType(), "Alert", "alert('Please select a state.')", true);
                return;
            }

            CarServiceRef.CarService carService = new CarServiceRef.CarService();
            DataSet agencies = carService.GetRentalCarAgencies(txtCarCity.Text, ddlCarState.SelectedValue);
            ddlAgencies.DataSource = agencies;
            ddlAgencies.DataTextField = "name";
            ddlAgencies.DataValueField = "name";
            ddlAgencies.DataBind();

            divCarDetails.Visible = true;
        }
Ejemplo n.º 13
0
        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();
        }