Пример #1
0
        private void getDetailsAndRefuel()
        {
            Console.WriteLine("Please enter the license number of the vehicle you would like to refuel");
            string licenseNumber = ValidateUserInput.ValidateInputInNotEmpty();

            Console.Clear();
            Console.WriteLine("Please enter the type of fuel of the vehicle you would like to refuel");
            Gas.eFuelType fuelType = (Gas.eFuelType)ValidateUserInput.InputIsInRangeOfEnum(typeof(Gas.eFuelType));
            Console.Clear();
            Console.WriteLine("Please enter the amount of fuel you would like to refuel");
            float amountOfFuel = ValidateUserInput.ParseInputToFloat();

            try
            {
                m_UserInterface.Garage.RefuelGasVehicle(licenseNumber, fuelType, amountOfFuel);
                Console.Clear();
                Console.WriteLine(String.Format("Vehicle with license number: {0}, was refueled with gas type: {1}, and amount: {2} successfuly!", licenseNumber, fuelType, amountOfFuel));
                Messages.PressAnyKeyToContinue();
            }
            catch (Exception exception)
            {
                Console.Clear();
                Console.WriteLine(exception.Message);

                if (exception is ValueOutOfRangeException)
                {
                    Console.WriteLine("Please try again");
                    getDetailsAndRefuel();
                }
                else
                {
                    Messages.PressAnyKeyToContinue();
                }
            }
        }
Пример #2
0
 private Motorcycle.eLicenseType assignLicenseType()
 {
     m_UserDisplay.ClearAndDisplayMessage("Please choose  Motorcycle LicenseType: ");
     return((Motorcycle.eLicenseType)ValidateUserInput.InputIsInRangeOfEnum(typeof(Motorcycle.eLicenseType)));
 }
Пример #3
0
 private Car.eNumberOfDoors installDoors()
 {
     userDisplay.ClearAndDisplayMessage("Please choose the number of Doors: ");
     return((Car.eNumberOfDoors)ValidateUserInput.InputIsInRangeOfEnum(typeof(Car.eNumberOfDoors)));
 }
Пример #4
0
 private Car.eCarColor paintCar()
 {
     userDisplay.ClearAndDisplayMessage("Please choose car color: ");
     return((Car.eCarColor)ValidateUserInput.InputIsInRangeOfEnum(typeof(Car.eCarColor)));
 }
 public Gas.eFuelType GetFuelTypeForRefuel()
 {
     m_UserDisplay.DisplayMessage("Please enter the type of fuel of the vehicle you would like to refuel");
     return((Gas.eFuelType)ValidateUserInput.InputIsInRangeOfEnum(typeof(Gas.eFuelType)));
 }
Пример #6
0
 private VehicleFactory.eVehicleTypes getVehicleType()
 {
     m_UserDisplay.DisplayMessage("Please choose one of the following vehicle types:");
     return((VehicleFactory.eVehicleTypes)ValidateUserInput.InputIsInRangeOfEnum(typeof(VehicleFactory.eVehicleTypes)));
 }