void AddBasicProduct(Inventory inv) { InventorySummaryItem isi = new InventorySummaryItem { ProductId = inv.Product.Id, Description = inv.Product.Description, Product = inv.Product, Warehouse = inv.Warehouse, Qty = inv.Balance, IsConsolidatedProductChild = false, ProductType = GetProductType(inv.Product) }; Items.Add(isi); }
void AddConsolidatedProduct(Inventory inv) { ConsolidatedProduct cp = inv.Product as ConsolidatedProduct; InventorySummaryItem isi = new InventorySummaryItem { ProductId = cp.Id, Description = cp.Description, ProductType = DomainProductType.Consolidated, Product = inv.Product, Warehouse = inv.Warehouse, Qty = inv.Balance, IsConsolidatedProductChild = false, HomeConsolidatedProductId = cp.Id, Level = 0, HomeConsolidatedProduct = cp, ParentConsolidatedProduct = null, QuantityPerConsolidatedProduct = 1, TotalProductsForHomeConsolidatedProduct = inv.Balance }; Items.Add(isi); var fps = cp.GetFlattenedProducts(); foreach (var fp in fps) { var isic = new InventorySummaryItem { ProductId = fp.Product.Id, Description = fp.Product.Description, ProductType = GetProductType(fp.Product), Warehouse = inv.Warehouse, IsConsolidatedProductChild = true, HomeConsolidatedProductId = cp.Id, Level = fp.Level, HomeConsolidatedProduct = cp, ParentConsolidatedProduct = fp.DirectParent, QuantityPerConsolidatedProduct = fp.QuantityPerConsolidatedProduct, TotalProductsForHomeConsolidatedProduct = fp.TotalProductsForHomeConsolidatedProduct, Qty = inv.Balance * fp.TotalProductsForHomeConsolidatedProduct }; Items.Add(isic); } }