예제 #1
0
        public bool AddVehicleToGarage(Vehicles i_Vehicle, string i_OwnerName, string i_OwnerPhoneNum)
        {
            bool vehicleExistsInGarage;

            vehicleExistsInGarage = r_DictOfGarageVehicles.ContainsKey(i_Vehicle.LicenseNumber);

            NewVehiclesInTheGarage vehicleInGarage;

            if (i_Vehicle == null)
            {
                throw new ArgumentNullException();
            }

            if (vehicleExistsInGarage == true)
            {
                ChangeExistingVehicleState(i_Vehicle.LicenseNumber, NewVehiclesInTheGarage.eVehicleConditionIngarage.InRepair);
            }

            else
            {
                vehicleInGarage = new NewVehiclesInTheGarage(i_Vehicle, i_OwnerName, i_OwnerPhoneNum);
                r_DictOfGarageVehicles.Add(i_Vehicle.LicenseNumber, vehicleInGarage);
            }

            return(vehicleExistsInGarage);
        }
예제 #2
0
        public string GetVehicleData(string i_LicenseNumber)
        {
            NewVehiclesInTheGarage VehicleData = null;

            VehicleData = getVehicleFromDictionary(i_LicenseNumber);

            return(VehicleData.ToString());
        }
예제 #3
0
        public NewVehiclesInTheGarage getVehicleFromDictionary(string i_LicenseNum)
        {
            bool vehicleExists;
            NewVehiclesInTheGarage garageVehicle = null;

            vehicleExists = r_DictOfGarageVehicles.TryGetValue(i_LicenseNum, out garageVehicle);

            if (vehicleExists == false)
            {
                throw new VehicleNotFoundException(i_LicenseNum);
            }

            return(garageVehicle);
        }