public static PeriodicConsumption Create(WorkPeriod currentWorkPeriod, IEnumerable <int> warehouseIds) { var result = new PeriodicConsumption { WorkPeriodId = currentWorkPeriod.Id, Name = currentWorkPeriod.StartDate + " - " + currentWorkPeriod.EndDate, StartDate = currentWorkPeriod.StartDate, EndDate = currentWorkPeriod.EndDate }; result.CreateWarehouseConsumptions(warehouseIds); return(result); }
public void CreatePeriodicConsumptionItems(int warehouseId, IList <InventoryItem> inventoryItems, PeriodicConsumption previousPc, List <InventoryTransaction> transactionItems) { var warehouseConsumption = WarehouseConsumptions.Single(x => x.WarehouseId == warehouseId); var previousWhc = previousPc != null ? previousPc.WarehouseConsumptions.SingleOrDefault(x => x.WarehouseId == warehouseConsumption.WarehouseId) : null; warehouseConsumption.CreatePeriodicConsumptionItems(inventoryItems, previousWhc, transactionItems); }