コード例 #1
0
ファイル: SaleLog.cs プロジェクト: bramboomen/mso3
        public void log(Ticket ticket)
        {
            sale[0] = ticket.From;
            sale[1] = ticket.To;
            sale[2] = ticket.Class.ToString();
            sale[3] = ticket.Way.ToString();
            sale[4] = ticket.Discount.ToString();
            sale[5] = ticket.Payment.ToString();

            this.Writelog();
        }
コード例 #2
0
        public void CreateTicket(UIInfo infoo, Ticket ticket)
        {
            this.date = ticket.date;
            this.price = ticket.price;
            this.trainClass = ticket.trainClass;
            this.startingStation = ticket.startingStation;
            this.destination = ticket.destination;
            this.discount = ticket.discount;

            CreateReceipt(infoo);
            PrintTicket();
        }
コード例 #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;
     }
 }
コード例 #4
0
ファイル: Sale.cs プロジェクト: RobinSikkens/MSO-Lab-3
 public void CreateTicket(string dep, string dest, UIClass type, UIDiscount disc, bool single)
 {
     t = new Ticket(dep, dest, type, disc, single);
 }
コード例 #5
0
ファイル: UI.cs プロジェクト: bramboomen/mso3
        private void Sale(Ticket ticket)
        {
            int tariefeenheden = Tariefeenheden.getTariefeenheden (ticket.From, ticket.To);

            // Compute the column in the table based on choices
            int tableColumn;
            // First based on class
            switch (ticket.Class) {
            case UIClass.FirstClass:
                tableColumn = 3;
                break;
            default:
                tableColumn = 0;
                break;
            }

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

            // Single or Return
            price *= ticket.Way;

            // Discount
            price -= price * ticket.Discount;

            // Pay
            DoPayment(ticket.Payment, price);

            // Log Sale
            SaleLog sale = new SaleLog();
            sale.log(ticket);
        }
コード例 #6
0
        public static void startTransaction(UIInfo info)
        {
            Ticket ticket = makeTicket(info.From, info.To, info.Class, info.Way);

            Payment.startPayment(ticket, info.Discount, info.Payment);
        }
コード例 #7
0
        public static Ticket makeTicket(string from, string to, UIClass cls, UIWay way)
        {
            Ticket ticket = new Ticket(from, to, cls, way);

            return(ticket);
        }