Example #1
0
 private void runMenuChoice(eUserChoice i_UserChoice)
 {
     if (i_UserChoice == eUserChoice.AddVehicle)
     {
         addVehicle();
     }
     else if (i_UserChoice == eUserChoice.PresentCarLicensePlateList)
     {
         presentCarLicensePlateList();
     }
     else if (i_UserChoice == eUserChoice.ChangeVehicleStatus)
     {
         changeVehicleStatus();
     }
     else if (i_UserChoice == eUserChoice.InflateVehicleTires)
     {
         inflateVehicleTires();
     }
     else if (i_UserChoice == eUserChoice.FillVehicleFuel)
     {
         fillVehicleFuel();
     }
     else if (i_UserChoice == eUserChoice.ChargeVehicleBattery)
     {
         chargeVehicleBattery();
     }
     else if (i_UserChoice == eUserChoice.ShowVehicleInformation)
     {
         showVehicleInformation();
     }
 }
Example #2
0
        public eUserChoice PrintMenuAndGetChoiceFromUser()
        {
            int         userChoice;
            eUserChoice userChoiceOption = new eUserChoice();
            string      header           = string.Format("Please select one of the options:");

            userChoice = MakeArrayOfStringFromEnum(header, userChoiceOption);
            Console.Clear();

            return((InputUI.eUserChoice)userChoice);
        }
        public eUserChoice PrintMenuAndGetChoice()
        {
            eUserChoice userChoiceOptions = new eUserChoice();
            string      header            = string.Format("from Garage Menu:");
            int         userChoice;

            userChoice = GetSpecificEnumInput(header, userChoiceOptions);
            Console.Clear();

            return((eUserChoice)userChoice);
        }
Example #4
0
        private Enum getUserInput(ref bool io_quitGarage)
        {
            eUserChoice userInput = eUserChoice.ChangeVehicleStatus;

            if (Enum.TryParse(Console.ReadLine(), out userInput) &&
                Enum.IsDefined(typeof(eUserChoice), userInput))
            {
                switch (userInput)
                {
                case eUserChoice.EnterNewVehicle:
                    enterNewVehicle();
                    break;

                case eUserChoice.ShowLicenseNumbers:
                    printGarageVehiclesLicense();
                    break;

                case eUserChoice.ChangeVehicleStatus:
                    changeVehicleStatus();
                    break;

                case eUserChoice.InflateTiresToMax:
                    inflateVehicleTiresToMax();
                    break;

                case eUserChoice.FuelVehicle:
                    fillFuelVehicle();
                    break;

                case eUserChoice.ChargeVehicle:
                    fillElectricSource();
                    break;

                case eUserChoice.ShowFullDetails:
                    showVehicleFullDetails();
                    break;

                case eUserChoice.Exit:
                    Console.WriteLine("Thank you for visiting Nofar & Erez Garage - Good-bye!");
                    io_quitGarage = true;
                    break;
                }
            }
            else
            {
                throw new ValueOutOfRangeException(k_MinMenuOption, k_MaxMenuOption);
            }

            return(userInput);
        }
Example #5
0
        private void getLicensePlate(ref string io_PlateNumber, ref eUserChoice io_UserChoice)
        {
            if (Enum.IsDefined(typeof(eUserChoice), io_UserChoice) && io_UserChoice != eUserChoice.DisplayVehicleList && io_UserChoice != eUserChoice.ExitProgram)
            {
                Console.Write("Enter your registration plate number: ");
                io_PlateNumber = Console.ReadLine().Trim();
                bool isVehicleInGarage = this.m_Garage.isVehicleInGarage(io_PlateNumber);

                if (!isVehicleInGarage)
                {
                    if (io_UserChoice != eUserChoice.InsertNewVehicle)
                    {
                        Console.WriteLine("No matching vehicle with license plate \"{0}\" found in the garage.", io_PlateNumber);
                        io_UserChoice = 0;
                    }
                }
            }
        }
Example #6
0
        private eUserChoice getUserChoice()
        {
            eUserChoice userChoice = eUserChoice.ExitProgram;
            string      userChoiceStr;
            bool        isValidInput = false;

            do
            {
                try
                {
                    this.printEnterChoiceMsg();
                    userChoiceStr = Console.ReadLine();
                    userChoice    = LogicUtils.EnumValidation <eUserChoice>(userChoiceStr, k_UserChoiceKey);
                    isValidInput  = true;
                }
                catch (Exception exception)
                {
                    Console.WriteLine(exception.Message);
                }
            }while (!isValidInput);

            return(userChoice);
        }
Example #7
0
        public void RunProgram()
        {
            Console.WriteLine(@"Hello And Welcome To Dani and Tamir's Garage system:
Please use the Following menu in order manage your Garage. Good Luck!
");
            while (true)
            {
                printMainMenu();
                eUserChoice userChoice = validateUserChoiceForMainMenu();

                switch (userChoice)
                {
                case eUserChoice.AddVehicle:
                {
                    addNewVehicleToTheGarage();
                    break;
                }

                case eUserChoice.ShowAllVehicle:
                {
                    printLicenseNumbers();
                    break;
                }

                case eUserChoice.ChangeVehicleStatus:
                {
                    changeVehicleStatus();
                    break;
                }

                case eUserChoice.AddAirPressure:
                {
                    addAirPressure();
                    break;
                }

                case eUserChoice.AddFuel:
                {
                    addFuel();
                    break;
                }

                case eUserChoice.ChargeBattery:
                {
                    chargeBattery();
                    break;
                }

                case eUserChoice.PrintVehicleData:
                {
                    printVehicleData();
                    break;
                }

                case eUserChoice.Exit:
                {
                    Environment.Exit(1);
                    break;
                }
                }
            }
        }