private void MakeBetterTrip_Click(object sender, RoutedEventArgs e) { IRepController controller = new RepositoryController(); GenerateBestTrip trip = new GenerateBestTrip(controller.GetDBRequiersFrom(employee.center), controller.GetTrucks(employee.center).FirstOrDefault()); Trip trip1 = new Trip( trip.GetTheBetterTrip().Slots, trip.GetTheBetterTrip().ToCenter, employee.center, trip.truck, "ожидает отправки"); // controller.AddTripInDB(trip1); Trip trip_slot = controller.GetTripForSlots(employee.center); foreach (TruckSlot slot in trip1.Slots) { slot.SetTrip(trip_slot); slot.AddInDB(); } // trip1.SaveSlots(); TripContentArea.Content = TripsTable.GetInstance(employee); }
public Trips(Employee empl) { employee = empl; IRepController controller = new RepositoryController(); InitializeComponent(); TripContentArea.Content = TripsTable.GetInstance(employee); trips = TripsTable.GetInstance(employee).GetTripsCollection(); }
public static TripsTable GetInstance(Employee empl) { if (State == null) { State = new TripsTable(empl); } if (State.employee.Id != empl.Id) { State = new TripsTable(empl); } // State.AddTripsInCollection(empl); return(State); }
public static Trips GetInstance(Employee empl) { if (State == null) { State = new Trips(empl); } if (State.employee.Id != empl.Id) { State = new Trips(empl); } State.TripContentArea.Content = TripsTable.GetInstance(empl); return(State); }