Exemplo n.º 1
0
        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);
        }