Exemplo n.º 1
0
        public static void CreateVehicleInGarage(Garage io_Garage, List <string> i_GeneralDetails, List <float> i_PowerSourceDetails,
                                                 List <string> i_Wheels, Dictionary <string, string> i_VehicleDetails, Type i_TypeOfVehicle, e_TypeOfPowerSource i_PowerSource)
        {
            Vehicle vehicleToAdd;
            string  vehicleLicense              = i_GeneralDetails[0];
            string  carModule                   = i_GeneralDetails[1];
            string  owner                       = i_GeneralDetails[2];
            string  cellphoneNumber             = i_GeneralDetails[3];
            float   i_currentPowerInPowerSource = i_PowerSourceDetails[0];

            if (i_TypeOfVehicle == typeof(Car))
            {
                vehicleToAdd = createACar(carModule, vehicleLicense, i_currentPowerInPowerSource,
                                          i_Wheels, i_VehicleDetails, i_PowerSource);
            }

            else if (i_TypeOfVehicle == typeof(Motorcycle))
            {
                vehicleToAdd = createAMotorCycle(carModule, vehicleLicense, i_currentPowerInPowerSource,
                                                 i_Wheels, i_VehicleDetails, i_PowerSource);
            }

            else
            {
                vehicleToAdd = createATruck(carModule,
                                            vehicleLicense, i_currentPowerInPowerSource, i_Wheels, i_VehicleDetails);
            }

            Garage.GarageVehicle garageVehicle = new Garage.GarageVehicle(owner, cellphoneNumber,
                                                                          Garage.GarageVehicle.eVehicleStatus.InRepair, vehicleToAdd);
            io_Garage.AddNewVehicleToGarage(garageVehicle);
        }