コード例 #1
0
        public void TrueSearchReservationsTest()
        {
            ReservationSQLDAL reservation = new ReservationSQLDAL(connectionString);
            int trueResult = reservation.BookReservation(1, 1, new System.DateTime(1980, 7, 4), new System.DateTime(1980, 7, 11), "Terranova");

            Assert.IsTrue(trueResult > 0);
        }
コード例 #2
0
        public void BookingMenu(int campgroundID, DateTime arrivalDate, DateTime departureDate)
        {
            int reservationID     = 0;
            ReservationSQLDAL dal = new ReservationSQLDAL(DatabaseConnection);
            bool done             = false;

            while (!done)
            {
                Console.WriteLine();
                Console.WriteLine("Which Site Should be Reserved? (0 To Cancel)");
                int siteNumber = int.Parse(Console.ReadLine());
                if (siteNumber == 0)
                {
                    done = true;
                    break;
                }
                else if (!(CampsiteSQLDAL.GetAvailableCampsites(campgroundID, arrivalDate, departureDate, siteNumber)))
                {
                    Console.WriteLine();
                    Console.WriteLine("Not a valid selection. Press enter to continue.");
                    Console.WriteLine();
                    Console.ReadLine();
                    continue;
                }

                Console.WriteLine("What Name Should the Reservation be Made Under?");
                string reservationName = Console.ReadLine();

                reservationID = dal.BookReservation(siteNumber, campgroundID, arrivalDate, departureDate, reservationName);

                if (reservationID > 0)
                {
                    Console.WriteLine();
                    Console.WriteLine($"The reservation has been made and the confirmation id is {reservationID}. Press enter to continue.");
                    Console.ReadLine();
                    done = true;
                }
                else
                {
                    Console.WriteLine("Error making reservation. Please try again.");
                }
            }
        }