public void MakeSureReservationIsInTheDatabase()
        {
            VenueAccess va = new VenueAccess(connectionString);

            bool result = va.AddReservation(1, 1, "2020-06-28", "2020-07-04", "Matt Eland");

            Assert.IsTrue(result);
        }
Esempio n. 2
0
        public void ReserveSpace(Venue userVenue, HashSet <VenueSpace> venueSpaces, int peopleAmt, string startDate, string endDate)
        {
            VenueAccess va = new VenueAccess(connectionString);

            DateTime start = Convert.ToDateTime(startDate);
            DateTime end   = Convert.ToDateTime(endDate);

            int diff = (end.Date - start.Date).Days;



            bool done = false;

            while (!done)
            {
                Console.WriteLine("Which Space would you like to reserve?");
                string choice = Console.ReadLine();


                Console.WriteLine("Who is this reservation for?");

                string reservationName = Console.ReadLine();

                foreach (VenueSpace item in venueSpaces)
                {
                    if (item.Name == choice)
                    {
                        va.AddReservation(item.SpaceId, peopleAmt, startDate, endDate, reservationName);

                        Random generator    = new Random();
                        int    randomNumber = generator.Next(10000000, 99999999);
                        Console.WriteLine("Thanks for submitting your reservation! The details for your event are listed below:");
                        Console.WriteLine();
                        Console.WriteLine("Confirmation #: " + randomNumber);
                        Console.WriteLine("Venue: " + userVenue.Name);
                        Console.WriteLine("Space: " + item.Name);
                        Console.WriteLine("Reserved For: " + reservationName);
                        Console.WriteLine("Attendees: " + peopleAmt);
                        Console.WriteLine("Arrival Date: " + startDate);
                        Console.WriteLine("Depart Date: " + endDate);
                        Console.WriteLine("Total Cost: " + (item.DailyRate * diff));
                        done = true;
                    }
                }
                if (!done)
                {
                    Console.WriteLine("please make a valid selection. Check your spelling.");
                }
            }
            Console.WriteLine("Press enter to return to the main menu.");
            Console.ReadLine();
            Console.Clear();
            Run();
        }