Exemple #1
0
        public double ProcessCashPayment(CalculateOrderTotal orderCalculation)
        {
            var  calc      = new CalculateOrderTotal();
            bool checkcash = true;

            while (checkcash == true)
            {
                Console.Write("Please enter the payment amount: $");
                bool isUserEnteredCashADouble = double.TryParse(Console.ReadLine(), out userEnteredCash);
                if (isUserEnteredCashADouble == false)
                {
                    Console.WriteLine("You entered invalid amount!");
                    checkcash = true;
                }
                else if (orderCalculation.DoesUserHaveEnoughCashFunds(userEnteredCash))
                {
                    Console.WriteLine("Enough funds");
                    PaymentMethod = PaymentMethodEnum.Cash;
                    PaymentDate   = DateTime.Now;
                    PaymentStatus = PaymentStatusEnum.Complete;
                    checkcash     = false;
                }
                else
                {
                    Console.WriteLine("the payment amount wasn't enough!!");
                    checkcash = true;
                }
            }
            return(userEnteredCash);
        }
Exemple #2
0
        public double ProcessCashPayment()
        {
            var  calc      = new CalculateOrderTotal();
            bool checkcash = true;

            while (checkcash == true)
            {
                Console.WriteLine("Please enter the payment amount : ");
                bool isUserEnteredCashADouble = double.TryParse(Console.ReadLine(), out userEnteredCash);
                if (isUserEnteredCashADouble == false)
                {
                    Console.WriteLine("You entered invalid amount!");
                    checkcash = true;
                }
                else if (calc.DoesUserHaveEnoughCashFunds(userEnteredCash))
                {
                    Console.WriteLine("Enough funds");
                    checkcash = false;
                }
                else
                {
                    Console.WriteLine("the payment amount wasn't enough!! .");
                    checkcash = true;
                }
            }
            return(userEnteredCash);
        }