Example #1
0
        public void Display()
        {
            while (true)
            {
                Console.WriteLine();
                Console.WriteLine("1 - Max Occupancy");
                Console.WriteLine("2 - Accessible");
                Console.WriteLine("3 - Max RV Length");
                Console.WriteLine("4 - Are utilities provided");
                Console.WriteLine("5 - Return to Main Menu");
                Console.WriteLine();

                string input = CLIHelper.GetString("Make your choice:");
                Console.WriteLine();


                if (input == "5")
                {
                    return;
                }

                int     siteId  = CLIHelper.GetInteger("Please Select Site ID ");
                SiteDal siteDal = new SiteDal(connectionString);

                Site s = siteDal.GetSite(siteId);


                switch (input.ToLower())
                {
                case "1":
                    ShowMaxOccupancy(s);
                    break;

                case "2":


                    int     site_idONE = CLIHelper.GetInteger("Please Select Site ID ");
                    SiteDal accessible = new SiteDal(connectionString);
                    IsItAccessible(accessible.ListIsSiteAccessible(site_idONE), site_idONE);
                    break;

                case "3":
                    int     maxRVId = CLIHelper.GetInteger("Please Select Site ID ");
                    SiteDal maxRV   = new SiteDal(connectionString);
                    MaxRvLength(maxRV.ListOfMaxRVLength(maxRVId), maxRVId);
                    break;

                case "4":
                    int     utilityID = CLIHelper.GetInteger("Please Select Site ID ");
                    SiteDal utility   = new SiteDal(connectionString);
                    AreThereUtilities(utility.ListAreThereUtilities(utilityID), utilityID);
                    break;
                }
            }
        }
Example #2
0
        private void CheckReservation()
        {
            int     siteID  = CLIHelper.GetInteger("Please Select your Camp Site:");
            SiteDal siteDal = new SiteDal(connectionString);
            Site    site    = siteDal.GetSite(siteID);

            if (site == null)
            {
                Console.WriteLine("That site does not exist.");
                return;
            }

            CampgroundDAL campDal = new CampgroundDAL(connectionString);
            Campground    c       = campDal.GetCampgroundById(site.campground_id);

            string   name       = CLIHelper.GetString("Please enter reservation Name:");
            DateTime fromDate   = CLIHelper.GetDateTime("Please select arrival date (yyyy-mm-dd):");
            DateTime toDate     = CLIHelper.GetDateTime("Please select depature date(yyyy-mm-dd):");
            DateTime createDate = DateTime.Now;

            Console.WriteLine();

            if (c.OpenFromMM > fromDate.Month || c.OpenToMM < toDate.Month)
            {
                Tools.ColorfulWriteLine("Sorry the camp is closed during that time frame. Please try again", ConsoleColor.Red);
            }
            else
            {
                ReservationDAL dal = new ReservationDAL(connectionString);
                dal.MakeReservation(siteID, name, fromDate, toDate, createDate);
                Reservation r = dal.GetReservationNumber(siteID, name, fromDate, toDate);

                Console.WriteLine("Success, your reservation confirmation is below!");
                Tools.ColorfulWriteLine("Confirmation ID".PadRight(20) + "Name".PadRight(35) + "Arrival Date".PadRight(10) + "Depature Date".PadRight(15) + "Creation Date", ConsoleColor.Green);
                Console.WriteLine($"{r.reservationId})".PadRight(20) + $"{r.name}".PadRight(35) + $"{r.fromDate}".PadRight(10) + $"{r.toDate}".PadRight(15) + $"{r.createDate}");
            }
        }