Example #1
0
        /// <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
                // list parks and stuff
                GetAllParks();
                Pause("Press enter to continue");
                return(true); // Keep running the main menu

            case "2":         // Do whatever option 2 is
                //promt user for parkID
                ListAllParks();
                int parkWant = GetInteger("What is the Park ID of the Park you would like info on?\n\t(0 to return to the Main Menu):\t");
                Console.WriteLine();
                //list camp info for ParkID
                if (parkWant == 0)
                {
                    return(true);
                }
                else
                {
                    GetAllCampgrounds(parkWant);
                    Pause("");
                    return(true);       // Keep running the main menu
                }

            case "3":     // Create and show the sub-menu
                SubMenu1 sm = new SubMenu1(siteDAO, reservationDAO, parkDAO, campgroundDAO);
                sm.Run();
                return(true);       // Keep running the main menu
            }
            return(true);
        }
Example #2
0
        /// <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)
        {
            if (menuOptions.ContainsKey(choice))
            {
                int  intChoice = int.Parse(choice);
                Park park      = ParkDAO.GetPark(intChoice);

                SubMenu1 subMenu1 = new SubMenu1(park, ParkDAO, CampgroundDAO, SiteDAO, ReservationDAO);
                subMenu1.Run();
                return(true);
            }
            //switch (choice)
            //{
            //    case "1": // Do whatever option 1 is
            //        int i1 = GetInteger("Enter the first integer: ");
            //        int i2 = GetInteger("Enter the second integer: ");
            //        Console.WriteLine($"{i1} + {i2} = {i1+i2}");
            //        Pause("Press enter to continue");
            //        return true;    // Keep running the main menu
            //    case "2": // Do whatever option 2 is
            //        WriteError("Not yet implemented");
            //        Pause("");
            //        return true;    // Keep running the main menu
            //    case "3": // Create and show the sub-menu
            //        SubMenu1 sm = new SubMenu1();
            //        sm.Run();
            //        return true;    // Keep running the main menu
            //}
            return(true);
        }