Exemplo n.º 1
0
        private static void fuelVeichleBasedOnFuelOption(Garage io_ThisGarage)
        {
            string vehicleLicenseNumber = GarageInterface.GetVeichleLicenseNumberFromUser();
            bool isVehicleInThisGarage = isInGarageIfNotSendError(io_ThisGarage, vehicleLicenseNumber);

            if (isVehicleInThisGarage)
            {
                string typeOfFuel = GarageInterface.GetTypeOfFuelFromUser();
                float litersOfFuelToFill = GarageInterface.GetNumberOfLitersOfFuel();
                try
                {
                    io_ThisGarage.FuelNumberOfLitersToFuelBasedVehicle
                        (vehicleLicenseNumber, typeOfFuel, litersOfFuelToFill);
                    GarageInterface.SendSucsses();
                }
                catch (FormatException formatException)
                {
                    GarageInterface.ShowThisStringAsOutput(formatException.Message);
                }
                catch (ArgumentException argumentException)
                {
                    GarageInterface.ShowThisStringAsOutput(argumentException.Message);
                }
                catch (ValueOutOfRangeException outOfRangeException)
                {
                    GarageInterface.ShowThisStringAsOutput(outOfRangeException.Message);
                }
            }
        }
Exemplo n.º 2
0
        private static void chargeVehicleBasedOnElectricityOption(Garage io_ThisGarage)
        {
            string vehicleLicenseNumber = GarageInterface.GetVeichleLicenseNumberFromUser();
            bool isVehicleInThisGarage = isInGarageIfNotSendError(io_ThisGarage, vehicleLicenseNumber);

            if (isVehicleInThisGarage)
            {
                float numberOfHoursToCharge = GarageInterface.GetNumberOfMinuetsToChargeBattery() / k_NumberOfMinutesInOneHour;
                try
                {
                    io_ThisGarage.ChargeElectricityBasedVehicle(vehicleLicenseNumber, numberOfHoursToCharge);
                    GarageInterface.SendSucsses();
                }
                catch (ArgumentException argumentException)
                {
                    GarageInterface.ShowThisStringAsOutput(argumentException.Message);
                }
                catch (ValueOutOfRangeException outOfRangeException)
                {
                    GarageInterface.ShowThisStringAsOutput(outOfRangeException.Message);
                }
                catch (FormatException formatException)
                {
                    GarageInterface.ShowThisStringAsOutput(formatException.Message);
                }
            }
        }
Exemplo n.º 3
0
        private static void showFullDataOfVeichleByLicenseNumberOption(Garage i_ThisGarage)
        {
            string vehicleLicenseNumber = GarageInterface.GetVeichleLicenseNumberFromUser();
            bool isVehicleInThisGarage = isInGarageIfNotSendError(i_ThisGarage, vehicleLicenseNumber);

            if (isVehicleInThisGarage)
            {
                GarageInterface.ShowThisStringAsOutput
                    (i_ThisGarage.getFullVehicleDetailsByLicenseNumber(vehicleLicenseNumber));
            }
        }
Exemplo n.º 4
0
        private static void inflateAirInWheelsOfVeichleToMaximumOption(Garage io_ThisGarage)
        {
            string vehicleLicenseNumber = GarageInterface.GetVeichleLicenseNumberFromUser();
            bool isVehicleInThisGarage = isInGarageIfNotSendError(io_ThisGarage, vehicleLicenseNumber);

            if (isVehicleInThisGarage)
            {
                io_ThisGarage.InflateAirInWheelsOfChoosenVehicleToMaximum(vehicleLicenseNumber);
                GarageInterface.SendSucsses();
            }
        }
Exemplo n.º 5
0
        private static void changeInGargeStateOfVeichleOption(Garage io_ThisGarage)
        {
            string vehicleLicenseNumber = GarageInterface.GetVeichleLicenseNumberFromUser();
            bool isVehicleInThisGarage = isInGarageIfNotSendError(io_ThisGarage, vehicleLicenseNumber);

            if (isVehicleInThisGarage)
            {
                string newInGargeStateOfVehicle = GarageInterface.GetVehicleNewStateInGarageFromUser();
                try
                {
                    io_ThisGarage.ChangeInGargeStateOfVehicle(vehicleLicenseNumber, newInGargeStateOfVehicle);
                    GarageInterface.SendSucsses();
                }
                catch (FormatException formatException)
                {
                    GarageInterface.ShowThisStringAsOutput(formatException.Message);
                }
            }
        }
Exemplo n.º 6
0
        private static void insertNewVeichleToGarageOption(Garage io_ThisGarage)
        {
            string vehicleLicenseNumber = GarageInterface.GetVeichleLicenseNumberFromUser();
            if (io_ThisGarage.IsVehicleInThisGarage(vehicleLicenseNumber))
            {
                io_ThisGarage.ChangeInGargeStateOfVehicle(vehicleLicenseNumber, k_InRepairState);
                GarageInterface.SendVeichleAlreadyInGarageAsOutput(vehicleLicenseNumber);
                GarageInterface.SendSucsses();
            }
            else
            {
                List<string> listOfPossibleVehicleTypes = io_ThisGarage.GetListOfPossibleVehicles();
                string newVehicleType = GarageInterface.GetVehicleTypeFromUser(listOfPossibleVehicleTypes);
                List<string> nameOfRequiredFieldsByVehicle = io_ThisGarage.GetParametersDict(newVehicleType);
                Dictionary<string, string> parametersForFactory = GarageInterface.getParametersForFactoryFromUser(nameOfRequiredFieldsByVehicle);

                parametersForFactory.Add(Garage.k_LicenceNumberKey, vehicleLicenseNumber);

                try
                {
                    io_ThisGarage.InsertNewVehicle(parametersForFactory, newVehicleType);
                    GarageInterface.SendSucsses();
                }
                catch (FormatException formatException)
                {
                    GarageInterface.ShowThisStringAsOutput(formatException.Message);
                }
                catch (ArgumentException argumentException)
                {
                    GarageInterface.ShowThisStringAsOutput(argumentException.Message);
                }
                catch (ValueOutOfRangeException outOfRangeException)
                {
                    GarageInterface.ShowThisStringAsOutput(outOfRangeException.Message);
                }
            }
        }