Exemplo n.º 1
0
        public bool CheckRegistrationType(string i_RegType, out eRegistrationType o_eRegType)
        {
            bool isValidRegType = false;

            switch (i_RegType)
            {
            case "A":
                o_eRegType     = eRegistrationType.A;
                isValidRegType = true;
                break;

            case "A1":
                o_eRegType     = eRegistrationType.A1;
                isValidRegType = true;
                break;

            case "A2":
                o_eRegType     = eRegistrationType.A2;
                isValidRegType = true;
                break;

            case "B":
                o_eRegType     = eRegistrationType.B;
                isValidRegType = true;
                break;

            default:
                o_eRegType     = eRegistrationType.None;
                isValidRegType = false;
                break;
            }

            return(isValidRegType);
        }
Exemplo n.º 2
0
        private void printMotorcycleDialog()
        {
            string            userInput      = string.Empty;
            int               engineCapacity = 0;
            eRegistrationType regType        = eRegistrationType.None;

            Console.Write(@"What is your motorcycle registration type? (A,A1,A2,B)
>> ");
            userInput = Console.ReadLine();

            if (m_Garage.CheckRegistrationType(userInput, out regType) == true)
            {
                m_Garage.AddVehicleInfo("m_RegistrationType", regType);
            }
            else
            {
                throw new ArgumentException("Registration type");
            }

            Console.Clear();

            Console.Write(@"what is your motorcycle engine capacity?
>> ");
            userInput = Console.ReadLine();

            if (m_Garage.CheckEngineCapacity(userInput, ref engineCapacity) == true)
            {
                m_Garage.AddVehicleInfo("m_EngineCapacity", engineCapacity);
            }
            else
            {
                Console.WriteLine("Error: Invaild input. Please try again.{0}", Environment.NewLine);
            }

            Console.Clear();
        }