Esempio n. 1
0
 private void LoadImagePreview(Product p)
 {
     ucImageUploadLarge.ImageUrl = DiskStorage.ProductImageUrlMedium(HccApp, p.Bvin, p.ImageFileMedium,
                                                                     HccApp.IsCurrentRequestSecure());
     imgPreviewSmall.ImageUrl = DiskStorage.ProductImageUrlSmall(HccApp, p.Bvin, p.ImageFileSmall,
                                                                 HccApp.IsCurrentRequestSecure());
 }
Esempio n. 2
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
        }
Esempio n. 3
0
        private void LoadWishList()
        {
            var w        = HccApp.CatalogServices.WishListItems.FindByCustomerIdPaged(CustomerId, 1, 100);
            var products = new List <Product>();

            foreach (var item in w)
            {
                var n = HccApp.CatalogServices.Products.FindWithCache(item.ProductId);

                n.ImageFileSmall = DiskStorage.ProductImageUrlSmall(
                    HccApp,
                    n.Bvin,
                    n.ImageFileSmall,
                    Request.IsSecureConnection);
                products.Add(n);
            }

            if (products.Count > 0)
            {
                WishList.Visible    = true;
                WishList.DataSource = products;
                WishList.DataBind();
            }
            else
            {
                lblNoWishListItems.Visible = true;
            }
        }
Esempio n. 4
0
 public ProductPurchasedWithInfo(HotcakesApplication hccApp, Product product)
 {
     ImageUrl = DiskStorage.ProductImageUrlSmall(hccApp, product.Bvin, product.ImageFileSmall,
                                                 hccApp.IsCurrentRequestSecure());
     ProductId   = product.Bvin;
     ProductName = product.ProductName;
     UpdatedOn   = DateHelper.ConvertUtcToStoreTime(hccApp, product.LastUpdated).ToString("MMM dd, yyyy");
     CreatedOn   = DateHelper.ConvertUtcToStoreTime(hccApp, product.CreationDateUtc).ToString("MMM dd, yyyy");
 }
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     if (Request.QueryString["id"] != null)
     {
         var prod = HccApp.CatalogServices.Products.FindWithCache(Request.QueryString["id"]);
         productImage.ImageUrl = DiskStorage.ProductImageUrlSmall(HccApp, prod.Bvin, prod.ImageFileSmall,
                                                                  HccApp.IsCurrentRequestSecure());
         productLabel.Text    = prod.ProductName;
         productSkuLabel.Text = prod.Sku;
         productPrice.Text    = prod.SitePrice.ToString("C");
     }
 }
Esempio n. 6
0
        public SingleProductJsonModel(Product product, HotcakesApplication app)
        {
            ProductLink   = UrlRewriter.BuildUrlForProduct(product);
            ProductName   = product.ProductName;
            ImageSmallUrl = DiskStorage.ProductImageUrlSmall(app, product.Bvin, product.ImageFileSmall,
                                                             app.IsCurrentRequestSecure());
            ImageSmallAltText = product.ImageFileSmallAlternateText;
            ProductSku        = product.Sku;
            Bvin = product.Bvin;

            var up = app.PriceProduct(product, app.CurrentCustomer, null, app.CurrentlyActiveSales);

            UserPrice = up.DisplayPrice();
        }
Esempio n. 7
0
        /// <summary>
        ///     Load the Image information for the product
        /// </summary>
        /// <param name="hccApp">An instance of the Hotcakes Application context.</param>
        /// <param name="product">Product for which its required to have the image details.</param>
        public void LoadProductImageUrls(HotcakesApplication hccApp, Product product)
        {
            OriginalUrl = DiskStorage.ProductImageUrlOriginal(hccApp, product.Bvin, product.ImageFileSmall,
                                                              hccApp.IsCurrentRequestSecure());
            MediumlUrl = DiskStorage.ProductImageUrlMedium(hccApp, product.Bvin, product.ImageFileMedium,
                                                           hccApp.IsCurrentRequestSecure());
            SmallUrl = DiskStorage.ProductImageUrlSmall(hccApp, product.Bvin, product.ImageFileSmall,
                                                        hccApp.IsCurrentRequestSecure());
            MediumlAltText = product.ImageFileMediumAlternateText;
            SmallAltText   = product.ImageFileSmallAlternateText;
            TinyUrl        = SmallUrl;

            if (string.IsNullOrWhiteSpace(MediumlAltText))
            {
                MediumlAltText = SmallAltText;
            }
        }
Esempio n. 8
0
        protected void gvProducts_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var imgProduct     = e.Row.FindControl("imgProduct") as Image;
                var litProductName = e.Row.FindControl("litProductName") as Literal;

                var li      = e.Row.DataItem as ContentBlockSettingListItem;
                var product = HccApp.CatalogServices.Products.FindWithCache(li.Setting1);
                if (product != null)
                {
                    imgProduct.ImageUrl = DiskStorage.ProductImageUrlSmall(HccApp, product.Bvin, product.ImageFileSmall,
                                                                           Page.Request.IsSecureConnection);
                    litProductName.Text = product.ProductName;
                }

                e.Row.Attributes["id"] = li.Id;
            }
        }
Esempio n. 9
0
        private void RenderProduct(Product product)
        {
            var price = HccApp.PriceProduct(product, HccApp.CurrentCustomer, null, HccApp.CurrentlyActiveSales);

            var imageUrl = DiskStorage.ProductImageUrlSmall(HccApp, product.Bvin, product.ImageFileSmall,
                                                            Page.Request.IsSecureConnection);

            var htmlDiv = new HtmlGenericControl("div");

            htmlDiv.Attributes["class"] = "hcBlockContent";
            htmlDiv.Controls.Add(new LiteralControl(product.ProductName));

            phProduct.Controls.Clear();
            phProduct.Controls.Add(new HtmlImage
            {
                Src = imageUrl
            });

            phProduct.Controls.Add(htmlDiv);
        }
Esempio n. 10
0
        protected void gvRelatedProducts_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var imgProduct     = e.Row.FindControl("imgProduct") as Image;
                var litProductName = e.Row.FindControl("litProductName") as Literal;

                var prodRelat = e.Row.DataItem as ProductRelationship;
                var product   = HccApp.CatalogServices.Products.Find(prodRelat.RelatedProductId);
                if (product != null)
                {
                    imgProduct.ImageUrl = DiskStorage.ProductImageUrlSmall(HccApp, product.Bvin, product.ImageFileSmall,
                                                                           Page.Request.IsSecureConnection);
                    imgProduct.AlternateText = product.ImageFileSmallAlternateText;
                    litProductName.Text      = product.ProductName;
                }

                e.Row.Attributes["id"] = prodRelat.RelatedProductId;
            }
        }
Esempio n. 11
0
        private void gvProducts_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var prod     = e.Row.DataItem as Product;
                var lnkImage = e.Row.FindControl("lnkImage") as HyperLink;
                var lnkEdit  = e.Row.FindControl("lnkEdit") as HyperLink;

                var editUrl = string.Format("Products_Performance.aspx?id={0}", prod.Bvin);
                lnkImage.NavigateUrl         = editUrl;
                lnkImage.ToolTip             = prod.ImageFileSmallAlternateText;
                lnkImage.Style["display"]    = "block";
                lnkImage.Style["max-height"] = "80px";
                lnkImage.Style["overflow"]   = "hidden";
                lnkEdit.NavigateUrl          = editUrl;

                var imageUrl = DiskStorage.ProductImageUrlSmall(((IHccPage)Page).HccApp, prod.Bvin, prod.ImageFileSmall,
                                                                Page.Request.IsSecureConnection);
                var img = lnkImage.Controls[0] as Image;
                img.ImageUrl = imageUrl;
            }
        }