Esempio n. 1
0
        protected override bool ExecuteSelection(string choice)
        {
            CampgroundMenu cif = new CampgroundMenu(chosen, campDAO, ParkDAO, SiteDAO, ReservationDAL);

            cif.Run();

            return(true);
        }
 /// <summary>
 /// The override of ExecuteSelection handles whatever selection was made by the user.
 /// This is where any business logic is executed.
 /// </summary>
 /// <param name="choice">"Key" of the user's menu selection</param>
 /// <returns></returns>
 protected override bool ExecuteSelection(string choice)
 {
     switch (choice)
     {
     case "1":     // Do whatever option 1 is
         CampgroundMenu cg = new CampgroundMenu(parkDAO, campgroundDAO, reservationDAO, siteDAO, park);
         cg.Run();
         return(true);
     }
     return(true);
 }
Esempio n. 3
0
        /// <summary>
        /// Handle user's menu selection here
        /// </summary>
        /// <param name="choice">String of user's menu selection</param>
        /// <returns>True to continue, false to return to previous menu</returns>
        protected override bool ExecuteSelection(string choice)
        {
            switch (choice)
            {
            case "1":
                // Show campgrounds at this park
                CampgroundMenu campmenu = new CampgroundMenu(MyParksDAO, MyCampgroundDAO, MySiteDAO, MyReservationDAO, MyPark);
                campmenu.Run();
                return(true);

            case "2":
                // Search for a reservation (reservation menu not yet implemented)
                ReservationMenu resmenu = new ReservationMenu(MyParksDAO, MyCampgroundDAO, MySiteDAO, MyReservationDAO, MyPark);
                resmenu.Run();
                return(true);

            case "3":
                return(false);
            }
            return(true);
        }
        private void ListAvailableSites()
        {
            int    counter = 0;
            string accessible;
            string utilities;

            sites = new List <Site>();

            try
            {
                foreach (Site site in campground.Sites)
                {
                    site.UserStartTime = Convert.ToDateTime(arrivalDate);
                    site.UserEndTime   = Convert.ToDateTime(departureDate);
                    int daysOfStay = Convert.ToInt32((site.UserEndTime.Date - site.UserStartTime.Date).TotalDays);
                    site.Reservations = reservationDao.getAllReservations(site.SiteId);

                    if (!site.IsBooked)
                    {
                        sites.Add(site);

                        if (site.IsAccessible)
                        {
                            accessible = "Yes";
                        }
                        else
                        {
                            accessible = "No";
                        }

                        if (site.HasUtilites)
                        {
                            utilities = "Yes";
                        }
                        else
                        {
                            utilities = "No";
                        }

                        Console.WriteLine($"Site No: {site.SiteNumber}, Occupancy {site.MaxOccupancy}, Accessible? {accessible}, MaxRvLength: {site.MaxRvLength}, Utilities: {utilities} " +
                                          $"Cost: {site.TotalFee = campground.DailyFee * daysOfStay:C}");
                        counter++;

                        if (counter == 5)
                        {
                            break;
                        }
                    }
                }

                if (sites.Count == 0)
                {
                    Console.WriteLine("There are no available campsites at the time you requested.");
                }
            }
            catch
            {
                Console.WriteLine("Incorect Date Format, Please retry.");
                Pause("");
                CampgroundMenu campgroundMenu = new CampgroundMenu(park, campgroundDao, siteDao, reservationDao);
                campgroundMenu.Run();
            }
        }