コード例 #1
0
        public void betaling(TicketautomaatInvoer info, float price)
        {
            // Pay
            switch (info.Payment)
            {
            case UIPayment.CreditCard:
                CreditCard c = new CreditCard();
                c.Connect();
                int ccid = c.BeginTransaction(price);
                c.EndTransaction(ccid);
                break;

            case UIPayment.DebitCard:
                DebitCard d = new DebitCard();
                d.Connect();
                int dcid = d.BeginTransaction(price);
                d.EndTransaction(dcid);
                break;

            case UIPayment.Cash:
                IKEAMyntAtare2000 coin = new IKEAMyntAtare2000();
                coin.starta();
                coin.betala(price);
                coin.stoppa();
                break;
            }
        }
コード例 #2
0
        public static void startPayment(Ticket ticket, UIDiscount discount, UIPayment payment)
        {
            float price = Pricing.calcPrice(ticket, discount, payment);

            // Pay
            switch (payment)
            {
            case UIPayment.CreditCard:
                CreditCard c = new CreditCard();
                c.Connect();
                int ccid = c.BeginTransaction(price);
                c.EndTransaction(ccid);
                break;

            case UIPayment.DebitCard:
                DebitCard d = new DebitCard();
                d.Connect();
                int dcid = d.BeginTransaction(price);
                d.EndTransaction(dcid);
                break;

            case UIPayment.Cash:
                IKEAMyntAtare2000 coin = new IKEAMyntAtare2000();
                coin.starta();
                coin.betala((int)Math.Round(price * 100));
                coin.stoppa();
                break;
            }
        }
コード例 #3
0
ファイル: Sale.cs プロジェクト: dbrunek/MSO_assingment_3
        void Pay()
        {
            Price = (float)Math.Round(Price, 2);
            switch (payment.SelectedIndex)
            {
            case 0:
                CreditCard c = new CreditCard();
                c.Connect();
                Price += 0.5f;
                int ccid = c.BeginTransaction(Price);
                PaymentSuccesful = c.EndTransaction(ccid);
                break;

            case 1:
                DebitCard d = new DebitCard();
                d.Connect();
                int dcid = d.BeginTransaction(Price);
                PaymentSuccesful = d.EndTransaction(dcid);
                break;

            case 2:
                IKEAMyntAtare2000 coin = new IKEAMyntAtare2000();
                coin.starta();
                coin.betala(Price);
                PaymentSuccesful = coin.stoppa(true);     //false
                break;
            }
            PaymentSucces(PaymentSuccesful, Price);
        }
コード例 #4
0
ファイル: Payment.cs プロジェクト: Swendude/mso3
        public bool startPayment(float price)
        {
            switch (paymenttype)
            {
            case UIPayment.CreditCard:
                CreditCard c = new CreditCard();
                c.Connect();
                int ccid = c.BeginTransaction(price);
                c.EndTransaction(ccid);
                break;

            case UIPayment.DebitCard:
                DebitCard d = new DebitCard();
                d.Connect();
                int dcid = d.BeginTransaction(price);
                d.EndTransaction(dcid);
                break;

            case UIPayment.Cash:
                IKEAMyntAtare2000 coin = new IKEAMyntAtare2000();
                coin.starta();
                coin.betala((int)Math.Round(price * 100));
                coin.stoppa();
                break;
            }
            return(true);
            // This should return false upon failure, but that's not going to happen.
        }
コード例 #5
0
ファイル: Cash.cs プロジェクト: Jeswer9/LabThree
 public override bool HandlePayment(float price)
 {
     IKEAMyntAtare2000 c = new IKEAMyntAtare2000();
     c.starta();
     c.stoppa();
     c.betala((int)Math.Round(price * 100)+additionalCharge);
     return true;
 }
コード例 #6
0
        public override void Pay(float price)
        {
            IKEAMyntAtare2000 coin = new IKEAMyntAtare2000();

            coin.starta();
            coin.betala((int)Math.Round(price * 100));
            coin.stoppa();
        }
コード例 #7
0
        public override string[] Pay()
        {
            string[] log = new string[8];

            IKEAMyntAtare2000 coin = new IKEAMyntAtare2000();

            coin.starta();
            coin.betala((int)Math.Round(price * 100));
            coin.stoppa();
            log[0] = "success";

            return(log);
        }
コード例 #8
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;
     }
 }
コード例 #9
0
ファイル: Betaling.cs プロジェクト: annemik/mso
 public CashPayment()
 {
     coinmachine = new IKEAMyntAtare2000();
 }
コード例 #10
0
ファイル: UI.cs プロジェクト: Maxymulator/MSO3
        private void handlePayment(UIInfo info)
        {
            // *************************************
            // This is the code you need to refactor
            // *************************************

            // Get number of tariefeenheden
            int tariefeenheden = Tariefeenheden.getTariefeenheden(info.From, info.To);

            // Compute the column in the table based on choices
            int tableColumn;

            // First based on class
            switch (info.Class)
            {
            case UIClass.FirstClass:
                tableColumn = 3;
                break;

            default:
                tableColumn = 0;
                break;
            }
            // Then, on the discount
            switch (info.Discount)
            {
            case UIDiscount.TwentyDiscount:
                tableColumn += 1;
                break;

            case UIDiscount.FortyDiscount:
                tableColumn += 2;
                break;
            }

            // Get price
            float price = PricingTable.getPrice(tariefeenheden, tableColumn);

            if (info.Way == UIWay.Return)
            {
                price *= 2;
            }
            // Add 50 cent if paying with credit card
            if (info.Payment == UIPayment.CreditCard)
            {
                price += 0.50f;
            }

            // Pay
            switch (info.Payment)
            {
            case UIPayment.CreditCard:
                CreditCard c = new CreditCard();
                c.Connect();
                int ccid = c.BeginTransaction(price);
                c.EndTransaction(ccid);
                break;

            case UIPayment.DebitCard:
                DebitCard d = new DebitCard();
                d.Connect();
                int dcid = d.BeginTransaction(price);
                d.EndTransaction(dcid);
                break;

            case UIPayment.Cash:
                IKEAMyntAtare2000 coin = new IKEAMyntAtare2000();
                coin.starta();
                coin.betala((int)Math.Round(price * 100));
                coin.stoppa();
                break;
            }
        }
コード例 #11
0
ファイル: Payment.cs プロジェクト: bramboomen/mso3
 public CashPayment()
 {
     coin = new IKEAMyntAtare2000();
 }
コード例 #12
0
ファイル: CoinMachine.cs プロジェクト: DvanLaar/MSO
 public CoinEater()
 {
     eater = new IKEAMyntAtare2000();
 }
コード例 #13
0
ファイル: AdapterCoin.cs プロジェクト: Jorisdeboer/MSO
 public AdapterCoin()
 {
     coinMachine = new IKEAMyntAtare2000();
 }