protected override void RenderContent(PrintContext printContext, XElement output) { string ListPriceKey = "List"; XElement baseXml = new XElement("base"); base.RenderContent(printContext, baseXml); XElement textFrame = baseXml.Element("TextFrame"); Item dataItem = GetDataItem(printContext); XElement xElement = RenderItemHelper.CreateXElement("TextFrame", base.RenderingItem, printContext.Settings.IsClient, dataItem); this.SetAttributes(xElement); output.Add(xElement); XAttribute xAttribute = output.Attribute("ParagraphStyle"); string text = (xAttribute != null && !string.IsNullOrEmpty(xAttribute.Value)) ? xAttribute.Value : "H1 Orange"; Field fieldname = dataItem.Fields[this.ContentFieldName]; DateField dateField = fieldname; var request = new GetProductPricesRequest(dataItem["ExternalID"]); var response = new PricingServiceProvider(); var price = response.GetProductPrices(request).Prices[ListPriceKey].Amount; //var price = response.Prices.ContainsKey(ListPriceKey) ? response.Prices[ListPriceKey].Amount : decimal.Zero; //var price = this.pricingService.GetProductPrice("11"); IEnumerable<XElement> result = this.FormatText(text, price.ToString("c")); xElement.Add(result); this.RenderChildren(printContext, xElement); }
public string GetExternalPrice(string ExternalID) { string ListPriceKey = "List"; var request = new GetProductPricesRequest(ExternalID); var response = new PricingServiceProvider(); var price = response.GetProductPrices(request).Prices[ListPriceKey].Amount; return price.ToString("c"); }
public string GetExternalPrice(string ExternalID) { string ListPriceKey = "List"; var request = new GetProductPricesRequest(ExternalID); var response = new PricingServiceProvider(); var price = response.GetProductPrices(request).Prices[ListPriceKey].Amount; return(price.ToString("c")); }
public ManagerResponse <GetProductPricesResult, IDictionary <string, Price> > GetProductPrices(string catalogName, string productId, bool includeVariants, string userId, params string[] priceTypeIds) { if (priceTypeIds == null) { priceTypeIds = _defaultPriceTypeIds; } var request = new GetProductPricesRequest(productId, priceTypeIds) { DateTime = GetCurrentDate() }; request.UserId = userId; request.CurrencyCode = CurrencyManager.CurrencyContext.CurrencyCode; var result = PricingServiceProvider.GetProductPrices(request); result.WriteToSitecoreLog(); return(new ManagerResponse <GetProductPricesResult, IDictionary <string, Price> >(result, result.Prices ?? new Dictionary <string, Price>())); }
protected override void RenderContent(PrintContext printContext, XElement output) { string ListPriceKey = "List"; XElement baseXml = new XElement("base"); base.RenderContent(printContext, baseXml); XElement textFrame = baseXml.Element("TextFrame"); Item dataItem = GetDataItem(printContext); XElement xElement = RenderItemHelper.CreateXElement("TextFrame", base.RenderingItem, printContext.Settings.IsClient, dataItem); this.SetAttributes(xElement); output.Add(xElement); XAttribute xAttribute = output.Attribute("ParagraphStyle"); string text = (xAttribute != null && !string.IsNullOrEmpty(xAttribute.Value)) ? xAttribute.Value : "H1 Orange"; Field fieldname = dataItem.Fields[this.ContentFieldName]; DateField dateField = fieldname; var request = new GetProductPricesRequest(dataItem["ExternalID"]); var response = new PricingServiceProvider(); var price = response.GetProductPrices(request).Prices[ListPriceKey].Amount; //var price = response.Prices.ContainsKey(ListPriceKey) ? response.Prices[ListPriceKey].Amount : decimal.Zero; //var price = this.pricingService.GetProductPrice("11"); IEnumerable <XElement> result = this.FormatText(text, price.ToString("c")); xElement.Add(result); this.RenderChildren(printContext, xElement); }