示例#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;
            }
        }
        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
        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
        public int BeginTransaction(float amount)
        {
            amount *= 100;
            int centen = (int)(amount);

            muntmachine.betala(centen);
            return(1);
        }
示例#6
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;
 }
示例#7
0
        public int BeginTransaction(float amount)
        {
            amount = amount * 100;
            int priceInt = (int)Math.Round(amount);

            machine.betala(priceInt);
            return(1);
        }
示例#8
0
        public override void Pay(float price)
        {
            IKEAMyntAtare2000 coin = new IKEAMyntAtare2000();

            coin.starta();
            coin.betala((int)Math.Round(price * 100));
            coin.stoppa();
        }
示例#9
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);
        }
示例#10
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;
     }
 }
示例#11
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;
            }
        }
示例#12
0
 public void pay(float price)
 {
     coin.betala((int)Math.Round(price * 100));
 }
示例#13
0
 public override int BeginTransaction(float price)
 {
     eater.starta();
     eater.betala((int)Math.Round(price * 100));
     return(1);
 }
示例#14
0
 protected override int BeginTransaction(float amount)
 {
     coinMachine.betala(amount);
     return(1);
 }
示例#15
0
 public override void BeginTransaction(float price)
 {
     coin.starta();
     coin.betala((int)Math.Round(price * 100));
 }