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(); }
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(); }
// 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; } }
public void CreateTicket(string dep, string dest, UIClass type, UIDiscount disc, bool single) { t = new Ticket(dep, dest, type, disc, single); }
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); }
public static void startTransaction(UIInfo info) { Ticket ticket = makeTicket(info.From, info.To, info.Class, info.Way); Payment.startPayment(ticket, info.Discount, info.Payment); }
public static Ticket makeTicket(string from, string to, UIClass cls, UIWay way) { Ticket ticket = new Ticket(from, to, cls, way); return(ticket); }