コード例 #1
0
        public static VehicleType GetVehicleTypeOfParkedVehicle(string[] parkingPlace, int position, string registrationNumber)
        {
            VehicleType type;

            type = ParkingSlot.GetVehicleTypeOfParkedVehicle(parkingPlace[position], registrationNumber);
            return(type);
        }
コード例 #2
0
        /// <summary>
        /// remove the vehicle
        /// </summary>
        /// <param name="parkingSlot"></param>
        /// <param name="registrationNumber"></param>
        public static void RemoveVehicle(ref string parkingSlot, string registrationNumber)
        {
            VehicleType type = ParkingSlot.GetVehicleTypeOfParkedVehicle(parkingSlot, registrationNumber);

            if (type == VehicleType.Car)
            {
                if (ParkingSlot.GetRegistrationNumber(parkingSlot) == registrationNumber)
                {
                    // Setting to null tells its empty
                    parkingSlot = null;
                }
                else
                {
                    throw new VehicleNotFoundException();
                }
            }
            else if (type == VehicleType.Mc)
            {
                // Remove Mc
                RemoveMc(ref parkingSlot, registrationNumber);
            }
        }