public void Insert(int i_vehicleType, VehicleInformation i_vehicleInformation, Dictionary <string, Object> i_specificInformation) { string licenseNumber = i_vehicleInformation.LicenseNumber; Vehicle vehicle = CreateVehicle.CreateNewVehicle((CreateVehicle.eVehicleType)i_vehicleType, i_vehicleInformation, i_specificInformation); m_currentGarageVehicles.Add(licenseNumber, vehicle); }
// $G$ DSN-011 (-8) The component who responsible for creating vehicles, should be in a separate component. private Vehicle createNewVehicle(string i_LicensePlate, string i_ModelName, string i_WheelManufacturer, out string o_OwnerName, out string o_OwnerPhone) { Vehicle newVehicle; Vehicle.eTypeOfVehicle vehicleType, vehicleOptions = new Vehicle.eTypeOfVehicle(); EnergySource.eSource vehicleEnergySource; EnergySource.eSource energySourceOptions = new EnergySource.eSource(); string PartOfOptionsHeaderMsg = string.Format("vehicle type"); o_OwnerName = m_InputUI.GetOwnerNameFromUser(); o_OwnerPhone = m_InputUI.GetOwnerPhoneFromUser(); vehicleType = (Vehicle.eTypeOfVehicle)m_InputUI.MakeArrayOfStringFromEnum(PartOfOptionsHeaderMsg, vehicleOptions); PartOfOptionsHeaderMsg = string.Format("energy source"); if (vehicleType != Vehicle.eTypeOfVehicle.Truck) { vehicleEnergySource = (EnergySource.eSource)m_InputUI.MakeArrayOfStringFromEnum(PartOfOptionsHeaderMsg, energySourceOptions); } else { vehicleEnergySource = EnergySource.eSource.FuelSource; } newVehicle = CreateVehicle.CreateNewVehicle(vehicleType, vehicleEnergySource, i_LicensePlate, i_ModelName, i_WheelManufacturer); insertVehicleDetails(newVehicle); return(newVehicle); }