示例#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);
        }
示例#2
0
        public void Execute()
        {
            IRepController repository = new RepositoryController();
            Employee       employee   = EmployeeWindow.GetInstance().employe;
            ObservableCollection <ProductPosition> products = repository.GetStorageProducts(employee.center);

            foreach (ProductPosition product in products)
            {
                ProductsViewer.ProductsOnStorage.Add(new ViewerObject(product));
            }

            ObservableCollection <Require> requiersTo   = repository.GetDBRequiersTo(employee.center);
            ObservableCollection <Require> requiersFrom = repository.GetDBRequiersFrom(employee.center);

            foreach (ViewerObject viewObj in ProductsViewer.ProductsOnStorage)
            {
                viewObj.SetNumberFrom(requiersFrom);
                viewObj.SetNumberTo(requiersTo);
            }
        }