コード例 #1
0
        public void InsertVehicleToGarage(string i_OwnerName, string i_OwnerPhoneNumber, string i_LicenseNumber, int i_VehicleType)
        {
            if (!CheckIfLicenseNumberInGarage(i_LicenseNumber))
            {
                Vehicle newVehicle = CreateVehicle.createVehicle(i_LicenseNumber, i_VehicleType);
                m_CurrentVehicleInGarage = new VehicleInGarage(newVehicle, i_OwnerName, i_OwnerPhoneNumber);

                m_VehiclesInGarage.Add(i_LicenseNumber, m_CurrentVehicleInGarage);
            }
            else
            {
                throw new ArgumentException("This vehicle already in the garage.");
            }
        }
コード例 #2
0
        public void AddCarToGarage(string i_OwnerName, string i_OwnerPhone, string i_LicenseNumber, int i_VehicleType)
        {
            Vehicle newVehicle;

            CreateVehicle.eVehicleType vehicleType = (CreateVehicle.eVehicleType)i_VehicleType;
            if (IsLicenseInGarage(i_LicenseNumber))
            {
                throw new ArgumentException("The vehicle already exists in the garage!");
            }
            else
            {
                newVehicle = CreateVehicle.createVehicle(vehicleType, i_LicenseNumber);
                m_CurrentVehicleInGarage = new VehicleInGarage(i_OwnerName, i_OwnerPhone, newVehicle);
                r_VehiclesInGarage.Add(i_LicenseNumber, m_CurrentVehicleInGarage);
            }
        }