public override void AddVehicleInformation(Dictionary <string, string> i_VehicleDetailsDic)
        {
            string         typeOfLicenseString;
            eTypeOfLicense typeOfLicenseValue;

            base.AddVehicleInformation(i_VehicleDetailsDic);

            if (!i_VehicleDetailsDic.TryGetValue("The type of the license (A/A1/B1/B2)", out typeOfLicenseString))
            {
                throw new KeyNotFoundException("Please enter the type of license");
            }

            try
            {
                typeOfLicenseValue = (eTypeOfLicense)Enum.Parse(typeof(eTypeOfLicense), typeOfLicenseString, true);
            }
            catch (ArgumentException)
            {
                throw new ArgumentException(string.Format("'{0}' is not a member of the type of licenses. please choose one of the options: A/A1/B1/B2 ", typeOfLicenseString));
            }

            if (!Enum.IsDefined(typeof(eTypeOfLicense), typeOfLicenseString))
            {
                throw new ArgumentException(string.Format("'{0}' is not a member of the type of licenses. please choose one of the options: A/A1/B1/B2 ", typeOfLicenseString));
            }

            TypeOfLicense = typeOfLicenseValue;
        }
Пример #2
0
 public static void setProperties(Vehicle vehicle, eTypeOfLicense i_TypeOfLicense, int i_EngineCapacity)
 {
     vehicle.m_Properties.Add(new Property("Type of license", typeof(eTypeOfLicense)), i_TypeOfLicense);
     vehicle.m_Properties.Add(new Property("Engine capacity", typeof(int)), i_EngineCapacity);
 }
 public Information(eTypeOfLicense i_TypeOfLicense, int i_CapacityOfEngine)
 {
     r_TypeOfLicense    = i_TypeOfLicense;
     r_CapacityOfEngine = i_CapacityOfEngine;
 }
Пример #4
0
 public Motorcycle(eTypeOfLicense i_TypeOfLicense, int i_EngineCapacity)
 {
     this.m_TypeOfLicense  = i_TypeOfLicense;
     this.m_EngineCapacity = i_EngineCapacity;
 }