Exemplo n.º 1
0
        public void ProcessPayment(UIInfo info)
        {
            Payment p;
            float tprice = t.price;

            switch (info.Payment)
            {
                default:
                case UIPayment.Cash:
                    p = new CashPayment();
                    break;
                case UIPayment.CreditCard:
                    p = new CreditPayment();
                    tprice += 0.5f;
                    break;
                case UIPayment.DebitCard:
                    p = new DebitPayment();
                    break;
            }

            p.BeginTransaction(t.price);
            bool b = p.EndTransaction();

            if (b) { MessageBox.Show("Your payment has been processed succesfully."); }
            else { MessageBox.Show("Your payment was not processed."); }
            WriteToLog();
            PrintReceipt(date, tprice);
        }
Exemplo n.º 2
0
        public void ProcessPayment(UIInfo info)
        {
            Payment p;
            float   tprice = t.price;

            switch (info.Payment)
            {
            default:
            case UIPayment.Cash:
                p = new CashPayment();
                break;

            case UIPayment.CreditCard:
                p       = new CreditPayment();
                tprice += 0.5f;
                break;

            case UIPayment.DebitCard:
                p = new DebitPayment();
                break;
            }

            p.BeginTransaction(t.price);
            bool b = p.EndTransaction();

            if (b)
            {
                MessageBox.Show("Your payment has been processed succesfully.");
            }
            else
            {
                MessageBox.Show("Your payment was not processed.");
            }
            WriteToLog();
            PrintReceipt(date, tprice);
        }