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); } } }
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); } } }
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)); } }
private static void showLicenseNumbersOfVeichlesInGarageOption(Garage i_ThisGarage) { string InGargeStateOfVehicleToFilterWith = GarageInterface.GetAndSetVeichleStateIfUserWantTo(); try { GarageInterface.ShowThisStringAsOutput (i_ThisGarage.ShowLicenseNumbersOfVehiclesInGarageWithFilterByState(InGargeStateOfVehicleToFilterWith)); } catch (FormatException formatException) { GarageInterface.ShowThisStringAsOutput(formatException.Message); } }
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); } } }
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); } } }