public ProductRichListOfLinksItem(string title, string target, string linkText, string targetUrl, bool suppressLinks, string tagLine, string text, string image, string productId, bool showProductDetail, string htmlContent, Product productDetails)
     : base(title, target, linkText, targetUrl, suppressLinks, tagLine, text, image, htmlContent)
 {
     ProductId = productId;
     ShowProductDetail = showProductDetail;
     ProductDetails = productDetails;
     HtmlContent = htmlContent;
 }
 public CategoryNavigationItemViewModel(string title, string targetUrl, string urlSuffix, string target, Product productDetails, string categoryId)
 {
     Title = title;
     TargetUrl = targetUrl;
     UrlSuffix = urlSuffix;
     Target = target;
     ProductDetails = productDetails;
     CategoryId = categoryId;
 }
 public ComparisonTableRowViewModel(string title, string image, string targetUrl, string urlSuffix, string target, string linkText, Product productDetails, string cells)
 {
     Title = title;
     Image = image;
     TargetUrl = targetUrl;
     UrlSuffix = urlSuffix;
     Target = target;
     LinkText = linkText;
     ProductDetails = productDetails;
     Cells = cells;
 }
 public PromoTilesItemViewModel(string title, string subtitle, string description, string imageDesktop, string imageTablet, string imageMobile,
     string linkText, string targetUrl, string urlSuffix, string target, Product productDetails)
 {
     Title = title;
     Subtitle = subtitle;
     Description = description;
     ImageDesktop = imageDesktop;
     ImageTablet = imageTablet;
     ImageMobile = imageMobile;
     LinkText = linkText;
     TargetUrl = targetUrl;
     UrlSuffix = urlSuffix;
     Target = target;
     ProductDetails = productDetails;
 }
        public async Task <IEnumerable <Product> > GetProductsAsync(IEnumerable <ResourceUri> productUris)
        {
            // todo: consider parsing uris to get product id off the end and then call the other GetProducts signature with an array of longs
            // todo:   this will reduce the one round trip per product to just one for the whole mess
            using (var log = RequestLogger.Current.BeginJungoLog(this))
            {
                var uris     = productUris.ToArray();
                var prodGet  = new Task <Product> [uris.Length];
                var products = new Product[uris.Length];

                for (var idx = 0; idx < uris.Length; idx++)
                {
                    prodGet[idx] = GetProductAsync(uris[idx]);
                }

                var exceptions = new List <Exception>();
                // wait for all
                // put papa prods into response
                for (var idx = 0; idx < prodGet.Length; idx++)
                {
                    try
                    {
                        var product = await prodGet[idx].ConfigureAwait(false);
                        if (product != null)
                        {
                            products[idx] = product;
                        }
                    }
                    catch (Exception exc)
                    {
                        exceptions.Add(exc);
                    }
                }
                if (exceptions.Any())
                {
                    throw log.LogException(new AggregateException(exceptions));
                }
                return(products.Where(p => p != null));
            }
        }
Esempio n. 6
0
        private static CatalogPageViewModel GetDemoSearchResult()
        {
            var ret = new CatalogPageViewModel
            {
                CategoryId             = 1,
                CurrentPage            = 1,
                EnableFacets           = false,
                PageHasProdResultsPart = false,
                PageSize     = 20,
                TotalResults = 50,
                Products     = new Products()
            };

            var product = new Product[20];

            for (var i = 0; i < 20; i++)
            {
                product[i] = NewProduct();
            }

            ret.Products.Product = product;

            return(ret);
        }
Esempio n. 7
0
        public async Task<IEnumerable<Product>> GetProductsAsync(IEnumerable<ResourceUri> productUris)
        {
            // todo: consider parsing uris to get product id off the end and then call the other GetProducts signature with an array of longs
            // todo:   this will reduce the one round trip per product to just one for the whole mess
            using (var log = RequestLogger.Current.BeginJungoLog(this))
            {
                var uris = productUris.ToArray();
                var prodGet = new Task<Product>[uris.Length];
                var products = new Product[uris.Length];

                for (var idx = 0; idx < uris.Length; idx++)
                    prodGet[idx] = GetProductAsync(uris[idx]);

                var exceptions = new List<Exception>();
                // wait for all
                // put papa prods into response
                for (var idx = 0; idx < prodGet.Length; idx++)
                {
                    try
                    {
                        var product = await prodGet[idx].ConfigureAwait(false);
                        if (product != null)
                            products[idx] = product;
                    }
                    catch (Exception exc)
                    {
                        exceptions.Add(exc);
                    }
                }
                if (exceptions.Any())
                    throw log.LogException(new AggregateException(exceptions));
                return products.Where(p => p != null);
            }
        }
Esempio n. 8
0
 /// <summary>
 /// Create a product detail link for the base product.
 /// </summary>
 /// <param name="html"></param>
 /// <param name="product">The product</param>
 /// <returns></returns>
 public static string BaseProductDetailLink(this HtmlHelper html, Product product)
 {
     return html.AssureHttpUrl(LinkGenerator.GenerateProductLink(product.Variations == null ? product.Id : product.Variations.Product.First().GetParentProductId()));
 }
 public FlexBannerProductItemViewModel(string title, string promoText, string imageDesktop, string imageTablet, string imageMobile, string targetUrl, string urlSuffix, string target, string linkText, string htmlContent, int itemWidth, string badgeText, Product productDetails)
     : base(title, promoText, imageDesktop, imageTablet, imageMobile, targetUrl, urlSuffix, target, linkText, htmlContent, itemWidth)
 {
     ProductDetails = productDetails;
     BadgeText = badgeText;
 }