Esempio n. 1
0
        public void TestAvailableCampgroundsFail()
        {
            CampgroundDAL campgroundDAL = new CampgroundDAL(connectionString);

            campgroundDAL.GetCampground(1);
            bool result = campgroundDAL.CampgroundCheck(testId, 1, "2018-05-10", "2018-06-14");

            Assert.AreEqual(false, result);
        }
Esempio n. 2
0
        public void DatesPrompt(int campgroundId, Park selectedPark)
        {
            string fromDate;
            string toDate;
            bool   isDone = false;

            CampsiteDAL     campsiteDAL   = new CampsiteDAL(connectionString);
            CampgroundDAL   campgroundDAL = new CampgroundDAL(connectionString);
            List <Campsite> campsites;

            try
            {
                do
                {
                    Console.WriteLine("\nWhat is the arrival date? (yyyy-mm-dd)");
                    fromDate = Console.ReadLine();

                    Console.WriteLine("\nWhat is the departure date? (yyyy-mm-dd)");
                    toDate = Console.ReadLine();

                    if (!AreDatesInFuture(fromDate, toDate) || !ArriveBeforeDepartCheck(fromDate, toDate))
                    {
                        Console.WriteLine("");
                        Console.WriteLine("Sorry, those are not valid dates.");
                    }
                    else if (!campgroundDAL.CampgroundCheck(campgroundId, selectedPark.Id, fromDate, toDate))
                    {
                        Console.WriteLine("");
                        Console.WriteLine("Sorry, the campground is not open during those dates.");
                    }
                    else
                    {
                        isDone = true;
                    }
                }while (!isDone);

                campsites = campsiteDAL.GetCampsites(campgroundId, fromDate, toDate);

                if (campsites.Count == 0)
                {
                    NoCampsitesAvailablePrompt(campsites);
                }
                else
                {
                    DisplayAvailableReservations(campsites, toDate, fromDate);
                    DisplayCreateReservationMenu(campsites, fromDate, toDate);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine();
                Console.WriteLine("Not a valid value- please try again");
            }
        }