// Return Vehicle Data : License, ModelName, OwnerName, CurrStatus, Wheels Data, Energy Level, FuelType OR BatteryStatus, public ComposedVehicle GetVehicle(string i_License) { ComposedVehicle vehicleToBeReturned = null; bool VehicleExists = this.VehiclesInGarage.TryGetValue(i_License, out vehicleToBeReturned); if (!VehicleExists) { throw new ArgumentException(); } return(vehicleToBeReturned); }
// Insert a some approved Vehicle to the garage. public bool InsertVehicle(ComposedVehicle i_Vehicle) { bool successfulInsert = false; if (i_Vehicle != null) { this.m_VehiclesInGarage.Add(i_Vehicle.LicenseNumber, i_Vehicle); successfulInsert = true; } else { // throw nullReferenceException. throw new ArgumentException(); } return(successfulInsert); }
public ComposedVehicle CreateTruck( eValidVehicle i_eValidVehicle, string i_OwnerName, string i_OwnerPhoneNumber, string i_LicenseNumber, string i_ModelName, string i_WheelManufacturer, float i_WheelPressure, float i_CurrentPower, float i_TruckCapacity, bool i_IsCooled) { Vehicle vehicle = VehicleFactory.CreateTruck(i_ModelName, i_LicenseNumber, i_WheelManufacturer, i_WheelPressure, i_CurrentPower, i_TruckCapacity, i_IsCooled); ComposedVehicle composedVehicle = new ComposedVehicle(vehicle, i_OwnerName, i_OwnerPhoneNumber); return(composedVehicle); }
public string GetVehicleDetails(string i_License) { ComposedVehicle cmpVehicle = null; string details; bool isVehicleInGarage = IsVehicleInGarage(i_License); if (IsVehicleInGarage(i_License)) { cmpVehicle = GetVehicle(i_License); details = cmpVehicle.ToString(); } else { details = $"There's no vehicle with license {i_License}" + $" in the garage."; } return(details); }
public ComposedVehicle CreateMotorcycle( eValidVehicle i_eValidVehicle, string i_OwnerName, string i_OwnerPhoneNumber, string i_LicenseNumber, string i_ModelName, string i_WheelManufacturer, float i_WheelPressure, float i_CurrentPower, eLicencseType i_eLicenseType, int i_EngineCapacity) { Vehicle vehicle; ComposedVehicle composedVehicle; if (i_eValidVehicle == eValidVehicle.RegMotorCycle) { vehicle = VehicleFactory.CreateMotorcycle( i_ModelName, i_LicenseNumber, i_WheelManufacturer, i_WheelPressure, i_CurrentPower, i_eLicenseType, i_EngineCapacity); } else { vehicle = VehicleFactory.CreateElectricMotorcycle( i_ModelName, i_LicenseNumber, i_WheelManufacturer, i_WheelPressure, i_CurrentPower, i_eLicenseType, i_EngineCapacity); } composedVehicle = new ComposedVehicle(vehicle, i_OwnerName, i_OwnerPhoneNumber); return(composedVehicle); }
public ComposedVehicle CreateAutomobile( eValidVehicle i_eValidVehicle, string i_OwnerName, string i_OwnerPhoneNumber, string i_LicenseNumber, string i_ModelName, string i_WheelManufacturer, float i_WheelPressure, float i_CurrentPower, eColor i_eColor, eNumOfDoors i_eNumOfDoors) { Vehicle vehicle; ComposedVehicle composedVehicle; if (i_eValidVehicle == eValidVehicle.RegCar) { vehicle = VehicleFactory.CreateAutomobile( i_ModelName, i_LicenseNumber, i_WheelManufacturer, i_WheelPressure, i_CurrentPower, i_eColor, i_eNumOfDoors); } else { vehicle = VehicleFactory.CreateElectricAutomobile( i_ModelName, i_LicenseNumber, i_WheelManufacturer, i_WheelPressure, i_CurrentPower, i_eColor, i_eNumOfDoors); } composedVehicle = new ComposedVehicle(vehicle, i_OwnerName, i_OwnerPhoneNumber); return(composedVehicle); }