Ejemplo n.º 1
0
 protected void RemoveCategoryButton_Click(object sender, EventArgs e)
 {
     if (ProductCategories.RemoveProductCategory(this.CategoryPath.CurrentCategoryId))
     {
         this.CategoryDropDown.Refresh();
         this.SetCurrentCategory(this.CategoryPath.CurrentParentCategoryId);
     }
     CategoryCache.ClearCategoryCache();
 }
Ejemplo n.º 2
0
 protected void AddCategoryButton_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         ProductCategory productCategory = new ProductCategory
         {
             ParentCategoryID    = this.CategoryPath.CurrentCategoryId,
             CategoryHtmlName    = base.Server.HtmlEncode(this.txtCategoryName.Text),
             CategoryDescription = base.Server.HtmlEncode(this.txtCategoryDescription.Text)
         };
         ProductCategories.AddProductCategory(productCategory);
         CategoryCache.ClearCategoryCache();
         this.CategoryDropDown.Refresh();
         this.txtCategoryName.Text        = string.Empty;
         this.txtCategoryDescription.Text = string.Empty;
         this.SubcategoriesList.DataBind();
     }
 }
Ejemplo n.º 3
0
 protected void RenameCategoryButton_Click(object sender, EventArgs e)
 {
     if (this.RequiredCategoryNameValidator.IsValid)
     {
         int             currentCategoryId = this.CategoryPath.CurrentCategoryId;
         ProductCategory productCategory   = new ProductCategory
         {
             CategoryID          = currentCategoryId,
             CategoryHtmlName    = base.Server.HtmlEncode(this.txtEditCategoryName.Text),
             CategoryDescription = base.Server.HtmlEncode(this.txtEditCategoryDescription.Text)
         };
         ProductCategories.UpdateProductCategory(productCategory);
         CategoryCache.ClearCategoryCache();
         this.txtEditCategoryDescription.Text = string.Empty;
         this.txtEditCategoryName.Text        = string.Empty;
         this.CategoryDropDown.Refresh();
         this.SetCurrentCategory(currentCategoryId);
     }
 }
Ejemplo n.º 4
0
        protected void MoveButton_Click(object sender, EventArgs e)
        {
            int currentCategoryId  = this.CategoryPath.CurrentCategoryId;
            int selectedCategoryId = this.CategoryDropDown.SelectedCategoryId;

            if (this.MoveAction.SelectedValue.Equals("Category"))
            {
                ProductCategory productCategory = new ProductCategory
                {
                    CategoryID       = currentCategoryId,
                    ParentCategoryID = selectedCategoryId
                };
                ProductCategories.MoveProductCategory(productCategory);
                CategoryCache.ClearCategoryCache();
                this.CategoryDropDown.Refresh();
                this.SetCurrentCategory(this.CategoryPath.CurrentParentCategoryId);
            }
            else if (this.MoveAction.SelectedValue.Equals("Ads"))
            {
                Products.MoveProductsToCategory(currentCategoryId, selectedCategoryId);
                this.CategoryDropDown.SelectedIndex = 0;
            }
        }
Ejemplo n.º 5
0
 public void Refresh()
 {
     CategoryCache.ClearCategoryCache();
     this.CategoryList.DataBind();
 }