public void PostStock(string pageId, Stock stock) { XPathNavigator xPathNavigator = library.GetXmlNodeById(pageId).Current; IXmlNodeProductInformationExtractor productInformationExtractor = XmlNodeProductInformationExtractor.Instance; long storeId = productInformationExtractor.GetStoreId(xPathNavigator, false); stock.Sku = !string.IsNullOrEmpty(stock.Sku) ? stock.Sku : productInformationExtractor.GetSku(xPathNavigator, false); ProductService.Instance.SetStock(storeId, stock.Sku, !string.IsNullOrEmpty(stock.Value) ? stock.Value.ParseToDecimal() : null); }
public Stock GetStock(string pageId) { Stock stock = new Stock(); XPathNavigator xPathNavigator = library.GetXmlNodeById(pageId).Current; IXmlNodeProductInformationExtractor productInformationExtractor = XmlNodeProductInformationExtractor.Instance; long storeId = productInformationExtractor.GetStoreId(xPathNavigator, false); stock.Sku = productInformationExtractor.GetSku(xPathNavigator, false); decimal?stockValue = ProductService.Instance.GetStock(storeId, stock.Sku); stock.Value = stockValue != null?stockValue.Value.ToString("0.####") : ""; return(stock); }
public virtual string GetSku(string productIdentifier) { return(XmlNodeProductInformationExtractor.GetSku(library.GetXmlNodeById(productIdentifier).Current)); }