/// <summary> /// Gets the product stock. /// </summary> /// <param name="stockInfo">The product stock info. Contains info required to get product stock value. /// By default it's product code.</param> /// <returns>The product stock.</returns> public ProductStock GetStock(ProductStockInfo stockInfo) { ServiceClientArgs args = this.serviceClientArgsFactory.GetServiceClientArgs(); using (ProductStockServiceClient client = new ProductStockServiceClient()) { ProductStock stock = client.Get(stockInfo, args); return stock; } }
/// <summary> /// Gets the product stock. /// </summary> /// <param name="stockInfo">The product stock info. Contains info required to get product stock value. /// By default it's product code.</param> /// <returns>The product stock.</returns> public ProductStock GetStock(ProductStockInfo stockInfo) { ServiceClientArgs args = this.serviceClientArgsFactory.GetServiceClientArgs(); using (ProductStockServiceClient client = new ProductStockServiceClient()) { ProductStock stock = client.Get(stockInfo, args); return(stock); } }
/// <summary> /// Updates the specified stock info. /// </summary> /// <param name="stockInfo">The stock info.</param> /// <param name="expression">The expression.</param> public void Update(ProductStockInfo stockInfo, Expression <Func <long, long> > expression) { Func <long, long> func = expression.Compile(); ServiceClientArgs args = this.serviceClientArgsFactory.GetServiceClientArgs(); using (ProductStockServiceClient client = new ProductStockServiceClient()) { ProductStock stock = client.Get(stockInfo, args); long newStock = func(stock.Stock); client.Update(stockInfo.ProductCode, newStock, args); } }
/// <summary> /// Updates the specified stock info. /// </summary> /// <param name="stockInfo">The stock info.</param> /// <param name="expression">The expression.</param> public void Update(ProductStockInfo stockInfo, Expression<Func<long, long>> expression) { Func<long, long> func = expression.Compile(); ServiceClientArgs args = this.serviceClientArgsFactory.GetServiceClientArgs(); using (ProductStockServiceClient client = new ProductStockServiceClient()) { ProductStock stock = client.Get(stockInfo, args); long newStock = func(stock.Stock); client.Update(stockInfo.ProductCode, newStock, args); } }