private static void addNewVehicleToGarage(GarageLogic.Garage i_Garage)
        {
            string[] specificPropertiesToGet = null;
            string[] specificPropertiesToSet = null;
            string   licenseNumber           = getUserInputOfVehicleLicenceNumberIfItIsNotExistiInGarage(i_Garage);

            if (!s_InterruptCurrTask)
            {
                UserInputOutput.WriteLine(GarageLogic.VehicleFactory.GetListOfAvailableVehiclesToBuild());
                GarageLogic.Vehicle newVehicle = buildVehilce(UserInputOutput.ReadLine());
                if (!s_InterruptCurrTask)
                {
                    setStandardDetailsOfNewVehicle(newVehicle, licenseNumber);
                    UserInputOutput.WriteLine(GarageLogic.PropulsionSystemFactory.GetListOfAvailableSystems());
                    newVehicle.SetPropulsionSystem(newVehicle.GetType().Name, UserInputOutput.ReadLine());
                    specificPropertiesToGet = newVehicle.GetSpecificPropertiesAsStrings();
                    specificPropertiesToSet = new string[specificPropertiesToGet.Length];
                    UserInputOutput.ClearScreen();
                    for (int i = 0; i < specificPropertiesToGet.Length; i++)
                    {
                        UserInputOutput.WriteLine(specificPropertiesToGet[i]);
                        specificPropertiesToSet[i] = UserInputOutput.ReadLine();
                    }

                    newVehicle.SetSpecificProperties(specificPropertiesToSet);
                    string[] ownerDetailsToSet = getOwnerDetailsOfVehicleFromUser();
                    i_Garage.SetOwnerDetailsOfVehicle(licenseNumber, ownerDetailsToSet);
                    i_Garage.AddVehicle(newVehicle);
                }
            }
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        private void enterVehicle()
        {
            string  licenseNumber = getLicenceNumberFromUser();
            Vehicle vehicle       = m_Garage.GetVehicle(licenseNumber);

            // No such vehicle, add it
            if (vehicle == null)
            {
                VehicleBuilder.eVehicleType typeOfVehicle = getVehicleTypeFromUser();
                string   vehicleModel           = getVehicleModelFromUser();
                string[] vehicleSpecificDetails = getVehicleSpecificDetailsFromUser(typeOfVehicle);
                vehicle            = m_Garage.vehicleBuilder.buildVehicle(licenseNumber, typeOfVehicle, vehicleModel, vehicleSpecificDetails);
                vehicle.Tires      = getTiresDetailsFromUser(vehicle);
                vehicle.LicenseNum = licenseNumber;
                vehicle.OwnerName  = getOwnerNameFromUser();
                vehicle.OwnerPhone = getOwnerPhoneFromUser();
                getAdditionalDetails(vehicle);
                m_Garage.AddVehicle(vehicle);

                write("Vehicle was successfuly added!");
            }
            // Already exists, change status
            else
            {
                m_Garage.ChangeStatus(vehicle, eVehicleStatus.InReparation);
                write(String.Format("Vehicle status changed to {0}", eVehicleStatus.InReparation));
            }
        }