public void firstInitialize() { ClientFactory clientFactory = new ClientFactory(); ClientGateway <Client> cg = (ClientGateway <Client>)clientFactory.GetClient(); TrainingFactory trainingFactory = new TrainingFactory(); TrainingGateway <Training> tg = (TrainingGateway <Training>)trainingFactory.GetTraining(); DiscountFactory discountFactory = new DiscountFactory(); DiscountGateway <DiscountCard> dg = (DiscountGateway <DiscountCard>)discountFactory.GetCard(); PurchaseFactory purchaseFactory = new PurchaseFactory(); PurchaseGateway <Purchase> pg = (PurchaseGateway <Purchase>)purchaseFactory.GetPurchase(); TicketFactory ticketFactory = new TicketFactory(); TicketGateway <Ticket> ticketg = (TicketGateway <Ticket>)ticketFactory.GetTicket(); Client client = cg.Select(tg.SelectLast().ClientId); clientName.Text = client.ToString(); if (client.CardId != null) { int toSetId = client.CardId ?? default(int); card = dg.Select(toSetId); } Ticket t = ticketg.Select(pg.SelectLast(card.RecordId).TicketId); ticketType.Text = t.Type; credit.Text = card.Credit.ToString(); }
private void acceptButton_Click(object sender, System.EventArgs e) { TrainingFactory trainingFactory = new TrainingFactory(); TrainingGateway <Training> tg = (TrainingGateway <Training>)trainingFactory.GetTraining(); Training tr = tg.SelectLast(clients[comboClient.SelectedIndex].RecordId); tr.TimeTo = DateTime.Now; tg.Update(tr); MessageBox.Show("Training was ended Successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Dispose(); }