public static Vehicle Create(string i_LicencePlate, string i_VehicleType)
        {
            Vehicle vehicleToCreate = null;

            Enum.TryParse <eType>(i_VehicleType, out eType vehicleType);
            switch (vehicleType)
            {
            case eType.ElectricCar:
                vehicleToCreate = new Car(i_LicencePlate, eEnergyType.Electric);
                break;

            case eType.FuelCar:
                vehicleToCreate = new Car(i_LicencePlate, eEnergyType.Fuel);
                break;

            case eType.ElectricMotorCycle:
                vehicleToCreate = new MotorCycle(i_LicencePlate, eEnergyType.Electric);
                break;

            case eType.FuelMotorCycle:
                vehicleToCreate = new MotorCycle(i_LicencePlate, eEnergyType.Fuel);
                break;

            case eType.Trunk:
                vehicleToCreate = new Trunk(i_LicencePlate);
                break;

            default:
                break;
            }
            return(vehicleToCreate);
        }
Ejemplo n.º 2
0
        public static Vehicle CreateVehicle(eVehicleTypes i_VehicleTypeCreate, string i_ModelName, string i_LicenceId, string i_WheelManufacturerName, string i_VehicleFirstParameter, string i_VehicleSecondParameter)
        {
            Vehicle newVehicle = null;

            switch (i_VehicleTypeCreate)
            {
            case eVehicleTypes.GasMotorCycle:
                newVehicle = new MotorCycle(i_ModelName, i_LicenceId, i_WheelManufacturerName, sr_MotorCycleMaxWheelPressure, sr_MotorCycleNumberOfWheels, VehicleType.eVehicleType.Gasoline, i_VehicleFirstParameter, i_VehicleSecondParameter, sr_GasMotorCycleMaxFuelInLiters.ToString(), sr_GasMotorCycleFuelType.ToString());
                break;

            case eVehicleTypes.ElectricMotorCycle:
                newVehicle = new MotorCycle(i_ModelName, i_LicenceId, i_WheelManufacturerName, sr_MotorCycleMaxWheelPressure, sr_MotorCycleNumberOfWheels, VehicleType.eVehicleType.Electric, i_VehicleFirstParameter, i_VehicleSecondParameter, sr_ElectricMotorCycleMaxBatteryTimeInHoures.ToString());
                break;

            case eVehicleTypes.GasCar:
                newVehicle = new Car(i_ModelName, i_LicenceId, i_WheelManufacturerName, sr_CarMaxWheelPressure, sr_CarNumberOFWheels, VehicleType.eVehicleType.Gasoline, i_VehicleSecondParameter, i_VehicleFirstParameter, sr_GasCarMaxFuelInLiters.ToString(), sr_GasCarFuelType.ToString());
                break;

            case eVehicleTypes.ElectricCar:
                newVehicle = new Car(i_ModelName, i_LicenceId, i_WheelManufacturerName, sr_CarMaxWheelPressure, sr_CarNumberOFWheels, VehicleType.eVehicleType.Electric, i_VehicleSecondParameter, i_VehicleFirstParameter, sr_ElectricCarMaxBatteryTimeInHoures.ToString());
                break;

            case eVehicleTypes.Truck:
                newVehicle = new Truck(i_ModelName, i_LicenceId, i_WheelManufacturerName, sr_TruckMaxWheelsPresssure, sr_TruckNumberOfWheels, VehicleType.eVehicleType.Gasoline, i_VehicleFirstParameter, i_VehicleSecondParameter, sr_TruckMaxFuelInLiters.ToString(), sr_TruckFuelType.ToString());
                break;
            }

            return(newVehicle);
        }
Ejemplo n.º 3
0
        public void CreateMotorCycle(object[] GeneralParamsOfVehicle, eMotorCycleLicences i_MotorCycleLicence, int i_EngineValume, ref List <Wheel> i_Wheels, bool i_IsElectronic)
        {
            Vehicle newVehicle;

            newVehicle = new MotorCycle((string)GeneralParamsOfVehicle[4], (string)GeneralParamsOfVehicle[0], i_EngineValume, i_MotorCycleLicence, (float)GeneralParamsOfVehicle[5], ref i_Wheels, i_IsElectronic);
            m_DictionaryVehicles.Add((string)GeneralParamsOfVehicle[0], new VehicleDetails((string)GeneralParamsOfVehicle[1], (string)GeneralParamsOfVehicle[2], ref newVehicle));
        }
Ejemplo n.º 4
0
        private static MotorCycle createMotorCycle(string i_LicenseNumber)
        {
            MotorCycle MotorCycleToReturn = new MotorCycle(i_LicenseNumber);

            createTires(2, 30, MotorCycleToReturn);

            return(MotorCycleToReturn);
        }
Ejemplo n.º 5
0
        /* 2 tires with max air pressure of 30 (psi), Max battery life – 1.8 hours */
        public static MotorCycle CreateElectricMotorCycle(string i_LicenseNumber)
        {
            MotorCycle MotorCycleToReturn = createMotorCycle(i_LicenseNumber);

            MotorCycleToReturn.Engine = new ElectricBasedEngine
            {
                MaximalAmountOfEnergy = 1.8f * 60
            };

            return(MotorCycleToReturn);
        }
Ejemplo n.º 6
0
        /* 2 tires with max air pressure of 30 (psi), Octane 96 (fuel), 6 liters fuel tank */
        public static MotorCycle CreateFuelBasedMotorCycle(string i_LicenseNumber)
        {
            MotorCycle MotorCycleToReturn = createMotorCycle(i_LicenseNumber);

            MotorCycleToReturn.Engine = new FuelBasedEngine(FuelBasedEngine.eFuelType.Octane96)
            {
                MaximalAmountOfEnergy = 6
            };

            return(MotorCycleToReturn);
        }
Ejemplo n.º 7
0
        public static Vehicle Create(int i_IntVehicleType, string i_NameOfModel, string i_LicenseNumber)
        {
            Vehicle newVehicle = null;

            if (Enum.IsDefined(typeof(eVehicleTypes), i_IntVehicleType))
            {
                eVehicleTypes vehicleType = (eVehicleTypes)i_IntVehicleType;
                switch (vehicleType)
                {
                case eVehicleTypes.FuelMotorCycle:
                {
                    newVehicle = new MotorCycle(Engine.eFuelType.Octan95, k_MaxEnergyCapacityFuelMotorCycle);
                    break;
                }

                case eVehicleTypes.ElectricMotorCycle:
                {
                    newVehicle = new MotorCycle(Engine.eFuelType.Electricity, k_MaxEnergyCapacityElectricMotorCycle);
                    break;
                }

                case eVehicleTypes.FuelCar:
                {
                    newVehicle = new Car(Engine.eFuelType.Octan96, k_MaxEnergyCapacityFuelCar);
                    break;
                }

                case eVehicleTypes.ElectricCar:
                {
                    newVehicle = new Car(Engine.eFuelType.Electricity, k_MaxEnergyCapacityElectricCar);
                    break;
                }

                case eVehicleTypes.FuelTruck:
                {
                    newVehicle = new Truck(Engine.eFuelType.Soler, k_MaxEnergyCapacityFuelTruck);
                    break;
                }
                }

                newVehicle.LicenseNumber = i_LicenseNumber;
                newVehicle.NameOfModel   = i_NameOfModel;
            }
            else
            {
                throw new FormatException(k_NoSuchAnOption);
            }

            return(newVehicle);
        }
Ejemplo n.º 8
0
        public static void RegisterVehicles()
        {
            BsonSerializer.RegisterSerializer(typeof(DateTime), DateTimeSerializer.LocalInstance);
            Vehicle newVehicle;

            newVehicle = new MotorCycle("00000000", eEnergyType.Electric);
            newVehicle.RegisterClass();
            newVehicle = new MotorCycle("00000000", eEnergyType.Fuel);
            newVehicle.RegisterClass();
            newVehicle = new Car("00000000", eEnergyType.Electric);
            newVehicle.RegisterClass();
            newVehicle = new Car("00000000", eEnergyType.Fuel);
            newVehicle.RegisterClass();
            newVehicle = new Truck("00000000");
            newVehicle.RegisterClass();
        }
Ejemplo n.º 9
0
        public static Vehicle CreateVehicle(eVehicleType i_typeOfVehicleToCreate, string i_licensePlate)
        {
            Vehicle newVehicle;

            switch (i_typeOfVehicleToCreate)
            {
            case eVehicleType.RegularMotorCycle:
            {
                newVehicle = new MotorCycle(new Fuel(), i_licensePlate);
                break;
            }

            case eVehicleType.ElectricMotorCycle:
            {
                newVehicle = new MotorCycle(new Electricity(), i_licensePlate);
                break;
            }

            case eVehicleType.RegularCar:
            {
                newVehicle = new Car(new Fuel(), i_licensePlate);
                break;
            }

            case eVehicleType.ElectricCar:
            {
                newVehicle = new Car(new Electricity(), i_licensePlate);
                break;
            }

            case eVehicleType.Truck:
            {
                newVehicle = new Truck(new Fuel(), i_licensePlate);
                break;
            }

            default:
            {
                newVehicle = null;
                break;
            }
            }

            return(newVehicle);
        }
Ejemplo n.º 10
0
        public static void GetRequiredVehicleParameters(int i_VehicleType, Dictionary <string, Type> io_DynamicParams)
        {
            eVehicleType vehicleType = (eVehicleType)i_VehicleType;

            switch (vehicleType)
            {
            case eVehicleType.Car:
                Car.GetDynamicParameter(io_DynamicParams);
                break;

            case eVehicleType.Motorcycle:
                MotorCycle.GetDynamicParameter(io_DynamicParams);
                break;

            case eVehicleType.Truck:
                Truck.GetDynamicParameter(io_DynamicParams);
                break;
            }
        }
Ejemplo n.º 11
0
        public static Vehicle createTheSpecificVehicle(string i_VehicleModel, string i_LicenseNumber, int i_VehicleType, int i_EngineType)
        {
            Vehicle newVehicle = null;

            switch (i_VehicleType)
            {
            case 1:
                newVehicle = new Car(i_VehicleModel, i_LicenseNumber, i_EngineType);
                break;

            case 2:
                newVehicle = new MotorCycle(i_VehicleModel, i_LicenseNumber, i_EngineType);
                break;

            case 3:
                newVehicle = new Truck(i_VehicleModel, i_LicenseNumber, 1);
                break;
            }

            return(newVehicle);
        }
Ejemplo n.º 12
0
        public static Vehicle CreateVehicle(eVehicleType i_VehicleType, string i_LicenseNumber)
        {
            Vehicle newVehicle = null;

            switch (i_VehicleType)
            {
            case eVehicleType.FuelMotorCycle:
            {
                newVehicle = new MotorCycle(i_LicenseNumber, eVehicleType.FuelMotorCycle);
                break;
            }

            case eVehicleType.ElectricMotorCycle:
            {
                newVehicle = new MotorCycle(i_LicenseNumber, eVehicleType.ElectricMotorCycle);
                break;
            }

            case eVehicleType.FuelCar:
            {
                newVehicle = new Car(i_LicenseNumber, eVehicleType.FuelCar);
                break;
            }

            case eVehicleType.ElectricCar:
            {
                newVehicle = new Car(i_LicenseNumber, eVehicleType.ElectricCar);
                break;
            }

            case eVehicleType.FuelTruck:
            {
                newVehicle = new Truck(i_LicenseNumber, eVehicleType.FuelTruck);
                break;
            }
            }

            return(newVehicle);
        }
Ejemplo n.º 13
0
        public Vehicle AddClient(eVehicleType i_VehicleType, Dictionary <string, object> i_VehilceInfo)
        {
            string licenceNumber = (string)i_VehilceInfo["LicenseNumber"];

            Vehicle newClient = null;

            switch (i_VehicleType)
            {
            case eVehicleType.ElectricCar:
                addElectricCarInfo(i_VehilceInfo);
                newClient = new Car(i_VehilceInfo);
                break;

            case eVehicleType.FuelCar:
                addFuelCarInfo(i_VehilceInfo);
                newClient = new Car(i_VehilceInfo);
                break;

            case eVehicleType.ElectricMotorCycle:
                addElectricMotorCycleInfo(i_VehilceInfo);
                newClient = new MotorCycle(i_VehilceInfo);
                break;

            case eVehicleType.FuelMotorCycle:
                addFuelMotorCylcleInfo(i_VehilceInfo);
                newClient = new MotorCycle(i_VehilceInfo);
                break;

            case eVehicleType.Truck:
                addTruckInfo(i_VehilceInfo);
                newClient = new Truck(i_VehilceInfo);
                break;
            }

            m_GarageManager.Add(newClient, eVehicleStatus.InRepair);

            return(newClient);
        }
        private static MotorVehicle VehicleCustomer(DataBase i_UserInput)
        {
            MotorVehicle vehicle;
            eVehicleType type   = i_UserInput.m_VehicleType;
            IEngine      engine = InitializeEngine(i_UserInput);

            switch (type)
            {
            case eVehicleType.Car:
                vehicle = new Car(i_UserInput.m_Wheels, i_UserInput.m_PlateNumber, i_UserInput.m_Manufacture, i_UserInput.m_EnergyPercentage, engine, i_UserInput.m_Color, i_UserInput.m_NumOfDoors);
                break;

            case eVehicleType.MotorCycle:
                vehicle = new MotorCycle(i_UserInput.m_Wheels, i_UserInput.m_PlateNumber, i_UserInput.m_Manufacture, i_UserInput.m_EnergyPercentage, engine, i_UserInput.m_EngineVolume, i_UserInput.m_LicenseType);
                break;

            default:     //case eVehicleType.Truck:
                vehicle = new Truck(i_UserInput.m_Wheels, i_UserInput.m_PlateNumber, i_UserInput.m_Manufacture, i_UserInput.m_EnergyPercentage, engine, i_UserInput.m_RiskyMaterials, i_UserInput.m_MaxCarry);
                break;
            }

            return(vehicle);
        }
Ejemplo n.º 15
0
        public static Vehicle CreateVehicle(eVehicleType i_VehicleType, string i_Model, string i_LicenseNumber, PowerUsage i_Power, List <Wheel> i_Wheels, Dictionary <string, object> i_DynamicParameters)

        {
            Vehicle vehicleOfOwner = null;
            float   energyPercent  = i_Power.CurrentAmountOfPower / i_Power.MaxAmountOfPower * 100;

            switch (i_VehicleType)
            {
            case eVehicleType.Car:
                vehicleOfOwner = new Car(i_Model, i_LicenseNumber, energyPercent,
                                         i_Wheels,
                                         i_Power,
                                         (Car.eCarColor)Enum.GetValues(typeof(Car.eCarColor)).GetValue((int)i_DynamicParameters["Color"] - 1),
                                         (Car.eNumberOfDoors)Enum.GetValues(typeof(Car.eNumberOfDoors)).GetValue((int)i_DynamicParameters["Number of doors"] - 1));
                break;

            case eVehicleType.Motorcycle:
                vehicleOfOwner = new MotorCycle(i_Model, i_LicenseNumber, energyPercent,
                                                i_Wheels,
                                                i_Power,
                                                (MotorCycle.eLicenseType)Enum.GetValues(typeof(MotorCycle.eLicenseType)).GetValue((int)i_DynamicParameters["License type"] - 1),
                                                (int)i_DynamicParameters["Engine volume"]);
                break;

            case eVehicleType.Truck:
                vehicleOfOwner = new Truck(i_Model,
                                           i_LicenseNumber,
                                           energyPercent,
                                           i_Wheels,
                                           i_Power,
                                           (bool)i_DynamicParameters["Dangerous Materials"],
                                           (float)i_DynamicParameters["Cargo Volume"]);
                break;
            }

            return(vehicleOfOwner);
        }