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 HttpResponseMessage Get(string pageId, long vatGroupId) { XPathNavigator xPathNavigator = library.GetXmlNodeById(pageId).Current; IXmlNodeProductInformationExtractor productInformationExtractor = XmlNodeProductInformationExtractor.Instance; long storeId = productInformationExtractor.GetStoreId(xPathNavigator, false); HttpResponseMessage response = new HttpResponseMessage { Content = new StringContent(VatGroupService.Instance.Get(storeId, vatGroupId).ToJson()) }; response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); return(response); }
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 ProductInformationExtractor( IXmlNodeProductInformationExtractor xmlNodeProductInformationExtractor ) { XmlNodeProductInformationExtractor = xmlNodeProductInformationExtractor; }
public ProductInformationExtractor(IXmlNodeProductInformationExtractor xmlNodeProductInformationExtractor) { XmlNodeProductInformationExtractor = xmlNodeProductInformationExtractor; }