Esempio n. 1
0
 public void payCredit(float price, UIPayment payMethod)
 {
     CreditCard c = new CreditCard ();
         c.Connect ();
         int ccid = c.BeginTransaction (price + 0.50f);
         c.EndTransaction (ccid);
 }
Esempio n. 2
0
        private Ticket getUIInfo()
        {
            UIClass cls;
            if (firstClass.Checked)
                cls = UIClass.FirstClass;
            else
                cls = UIClass.SecondClass;

            int way;
            if (oneWay.Checked)
                way = 1;
            else
                way = 2;

            float dis;
            if (noDiscount.Checked)
                dis = 0;
            else if (twentyDiscount.Checked)
                dis = 0.20f;
            else
                dis = 0.40f;

            Payment pment;
            ICard c;
            switch ((string)payment.SelectedItem) {
            case "Credit card":
                pment = new CardPayment(c = new CreditCard());
                break;
            case "Debit card":
                pment = new CardPayment(c = new DebitCard());
                break;
            default:
                pment = new CashPayment();
                break;
            }

            return new Ticket ((string)fromBox.SelectedItem,
                (string)toBox.SelectedItem,
                cls, way, dis, pment);
        }
Esempio n. 3
0
 // Pay
 public Payment(Ticket standard, UIInfo info)
 {
     switch (info.Payment) //Changing this in any way whatsoever does get rid of the cases but would just replace it with a different system to determine which method of payyment is used.
     {                     // no other method would make it easier to add extra payment methods, so this might as well stay.
         case UIPayment.CreditCard:
             CreditCard c = new CreditCard();
             c.Connect();
             int ccid = c.BeginTransaction(standard.price);
             c.EndTransaction(ccid);
             break;
         case UIPayment.DebitCard:
             DebitCard d = new DebitCard();
             d.Connect();
             int dcid = d.BeginTransaction(standard.price);
             d.EndTransaction(dcid);
             break;
         case UIPayment.Cash:
             IKEAMyntAtare2000 coin = new IKEAMyntAtare2000();
             coin.starta();
             coin.betala((int)Math.Round(standard.price * 100));
             coin.stoppa();
             break;
     }
 }
Esempio n. 4
0
 public CreditPayment()
 {
     c = new CreditCard();
 }
Esempio n. 5
0
 public CreditPayment()
 {
     c = new CreditCard();
 }