Ejemplo n.º 1
0
        private void btnSaveAddCategory_Click(object sender, System.EventArgs e)
        {
            CategoryInfo category = this.GetCategory();

            if (category == null)
            {
                return;
            }
            if (CatalogHelper.AddCategory(category) == CategoryActionStatus.Success)
            {
                this.ShowMsg("成功添加了商品分类", true);
                this.dropCategories.DataBind();
                this.dropProductTypes.DataBind();
                //this.dropTaxRate.DataBind();
                this.txtCategoryName.Text      = string.Empty;
                this.txtSKUPrefix.Text         = string.Empty;
                this.txtRewriteName.Text       = string.Empty;
                this.txtPageKeyTitle.Text      = string.Empty;
                this.txtPageKeyWords.Text      = string.Empty;
                this.txtPageDesc.Text          = string.Empty;
                this.fckNotes1.Text            = string.Empty;
                this.fckNotes2.Text            = string.Empty;
                this.fckNotes3.Text            = string.Empty;
                this.radioButton.SelectedIndex = 0;
                this.ddlType.SelectedValue     = CategoryType.Category.ToString();
                return;
            }
            this.ShowMsg("添加商品分类失败,未知错误", false);
        }
Ejemplo n.º 2
0
        private void btnSaveAddCategory_Click(object sender, EventArgs e)
        {
            CategoryInfo category = this.GetCategory();

            if (category != null)
            {
                if (CatalogHelper.AddCategory(category) == CategoryActionStatus.Success)
                {
                    this.ShowMsg("成功添加了商品分类", true);
                    this.dropCategories.DataBind();
                    this.dropProductTypes.DataBind();
                    this.txtCategoryName.Text = string.Empty;
                    this.txtSKUPrefix.Text    = string.Empty;
                    this.txtRewriteName.Text  = string.Empty;
                    this.txtPageKeyTitle.Text = string.Empty;
                    this.txtPageKeyWords.Text = string.Empty;
                    this.txtPageDesc.Text     = string.Empty;
                    this.fckNotes1.Text       = string.Empty;
                    this.fckNotes2.Text       = string.Empty;
                    this.fckNotes3.Text       = string.Empty;
                }
                else
                {
                    this.ShowMsg("添加商品分类失败,未知错误", false);
                }
            }
        }
Ejemplo n.º 3
0
        private void btnSaveAddCategory_Click(object sender, System.EventArgs e)
        {
            CategoryInfo category = this.GetCategory();

            if (category == null)
            {
                return;
            }
            if (CatalogHelper.AddCategory(category) == CategoryActionStatus.Success)
            {
                this.ShowMsgAndReUrl(this.operatorName + "成功", true, "categoryedit.aspx");
                return;
            }
            this.ShowMsg(this.operatorName + "商品分类失败,未知错误", false);
        }
Ejemplo n.º 4
0
        private void btnSaveCategory_Click(object sender, System.EventArgs e)
        {
            CategoryInfo category = this.GetCategory();

            if (category == null)
            {
                return;
            }
            if (CatalogHelper.AddCategory(category) == CategoryActionStatus.Success)
            {
                base.Response.Redirect(Globals.GetAdminAbsolutePath("/product/ManageCategories.aspx"), true);
                return;
            }
            this.ShowMsg("添加商品分类失败,未知错误", false);
        }
Ejemplo n.º 5
0
        private void btnSaveCategory_Click(object sender, EventArgs e)
        {
            CategoryInfo category = this.GetCategory();

            if (category != null)
            {
                if (CatalogHelper.AddCategory(category))
                {
                    base.Response.Redirect(Globals.GetAdminAbsolutePath("/product/ManageCategories.aspx"), true);
                }
                else
                {
                    this.ShowMsg("添加商品分类失败,未知错误", false);
                }
            }
        }
Ejemplo n.º 6
0
        private void btnSaveCategory_Click(object sender, System.EventArgs e)
        {
            CategoryInfo category = this.GetCategory();

            if (category != null)
            {
                if (CatalogHelper.AddCategory(category) == CategoryActionStatus.Success)
                {
                    //保存成功后清空分类缓存
                    HiCache.Remove("DataCache-CategoriesRange");
                    base.Response.Redirect(Globals.GetAdminAbsolutePath("/product/ManageCategories.aspx"), true);
                }
                else
                {
                    this.ShowMsg("添加商品分类失败,未知错误", false);
                }
            }
        }
Ejemplo n.º 7
0
        private void btnSaveCategory_Click(object sender, EventArgs e)
        {
            if (this.categoryid > 0)
            {
                CategoryInfo category = CatalogHelper.GetCategory(this.categoryid);
                if (category == null)
                {
                    this.ShowMsg("编缉商品分类错误,未知", false);
                }
                else
                {
                    category.IconUrl               = this.uploader1.UploadedImageUrl;
                    category.Name                  = this.txtCategoryName.Text;
                    category.SKUPrefix             = this.txtSKUPrefix.Text;
                    category.RewriteName           = this.txtRewriteName.Text;
                    category.MetaTitle             = this.txtPageKeyTitle.Text;
                    category.MetaKeywords          = this.txtPageKeyWords.Text;
                    category.MetaDescription       = this.txtPageDesc.Text;
                    category.AssociatedProductType = this.dropProductTypes.SelectedValue;
                    category.Notes1                = "";
                    category.Notes2                = "";
                    category.Notes3                = "";
                    if (category.Depth > 1)
                    {
                        CategoryInfo info2 = CatalogHelper.GetCategory(category.ParentCategoryId.Value);
                        if (string.IsNullOrEmpty(category.Notes1))
                        {
                            category.Notes1 = info2.Notes1;
                        }
                        if (string.IsNullOrEmpty(category.Notes2))
                        {
                            category.Notes2 = info2.Notes2;
                        }
                        if (string.IsNullOrEmpty(category.Notes3))
                        {
                            category.Notes3 = info2.Notes3;
                        }
                    }
                    ValidationResults results = Hishop.Components.Validation.Validation.Validate <CategoryInfo>(category, new string[] { "ValCategory" });
                    string            msg     = string.Empty;
                    if (!results.IsValid)
                    {
                        foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
                        {
                            msg = msg + Formatter.FormatErrorMessage(result.Message);
                        }
                        this.ShowMsg(msg, false);
                    }
                    else
                    {
                        switch (CatalogHelper.UpdateCategory(category))
                        {
                        case CategoryActionStatus.Success:
                            this.ShowMsgAndReUrl(this.operatorName + "成功", true, this.reurl);
                            return;

                        case CategoryActionStatus.UpdateParentError:
                            this.ShowMsg("不能自己成为自己的上级分类", false);
                            return;
                        }
                        this.ShowMsg(this.operatorName + "商品分类错误", false);
                    }
                }
            }
            else
            {
                CategoryInfo info3 = this.GetCategory();
                if (info3 != null)
                {
                    if (CatalogHelper.AddCategory(info3) == CategoryActionStatus.Success)
                    {
                        this.ShowMsgAndReUrl("成功" + this.operatorName + "了商品分类", true, this.reurl);
                    }
                    else
                    {
                        this.ShowMsg(this.operatorName + "失败", false);
                    }
                }
            }
        }
Ejemplo n.º 8
0
 private void btnSaveCategory_Click(object sender, System.EventArgs e)
 {
     if (this.categoryid > 0)
     {
         CategoryInfo category = CatalogHelper.GetCategory(this.categoryid);
         if (category == null)
         {
             this.ShowMsg("编缉商品分类错误,未知", false);
             return;
         }
         string arg_2D_0 = string.Empty;
         category.IconUrl               = this.uploader1.UploadedImageUrl;
         category.Name                  = this.txtCategoryName.Text;
         category.SKUPrefix             = this.txtSKUPrefix.Text;
         category.RewriteName           = this.txtRewriteName.Text;
         category.MetaTitle             = this.txtPageKeyTitle.Text;
         category.MetaKeywords          = this.txtPageKeyWords.Text;
         category.MetaDescription       = this.txtPageDesc.Text;
         category.AssociatedProductType = this.dropProductTypes.SelectedValue;
         category.DelayDays             = Convert.ToInt32(this.txtDelayDays.Text);
         category.Notes1                = "";
         category.Notes2                = "";
         category.Notes3                = "";
         if (category.Depth > 1)
         {
             CategoryInfo category2 = CatalogHelper.GetCategory(category.ParentCategoryId.Value);
             if (string.IsNullOrEmpty(category.Notes1))
             {
                 category.Notes1 = category2.Notes1;
             }
             if (string.IsNullOrEmpty(category.Notes2))
             {
                 category.Notes2 = category2.Notes2;
             }
             if (string.IsNullOrEmpty(category.Notes3))
             {
                 category.Notes3 = category2.Notes3;
             }
         }
         ValidationResults validationResults = Validation.Validate <CategoryInfo>(category, new string[]
         {
             "ValCategory"
         });
         string text = string.Empty;
         if (!validationResults.IsValid)
         {
             foreach (ValidationResult current in ((System.Collections.Generic.IEnumerable <ValidationResult>)validationResults))
             {
                 text += Formatter.FormatErrorMessage(current.Message);
             }
             this.ShowMsg(text, false);
             return;
         }
         CategoryActionStatus categoryActionStatus = CatalogHelper.UpdateCategory(category);
         if (categoryActionStatus == CategoryActionStatus.Success)
         {
             this.ShowMsgAndReUrl(this.operatorName + "成功", true, this.reurl);
             return;
         }
         if (categoryActionStatus == CategoryActionStatus.UpdateParentError)
         {
             this.ShowMsg("不能自己成为自己的上级分类", false);
             return;
         }
         this.ShowMsg(this.operatorName + "商品分类错误", false);
         return;
     }
     else
     {
         CategoryInfo category3 = this.GetCategory();
         if (category3 == null)
         {
             return;
         }
         if (CatalogHelper.AddCategory(category3) == CategoryActionStatus.Success)
         {
             this.ShowMsgAndReUrl("成功" + this.operatorName + "了商品分类", true, this.reurl);
             return;
         }
         this.ShowMsg(this.operatorName + "失败", false);
         return;
     }
 }