コード例 #1
0
ファイル: PayInfo.cs プロジェクト: NSavenije/MSO3
 public void payCredit(float price, UIPayment payMethod)
 {
     CreditCard c = new CreditCard ();
         c.Connect ();
         int ccid = c.BeginTransaction (price + 0.50f);
         c.EndTransaction (ccid);
 }
コード例 #2
0
ファイル: PayInfo.cs プロジェクト: NSavenije/MSO3
 public void payCash(float price, UIPayment payMethod)
 {
     CoinMachineAdap coin = new CoinMachineAdap();
      coin.start();
      coin.pay(price);
      coin.stop();
 }
コード例 #3
0
ファイル: PayInfo.cs プロジェクト: NSavenije/MSO3
 public void payDebit(float price, UIPayment payMethod)
 {
     DebitCard d = new DebitCard();
     d.Connect();
     int dcid = d.BeginTransaction(price);
     d.EndTransaction(dcid);
 }
コード例 #4
0
ファイル: UI.cs プロジェクト: DvanLaar/MSO
        private void makePayment(UIPayment payment, float price)
        {
            // Select the correct method of payment
            PaymentStrategy payMethod;

            switch (payment)
            {
            case UIPayment.CreditCard:
                // Add 50 cents if paying by credit card
                price    += 0.50f;
                payMethod = new CreditCard();
                break;

            case UIPayment.DebitCard:
                payMethod = new DebitCard();
                break;

            case UIPayment.Cash:
                payMethod = new CoinEater();
                break;

            default:
                payMethod = null;
                throw new Exception("No payment found");
            }

            // Pay
            payMethod.Pay(price);
        }
コード例 #5
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;
            }
        }
コード例 #6
0
ファイル: Automaat.cs プロジェクト: 4144805/MSO-Lab3
        private bool betaal(UIPayment betaalmiddel, float prijs)
        {
            IBetaalmiddel fysiekBetaalmiddel = new CreditCard(); // Initialiseer betaalmiddel als CreditCard, anders mogen we geen methodes ervan aanroepen.

            switch (betaalmiddel)
            {
            case UIPayment.CreditCard:
                prijs += 0.50f;
                fysiekBetaalmiddel = new CreditCard();
                break;

            case UIPayment.DebitCard:
                fysiekBetaalmiddel = new DebitCard();
                break;

            case UIPayment.Chipknip:
                fysiekBetaalmiddel = new Chipknip();
                break;

            case UIPayment.Cash:
                fysiekBetaalmiddel = new Cash();
                break;
            }
            fysiekBetaalmiddel.Connect();
            int id = fysiekBetaalmiddel.BeginTransaction(prijs);

            // Return True als de betaling succesvol is afgerond.
            return(fysiekBetaalmiddel.EndTransaction(id));
        }
コード例 #7
0
ファイル: Paymentfee.cs プロジェクト: Swendude/mso3
 //This should be a hastable, but I couldn't get the import to work on the Mono framework so I used a switch
 public static float getFee(UIPayment payment)
 {
     if (payment == UIPayment.CreditCard)
     {
         return(0.50f);
     }
     return(0.00f);
 }
コード例 #8
0
ファイル: Purchase.cs プロジェクト: Swendude/mso3
 public Purchase(String arr, String dep, UIDiscount discountt, UIClass class_t, UIPayment paymenttype)
 {
     dep_station  = dep;
     arr_station  = arr;
     discounttype = discountt;
     classtype    = class_t;
     paymentType  = paymenttype;
 }
コード例 #9
0
ファイル: PayInfo.cs プロジェクト: NSavenije/MSO3
        public void payCash(float price, UIPayment payMethod)
        {
            CoinMachineAdap coin = new CoinMachineAdap();

            coin.start();
            coin.pay(price);
            coin.stop();
        }
コード例 #10
0
ファイル: PayInfo.cs プロジェクト: NSavenije/MSO3
        public void payCredit(float price, UIPayment payMethod)
        {
            CreditCard c = new CreditCard();

            c.Connect();
            int ccid = c.BeginTransaction(price + 0.50f);

            c.EndTransaction(ccid);
        }
コード例 #11
0
ファイル: PayInfo.cs プロジェクト: NSavenije/MSO3
        public void payDebit(float price, UIPayment payMethod)
        {
            DebitCard d = new DebitCard();

            d.Connect();
            int dcid = d.BeginTransaction(price);

            d.EndTransaction(dcid);
        }
コード例 #12
0
 public UIInfo(string from, string to, UIClass cls, UIWay way, UIDiscount discount, UIPayment payment)
 {
     this.from     = from;
     this.to       = to;
     this.cls      = cls;
     this.way      = way;
     this.discount = discount;
     this.payment  = payment;
 }
コード例 #13
0
ファイル: UIInfo.cs プロジェクト: RobinSikkens/MSO-Lab-3
 public UIInfo(string from, string to, UIClass cls, UIWay way, UIDiscount discount, UIPayment payment)
 {
     this.from = from;
     this.to = to;
     this.cls = cls;
     this.way = way;
     this.discount = discount;
     this.payment = payment;
 }
コード例 #14
0
 public TicketautomaatInvoer(string from, string to, UIClass cls, UIWay way, UIDiscount discount, UIPayment payment)
 {
     this.from     = from;
     this.to       = to;
     this.cls      = cls;
     this.way      = way;
     this.discount = discount;
     this.payment  = payment;
 }
コード例 #15
0
ファイル: Bestelling.cs プロジェクト: 4144805/MSO-Lab3
 public Bestelling(string from, string to, UIClass cls, UIWay way, UIDiscount discount, UIPayment payment, int aantalKaartjes)
 {
     this.from           = from;
     this.to             = to;
     this.cls            = cls;
     this.way            = way;
     this.discount       = discount;
     this.payment        = payment;
     this.aantalKaartjes = aantalKaartjes;
 }
コード例 #16
0
        public Sale(UIPayment paymentMethod)
        {
            switch (paymentMethod)
            {
            case UIPayment.CreditCard:
                payment = new PaymentCredit();
                break;

            case UIPayment.DebitCard:
                payment = new PaymentDebit();
                break;

            case UIPayment.Cash:
                payment = new PaymentCash();
                break;
            }
        }
コード例 #17
0
        public static float calcPrice(Ticket ticket, UIDiscount discount, UIPayment payment)
        {
            float price          = 0;
            int   tariefeenheden = Tariefeenheden.getTariefeenheden(ticket.from, ticket.to);
            int   tableColumn;

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

            default:
                tableColumn = 0;
                break;
            }

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

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

            // Get price
            price = PricingTable.getPrice(tariefeenheden, tableColumn);
            if (ticket.way == UIWay.Return)
            {
                price *= 2;
            }
            // Add 50 cent if paying with credit card
            if (payment == UIPayment.CreditCard)
            {
                price += 0.50f;
            }

            return(price);
        }
コード例 #18
0
ファイル: PaymentFactory.cs プロジェクト: Jeswer9/LabThree
        public bool MakePayment(UIPayment uiPayment, float price)
        {
            switch (uiPayment)
            {
                case UIPayment.CreditCard:
                    payment = new CreditCard();
                    break;
                case UIPayment.DebitCard:
                    payment = new DebitCard();
                    break;
                case UIPayment.Chipknip:
                    payment = new Chipknip();
                    break;
                case UIPayment.Cash:
                    payment = new Cash();
                    break;
            }

            return payment.HandlePayment(price);
        }
コード例 #19
0
        void paymethod(float price, UIPayment payMethod)
        {
            //Create a payInfo class
            PayInfo payInfo = new PayInfo();

            //Select the paymethod and call upon the right method in PayInfo.cs
            switch (payMethod)
            {
            case UIPayment.CreditCard:
                payInfo.payCredit(price, payMethod);
                break;

            case UIPayment.DebitCard:
                payInfo.payDebit(price, payMethod);
                break;

            case UIPayment.Cash:
                payInfo.payCash(price, payMethod);
                break;
            }
        }
コード例 #20
0
 public void CreateReceipt(UIInfo infoo)
 {
     this.payment = infoo.Payment;
     PrintReceipt();
 }
コード例 #21
0
ファイル: Payment.cs プロジェクト: Swendude/mso3
 public Payment(UIPayment pt)
 {
     paymenttype = pt;
 }
コード例 #22
0
ファイル: UI.cs プロジェクト: NSavenije/MSO3
        void paymethod(float price, UIPayment payMethod)
        {
            //Create a payInfo class
             PayInfo payInfo = new PayInfo();

             //Select the paymethod and call upon the right method in PayInfo.cs
            switch (payMethod) {
            case UIPayment.CreditCard:
               payInfo.payCredit(price, payMethod);
                break;
            case UIPayment.DebitCard:
            payInfo.payDebit(price, payMethod);
                break;
            case UIPayment.Cash:
               payInfo.payCash(price, payMethod);
                break;
            }
        }
コード例 #23
0
ファイル: Paymentfee.cs プロジェクト: Swendude/mso3
 // Calculates the total prices based on the type of payment
 public static float calculatePaymentPrice(float total, UIPayment payment)
 {
     return(total + getFee(payment));
 }
コード例 #24
0
 public void PrintTicket(string from, string to, UIClass cls, UIWay way, UIDiscount discount, UIPayment payment)
 {
     MessageBox.Show("Uw ticket\nStart location: " + from + "\nDestination: " + to +
                     "\nClass: " + cls + "\nWay: " + way + "\nDiscount: " + discount + "\nPayment method: " + payment);
 }