/* Public Methods */

        /// <summary>
        /// “Insert” a new vehicle into the garage.
        /// </summary>
        /// <param name="i_Vehicle"></param>
        public void Insert(
            Vehicle i_Vehicle,
            string i_LicenseNumber,
            string i_OwnerName,
            string i_OwnerPhone)
        {
            if (i_LicenseNumber != "" && i_OwnerName != "" && i_OwnerPhone != "")
            {
                // If we have this vehicle in this garage, change its status
                if (VehicleIsAlreadyInTheGarage(i_LicenseNumber))
                {
                    throw new ArgumentException("Vehicle's license plate is already in the Garage");
                }
                // If we don't have this vehicle in this garage, add it
                else
                {
                    VehicleDetails details = new VehicleDetails(i_OwnerName, i_OwnerPhone)
                    {
                        VehicleStatus = eVehicleStatus.Waiting
                    };

                    LicenseNumbersList.Add(i_LicenseNumber, details);
                    VehicleList.Add(i_LicenseNumber, i_Vehicle);
                }
            }
        }
示例#2
0
        private void addVehicleToGarage(string i_LicenseNumber, object i_Vehicle, string i_OwnerName, string i_PhoneNumber)
        {
            Vehicle        vehicle        = i_Vehicle as Vehicle;
            VehicleDetails vehicleDetails = new VehicleDetails(vehicle, i_OwnerName, i_PhoneNumber);

            m_VehicleDetailsList.Add(i_LicenseNumber, vehicleDetails);
        }
示例#3
0
        public bool checkIfPlateNumberExist(string i_PlateNumber) //return true if the plate is already in the system
        {
            bool plateIsExist = false;

            if (m_DictionaryVehicles.ContainsKey(i_PlateNumber))
            {
                VehicleDetails vehicleDetails = m_DictionaryVehicles[i_PlateNumber];
                plateIsExist = true;
            }

            return(plateIsExist);
        }