Ejemplo n.º 1
0
        internal static VehicleGarageCard CreateFirstCard(
            string i_OwnerName,
            string i_OwnerPhone,
            string i_ModelName,
            string i_LicenseNumber,
            string i_WheelManufacturerName,
            eVehiclesType i_VehicleType)
        {
            Vehicle toReturn;

            switch (i_VehicleType)
            {
            case eVehiclesType.ElectricMotorcycle:
            case eVehiclesType.FuelBasedMotorcycle:
                toReturn = new MotorCycle(i_ModelName, i_LicenseNumber, i_WheelManufacturerName, i_VehicleType);
                break;

            case eVehiclesType.ElectricCar:
            case eVehiclesType.FuelBasedCar:
                toReturn = new RegularCar(i_ModelName, i_LicenseNumber, i_WheelManufacturerName, i_VehicleType);
                break;

            default:
                toReturn = new Truck(i_ModelName, i_LicenseNumber, i_WheelManufacturerName, i_VehicleType);
                break;
            }

            VehicleGarageCard cardToReturn = new VehicleGarageCard(i_OwnerName, i_OwnerPhone, toReturn);

            return(cardToReturn);
        }
        public void InsertANewVehicleCardIntoTheGarage(
            string i_OwnerName,
            string i_OwnerCellPhone,
            string i_ModelName,
            string i_LicenseNumber,
            string i_WheelManufacturerName,
            Registration.eVehiclesType i_Type)
        {
            if (this.IsLicenseNumberExist(i_LicenseNumber))
            {
                throw new ArgumentException("Sorry.. you must have a mistake, the license number already exists in our system.");
            }

            VehicleGarageCard cardVehicle = Registration.CreateFirstCard(i_OwnerName, i_OwnerCellPhone, i_ModelName, i_LicenseNumber, i_WheelManufacturerName, i_Type);

            m_Vehicles.Add(i_LicenseNumber, cardVehicle);

            m_CurrentVehicleCardToInsert = cardVehicle;
        }
 public void MoveCurrentVehicleCardOutOfRegistration()
 {
     m_CurrentVehicleCardToInsert = null;
 }
 public Garage()
 {
     m_Vehicles = new Dictionary <string, VehicleGarageCard>();
     m_CurrentVehicleCardToInsert = null;
 }