示例#1
0
        void DrawParks()
        {
            CampSqlDAL  sqlParks = new CampSqlDAL(dbConnectionString);
            List <Park> parks    = sqlParks.GetParks();

            foreach (Park park in parks)
            {
                park.DrawInformation();
            }

            MenuHelper.EnterToRelease();
        }
示例#2
0
        void SiteSeach()
        {
            CampSqlDAL sqlParks = new CampSqlDAL(dbConnectionString);

            ReservationAndSite reservation = new ReservationAndSite();

            Park       park = MenuHelper.SelectFrom(sqlParks.GetParks());
            Campground camp = MenuHelper.SelectFrom(sqlParks.GetCampgrounds(park));

            bool correct = false;

            while (!correct)
            {
                Console.Clear();
                Campground.DrawInfoHead();
                camp.DrawInfo();
                Console.WriteLine();
                Console.Write("Arrival date: ");
                reservation.GetDate(true);


                Console.Clear();
                Campground.DrawInfoHead();
                camp.DrawInfo();
                Console.WriteLine();
                Console.Write("Departure date: ");
                reservation.GetDate(false);

                Console.Clear();
                Campground.DrawInfoHead();
                camp.DrawInfo();
                Console.WriteLine();
                Console.WriteLine($"Arrival date: " + reservation.startDate.ToShortDateString() + "\t Departure date: " + reservation.endDate.ToShortDateString());
                correct = MenuHelper.GetConfirmation();
            }

            ReservationAndSite selectedSite = MenuHelper.SelectFrom(sqlParks.GetSites(reservation.startDate, reservation.endDate, camp));

            correct = false;
            while (!correct)
            {
                while (reservation.reservationName == null)
                {
                    Console.Clear();
                    Campground.DrawInfoHead();
                    camp.DrawInfo();
                    Console.WriteLine();
                    Console.WriteLine($"Arrival date: " + reservation.startDate.ToShortDateString() + "\t Departure date: " + reservation.endDate.ToShortDateString());
                    Console.Write("Reservation Name: ");
                    reservation.GetName();
                }
                Console.Clear();
                Campground.DrawInfoHead();
                camp.DrawInfo();
                Console.WriteLine();
                Console.WriteLine($"Arrival date: " + reservation.startDate.ToShortDateString() + "\t Departure date: " + reservation.endDate.ToShortDateString());
                Console.Write("Reservation Name: " + reservation.reservationName);
                Console.WriteLine();
                correct = MenuHelper.GetConfirmation();
            }
            reservation.siteId = selectedSite.siteId;

            int resID = sqlParks.MakeReservation(reservation);

            Console.WriteLine("Your confirmation number is: " + resID);
            MenuHelper.EnterToRelease();
        }