示例#1
0
        public void AddTransferItem(Storage from, Storage to, Inventory inventory, long quantity)
        {
            if (from.GetStockOf(inventory) < quantity)
            {
                throw new ApplicationException(string.Format(@"Not enough {0} stock stored in {1}", inventory.Name, from.Name));
            }

            from.Take(inventory, quantity);
            to.Store(inventory, quantity);

            _stockTransferItems.Add(new StockTransferItem(inventory, from, to, quantity));
        }
示例#2
0
        public virtual void AddMovementItem(Inventory inventory, Storage storage, long quantity)
        {
            foreach (var stockMovementItem in _stockMovementItems)
            {
                if (stockMovementItem.Inventory == inventory)
                {
                    var tempQty = stockMovementItem.Quantity;

                    _stockMovementItems.Remove(stockMovementItem);

                    quantity += tempQty;
                }
            }

            _stockMovementItems.Add(new StockMovementItem(this, inventory, storage, quantity));
        }