public void AddNewReservation()
        {
            Reservation myReservationTest = new Reservation();

            myReservationTest.CampgroundId = 1;
            myReservationTest.FromDate     = new DateTime(2017, 02, 20);
            myReservationTest.ToDate       = new DateTime(2017, 03, 01);
            myReservationTest.SiteId       = 9;
            myReservationTest.Name         = "Test Johnson";

            ReservationSQLDAL mySQLTest = new ReservationSQLDAL(connectionString);

            myReservationTest.ReservationId = mySQLTest.AddNewReservation(myReservationTest);
        }
Exemple #2
0
        public void DisplayCampsiteAndReservations(List <Campsite> campsites)
        {
            foreach (var campsite in campsites)
            {
                Console.WriteLine(campsite);
            }

            Console.WriteLine();
            Console.WriteLine("Do you want to make a reservation?");
            string userChoice = Console.ReadLine().ToUpper();

            if (userChoice == "Y")
            {
                ReservationSQLDAL resDal = new ReservationSQLDAL(connectionString);

                Console.WriteLine("Please Enter the Campsite Id...");
                newReservation.SiteId = int.Parse(Console.ReadLine());

                Console.WriteLine("What is the last name for the reservation?");
                newReservation.Name = Console.ReadLine();

                if (newReservation.ToDate == DateTime.MinValue)
                {
                    AskForTravelDates();
                }

                resDal.AddNewReservation(newReservation);

                if (newReservation.ReservationId > 0)
                {
                    Console.WriteLine(newReservation);
                }
                else
                {
                    Console.WriteLine("Invalid Date Range.");
                }
            }
            else if (userChoice == "N")
            {
                //send them back to the main menu
            }
            else
            {
                Console.WriteLine("Invalid input.");
            }
        }