Exemplo n.º 1
0
        private string ResolveSpecialUrl(string raw)
        {
            // full url
            var tester = raw.Trim().ToLowerInvariant();

            if (tester.StartsWith("http:") || tester.StartsWith("https:") ||
                tester.StartsWith("//"))
            {
                return(raw);
            }

            // tag replaced url {{img}} or {{assets}
            if (tester.StartsWith("{{"))
            {
                return(TagReplacer.ReplaceContentTags(raw, HccApp));
            }

            // app relative url
            if (tester.StartsWith("~"))
            {
                return(ResolveUrl(raw));
            }

            // old style asset
            return(DiskStorage.StoreUrl(
                       HccApp,
                       raw,
                       HccApp.IsCurrentRequestSecure()));
        }
Exemplo n.º 2
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());
 }
Exemplo n.º 3
0
        protected string GetVariantImageUrl(IDataItemContainer cont)
        {
            var v = cont.DataItem as Variant;
            var p = _currentProduct;

            return(DiskStorage.ProductVariantImageUrlMedium(HccApp, p.Bvin, p.ImageFileSmall, v.Bvin,
                                                            HccApp.IsCurrentRequestSecure()));
        }
Exemplo n.º 4
0
        private void LoadCategory(Category c)
        {
            NameField.Text      = c.Name;
            LinkToField.Text    = c.CustomPageUrl;
            MetaTitleField.Text = c.MetaTitle;
            chkHidden.Checked   = c.Hidden;

            ucIconImage.ImageUrl = DiskStorage.CategoryIconUrl(HccApp, c.Bvin, c.ImageUrl,
                                                               HccApp.IsCurrentRequestSecure());
        }
 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");
     }
 }
Exemplo n.º 6
0
        public ActionResult Validate()
        {
            var productBvin = Request.Form["productbvin"];

            if (!string.IsNullOrEmpty(productBvin))
            {
                productBvin = security.InputFilter(productBvin.Trim(), PortalSecurity.FilterFlag.NoMarkup);
            }

            var product        = HccApp.CatalogServices.Products.FindWithCache(productBvin);
            var validateResult = new ProductValidateResponse();

            if (product != null)
            {
                var selections = ParseSelections(product, false);
                var price      = HccApp.PriceProduct(product, HccApp.CurrentCustomer, selections, HccApp.CurrentlyActiveSales);

                ValidateSelections(validateResult, product, selections);
                ValidatePrice(validateResult, price);
                ValidateInventory(validateResult, product, selections);

                UpdateVariantImage(validateResult, product, price);

                if (validateResult != null)
                {
                    if (!string.IsNullOrEmpty(validateResult.MediumImageUrl))
                    {
                        if (HccApp.IsCurrentRequestSecure())
                        {
                            validateResult.MediumImageUrl = validateResult.MediumImageUrl.Replace("http", "https");
                        }
                    }

                    if (!string.IsNullOrEmpty(validateResult.OriginalImageUrl))
                    {
                        if (HccApp.IsCurrentRequestSecure())
                        {
                            validateResult.OriginalImageUrl = validateResult.OriginalImageUrl.Replace("http", "https");
                        }
                    }
                }
            }

            return(new PreJsonResult(Web.Json.ObjectToJson(validateResult)));
        }
Exemplo n.º 7
0
        protected void gvAditionalImages_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var imgImage    = e.Row.FindControl("imgImage") as Image;
                var litFileName = e.Row.FindControl("litFileName") as Literal;

                var productImage = e.Row.DataItem as ProductImage;

                imgImage.ImageUrl = DiskStorage.ProductAdditionalImageUrlTiny(HccApp,
                                                                              productImage.ProductId,
                                                                              productImage.Bvin,
                                                                              productImage.FileName,
                                                                              HccApp.IsCurrentRequestSecure());
                imgImage.AlternateText = productImage.AlternateText;
                litFileName.Text       = productImage.FileName;

                e.Row.Attributes["id"] = productImage.Bvin;
            }
        }
Exemplo n.º 8
0
        private void ShowDialog()
        {
            var variant = HccApp.CatalogServices.ProductVariants.Find(EditedVariantId);

            lblVariantDescription.Text    = GetVariantDescription(variant);
            txtVariantSku.Text            = string.IsNullOrEmpty(variant.Sku) ? _currentProduct.Sku : variant.Sku;
            txtVariantPrice.Text          = (variant.Price < 0 ? _currentProduct.SitePrice : variant.Price).ToString("c");
            txtVariantCustomProperty.Text = variant.CustomProperty;

            ucVariantImage.ImageUrl = DiskStorage.ProductVariantImageUrlMedium(HccApp, _currentProduct.Bvin,
                                                                               _currentProduct.ImageFileSmall, variant.Bvin, HccApp.IsCurrentRequestSecure());

            pnlEditVariant.Visible = true;
            ClientScript.RegisterStartupScript(Page.GetType(), "hcEditVariantDialog", "hcEditVariantDialog();", true);
        }
Exemplo n.º 9
0
        private void LoadCategory(Category c)
        {
            // load the parent categories DDL
            PopulateCategories(c.Bvin);

            NameField.Text            = c.Name;
            DescriptionField.Text     = c.Description;
            MetaDescriptionField.Text = c.MetaDescription;
            MetaKeywordsField.Text    = c.MetaKeywords;
            MetaTitleField.Text       = c.MetaTitle;
            chkHidden.Checked         = c.Hidden;

            if (ParentCategoryDropDownList.Items.FindByValue(c.ParentId) != null)
            {
                ParentCategoryDropDownList.ClearSelection();
                ParentCategoryDropDownList.Items.FindByValue(c.ParentId).Selected = true;
            }

            if (TemplateList.Items.FindByValue(c.TemplateName) != null)
            {
                TemplateList.ClearSelection();
                TemplateList.Items.FindByValue(c.TemplateName).Selected = true;
            }

            if (!string.IsNullOrWhiteSpace(c.PreContentColumnId))
            {
                if (PreContentColumnIdField.Items.FindByValue(c.PreContentColumnId) != null)
                {
                    PreContentColumnIdField.Items.FindByValue(c.PreContentColumnId).Selected = true;
                }
            }
            if (!string.IsNullOrWhiteSpace(c.PostContentColumnId))
            {
                if (PostContentColumnIdField.Items.FindByValue(c.PostContentColumnId) != null)
                {
                    PostContentColumnIdField.Items.FindByValue(c.PostContentColumnId).Selected = true;
                }
            }

            if (Enum.IsDefined(typeof(CategorySortOrder), c.DisplaySortOrder) &&
                c.DisplaySortOrder != CategorySortOrder.None)
            {
                SortOrderDropDownList.SelectedValue = ((int)c.DisplaySortOrder).ToString();
            }
            else
            {
                SortOrderDropDownList.SelectedValue = ((int)CategorySortOrder.ManualOrder).ToString();
            }

            RewriteUrlField.Text = c.RewriteUrl;
            chkShowTitle.Checked = c.ShowTitle;
            keywords.Text        = c.Keywords;
            txtTaxonomyTags.Text = string.Join(",", HccApp.SocialService.GetTaxonomyTerms(c));

            CategoryBreadCrumbTrail1.LoadTrail(c.Bvin);
            UrlsAssociated1.ObjectId = c.Bvin;
            UrlsAssociated1.LoadUrls();

            lnkViewInStore.NavigateUrl = UrlRewriter.BuildUrlForCategory(new CategorySnapshot(c));
            ucIconImage.ImageUrl       = DiskStorage.CategoryIconUrl(HccApp, c.Bvin, c.ImageUrl,
                                                                     HccApp.IsCurrentRequestSecure());
            ucBannerImage.ImageUrl = DiskStorage.CategoryBannerUrl(HccApp, c.Bvin, c.BannerImageUrl,
                                                                   HccApp.IsCurrentRequestSecure());
        }