/// <summary> /// Generates flight tickets randomly for each customer. /// </summary> public static IList <Ticket> GetRandomTickets(int ticketsPerCustomer) { TestFacade facade = new TestFacade(); IList <Customer> customers = facade.GetAllCustomers(); IList <Flight> flights = facade.GetAllFlights(); IList <Ticket> tickets = new List <Ticket>(); foreach (Customer customer in customers) { for (int i = 0; i < ticketsPerCustomer; i++) { if (flights[i].DepartureTime < DateTime.Now.AddDays(-1)) { continue; } Ticket ticket = new Ticket { CustomerId = customer.Id, FlightId = flights[i].Id }; tickets.Add(ticket); } } return(tickets); }
private void InitializeDataCount() { Task.Run(() => { TestFacade facade = new TestFacade(); CustomersField.CurrentItemsNumber = facade.GetAllCustomers().Count; AirlinesField.CurrentItemsNumber = facade.GetAllAirlineCompanies().Count; FlightsField.CurrentItemsNumber = facade.GetAllFlights().Count; TicketsField.CurrentItemsNumber = facade.GetAllTickets().Count; }); }