示例#1
0
        public Controller(WypozyczalniaDataClassesDataContext dbContext, BaseView initForm)
        {
            activeView     = initForm;
            this.dbContext = dbContext;
            // TODO: sprawdzenie typu przekazanego parametru
            clients = (ClientsView)initForm;

            // zainicjalizowanie pozostalych okienek
            employees = new EmployeesView();
            warehouse = new WarehouseView();
            clients.SetController(this);
            employees.SetController(this);
            warehouse.SetController(this);
            IsClosing = false;

            // inicjalizacja obiektow dbContext
            queriesClient    = new QueriesClient(dbContext);
            queriesEmployee  = new QueriesEmployee(dbContext);
            queriesWarehouse = new QueriesWarehouse(dbContext);

            // inicjalizacja DialogResult
            dr = DialogResult.None;

            // inicjalizacja danych w domyslnym okienku
            SelectAllAtActiveWindow();
            UpdateDBStatus();
        }
 public WarehouseViewModel(WarehouseView owner)
 {
     this.owner      = owner;
     Warehouses      = new ObservableCollection <Warehouse>();
     AddCommand      = DelegateCommand.Create(Add);
     ToDetailCommand = DelegateCommand.Create(owner.ToDetail);
 }
示例#3
0
        private void warehousebarButtonItem_ItemClick(object sender, ItemClickEventArgs e)
        {
            var warehouse = new WarehouseView();

            warehouse.ShowList();
            warehouse.ShowDialog();
        }
        private Dictionary <Guid, List <IEvent> > AddOrderLines(OrderAggregate orderAggregate, IEnumerable <OrderLineDto> orderLines)
        {
            IEnumerable <WarehouseView> warehouses = repository.Query <WarehouseView, WarehouseView>((w) => new WarehouseView {
                Id = w.Id, Items = w.Items
            });
            var events = new Dictionary <Guid, List <IEvent> >();

            foreach (OrderLineDto orderLine in orderLines)
            {
                WarehouseView warehouse = warehouses.FirstOrDefault(w => w.Items.Any(item => item.ProductId == orderLine.ProductNumber && item.Quantity >= orderLine.Quantity));

                var orderItem = new OrderLine
                {
                    ProductId = orderLine.ProductNumber,
                    Quantity  = orderLine.Quantity
                };

                if (warehouse != null)
                {
                    WarehouseAggregate warehouseAggregate = repository.Load <WarehouseAggregate>(warehouse.Id);
                    warehouseAggregate.SubstractItemQuantity(orderLine.ProductNumber, orderLine.Quantity);
                    AddAggEvents(events, warehouseAggregate.Id, warehouseAggregate.PendingEvents.ToList());
                    orderItem.WarehouseId = warehouseAggregate.Id;
                }
                else
                {
                    orderItem.Status = OrderLineStatus.OutOfStock.ToString();
                }

                orderAggregate.AddLine(orderItem);

                AddAggEvents(events, orderAggregate.Id, orderAggregate.PendingEvents.ToList());
            }
            return(events);
        }
示例#5
0
        private void MoveToWarehouse()
        {
            var warehouse = new WarehouseView();

            warehouse.Show();
            CloseAction();
        }
        private void ViewWarehouse(object sender, RoutedEventArgs e)
        {
            WarehouseView add     = new WarehouseView();
            StackPanel    element = new StackPanel();

            element.Orientation = Orientation.Horizontal;

            element.Children.Add(new TextBlock()
            {
                Text = "Просмотр склада "
            });


            Button btn = new Button();

            btn.Click          += deleteBtnClk;
            btn.Content         = "✕";
            btn.Background      = Brushes.Transparent;
            btn.BorderThickness = new Thickness(0);


            element.Children.Add(btn);
            TabItem item = new TabItem()
            {
                Content = add,
                Header  = element
            };

            ControlView.Items.Add(item);
            ControlView.SelectedItem = item;
            add.itemToDelete         = item;
        }
示例#7
0
        private void Warehouse_Click(object sender, RoutedEventArgs e)
        {
            //Opening requred form
            WarehouseView ViewNextForm = new WarehouseView();

            Frame.Content = ViewNextForm;
            Frame.NavigationService.RemoveBackEntry();
        }
        public ActionResult <WarehouseView> Update(WarehouseView stock)
        {
            var mapper = new MapperConfiguration(
                configuration => configuration.
                CreateMap <WarehouseView, WarehouseDTO>()).
                         CreateMapper();

            warehouseService.Update(mapper.Map <WarehouseView, WarehouseDTO>(stock));
            return(Ok());
        }
        public ActionResult <WarehouseView> Create(WarehouseView stock)
        {
            if (stock == null)
            {
                return(BadRequest("Invalid Datat"));
            }
            var mapper = new MapperConfiguration(
                configuration => configuration.
                CreateMap <WarehouseView, WarehouseDTO>()).
                         CreateMapper();

            warehouseService.MakeStock(mapper.Map <WarehouseView, WarehouseDTO>(stock));
            return(Ok());
        }
示例#10
0
 private void ManageWarehouseClickHandler(object sender, RoutedEventArgs e)
 {
     var warehouseView = new WarehouseView();
     warehouseView.ShowDialog();
 }
示例#11
0
        public ActionResult Index(int warehouseId)
        {
            WarehouseView model = this._warehouseService.GetWarehouseViewById(warehouseId);

            return(View(model));
        }