Example #1
0
        /// <summary>
        /// method to add a ski run info
        /// </summary>
        public static SkiRun AddSkiRun()
        {
            SkiRun skiRun = new SkiRun();

            DisplayReset();

            DisplayMessage("");
            Console.WriteLine(ConsoleUtil.Center("Add A Ski Run", WINDOW_WIDTH));
            DisplayMessage("");

            DisplayPromptMessage("Enter the ski run ID: ");
            skiRun.ID = ConsoleUtil.ValidateIntegerResponse("Please enter the ski run ID: ", Console.ReadLine());
            DisplayMessage("");

            DisplayPromptMessage("Enter the ski run name: ");
            skiRun.Name = Console.ReadLine();
            DisplayMessage("");

            DisplayPromptMessage("Enter the ski run vertical in feet: ");
            skiRun.Vertical = ConsoleUtil.ValidateIntegerResponse("Please the ski run vertical in feet: ", Console.ReadLine());

            return(skiRun);
        }
Example #2
0
        /// <summary>
        /// method gets the minimum and maximum values for the vertical query
        /// </summary>
        /// <param name="minimumVertical">minimum vertical</param>
        /// <param name="maximumVertical">maximum vertical</param>
        public static void GetVerticalQueryMinMaxValues(out int minimumVertical, out int maximumVertical)
        {
            minimumVertical = 0;
            maximumVertical = 0;
            string userResponse = "";

            DisplayReset();

            DisplayMessage("");
            Console.WriteLine(ConsoleUtil.Center("Query Ski Runs by Vertical", WINDOW_WIDTH));
            DisplayMessage("");

            DisplayPromptMessage("Enter the minimum vertical: ");
            userResponse = Console.ReadLine();
            if (userResponse != "")
            {
                minimumVertical = ConsoleUtil.ValidateIntegerResponse("Please enter the minimum vertical in feet.", userResponse);
            }

            DisplayMessage("");

            DisplayPromptMessage("Enter the maximum vertical: ");
            userResponse = Console.ReadLine();
            if (userResponse != "")
            {
                maximumVertical = ConsoleUtil.ValidateIntegerResponse("Please enter the maximum vertical in feet.", userResponse);
            }

            DisplayMessage("");

            DisplayMessage(String.Format("You have entered {0} feet as the minimum value and {1} as the maximum value.", minimumVertical, maximumVertical));

            DisplayMessage("");

            DisplayContinuePrompt();
        }
Example #3
0
        /// <summary>
        /// method to display the manager menu and get the user's choice
        /// </summary>
        /// <returns></returns>
        public static AppEnum.ManagerAction GetUserActionChoice()
        {
            AppEnum.ManagerAction userActionChoice = AppEnum.ManagerAction.None;
            //
            // set a string variable with a length equal to the horizontal margin and filled with spaces
            //
            string leftTab = ConsoleUtil.FillStringWithSpaces(DISPLAY_HORIZONTAL_MARGIN);

            //
            // set up display area
            //
            DisplayReset();

            //
            // display the menu
            //
            DisplayMessage("");
            Console.WriteLine(ConsoleUtil.Center("Ski Run Manager Menu", WINDOW_WIDTH));
            DisplayMessage("");

            Console.WriteLine(
                leftTab + "1. Display All Ski Runs" + Environment.NewLine +
                leftTab + "2. Display a Ski Run Detail" + Environment.NewLine +
                leftTab + "3. Add a Ski Run" + Environment.NewLine +
                leftTab + "4. Delete a Ski Run" + Environment.NewLine +
                leftTab + "5. Edit a Ski Run" + Environment.NewLine +
                leftTab + "6. Query Ski Runs by Vertical" + Environment.NewLine +
                leftTab + "E. Exit" + Environment.NewLine);

            DisplayMessage("");
            DisplayPromptMessage("Enter the number/letter for the menu choice: ");
            ConsoleKeyInfo userResponse = Console.ReadKey(true);

            switch (userResponse.KeyChar)
            {
            case '1':
                userActionChoice = AppEnum.ManagerAction.ListAllSkiRuns;
                break;

            case '2':
                userActionChoice = AppEnum.ManagerAction.DisplaySkiRunDetail;
                break;

            case '3':
                userActionChoice = AppEnum.ManagerAction.AddSkiRun;
                break;

            case '4':
                userActionChoice = AppEnum.ManagerAction.DeleteSkiRun;
                break;

            case '5':
                userActionChoice = AppEnum.ManagerAction.UpdateSkiRun;
                break;

            case '6':
                userActionChoice = AppEnum.ManagerAction.QuerySkiRunsByVertical;
                break;

            case 'E':
            case 'e':
                userActionChoice = AppEnum.ManagerAction.Quit;
                break;

            default:
                DisplayMessage("");
                DisplayMessage("");
                DisplayMessage("It appears you have selected an incorrect choice.");
                DisplayMessage("");
                DisplayMessage("Press any key to try again or the ESC key to exit.");

                userResponse = Console.ReadKey(true);
                if (userResponse.Key == ConsoleKey.Escape)
                {
                    userActionChoice = AppEnum.ManagerAction.Quit;
                }
                break;
            }

            return(userActionChoice);
        }
Example #4
0
        public static AppEnum.DataType DisplayGetUserDataChoice()
        {
            bool validType = false;

            AppEnum.DataType userDataChoice = AppEnum.DataType.None;

            //
            // set a string variable with a length equal to the horizontal margin and filled with spaces
            //
            string leftTab = ConsoleUtil.FillStringWithSpaces(DISPLAY_HORIZONTAL_MARGIN);

            while (!validType)
            {
                //
                // set up display area
                //
                DisplayReset();

                //
                // display the menu
                //
                DisplayMessage("Choose Your Data Type");
                DisplayMessage("");
                Console.WriteLine(
                    leftTab + "1. CSV" + Environment.NewLine +
                    leftTab + "2. XML" + Environment.NewLine +
                    leftTab + "3. JSON" + Environment.NewLine);

                DisplayMessage("");
                DisplayPromptMessage("Enter the number for the data type choice.");
                ConsoleKeyInfo userResponse = Console.ReadKey(true);

                switch (userResponse.KeyChar)
                {
                case '1':
                case 'c':
                    userDataChoice = AppEnum.DataType.CSV;
                    validType      = true;
                    break;

                case '2':
                case 'x':
                    userDataChoice = AppEnum.DataType.XML;
                    validType      = true;
                    break;

                case '3':
                case 'j':
                    userDataChoice = AppEnum.DataType.JSON;
                    validType      = true;
                    break;

                default:
                    DisplayMessage("It appears you have selected an incorrect choice.");
                    DisplayMessage("Press any key to try again.");

                    userResponse = Console.ReadKey(true);
                    //if (userResponse.Key == ConsoleKey.Escape)
                    //{
                    //    userDataChoice = AppEnum.DataType.Quit;
                    //}
                    break;
                }
            }


            return(userDataChoice);
        }