private List <Ticket> CreateTickets(int planeSids, int flightId, string flightNumber) { List <Ticket> tickets = new List <Ticket>(); int startID = 0; if (Tickets.Count > 0) { startID = Tickets.Last().Id; } for (int i = 1; i <= planeSids; i++) { tickets.Add( new Ticket { Id = ++startID, FlightId = flightId, FlightNumber = flightNumber, IsSold = false, PlaseNumber = tickets.Count + 1, Price = 200 }); } Tickets.AddRange(tickets); return(tickets); }
private void setup() { // setting up new ticket for testing only Ticket newTicket1 = new Ticket("Testing Tickets", "Small string to indicate description!"); Ticket newTicket2 = new Ticket("Testing Tickets2", "Small string to indicate description!2"); Ticket newTicket3 = new Ticket("Testing Tickets3", "Small string to indicate description!3"); Tickets.AddRange(new Ticket[] { newTicket1, newTicket2, newTicket3 }); // Tickets.Add(newTicket); }
public PostgresContext(DbContextOptions options) : base(options) { //Database.EnsureDeleted(); Database.EnsureCreated(); if (Sessions.ToList().Count == 0) { PutData data = new PutData(); Sessions.AddRange(data.sessionModels); Tickets.AddRange(data.ticketModels); SaveChanges(); } }
public PointOfSaleViewModel() { aViewManager = DataHelpers.container.Get <ViewManager>(); // AddTicket(); CartData = new BindableCollection <UIElement>(); var notHnadled = DS.db.GetAll <PosTicket>(a => a.isHandled == 0) as IEnumerable <PosTicket>; Tickets.AddRange(notHnadled); BackgroundWorker worker = new BackgroundWorker(); timer = new Timer(new TimerCallback(SyncData), Tickets, 0, 5000); }
private void Initialize() { tickets = new BindableCollection <Ticket>(); try { Tickets.AddRange(unitOfWork.CreateTickets(currentuser)); } catch (AggregateException e) { SendMessage(InformationToUser.ServerError); return; } var list = Tickets.OrderByDescending(t => t.StartTime).ThenByDescending(t => t.EndTime).ToList(); Tickets.Clear(); Tickets.AddRange(list); }