Ejemplo n.º 1
0
        /// <summary>
        ///     Set parameter values with provided product object
        /// </summary>
        /// <param name="p">Product information.</param>
        /// <param name="hccApp">An instance of the Hotcakes Application context.</param>
        public SingleProductViewModel(Product p, HotcakesApplication hccApp)
        {
            if (p == null)
            {
                throw new ArgumentNullException("Product");
            }
            if (hccApp == null)
            {
                throw new ArgumentNullException("HotcakesApplication");
            }

            UserPrice = hccApp.PriceProduct(p, hccApp.CurrentCustomer, null, hccApp.CurrentlyActiveSales);
            Item      = p;

            ProductLink = UrlRewriter.BuildUrlForProduct(p);
            ImageUrls   = new ProductImageUrls();
            ImageUrls.LoadProductImageUrls(hccApp, p);

            SwatchDisplay = ImageHelper.GenerateSwatchHtmlForProduct(p, hccApp);

#pragma warning disable 0612, 0618
            ImageUrl = DiskStorage.ProductImageUrlSmall(
                hccApp,
                p.Bvin,
                p.ImageFileSmall,
                hccApp.IsCurrentRequestSecure());

            OriginalImageUrl = DiskStorage.ProductImageUrlOriginal(
                hccApp,
                p.Bvin,
                p.ImageFileSmall,
                hccApp.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection);
#pragma warning restore 0612, 0618
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Set default values using parameterized constructor
        ///     <remarks>
        ///         This generally called from the products controller to set proper urls and product link for the bundled product
        ///     </remarks>
        /// </summary>
        /// <param name="bp">Parameter passed for existing  BundledProduct object</param>
        /// <param name="hccApp">An instance of the Hotcakes Application context.</param>
        public BundledProductViewModel(BundledProductAdv bp, HotcakesApplication hccApp)
        {
            BundledProductAdv = bp;
            Item = bp.BundledProduct;

            ProductLink = UrlRewriter.BuildUrlForProduct(BundledProductAdv.BundledProduct);
            ImageUrls   = new ProductImageUrls();
            ImageUrls.LoadProductImageUrls(hccApp, BundledProductAdv.BundledProduct);

            SwatchDisplay = ImageHelper.GenerateSwatchHtmlForProduct(BundledProductAdv.BundledProduct, hccApp);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Set parameter values with provided product object
        /// </summary>
        /// <param name="p">Product information.</param>
        /// <param name="hccApp">An instance of the Hotcakes Application context.</param>
        public SingleProductViewModel(Product p, HotcakesApplication hccApp)
        {
            if (p == null)
            {
                throw new ArgumentNullException("Product");
            }
            if (hccApp == null)
            {
                throw new ArgumentNullException("HotcakesApplication");
            }

            UserPrice = hccApp.PriceProduct(p, hccApp.CurrentCustomer, null, hccApp.CurrentlyActiveSales);
            Item      = p;

            ProductLink          = UrlRewriter.BuildUrlForProduct(p);
            ProductAddToCartLink = UrlRewriter.BuildUrlForProductAddToCart(p);
            ImageUrls            = new ProductImageUrls();
            ImageUrls.LoadProductImageUrls(hccApp, p);

            SwatchDisplay = ImageHelper.GenerateSwatchHtmlForProduct(p, hccApp);
        }