Esempio n. 1
0
        public static string ColumnsValidation(string valInput)
        {
            valInput = Regex.Replace(valInput, "[s]", string.Empty);
            if (valInput.Equals("column1"))
            {
                return(valInput);
            }
            if (valInput.Equals("column2"))
            {
                return(valInput);
            }
            if (valInput.Equals("column3"))
            {
                return(valInput);
            }
            else
            {
                WriteText.InvalidInputText();
                WriteText.EnterChoice();
                EvenOddValidation(Console.ReadLine());
            }


            return(Regex.Replace(valInput, "[s]", string.Empty));
        }
Esempio n. 2
0
        public static int NumbersChoiceValidation(int valInput)
        {
            while (valInput < 0 || valInput > 36)
            {
                WriteText.InvalidInputText();
                WriteText.EnterChoice();
                valInput = NumberValidation(Console.ReadLine());
            }

            return(valInput);
        }
Esempio n. 3
0
 public static bool YesOrNo(string input)
 {
     if (input.ToLower() == "yes")
     {
         return(true);
     }
     if (input.ToLower() == "no")
     {
         return(false);
     }
     else
     {
         WriteText.InvalidInputText();
         WriteText.TypesYesOrNo();
         YesOrNo(Console.ReadLine());
     }
     return(true);
 }
Esempio n. 4
0
        // This is to validate that the user is not trying to enter an yletters
        // nor enter any values below zero or above nine
        public static int NumberValidation(string valInput)
        {
            string userInput;
            int    newInput;
            bool   keepGoing = false;

            do
            {
                keepGoing = int.TryParse(valInput, out newInput);
                if (!keepGoing)
                {
                    WriteText.InvalidInputText();
                    WriteText.EnterChoice();
                    userInput = Console.ReadLine();
                    keepGoing = int.TryParse(userInput, out newInput);
                    //keepGoing = InRangeValidation(newInput);
                }
            } while (!keepGoing);

            return(newInput);
        }
Esempio n. 5
0
        public static string DozensValidation(string valInput)
        {
            if (valInput.Equals("first"))
            {
                return(valInput);
            }
            if (valInput.Equals("second"))
            {
                return(valInput);
            }
            if (valInput.Equals("third"))
            {
                return(valInput);
            }
            else
            {
                WriteText.InvalidInputText();
                WriteText.EnterChoice();
                EvenOddValidation(Console.ReadLine());
            }


            return(valInput);
        }