Inheritance: DomainEntity
Esempio n. 1
0
 public EditStockMovementItem(RecipeableItem itemToBook, Unit unitToBook)
 {
     ItemToBook = itemToBook;
     UnitToBook = unitToBook;
     QuantityToBook = 0.0m;
     QuantityLeft = 0.0m;
 }
Esempio n. 2
0
        public StockItem BookItemOutOfStock(Stock stock, decimal quantity, Unit unit, RecipeableItem recipeableItem)
        {
            if (stock == null)
                throw new ArgumentNullException("stock");

            var stockItem = FindStockItem(stock, unit, recipeableItem, stock.IsMainStock);
            var bookQuantity = _unitConverter.Convert(quantity, unit, stockItem.Unit);
            stockItem.Quantity -= bookQuantity;
            return stockItem;
        }
Esempio n. 3
0
        internal StockItem FindStockItem(Stock stock, Unit unit, RecipeableItem recipeableItem, bool createIfNotExists)
        {
            if (recipeableItem == null)
                throw new ArgumentNullException("recipeableItem");
            if (unit == null)
                throw new ArgumentNullException("unit");

            var stockItem = stock.StockItems.Where(x => x.RecipeableItem == recipeableItem).FirstOrDefault();
            if (stockItem == null)
            {
                if( !createIfNotExists )
                    throw new InvalidOperationException();
                stockItem = new StockItem { RecipeableItem = recipeableItem, Unit = unit };
                stock.AddStockItem(stockItem);
            }
            return stockItem;
        }
Esempio n. 4
0
 public new StockItem FindStockItem(Stock stock, Unit unit, RecipeableItem recipeableItem, bool createIfNotExists)
 {
     return base.FindStockItem(stock, unit, recipeableItem, createIfNotExists);
 }
Esempio n. 5
0
 public StockItem(decimal quantity, RecipeableItem recipeableItem)
 {
     Quantity = quantity;
     RecipeableItem = recipeableItem;
 }