Пример #1
0
        public static PaymentTypeEnum AskForPaymentMethodMenu()
        {
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Enter Payment Type: ");// working with the enums
            Console.WriteLine("-----------------------------");
            Console.ForegroundColor = ConsoleColor.DarkRed;
            Console.WriteLine("1. Cash");
            Console.WriteLine("2. Credit/Debit Card");
            Console.WriteLine("3. Check");
            Console.ForegroundColor = ConsoleColor.Gray;

            string paymentType;
            var    paymentTypeParsed = 0;

            do
            {
                paymentType = Console.ReadLine();

                if (ValidateInput.IsAnInteger(paymentType))
                {
                    paymentTypeParsed = int.Parse(paymentType);
                }
                else
                {
                    Console.WriteLine("Please input valid payment type 1. Cash, 2. Credit/Debit Card, or 3. Check:");
                }
            }while (!ValidateInput.IsAnInteger(paymentType));

            return((PaymentTypeEnum)paymentTypeParsed);
        }
Пример #2
0
        public static int GetUserItemQuantity()
        {
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.WriteLine("Enter Quantity:");
            var takeUserQuantity = Console.ReadLine();

            if (ValidateInput.GetIsInteger(takeUserQuantity))
            {
                return(int.Parse(takeUserQuantity));
            }
            Console.WriteLine("Something went wrong");
            return(GetUserItemQuantity());
        }
Пример #3
0
        public static bool AskToContinueToShop()  //Think we've done this a bazillion times in class, Continue?  Yes or no?
        {
            Console.WriteLine("Would you like to continue to shop? (Y/N)");
            var continueYesNo = Console.ReadLine().ToLower();

            if (ValidateInput.CheckYesNo(continueYesNo))//todo
            {
                if (continueYesNo == "y")
                {
                    return(true);
                }
            }
            else
            {
                Console.WriteLine("Please make a valid input");
                AskToContinueToShop();
            }

            return(false);
        }