示例#1
0
        /// <summary>
        /// If user chose to change vehicle status is garage we will now ask what is the new vehicles status by a given list.
        /// User will choose 1-3 out of 3 possible status of vehicles in garage.
        /// </summary>
        /// <returns>Returns the users answer to the new status after logical check up as an optional answer from the list</returns>
        internal static Garage.e_VehicleState NewVehicleStateToChangeInput()
        {
            string newStringStatus = string.Empty;
            int    newIntStatus    = int.MinValue;

            Garage.e_VehicleState newStatus = Garage.e_VehicleState.WaitForStartingRepair;
            newStringStatus = string.Format(
                @"What is the new vehicle status for change:
1) In repair process
2) Repair Completed
3) Paid");
            Console.WriteLine(newStringStatus);
            newIntStatus = UserChoiceForRangeCheck(GlobalConstants.lowerRangeOfSortingDisplayVehiclesList, GlobalConstants.upperRangeOfSortingDisplayVehiclesList);
            newStatus    = (Garage.e_VehicleState)Enum.ToObject(typeof(Garage.e_VehicleState), newIntStatus);
            return(newStatus);
        }
示例#2
0
        /// <summary>
        /// Details main for user to choose from list of functionality options.
        /// </summary>
        public void UIManager()
        {
            int    mainUserChoiceInt    = int.MinValue;
            string licenseNumber        = string.Empty;
            bool   mainUserChoiceBool   = true;
            bool   allGoodForEnterInput = false;

            Garage.OwnerAndVehicleDetails informationOfSpecificVehicle;
            Garage.e_VehicleState         newVehicleState = Garage.e_VehicleState.WaitForStartingRepair;
            ConsoleUI.WelcomeToGarageMessage();

            while (mainUserChoiceBool == true)
            {
                try
                {
                    ConsoleUI.DetailingMenuSystemFunctionality();
                    mainUserChoiceInt = ConsoleUI.UserChoiceForRangeCheck(GlobalConstants.lowerRangeOfFunctionalityChoice, GlobalConstants.upperRangeOfFunctionalityChoice);
                    Ex02.ConsoleUtils.Screen.Clear();
                    switch (mainUserChoiceInt)
                    {
                    case 1:
                        allGoodForEnterInput = InputInformationToCreateNewSpecificVehicle();
                        break;

                    case 2:
                        MethodForMainUserChoiceCase2();
                        break;

                    case 3:
                        licenseNumber   = ConsoleUI.LicenseNumberInput();
                        newVehicleState = ConsoleUI.NewVehicleStateToChangeInput();
                        m_garage.ChangeVehicleState(licenseNumber, newVehicleState);
                        break;

                    case 4:
                        licenseNumber = ConsoleUI.LicenseNumberInput();
                        m_garage.InflateWheelAirPressureToMaximum(licenseNumber);
                        break;

                    case 5:
                        MethodForMainUserChoiceCase5();
                        break;

                    case 6:
                        licenseNumber = ConsoleUI.LicenseNumberInput();
                        informationOfSpecificVehicle = m_garage.StructOfAllDetailsOfVehicle(licenseNumber);
                        ConsoleUI.PrintGeneralInformationOfSpecificVehicle(informationOfSpecificVehicle);
                        ConsoleUI.PrintSpecificInformationForSpecificVehicle(informationOfSpecificVehicle);
                        break;

                    case 7:
                        mainUserChoiceBool = false;
                        break;
                    }

                    if (allGoodForEnterInput == true)
                    {
                        ConsoleUI.PrintSuccessAndPressAnyKeyToContinue();
                    }
                    else
                    {
                        ConsoleUI.PrintFailedAndPressAnyKeyToContinue();
                    }
                }
                catch (FormatException formatException)
                {
                    Console.WriteLine(formatException.Message);
                }
                catch (ArgumentException argumentException)
                {
                    Console.WriteLine(argumentException.Message);
                }
                catch (ValueOutOfRangeException valueOutOfRangeException)
                {
                    Console.WriteLine(valueOutOfRangeException.Message);
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.Message);
                }
            }

            ConsoleUI.GoodByeMessage();
        }