Пример #1
0
        public static void DeliverGoods(int orderNo)
        {
            Console.WriteLine("Deliver Goods Now");

            AmazonPayment p = new AmazonPayment();

            p.OrderNo = 213123;           // setter
            Console.WriteLine(p.OrderNo); //Getter
        }
Пример #2
0
        public static void xMain()
        {
            AmazonPayment p = new AmazonPayment();

            p.CcNo   = "4211111111"; //Setter
            p.Amount = 500;          //Setter

            //Function Call
            p.Pay("1002");      //Arguments: 400, "1002"
            p.Pay("1002", 400); //Arguments: 400, "1002"

            int  paymentNo = 0;
            bool status    = p.Pay("1002", 500, out paymentNo);

            Console.WriteLine(paymentNo);

            string paymentNum = "0";
            bool   status1    = p.Pay("1002", 500, ref paymentNum);

            Console.WriteLine(paymentNum);

            //Params
            p.PrintNum(1, 2, 3, 4, 5, 6, 7, 10, 11, 2, 321, 4324, 4324, 4234, 4324, 432432, 2432, 4324, 234, 23423, 423, 432, 4);

            return;

            bool isPaymentSuccessfull = false;

            do
            {
                try
                {
                    Console.WriteLine("Enter CC No: ");
                    string ccNo = Console.ReadLine();

                    PaymentCheckout(500, ccNo, 100);
                    isPaymentSuccessfull = true;
                    DeliverGoods(100);
                }
                catch (NullReferenceException ex1)
                {
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                finally
                {
                    Console.WriteLine("Remove from the cart");
                }
            }while (!isPaymentSuccessfull);

            Console.ReadLine();
        }