Beispiel #1
0
 public static RentalAgreement Reservation(DateTime dateOfPickup, string locationToPickup, DateTime dateOfReturn, string locationtoDropOff, string destination, string drivers)
 {
     var reservation = new RentalAgreement
     {
         DateOfPickup      = dateOfPickup,
         LocationToPickup  = locationToPickup,
         DateOfReturn      = dateOfReturn,
         LocationToDropOff = locationToDropOff,
         Destination       = destination,
         Drivers           = drivers,
     };
 }
Beispiel #2
0
        public static void MyReservations(string email)
        {
            var reservations = RentalAgreement.GetMyRentalAgreements(email);

            foreach (var getreservations in reservations)
            {
                Console.WriteLine($"Pickup date:       {getreservations.DateOfPickup},");
                Console.WriteLine($"Return date:       {getreservations.DateOfReturn},");
                Console.WriteLine($"Pickup location:   {getreservations.LocationToPickup},");
                Console.WriteLine($"Return location:   {getreservations.LocationToDropOff},");
                Console.WriteLine($"Destination:       {getreservations.Destination},");
                Console.WriteLine($"Drivers:           {getreservations.Drivers}");
                Console.WriteLine();
            }
        }
Beispiel #3
0
        public static void Reservation(DateTime dateOfPickup, RentalLocations locationToPickup, DateTime dateOfReturn, RentalLocations locationToDropOff, string destination, string drivers, string email)
        {
            var reservation = new RentalAgreement
            {
                ReservationEmail  = email,
                DateOfPickup      = dateOfPickup,
                LocationToPickup  = locationToPickup,
                DateOfReturn      = dateOfReturn,
                LocationToDropOff = locationToDropOff,
                Destination       = destination,
                Drivers           = drivers,
            };

            db.Reservervation.Add(reservation);
            db.SaveChanges();
        }
Beispiel #4
0
        public static void ConsoleCustomerMenu(string loginEmailAddress)
        {
            string email  = loginEmailAddress;
            bool   active = true;

            while (active == true)
            {
                Console.Clear();
                PrintConsole.AccountBanner(email);
                PrintConsole.AccountMenu();
                // I think this is where the swtich for PrintAccountMenu should be
                var accountoption = Console.ReadLine();

                switch (accountoption)
                {
                case "1":

                    //Basic Info
                    //CustomerAccounts.EditAccount
                    //Remember to include the insurance part
                    PrintConsole.AllAccountsBanner();


                    PrintAllAccounts(email);

                    Console.ReadLine();
                    ConsoleCustomerMenu(loginEmailAddress);
                    break;


                case "2":

                    //Reserve a car
                    //RentalAgreement.Reservation
                    PrintConsole.ReservationBanner();

                    Console.WriteLine("What type of vehicle would you like?");
                    var rentalClass = Enum.GetNames(typeof(VehicleRentalClassification));
                    for (var i = 0; i < rentalClass.Length; i++)
                    {
                        Console.WriteLine($"{i + 1}. {rentalClass[i]}");
                    }
                    Console.Write("Select number: ");
                    var rentalClassType            = Convert.ToInt32(Console.ReadLine()); // This will cause an exception if not number
                    var vehicleRentalClassSelected = (VehicleRentalClassification)Enum.Parse(typeof(VehicleRentalClassification), rentalClass[rentalClassType - 1]);



                    Console.WriteLine("Enter desired pickup date and time mm/dd/yy 'time': ");
                    DateTime dateOfPickup = DateTime.Parse(Console.ReadLine());
                    Console.WriteLine(dateOfPickup);

                    Console.WriteLine("Pick one of our terrible branches to pickup at:");
                    var rentalLocations = Enum.GetNames(typeof(RentalLocations));
                    for (var i = 0; i < rentalLocations.Length; i++)
                    {
                        Console.WriteLine($"{ i + 1}. {rentalLocations[i]}");
                    }
                    var pickuplocation   = Convert.ToInt32(Console.ReadLine());
                    var locationToPickup = (RentalLocations)Enum.Parse(typeof(RentalLocations), rentalLocations[pickuplocation - 1]);

                    Console.WriteLine("Enter desired return date and time mm/dd/yy 'time': ");
                    DateTime dateOfReturn = DateTime.Parse(Console.ReadLine());
                    Console.WriteLine(dateOfReturn);

                    Console.WriteLine("Pick one of our disgusting branches to return to:");
                    for (var i = 0; i < rentalLocations.Length; i++)
                    {
                        Console.WriteLine($"{ i + 1}. {rentalLocations[i]}");
                    }
                    var returnlocation    = Convert.ToInt32(Console.ReadLine());
                    var locationToDropOff = (RentalLocations)Enum.Parse(typeof(RentalLocations), rentalLocations[returnlocation - 1]);

                    Console.WriteLine("Please let us know what city you are headed with the vehicle:");
                    var destination = Console.ReadLine();

                    Console.WriteLine("Please provide the names of the drivers:");
                    var drivers = Console.ReadLine();

                    //Reservation(DateTime dateOfPickup, string locationToPickup, DateTime dateOfReturn, string locationtoDropOff, string destination, string drivers)
                    //RentalAgreement.Reservation();
                    RentalAgreement.Reservation(dateOfPickup, locationToPickup, dateOfReturn, locationToDropOff, destination, drivers, email);

                    ConsoleCustomerMenu(email);
                    break;

                case "3":

                    //Current reservation

                    PrintConsole.AllReservationsBanner();
                    PrintConsole.MyReservations(email);
                    Console.ReadLine();
                    ConsoleCustomerMenu(email);
                    break;

                case "4":

                    //Pickup
                    //RentalAgreement.CheckOutVehical
                    //Need to have a check to make sure that this is completed
                    //InsuranceInformation.PolicyInformation
                    ConsoleCustomerMenu(email);
                    break;



                case "5":

                    //Dropoff
                    //RentalAgreement.CheckInVehicle
                    ConsoleCustomerMenu(email);
                    break;

                //Return to main menu

                case "6":
                    ConsoleMainMenu();
                    active = false;
                    break;
                }
                break;
            }
        }