//-----------------------------------------------------------------// public void FillEngineUp(string i_LicensePlate, float i_HowMuchToIncrease, Engine.eEngineType i_EngineType, Engine.FuelEngine.eFuelType i_FuelType) { try { InformationOfVehicle vehicleToFuel = this.CheckForLicensePlate(i_LicensePlate); if ((vehicleToFuel != null) && (vehicleToFuel.Vehicle.Engine is Engine.FuelEngine) && (i_EngineType == Engine.eEngineType.Fuel)) { (vehicleToFuel.Vehicle.Engine as Engine.FuelEngine).Refuel(i_HowMuchToIncrease, i_FuelType); } else if ((vehicleToFuel != null) && (vehicleToFuel.Vehicle.Engine is Engine.ElectricEngine) && (i_EngineType == Engine.eEngineType.Electric)) { (vehicleToFuel.Vehicle.Engine as Engine.ElectricEngine).ChargeBattery(i_HowMuchToIncrease); } else { if (i_EngineType == Engine.eEngineType.Fuel) { throw new ArgumentException("This Vehicle cannot be fueled" + Environment.NewLine); } else { throw new ArgumentException("This Vehicle cannot be charged" + Environment.NewLine); } } } catch (ArgumentException exception) { throw exception; } catch (ValueOutOfRangeException exeption) { throw exeption; } }
//-----------------------------------------------------------------// public void FillTiresToMaxByLicensePlate(string i_LicenseNumber) { try { InformationOfVehicle vehicleInformation = this.CheckForLicensePlate(i_LicenseNumber); vehicleInformation.Vehicle.FillTiresToMax(); } catch (Exception exception) { throw exception; } }
//-----------------------------------------------------------------// public void ChangeVehicleState(string i_LicenseNumber, InformationOfVehicle.eVehicleStateInGarage i_NewState) { try { InformationOfVehicle vehicleInformation = this.CheckForLicensePlate(i_LicenseNumber); vehicleInformation.State = i_NewState; } catch (ArgumentException exception) { throw exception; } }