public StockOut(InventoryDBContext context, StockDTO stockDTO) { ID = stockDTO.ID; ProductID = stockDTO.ProductID; TotalQuantity = stockDTO.TotalQuantity; AvailableQuantity = stockDTO.AvailableQuantity; ProductDTO dto = context.GetProduct(stockDTO.ProductID); Product = new ProductOut(context, dto); }
public TransactionOut(InventoryDBContext context, TransactionDTO dto) : base(dto) { ProductDetails = new List <ProductOut>(); // fill ProductDetails string[] IDs = dto.ProductIDs.Split(','); foreach (string sID in IDs) { if (!string.IsNullOrEmpty(sID)) { int ID = int.Parse(sID); ProductDetails.Add(new ProductOut(context, context.GetProduct(ID))); } } if (dto.CustomerID != 0) { Customer = new CustomerOut(context, context.GetCustomer(dto.CustomerID)); } }
public PurchaseOut(InventoryDBContext context, PurchaseDTO dto) : base(dto) { this.ProductDetails = new List <ProductPurchaseDetails>(); // products string[] productIDs = dto.ProductIDs.Split(','); string[] productQuantities = dto.ProductQuantities.Split(','); string[] productBuyingPrices = dto.ProductBuyingPrices.Split(','); int numProducts = productIDs.Length; for (int i = 0; i < numProducts; ++i) { int id = int.Parse(productIDs[i]); ProductOut productOut = new ProductOut(context, context.GetProduct(id)); int Quantity = int.Parse(productQuantities[i]); double BuyingPrice = double.Parse(productBuyingPrices[i]); this.ProductDetails.Add(new ProductPurchaseDetails(productOut, Quantity, BuyingPrice)); } }