コード例 #1
0
ファイル: Sale.cs プロジェクト: RobinSikkens/MSO-Lab-3
        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);
        }
コード例 #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);
        }