Exemplo n.º 1
0
        private void addVehicle()
        {
            string ownerName, ownerCellphone, licenseNumber, modelName;

            getBasicDataFromOwner(out ownerName, out ownerCellphone, out licenseNumber, out modelName);

            if (m_OurGarage.IsVehicleinGarage(licenseNumber))
            {
                Console.WriteLine("This vehicle is already in the garage. State changed to: during a repair");
                m_OurGarage.ChangeVehicleState(licenseNumber, eVehicleState.DuringRepair);
            }
            else
            {
                int     choose          = getVehicleTypeChoise(m_OurFactory.VehiclesTypes);
                Vehicle newVehicle      = m_OurFactory.CreateVehicle(choose, licenseNumber, modelName);
                string  infoVehicleNeed = newVehicle.GetVehicleParamsNeeds();
                string  msg             = string.Format(
                    @"Please enter the follwing parameters:
using ',' (for example: Red, 4, 10).
{0}",
                    infoVehicleNeed);

                Console.WriteLine(msg);

                string allParams = Console.ReadLine();
                newVehicle.SetValues(makeCollectionFromString(allParams));
                m_OurGarage.AddToGarage(newVehicle, ownerName, ownerCellphone);
                Console.WriteLine("Yay! vehicle Car successfully added.");
            }
        }
Exemplo n.º 2
0
        public static void EnterNewVehicleToGarage(Garage i_Garage, string i_LicenseNumber)
        {
            Vehicle vehicle    = CreateNewVehicle(i_LicenseNumber);
            string  ownerName  = GetOwnerName();
            string  ownerPhone = GetOwnerPhone();

            VehicleInformation newVehicleInGarage = VehicleCreator.CreateVehicleWithFullInformation(vehicle, ownerName, ownerPhone);

            i_Garage.AddToGarage(newVehicleInGarage);
        }
        // Methods:
        public static void AddNewVehicleToGarage(Garage i_Garage, string i_LicenseNumber)
        {
            string ownerName, ownerPhoneNumber;

            Console.WriteLine("To Insert a new car, please fill all the details below:");
            Vehicle vehicle = Utilities.CreateUserVehicle(i_LicenseNumber);

            Utilities.GetOwnerDetails(out ownerName, out ownerPhoneNumber);
            Utilities.GetWheelsManufacturer(vehicle);
            i_Garage.AddToGarage(vehicle, ownerName, ownerPhoneNumber);
        }