private void insertMotorcycle() { string modelName = getModelName(); string licenseNumber = getLicenseNumber(); Factory.eEnergyType energyType = GetEnergyType(); EnergyStorage energyStorage = Factory.GenerateEnergyStorage(Factory.eVehicleType.Motorcycle, energyType); float energyPercentage = getEnergyPercentage(); List <Tire> wheels = insertWheels(Factory.eVehicleType.Motorcycle, k_MotorcycleWheelsAmount); Motorcycle.eLicenseType licenseType = getLicenseType(); int engineCapacity = getEngineCapacity(); Motorcycle motorcycle = Factory.GenerateMotorcycle(modelName, licenseNumber, wheels, energyStorage, licenseType, engineCapacity, energyPercentage); try { r_GarageLogic.InsertVehicleToGarage(getOwnerDetails(motorcycle)); } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ResetColor(); } }
// $G$ DSN-002 (-10) The UI should not know Car\Truck\Motorcycle private void insertCar() { string modelName = getModelName(); string licenseNumber = getLicenseNumber(); Factory.eEnergyType energyType = GetEnergyType(); EnergyStorage energyStorage = Factory.GenerateEnergyStorage(Factory.eVehicleType.Car, energyType); float energyPercentage = getEnergyPercentage(); List <Tire> wheels = insertWheels(Factory.eVehicleType.Car, k_CarWheelsAmount); byte numberOfDoors = getNumberOfDoors(); Car.eColor color = getCarColor(); Car car = Factory.GenerateCar(modelName, licenseNumber, wheels, energyStorage, color, numberOfDoors, energyPercentage); try { r_GarageLogic.InsertVehicleToGarage(getOwnerDetails(car)); } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.ResetColor(); } }