Exemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!Page.IsPostBack)
            {
                NameField.Focus();

                var categoryId = CategoryId;
                var parentId   = ParentCategoryId;

                if (!string.IsNullOrEmpty(categoryId))
                {
                    var category = HccApp.CatalogServices.Categories.Find(categoryId);
                    if (category == null)
                    {
                        EventLog.LogEvent("Edit Category Page", "Could not find category with bvin " + categoryId,
                                          EventLogSeverity.Warning);
                        Response.Redirect("Categories.aspx");
                    }

                    LoadCategory(category);
                }
                else if (!string.IsNullOrEmpty(parentId))
                {
                    CategoryBreadCrumbTrail1.LoadTrail(parentId);
                }
            }
        }
Exemplo n.º 2
0
        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (!Page.IsPostBack)
            {
                this.NameField.Focus();

                if (Request.QueryString["id"] != null)
                {
                    this.BvinField.Value = Request.QueryString["id"];
                    if (Request.QueryString["type"] != null)
                    {
                        ViewState["type"] = Request.QueryString["type"];
                    }
                    Category category = LoadCategory();
                    if (category == null)
                    {
                        MerchantTribe.Commerce.EventLog.LogEvent("Edit Category Page",
                                                                 "Could not find category with bvin " + this.BvinField.Value,
                                                                 EventLogSeverity.Warning);
                        Response.Redirect("categories.aspx");
                    }

                    if (ViewState["type"] == null)
                    {
                        ViewState["type"] = category.SourceType;
                    }

                    if (category != null)
                    {
                        if (category.SourceType == CategorySourceType.CustomPage)
                        {
                            Response.Redirect("Categories/Custom/Edit/" + category.Bvin);
                        }
                    }

                    CategoryBreadCrumbTrail1.LoadTrail(Request.QueryString["id"]);
                }
                else
                {
                    this.BvinField.Value = string.Empty;
                    if (Request.QueryString["ParentID"] != null)
                    {
                        CategoryBreadCrumbTrail1.LoadTrail(Request.QueryString["ParentID"]);
                        if (Request.QueryString["type"] != null)
                        {
                            ViewState["type"] = Request.QueryString["type"];
                        }
                        this.ParentIDField.Value = (string)Request.QueryString["ParentID"];
                    }
                    else
                    {
                        Response.Redirect("~/BVAdmin/Catalog/Categories.aspx");
                    }
                }
            }
            //Me.TemplatePreviewImage.ImageUrl = Content.ModuleController.FindCategoryTemplatePreviewImage(Me.TemplateList.SelectedValue, Request.PhysicalApplicationPath)
        }
Exemplo n.º 3
0
        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (!Page.IsPostBack)
            {
                this.NameField.Focus();

                if (Request.QueryString["id"] != null)
                {
                    this.BvinField.Value = Request.QueryString["id"];
                    if (Request.QueryString["type"] != null)
                    {
                        ViewState["type"] = Request.QueryString["type"];
                    }
                    Category category = LoadCategory();

                    if (category != null)
                    {
                        if (category.SourceType != CategorySourceType.DrillDown)
                        {
                            Response.Redirect("categories.aspx");
                        }
                    }

                    if (ViewState["type"] == null)
                    {
                        ViewState["type"] = category.SourceType;
                    }
                    CategoryBreadCrumbTrail1.LoadTrail(Request.QueryString["id"]);
                    PopulateStoreLink(category);
                }
                else
                {
                    this.BvinField.Value = string.Empty;
                    if (Request.QueryString["ParentID"] != null)
                    {
                        CategoryBreadCrumbTrail1.LoadTrail(Request.QueryString["ParentID"]);
                        if (Request.QueryString["type"] != null)
                        {
                            ViewState["type"] = Request.QueryString["type"];
                        }
                        this.ParentIDField.Value = (string)Request.QueryString["ParentID"];
                    }
                    else
                    {
                        Response.Redirect("~/HCC/Admin/Catalog/Categories.aspx");
                    }
                }

                PopulatePropertyList();
                RenderFilterTree();
            }
        }
        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (!Page.IsPostBack)
            {
                this.NameField.Focus();

                if (Request.QueryString["id"] != null)
                {
                    this.BvinField.Value = Request.QueryString["id"];
                    if (Request.QueryString["type"] != null)
                    {
                        ViewState["type"] = Request.QueryString["type"];
                    }
                    Category category = LoadCategory();

                    if (category != null)
                    {
                        if (category.SourceType != CategorySourceType.FlexPage)
                        {
                            Response.Redirect("categories_edit.aspx?id=" + category.Bvin);
                        }
                    }
                    if (ViewState["type"] == null)
                    {
                        ViewState["type"] = category.SourceType;
                    }
                    CategoryBreadCrumbTrail1.LoadTrail(Request.QueryString["id"]);
                    this.UrlsAssociated1.ObjectId = category.Bvin;
                    this.UrlsAssociated1.LoadUrls();
                }
                else
                {
                    this.BvinField.Value = string.Empty;
                    if (Request.QueryString["ParentID"] != null)
                    {
                        CategoryBreadCrumbTrail1.LoadTrail(Request.QueryString["ParentID"]);
                        if (Request.QueryString["type"] != null)
                        {
                            ViewState["type"] = Request.QueryString["type"];
                        }
                        this.ParentIDField.Value = (string)Request.QueryString["ParentID"];
                        CreateCategory();
                    }
                    else
                    {
                        Response.Redirect("~/BVAdmin/Catalog/Categories.aspx");
                    }
                }
            }
        }
Exemplo n.º 5
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // TODO: troubleshoot taxonomy to see why it's not saving and loading
            TaxonomyBlock.Visible = false;

            if (!Page.IsPostBack)
            {
                PopulateCategories();
                PopulateTemplates();
                PopulateColumns();

                NameField.Focus();

                var categoryId = CategoryId;
                var parentId   = ParentCategoryId;

                if (!string.IsNullOrEmpty(categoryId))
                {
                    var category = HccApp.CatalogServices.Categories.Find(categoryId);
                    if (category == null)
                    {
                        EventLog.LogEvent("Edit Category Page", "Could not find category with bvin " + categoryId,
                                          EventLogSeverity.Warning);
                        Response.Redirect("Categories.aspx");
                    }

                    LoadCategory(category);
                }
                else if (!string.IsNullOrEmpty(parentId))
                {
                    ParentCategoryDropDownList.SelectedValue = parentId;
                    CategoryBreadCrumbTrail1.LoadTrail(parentId);
                }
            }
        }
Exemplo n.º 6
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());
        }