private void btnSave_Click(object sender, EventArgs e)
        {
            BrandCategoryInfo brandCategoryInfo = this.GetBrandCategoryInfo();

            if (this.fileUpload.HasFile)
            {
                try
                {
                    brandCategoryInfo.Logo = CatalogHelper.UploadBrandCategorieImage(this.fileUpload.PostedFile);
                    if (this.ValidationBrandCategory(brandCategoryInfo))
                    {
                        if (CatalogHelper.AddBrandCategory(brandCategoryInfo))
                        {
                            base.Response.Redirect(Globals.GetAdminAbsolutePath("/product/BrandCategories.aspx"), true);
                        }
                        else
                        {
                            this.ShowMsg("添加品牌分类失败", true);
                        }
                    }
                    return;
                }
                catch
                {
                    this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                    return;
                }
            }
            this.ShowMsg("请上传一张品牌logo图片", false);
        }
        protected void btnAddBrandCategory_Click(object sender, EventArgs e)
        {
            BrandCategoryInfo brandCategoryInfo = this.GetBrandCategoryInfo();

            if (this.fileUpload.HasFile)
            {
                try
                {
                    brandCategoryInfo.Logo = CatalogHelper.UploadBrandCategorieImage(this.fileUpload.PostedFile);
                }
                catch
                {
                    this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                    return;
                }
            }
            if (this.ValidationBrandCategory(brandCategoryInfo))
            {
                if (CatalogHelper.AddBrandCategory(brandCategoryInfo))
                {
                    this.txtBrandName.Text       = "";
                    this.txtCompanyUrl.Text      = "";
                    this.txtkeyword.Text         = "";
                    this.txtMetaDescription.Text = "";
                    this.txtReUrl.Text           = "";
                    this.fckDescription.Text     = "";
                    this.ShowMsg("成功添加品牌分类", true);
                }
                else
                {
                    this.ShowMsg("添加品牌分类失败", true);
                }
            }
        }
        protected void btnAddBrandCategory_Click(object sender, System.EventArgs e)
        {
            string value = Globals.HtmlEncode(Globals.StripHtmlXmlTags(Globals.StripScriptTags(this.txtBrandName.Text.Trim())).Replace("\\", ""));

            if (string.IsNullOrEmpty(value))
            {
                this.ShowMsg("请填写品牌名称,品牌名称中不能包含HTML字符,脚本字符,以及\\", false);
                return;
            }
            BrandCategoryInfo brandCategoryInfo = this.GetBrandCategoryInfo();

            if (this.fileUpload.HasFile)
            {
                try
                {
                    brandCategoryInfo.Logo = CatalogHelper.UploadBrandCategorieImage(this.fileUpload.PostedFile);
                    goto IL_8C;
                }
                catch
                {
                    this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                    return;
                }
                try
                {
                    brandCategoryInfo.BigLogo = this.fileUpload1.HasFile ? CatalogHelper.UploadBrandCategorieImage(this.fileUpload1.PostedFile) : string.Empty;
                    goto IL_8C;
                }
                catch
                {
                    this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                    return;
                }

IL_8C:
                if (!this.ValidationBrandCategory(brandCategoryInfo))
                {
                    return;
                }
                if (CatalogHelper.AddBrandCategory(brandCategoryInfo))
                {
                    this.ShowMsg("成功添加品牌分类", true);
                    return;
                }
                this.ShowMsg("添加品牌分类失败", true);
                return;
            }
        }
Exemple #4
0
        protected void btnAddBrandCategory_Click(object sender, EventArgs e)
        {
            string value = Globals.HtmlEncode(Globals.StripHtmlXmlTags(Globals.StripScriptTags(this.txtBrandName.Text.Trim())).Replace("\\", ""));

            if (string.IsNullOrEmpty(value))
            {
                this.ShowMsg("请填写品牌名称,品牌名称中不能包含HTML字符,脚本字符,以及\\", false);
            }
            else
            {
                BrandCategoryInfo brandCategoryInfo = this.GetBrandCategoryInfo();
                if (this.hidUploadImages.Value.Trim().Length > 0)
                {
                    try
                    {
                        string value2 = brandCategoryInfo.Logo = this.UploadImage();
                        this.hidOldImages.Value = value2;
                    }
                    catch
                    {
                        this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                        return;
                    }
                    if (this.ValidationBrandCategory(brandCategoryInfo))
                    {
                        if (CatalogHelper.AddBrandCategory(brandCategoryInfo))
                        {
                            this.ShowMsg("成功添加品牌分类", true);
                        }
                        else
                        {
                            this.ShowMsg("添加品牌分类失败", true);
                        }
                    }
                }
                else
                {
                    this.ShowMsg("请上传一张品牌logo图片", false);
                }
            }
        }
        protected void btnAddBrandCategory_Click(object sender, EventArgs e)
        {
            BrandCategoryInfo brandCategoryInfo = this.GetBrandCategoryInfo();

            if (!string.IsNullOrEmpty(this.uploader1.UploadedImageUrl.ToString()))
            {
                brandCategoryInfo.Logo = this.uploader1.UploadedImageUrl;
            }
            else
            {
                this.ShowMsg("请上传图片!", false);
                return;
            }
            if (string.IsNullOrEmpty(brandCategoryInfo.BrandName))
            {
                this.ShowMsg("请输入品牌名称!", false);
            }
            else if (string.IsNullOrEmpty(brandCategoryInfo.Description))
            {
                this.ShowMsg("请输入品牌介绍!", false);
            }
            else if (CatalogHelper.AddBrandCategory(brandCategoryInfo))
            {
                this.txtBrandName.Text       = "";
                this.txtCompanyUrl.Text      = "";
                this.txtkeyword.Text         = "";
                this.txtMetaDescription.Text = "";
                this.txtReUrl.Text           = "";
                this.fckDescription.Text     = "";
                this.ShowMsg("成功添加品牌分类", true);
            }
            else
            {
                this.ShowMsg("添加品牌分类失败", true);
            }
        }