Пример #1
0
        private ProductImagesInfo SaveGiftImage()
        {
            string text = Globals.GetStoragePath() + "/gift/";

            if (!Globals.PathExist(text, false))
            {
                Globals.CreatePath(text);
            }
            string str   = Globals.GetStoragePath() + "/temp/";
            string str2  = HttpContext.Current.Server.MapPath(text + "/images/");
            string value = this.hidUploadImages.Value;

            if (value.Trim().Length == 0)
            {
                return(null);
            }
            value = value.Replace("//", "/");
            string text2 = (value.Split('/').Length == 6) ? value.Split('/')[5] : value.Split('/')[4];

            if (File.Exists(str2 + text2))
            {
                return(null);
            }
            ProductImagesInfo productImagesInfo = new ProductImagesInfo();

            File.Copy(HttpContext.Current.Server.MapPath(this.hidUploadImages.Value), str2 + text2);
            string text3  = text + "thumbs40/40_" + text2;
            string text4  = text + "thumbs60/60_" + text2;
            string text5  = text + "thumbs100/100_" + text2;
            string text6  = text + "thumbs160/160_" + text2;
            string text7  = text + "thumbs180/180_" + text2;
            string text8  = text + "thumbs220/220_" + text2;
            string text9  = text + "thumbs310/310_" + text2;
            string text10 = text + "thumbs410/410_" + text2;

            ResourcesHelper.CreateThumbnail(str2 + text2, HttpContext.Current.Server.MapPath(text3), 40, 40);
            ResourcesHelper.CreateThumbnail(str2 + text2, HttpContext.Current.Server.MapPath(text4), 60, 60);
            ResourcesHelper.CreateThumbnail(str2 + text2, HttpContext.Current.Server.MapPath(text5), 100, 100);
            ResourcesHelper.CreateThumbnail(str2 + text2, HttpContext.Current.Server.MapPath(text6), 160, 160);
            ResourcesHelper.CreateThumbnail(str2 + text2, HttpContext.Current.Server.MapPath(text7), 180, 180);
            ResourcesHelper.CreateThumbnail(str2 + text2, HttpContext.Current.Server.MapPath(text8), 220, 220);
            ResourcesHelper.CreateThumbnail(str2 + text2, HttpContext.Current.Server.MapPath(text9), 310, 310);
            ResourcesHelper.CreateThumbnail(str2 + text2, HttpContext.Current.Server.MapPath(text10), 410, 410);
            productImagesInfo.ImageUrl1       = text + "images/" + text2;
            productImagesInfo.ThumbnailUrl40  = text3;
            productImagesInfo.ThumbnailUrl60  = text4;
            productImagesInfo.ThumbnailUrl100 = text5;
            productImagesInfo.ThumbnailUrl160 = text6;
            productImagesInfo.ThumbnailUrl180 = text7;
            productImagesInfo.ThumbnailUrl220 = text8;
            productImagesInfo.ThumbnailUrl310 = text9;
            productImagesInfo.ThumbnailUrl410 = text10;
            string path = HttpContext.Current.Server.MapPath(str + text2);

            if (File.Exists(path))
            {
                File.Delete(path);
            }
            return(productImagesInfo);
        }
Пример #2
0
        private ProductImagesInfo SaveProductImages()
        {
            string text = HiContext.Current.GetStoragePath() + "product/";

            if (!Globals.PathExist(text, false))
            {
                Globals.CreatePath(text);
            }
            ProductImagesInfo productImagesInfo = new ProductImagesInfo();
            string            str   = HttpContext.Current.Server.MapPath(text + "images/");
            string            text2 = this.hidUploadImages.Value.Trim();

            if (text2.Length == 0)
            {
                return(productImagesInfo);
            }
            string[] array = text2.Split(',');
            for (int i = 0; i < array.Length; i++)
            {
                string text3 = array[i];
                text3 = text3.Replace("//", "/");
                if (text3.Length != 0)
                {
                    string text4  = (text3.Split('/').Length == 6) ? text3.Split('/')[5] : text3.Split('/')[4];
                    string text5  = text + "thumbs40/40_" + text4;
                    string text6  = text + "thumbs60/60_" + text4;
                    string text7  = text + "thumbs100/100_" + text4;
                    string text8  = text + "thumbs160/160_" + text4;
                    string text9  = text + "thumbs180/180_" + text4;
                    string text10 = text + "thumbs220/220_" + text4;
                    string text11 = text + "thumbs310/310_" + text4;
                    string text12 = text + "thumbs410/410_" + text4;
                    if (File.Exists(str + text4))
                    {
                        AddProduct.BindProductImageInfo(text, productImagesInfo, i, text4, text5, text6, text7, text8, text9, text10, text11, text12);
                    }
                    else
                    {
                        File.Copy(HttpContext.Current.Server.MapPath(text3), str + text4);
                        if (File.Exists(HttpContext.Current.Server.MapPath(text3)))
                        {
                            File.Delete(HttpContext.Current.Server.MapPath(text3));
                        }
                        ResourcesHelper.CreateThumbnail(str + text4, HttpContext.Current.Server.MapPath(text5), 40, 40);
                        ResourcesHelper.CreateThumbnail(str + text4, HttpContext.Current.Server.MapPath(text6), 60, 60);
                        ResourcesHelper.CreateThumbnail(str + text4, HttpContext.Current.Server.MapPath(text7), 100, 100);
                        ResourcesHelper.CreateThumbnail(str + text4, HttpContext.Current.Server.MapPath(text8), 160, 160);
                        ResourcesHelper.CreateThumbnail(str + text4, HttpContext.Current.Server.MapPath(text9), 180, 180);
                        ResourcesHelper.CreateThumbnail(str + text4, HttpContext.Current.Server.MapPath(text10), 220, 220);
                        ResourcesHelper.CreateThumbnail(str + text4, HttpContext.Current.Server.MapPath(text11), 310, 310);
                        ResourcesHelper.CreateThumbnail(str + text4, HttpContext.Current.Server.MapPath(text12), 410, 410);
                        AddProduct.BindProductImageInfo(text, productImagesInfo, i, text4, text5, text6, text7, text8, text9, text10, text11, text12);
                    }
                }
            }
            return(productImagesInfo);
        }
Пример #3
0
 private static void BindProductImageInfo(string uploadPath, ProductImagesInfo imgInfo, int i, string newFilename, string thumbnail40SavePath, string thumbnail60SavePath, string thumbnail100SavePath, string thumbnail160SavePath, string thumbnail180SavePath, string thumbnail220SavePath, string thumbnail310SavePath, string thumbnail410SavePath)
 {
     imgInfo.ImageUrl1 = ((i == 0) ? (uploadPath + "images/" + newFilename) : imgInfo.ImageUrl1);
     imgInfo.ImageUrl2 = ((i == 1) ? (uploadPath + "images/" + newFilename) : imgInfo.ImageUrl2);
     imgInfo.ImageUrl3 = ((i == 2) ? (uploadPath + "images/" + newFilename) : imgInfo.ImageUrl3);
     imgInfo.ImageUrl4 = ((i == 3) ? (uploadPath + "images/" + newFilename) : imgInfo.ImageUrl4);
     imgInfo.ImageUrl5 = ((i == 4) ? (uploadPath + "images/" + newFilename) : imgInfo.ImageUrl5);
     if (i == 0)
     {
         imgInfo.ThumbnailUrl40  = thumbnail40SavePath;
         imgInfo.ThumbnailUrl60  = thumbnail60SavePath;
         imgInfo.ThumbnailUrl100 = thumbnail100SavePath;
         imgInfo.ThumbnailUrl160 = thumbnail160SavePath;
         imgInfo.ThumbnailUrl180 = thumbnail180SavePath;
         imgInfo.ThumbnailUrl220 = thumbnail220SavePath;
         imgInfo.ThumbnailUrl310 = thumbnail310SavePath;
         imgInfo.ThumbnailUrl410 = thumbnail410SavePath;
     }
 }
Пример #4
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            GiftInfo giftDetails = GiftHelper.GetGiftDetails(this.giftId);

            if (ActivityHelper.ExistGiftNoReceive(this.giftId))
            {
                this.liprize.Visible = true;
                this.ShowMsg("有用户存在此礼品未领取,如编辑领取的礼品将以最新信息的为准", false);
            }
            else if (ActivityHelper.ExistValueInActivity(this.giftId, ActivityEnumPrizeType.Gift))
            {
                this.liprize.Visible = true;
                this.ShowMsg("有活动中正在使用此礼品最为奖品,如编辑中奖的礼品将以最新的信息为准", false);
            }
            int     shippingTemplateId = 0;
            decimal weight             = default(decimal);
            decimal volume             = default(decimal);
            bool    isExemptionPostage = false;
            Regex   regex       = new Regex("^(?!_)(?!.*?_$)(?!-)(?!.*?-$)[a-zA-Z0-9_一-龥-]+$");
            decimal?costPrice   = default(decimal?);
            decimal?marketPrice = default(decimal?);
            int     needPoint   = default(int);

            if (this.ValidateValues(out costPrice, out marketPrice, out needPoint, out shippingTemplateId, out weight, out volume, out isExemptionPostage))
            {
                giftDetails.CostPrice          = costPrice;
                giftDetails.MarketPrice        = marketPrice;
                giftDetails.NeedPoint          = needPoint;
                giftDetails.Name               = Globals.HtmlEncode(this.txtGiftName.Text.Trim());
                giftDetails.Unit               = this.txtUnit.Text.Trim();
                giftDetails.ShortDescription   = Globals.HtmlEncode(this.txtShortDescription.Text.Trim());
                giftDetails.LongDescription    = this.fcDescription.Text.Trim();
                giftDetails.Title              = Globals.HtmlEncode(this.txtGiftTitle.Text.Trim());
                giftDetails.Meta_Description   = Globals.HtmlEncode(this.txtTitleDescription.Text.Trim());
                giftDetails.Meta_Keywords      = Globals.HtmlEncode(this.txtTitleKeywords.Text.Trim());
                giftDetails.IsPromotion        = this.chkPromotion.SelectedValue;
                giftDetails.IsExemptionPostage = isExemptionPostage;
                giftDetails.IsPointExchange    = this.onoffIsPointExchange.SelectedValue;
                ProductImagesInfo productImagesInfo = this.SaveGiftImage();
                if (productImagesInfo != null)
                {
                    giftDetails.ImageUrl        = productImagesInfo.ImageUrl1;
                    this.hidOldImages.Value     = giftDetails.ImageUrl;
                    giftDetails.ThumbnailUrl40  = productImagesInfo.ThumbnailUrl40;
                    giftDetails.ThumbnailUrl60  = productImagesInfo.ThumbnailUrl60;
                    giftDetails.ThumbnailUrl100 = productImagesInfo.ThumbnailUrl100;
                    giftDetails.ThumbnailUrl160 = productImagesInfo.ThumbnailUrl160;
                    giftDetails.ThumbnailUrl180 = productImagesInfo.ThumbnailUrl180;
                    giftDetails.ThumbnailUrl220 = productImagesInfo.ThumbnailUrl220;
                    giftDetails.ThumbnailUrl310 = productImagesInfo.ThumbnailUrl310;
                    giftDetails.ThumbnailUrl410 = productImagesInfo.ThumbnailUrl410;
                }
                else if (this.hidUploadImages.Value.Trim().Length == 0)
                {
                    if (!string.IsNullOrEmpty(giftDetails.ImageUrl))
                    {
                        this.hidUploadImages.Value = giftDetails.ImageUrl;
                    }
                    this.ShowMsg("必须上传礼品图片", false);
                    return;
                }
                giftDetails.IsExemptionPostage = isExemptionPostage;
                giftDetails.Weight             = weight;
                giftDetails.Volume             = volume;
                giftDetails.ShippingTemplateId = shippingTemplateId;
                ValidationResults validationResults = Validation.Validate(giftDetails, "ValGift");
                string            text = string.Empty;
                if (!validationResults.IsValid)
                {
                    foreach (ValidationResult item in (IEnumerable <ValidationResult>)validationResults)
                    {
                        text += Formatter.FormatErrorMessage(item.Message);
                    }
                }
                if (!string.IsNullOrEmpty(text))
                {
                    this.ShowMsg(text, false);
                }
                else if (GiftHelper.UpdateGift(giftDetails))
                {
                    base.Response.Redirect("Gifts.aspx?flag=2");
                }
                else
                {
                    this.ShowMsg("已经存在相同的礼品名称", false);
                }
            }
        }
Пример #5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            masterSettings.SiteName          = this.txtSiteName.Text.Trim();
            masterSettings.ServicePhone      = this.txtServicePhone.Text.Trim();
            masterSettings.SiteUrl           = this.txtDomainName.Text.Trim();
            masterSettings.Footer            = this.fkFooter.Text;
            masterSettings.RegisterAgreement = this.fckRegisterAgreement.Text;
            ProductImagesInfo productImagesInfo = this.SaveDefaultImage();

            if (productImagesInfo != null)
            {
                masterSettings.DefaultProductImage      = productImagesInfo.ImageUrl1;
                this.hidOldImages.Value                 = productImagesInfo.ImageUrl1;
                masterSettings.DefaultProductThumbnail1 = productImagesInfo.ThumbnailUrl40;
                masterSettings.DefaultProductThumbnail2 = productImagesInfo.ThumbnailUrl60;
                masterSettings.DefaultProductThumbnail3 = productImagesInfo.ThumbnailUrl100;
                masterSettings.DefaultProductThumbnail4 = productImagesInfo.ThumbnailUrl160;
                masterSettings.DefaultProductThumbnail5 = productImagesInfo.ThumbnailUrl180;
                masterSettings.DefaultProductThumbnail6 = productImagesInfo.ThumbnailUrl220;
                masterSettings.DefaultProductThumbnail7 = productImagesInfo.ThumbnailUrl310;
                masterSettings.DefaultProductThumbnail8 = productImagesInfo.ThumbnailUrl410;
            }
            else if (this.hidUploadImages.Value.Trim().Length == 0)
            {
                masterSettings.DefaultProductImage      = string.Empty;
                this.hidOldImages.Value                 = string.Empty;
                masterSettings.DefaultProductThumbnail1 = string.Empty;
                masterSettings.DefaultProductThumbnail2 = string.Empty;
                masterSettings.DefaultProductThumbnail3 = string.Empty;
                masterSettings.DefaultProductThumbnail4 = string.Empty;
                masterSettings.DefaultProductThumbnail5 = string.Empty;
                masterSettings.DefaultProductThumbnail6 = string.Empty;
                masterSettings.DefaultProductThumbnail7 = string.Empty;
                masterSettings.DefaultProductThumbnail8 = string.Empty;
            }
            string text = this.UploadSiteLogo();

            this.hidOldLogo.Value                = text;
            masterSettings.LogoUrl               = text;
            masterSettings.DecimalLength         = this.dropBitNumber.SelectedValue;
            masterSettings.SiteDescription       = Globals.StripAllTags(this.txtSiteDescription.Text.Trim());
            masterSettings.SearchMetaDescription = Globals.StripAllTags(this.txtSearchMetaDescription.Text.Trim());
            masterSettings.SearchMetaKeywords    = Globals.StripAllTags(this.txtSearchMetaKeywords.Text.Trim());
            masterSettings.AutoRedirectClient    = this.txtAutoRedirectClient.Value.ToBool();
            masterSettings.PolyapiAppId          = Globals.StripAllTags(this.txtPolyapiAppId.Text);
            masterSettings.PolyapiKey            = Globals.StripAllTags(this.txtPolyapiKey.Text);
            if (!string.IsNullOrEmpty(this.txtQQMapAppKey.Text))
            {
                masterSettings.QQMapAPIKey = Globals.StripAllTags(this.txtQQMapAppKey.Text);
            }
            if (this.ValidationSettings(masterSettings))
            {
                Globals.EntityCoding(masterSettings, true);
                SettingsManager.Save(masterSettings);
                HiCache.Clear();
                this.ShowMsg("成功修改了商城基本信息", true);
                masterSettings = SettingsManager.GetMasterSettings();
                this.LoadSiteContent(masterSettings);
            }
        }
Пример #6
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            int     shippingTemplateId = 0;
            decimal weight             = default(decimal);
            decimal volume             = default(decimal);
            bool    isExemptionPostage = false;
            decimal?costPrice          = default(decimal?);
            decimal?marketPrice        = default(decimal?);
            int     needPoint          = default(int);

            if (this.ValidateValues(out costPrice, out marketPrice, out needPoint, out shippingTemplateId, out weight, out volume, out isExemptionPostage))
            {
                GiftInfo giftInfo = new GiftInfo
                {
                    CostPrice          = costPrice,
                    MarketPrice        = marketPrice,
                    NeedPoint          = needPoint,
                    Name               = Globals.HtmlEncode(this.txtGiftName.Text.Trim()),
                    Unit               = this.txtUnit.Text.Trim(),
                    ShortDescription   = Globals.HtmlEncode(this.txtShortDescription.Text.Trim()),
                    LongDescription    = (string.IsNullOrEmpty(this.fcDescription.Text) ? null : this.fcDescription.Text.Trim()),
                    Title              = Globals.HtmlEncode(this.txtGiftTitle.Text.Trim()),
                    Meta_Description   = Globals.HtmlEncode(this.txtTitleDescription.Text.Trim()),
                    Meta_Keywords      = Globals.HtmlEncode(this.txtTitleKeywords.Text.Trim()),
                    IsPromotion        = this.chkPromotion.SelectedValue,
                    IsExemptionPostage = isExemptionPostage,
                    ShippingTemplateId = shippingTemplateId,
                    Weight             = weight,
                    Volume             = volume,
                    IsPointExchange    = this.onoffIsPointExchange.SelectedValue
                };
                ProductImagesInfo productImagesInfo = this.SaveGiftImage();
                if (productImagesInfo != null)
                {
                    giftInfo.ImageUrl        = productImagesInfo.ImageUrl1;
                    this.hidOldImages.Value  = giftInfo.ImageUrl;
                    giftInfo.ThumbnailUrl40  = productImagesInfo.ThumbnailUrl40;
                    giftInfo.ThumbnailUrl60  = productImagesInfo.ThumbnailUrl60;
                    giftInfo.ThumbnailUrl100 = productImagesInfo.ThumbnailUrl100;
                    giftInfo.ThumbnailUrl160 = productImagesInfo.ThumbnailUrl160;
                    giftInfo.ThumbnailUrl180 = productImagesInfo.ThumbnailUrl180;
                    giftInfo.ThumbnailUrl220 = productImagesInfo.ThumbnailUrl220;
                    giftInfo.ThumbnailUrl310 = productImagesInfo.ThumbnailUrl310;
                    giftInfo.ThumbnailUrl410 = productImagesInfo.ThumbnailUrl410;
                }
                else if (this.hidUploadImages.Value.Trim().Length == 0)
                {
                    this.ShowMsg("必须上传礼品图片", false);
                    return;
                }
                ValidationResults validationResults = Validation.Validate(giftInfo, "ValGift");
                string            text = string.Empty;
                if (!validationResults.IsValid)
                {
                    foreach (ValidationResult item in (IEnumerable <ValidationResult>)validationResults)
                    {
                        text += Formatter.FormatErrorMessage(item.Message);
                    }
                }
                if (!string.IsNullOrEmpty(text))
                {
                    this.ShowMsg(text, false);
                }
                else if (GiftHelper.AddGift(giftInfo))
                {
                    base.Response.Redirect("Gifts.aspx?flag=1");
                }
                else
                {
                    this.ShowMsg("已经存在相同的礼品名称", false);
                }
            }
        }
Пример #7
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            bool    isfreeShipping     = false;
            int     shippingTemplateId = 0;
            int     num               = default(int);
            decimal num2              = default(decimal);
            decimal?nullable          = default(decimal?);
            decimal?marketPrice       = default(decimal?);
            int     stock             = default(int);
            int     warningStock      = default(int);
            decimal weight            = default(decimal);
            decimal?secondLevelDeduct = default(decimal?);
            decimal?subMemberDeduct   = default(decimal?);
            decimal?threeLevelDeduct  = default(decimal?);
            decimal num3              = default(decimal);

            if (this.ValidateConverts(this.chkSkuEnabled.Checked, out num, out num2, out nullable, out marketPrice, out stock, out warningStock, out weight, out secondLevelDeduct, out subMemberDeduct, out threeLevelDeduct, out shippingTemplateId, out num3, out isfreeShipping))
            {
                if (!this.chkSkuEnabled.Checked)
                {
                    if (num2 <= decimal.Zero)
                    {
                        this.ShowMsg("商品一口价必须大于0", false);
                        return;
                    }
                    if (nullable.HasValue && nullable.Value >= num2)
                    {
                        this.ShowMsg("商品成本价必须小于商品一口价", false);
                        return;
                    }
                }
                string content = Globals.StripScriptTags(this.txtProductName.Text.Trim());
                content = Globals.StripHtmlXmlTags(content).Replace("\\", "").Replace("'", "");
                if (string.IsNullOrEmpty(content) || content == "")
                {
                    this.ShowMsg("产品名称不能为空,且不能包含脚本标签、HTML标签、XML标签、反斜杠(\\)、单引号(')!", false);
                }
                else
                {
                    string text  = this.editDescription.Text;
                    string text2 = this.editmobbileDescription.Text;
                    if (this.ckbIsDownPic.Checked)
                    {
                        text  = base.DownRemotePic(text);
                        text2 = base.DownRemotePic(text2);
                    }
                    ProductImagesInfo productImagesInfo = this.SaveProductImages();
                    Regex             regex             = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                    ProductInfo       productInfo       = new ProductInfo
                    {
                        CategoryId         = this.categoryId,
                        TypeId             = this.dropProductTypes.SelectedValue,
                        ProductName        = content,
                        ProductCode        = this.txtProductCode.Text,
                        MarketPrice        = marketPrice,
                        Unit               = this.txtUnit.Text,
                        ImageUrl1          = productImagesInfo.ImageUrl1,
                        ImageUrl2          = productImagesInfo.ImageUrl2,
                        ImageUrl3          = productImagesInfo.ImageUrl3,
                        ImageUrl4          = productImagesInfo.ImageUrl4,
                        ImageUrl5          = productImagesInfo.ImageUrl5,
                        ThumbnailUrl40     = productImagesInfo.ThumbnailUrl40,
                        ThumbnailUrl60     = productImagesInfo.ThumbnailUrl60,
                        ThumbnailUrl100    = productImagesInfo.ThumbnailUrl100,
                        ThumbnailUrl160    = productImagesInfo.ThumbnailUrl160,
                        ThumbnailUrl180    = productImagesInfo.ThumbnailUrl180,
                        ThumbnailUrl220    = productImagesInfo.ThumbnailUrl220,
                        ThumbnailUrl310    = productImagesInfo.ThumbnailUrl310,
                        ThumbnailUrl410    = productImagesInfo.ThumbnailUrl410,
                        ShortDescription   = this.txtShortDescription.Text,
                        Description        = ((!string.IsNullOrEmpty(text) && text.Length > 0) ? regex.Replace(text, "") : null),
                        MobbileDescription = ((!string.IsNullOrEmpty(text2) && text2.Length > 0) ? regex.Replace(text2, "") : null),
                        Title              = this.txtTitle.Text,
                        Meta_Description   = this.txtMetaDescription.Text,
                        Meta_Keywords      = this.txtMetaKeywords.Text,
                        AddedDate          = DateTime.Now,
                        BrandId            = this.dropBrandCategories.SelectedValue,
                        MainCategoryPath   = CatalogHelper.GetCategory(this.categoryId).Path + "|",
                        IsfreeShipping     = isfreeShipping,
                        SecondLevelDeduct  = secondLevelDeduct,
                        SubMemberDeduct    = subMemberDeduct,
                        ThreeLevelDeduct   = threeLevelDeduct,
                        ShippingTemplateId = shippingTemplateId,
                        SupplierId         = 0,
                        AuditStatus        = ProductAuditStatus.Pass,
                        IsCrossborder      = this.chkIsCrossborder.Checked,
                        ProductType        = ((!this.radPhysicalProduct.Checked) ? 1 : 0),
                        IsValid            = this.valid.Checked,
                        ValidStartDate     = this.validStartDate.Text.ToDateTime(),
                        ValidEndDate       = (this.validEndDate.Text + " 23:59:59").ToDateTime(),
                        IsRefund           = this.IsRefund.Checked,
                        IsOverRefund       = this.IsOverRefund.Checked,
                        IsGenerateMore     = this.IsGenerateMore.Checked
                    };
                    ProductSaleStatus saleStatus = ProductSaleStatus.OnSale;
                    if (this.radInStock.Checked)
                    {
                        saleStatus = ProductSaleStatus.OnStock;
                    }
                    if (this.radUnSales.Checked)
                    {
                        saleStatus = ProductSaleStatus.UnSale;
                    }
                    if (this.radOnSales.Checked)
                    {
                        saleStatus = ProductSaleStatus.OnSale;
                    }
                    productInfo.SaleStatus = saleStatus;
                    Dictionary <string, SKUItem>   dictionary = null;
                    Dictionary <int, IList <int> > attrs      = null;
                    if (this.chkSkuEnabled.Checked)
                    {
                        productInfo.HasSKU = true;
                        dictionary         = base.GetSkus(this.txtSkus.Text, weight);
                    }
                    else
                    {
                        dictionary = new Dictionary <string, SKUItem>
                        {
                            {
                                "0",
                                new SKUItem
                                {
                                    SkuId        = "0",
                                    SKU          = Globals.HtmlEncode(Globals.StripScriptTags(this.txtSku.Text.Trim()).Replace("\\", "")),
                                    SalePrice    = num2,
                                    CostPrice    = (nullable.HasValue ? nullable.Value : decimal.Zero),
                                    Stock        = stock,
                                    WarningStock = warningStock,
                                    Weight       = weight
                                }
                            }
                        };
                        if (this.txtMemberPrices.Text.Length > 0)
                        {
                            base.GetMemberPrices(dictionary["0"], this.txtMemberPrices.Text);
                        }
                    }
                    if (!string.IsNullOrEmpty(this.txtAttributes.Text) && this.txtAttributes.Text.Length > 0)
                    {
                        attrs = base.GetAttributes(this.txtAttributes.Text);
                    }
                    ValidationResults validationResults = Validation.Validate(productInfo, "AddProduct");
                    if (!validationResults.IsValid)
                    {
                        this.ShowMsg(validationResults);
                    }
                    else
                    {
                        IList <int> list = new List <int>();
                        if (!string.IsNullOrEmpty(this.txtProductTag.Text.Trim()))
                        {
                            string   text3 = this.txtProductTag.Text.Trim();
                            string[] array = null;
                            array = ((!text3.Contains(",")) ? new string[1]
                            {
                                text3
                            } : text3.Split(','));
                            string[] array2 = array;
                            foreach (string value in array2)
                            {
                                list.Add(Convert.ToInt32(value));
                            }
                        }
                        List <ProductSpecificationImageInfo> attrImgs = this.SaveProductAttributeImages();
                        string inputItemJson = "";
                        if (this.radServiceProduct.Checked)
                        {
                            inputItemJson = this.hidJson.Value;
                        }
                        switch (ProductHelper.AddProduct(productInfo, dictionary, attrs, list, attrImgs, false, inputItemJson))
                        {
                        case ProductActionStatus.Success:
                            this.ShowMsg("添加商品成功", true);
                            base.Response.Redirect(Globals.GetAdminAbsolutePath($"/product/AddProductComplete.aspx?categoryId={this.categoryId}&productId={productInfo.ProductId}"), true);
                            break;

                        case ProductActionStatus.AttributeError:
                            this.ShowMsg("添加商品失败,保存商品属性时出错", false);
                            break;

                        case ProductActionStatus.DuplicateName:
                            this.ShowMsg("添加商品失败,商品名称不能重复", false);
                            break;

                        case ProductActionStatus.DuplicateSKU:
                            this.ShowMsg("添加商品失败,商家编码不能重复", false);
                            break;

                        case ProductActionStatus.SKUError:
                            this.ShowMsg("添加商品失败,商家规格错误", false);
                            break;

                        case ProductActionStatus.ProductTagEroor:
                            this.ShowMsg("添加商品失败,保存商品标签时出错", false);
                            break;

                        case ProductActionStatus.ProductAttrImgsError:
                            this.ShowMsg("添加商品失败,保存商品规格图片时出错", false);
                            break;

                        default:
                            this.ShowMsg("添加商品失败,未知错误", false);
                            break;
                        }
                    }
                }
            }
        }