Exemple #1
0
        public string GetOwnerPhone()
        {
            string input        = null;
            bool   isValidInput = true;

            Console.WriteLine("->Insert owner phone number(no more then 10 digits)");
            do
            {
                try
                {
                    input        = Console.ReadLine();
                    isValidInput = Treatment.IsValidOwnerPhone(input);
                }
                catch (FormatException)
                {
                    InvalidInputTryAgainMsg();
                    isValidInput = false;
                }
                catch (ValueOutOfRangeException ofr)
                {
                    Console.WriteLine(ofr.Message);
                    Console.WriteLine("try again");
                    isValidInput = false;
                }
            }while (!isValidInput);

            return(input);
        }