コード例 #1
0
        private void SubmitProduct(string opername)
        {
            int     num2;
            int     num3;
            decimal num4;
            decimal?nullable;
            decimal?nullable2;
            decimal num6;
            decimal num7;
            decimal num8;
            decimal num9;
            decimal num10;
            decimal?nullable3;
            string  str = this.ucFlashUpload1.Value.Trim();

            this.ucFlashUpload1.Value = str;
            string[] strArray  = str.Split(new char[] { ',' });
            string[] strArray2 = new string[] { "", "", "", "", "" };
            for (int i = 0; (i < strArray.Length) && (i < 5); i++)
            {
                strArray2[i] = strArray[i];
            }
            if (this.categoryid == 0)
            {
                this.categoryid = (int)this.ViewState["ProductCategoryId"];
            }
            bool flag           = !this.cbIsSetCommission.Checked;
            int  showSaleCounts = 0;

            if (this.ValidateConverts(this.txtProductName.Text.Trim(), this.chkSkuEnabled.Checked, out num2, out num4, out nullable, out nullable2, out num3, out nullable3, out showSaleCounts, out num6, out num7, out num8, out num9, out num10))
            {
                if (!this.chkSkuEnabled.Checked && (num4 <= 0M))
                {
                    this.ShowMsg("商品现价必须大于0", false);
                }
                else
                {
                    string text = this.fckDescription.Text;
                    if (this.ckbIsDownPic.Checked)
                    {
                        text = base.DownRemotePic(text);
                    }
                    ProductInfo target = new ProductInfo {
                        wid               = this.wid,
                        ProductId         = this.productId,
                        CategoryId        = this.categoryid,
                        TypeId            = this.dropProductTypes.SelectedValue,
                        ProductName       = this.txtProductName.Text.Trim().Replace(@"\", ""),
                        ProductShortName  = this.txtProductShortName.Text.Trim(),
                        ProductCode       = this.txtProductCode.Text.Trim(),
                        DisplaySequence   = num2,
                        MarketPrice       = nullable2,
                        Unit              = this.txtUnit.Text.Trim(),
                        ImageUrl1         = strArray2[0],
                        ImageUrl2         = strArray2[1],
                        ImageUrl3         = strArray2[2],
                        ImageUrl4         = strArray2[3],
                        ImageUrl5         = strArray2[4],
                        ThumbnailUrl40    = strArray2[0].Replace("/images/", "/thumbs40/40_"),
                        ThumbnailUrl60    = strArray2[0].Replace("/images/", "/thumbs60/60_"),
                        ThumbnailUrl100   = strArray2[0].Replace("/images/", "/thumbs100/100_"),
                        ThumbnailUrl160   = strArray2[0].Replace("/images/", "/thumbs160/160_"),
                        ThumbnailUrl180   = strArray2[0].Replace("/images/", "/thumbs180/180_"),
                        ThumbnailUrl220   = strArray2[0].Replace("/images/", "/thumbs220/220_"),
                        ThumbnailUrl310   = strArray2[0].Replace("/images/", "/thumbs310/310_"),
                        ThumbnailUrl410   = strArray2[0].Replace("/images/", "/thumbs410/410_"),
                        ShortDescription  = this.txtShortDescription.Text,
                        IsfreeShipping    = this.ChkisfreeShipping.Checked,
                        Description       = (!string.IsNullOrEmpty(text) && (text.Length > 0)) ? text : null,
                        AddedDate         = DateTime.Now,
                        BrandId           = this.dropBrandCategories.SelectedValue,
                        FirstCommission   = num6,
                        SecondCommission  = num7,
                        ThirdCommission   = num8,
                        FreightTemplateId = this.ChkisfreeShipping.Checked ? 0 : this.FreightTemplateDownList1.SelectedValue,
                        IsSetCommission   = flag,
                        CubicMeter        = num9,
                        FreightWeight     = num10
                    };
                    ProductSaleStatus onSale = ProductSaleStatus.OnSale;
                    if (this.radInStock.Checked)
                    {
                        onSale = ProductSaleStatus.OnStock;
                    }
                    if (this.radUnSales.Checked)
                    {
                        onSale = ProductSaleStatus.UnSale;
                    }
                    if (this.radOnSales.Checked)
                    {
                        onSale = ProductSaleStatus.OnSale;
                    }
                    target.SaleStatus = onSale;
                    CategoryInfo category = CatalogHelper.GetCategory(this.categoryid);
                    if (category != null)
                    {
                        target.MainCategoryPath = category.Path + "|";
                    }
                    Dictionary <string, SKUItem>   skus  = null;
                    Dictionary <int, IList <int> > attrs = null;
                    if (this.chkSkuEnabled.Checked)
                    {
                        decimal num11 = 0M;
                        decimal num12 = new decimal(0);
                        target.HasSKU = true;
                        skus          = base.GetSkus(this.txtSkus.Text);
                        if (skus == null)
                        {
                            this.ShowMsg("商品规格填写不完整!", false);
                            return;
                        }
                        decimal[] minSalePrice = new decimal[] { 79228162514264337593543950335M };
                        foreach (SKUItem item in from sku in skus.Values
                                 where sku.SalePrice < minSalePrice[0]
                                 select sku)
                        {
                            minSalePrice[0] = item.SalePrice;
                        }
                        num11 = minSalePrice[0];
                        decimal[] maxSalePrice = new decimal[] { -79228162514264337593543950335M };
                        foreach (SKUItem item2 in from sku in skus.Values
                                 where sku.SalePrice > maxSalePrice[0]
                                 select sku)
                        {
                            maxSalePrice[0] = item2.SalePrice;
                        }
                        num12 = maxSalePrice[0];
                        target.MinShowPrice = num11;
                        target.MaxShowPrice = num12;
                    }
                    else
                    {
                        Dictionary <string, SKUItem> dictionary3 = new Dictionary <string, SKUItem>();
                        SKUItem item3 = new SKUItem {
                            SkuId     = "0",
                            SKU       = this.txtSku.Text,
                            SalePrice = num4,
                            CostPrice = nullable.HasValue ? nullable.Value : 0M,
                            Stock     = num3,
                            Weight    = nullable3.HasValue ? nullable3.Value : 0M
                        };
                        dictionary3.Add("0", item3);
                        skus = dictionary3;
                        if (this.txtMemberPrices.Text.Length > 0)
                        {
                            base.GetMemberPrices(skus["0"], this.txtMemberPrices.Text);
                        }
                        target.MinShowPrice = num4;
                        target.MaxShowPrice = num4;
                    }
                    if (!string.IsNullOrEmpty(this.txtAttributes.Text) && (this.txtAttributes.Text.Length > 0))
                    {
                        attrs = base.GetAttributes(this.txtAttributes.Text);
                    }
                    ValidationResults validateResults = Hishop.Components.Validation.Validation.Validate <ProductInfo>(target);
                    if (!validateResults.IsValid)
                    {
                        this.ShowMsg(validateResults);
                    }
                    else
                    {
                        IList <int> tagIds = new List <int>();
                        if (!string.IsNullOrEmpty(this.txtProductTag.Text.Trim()))
                        {
                            string   str3      = this.txtProductTag.Text.Trim();
                            string[] strArray3 = null;
                            if (str3.Contains(","))
                            {
                                strArray3 = str3.Split(new char[] { ',' });
                            }
                            else
                            {
                                strArray3 = new string[] { str3 };
                            }
                            foreach (string str4 in strArray3)
                            {
                                tagIds.Add(Convert.ToInt32(str4));
                            }
                        }
                        if (this.productId > 0)
                        {
                            ProductInfo productBaseInfo = ProductHelper.GetProductBaseInfo(this.productId);
                            target.SaleCounts     = productBaseInfo.SaleCounts;
                            target.ShowSaleCounts = productBaseInfo.ShowSaleCounts;
                        }
                        else
                        {
                            target.SaleCounts     = 0;
                            target.ShowSaleCounts = showSaleCounts;
                        }
                        if (this.productId > 0)
                        {
                            switch (ProductHelper.UpdateProduct(target, skus, attrs, tagIds, wid))
                            {
                            case ProductActionStatus.AttributeError:
                                this.ShowMsg(this.operatorName + "商品失败,保存商品属性时出错", false);
                                return;

                            case ProductActionStatus.DuplicateName:
                                this.ShowMsg(this.operatorName + "商品失败,商品名称不能重复", false);
                                return;

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

                            case ProductActionStatus.SKUError:
                                this.ShowMsg(this.operatorName + "商品失败,商家编码不能重复", false);
                                return;

                            case ProductActionStatus.OffShelfError:
                                this.ShowMsg(this.operatorName + "商品失败,子站没在零售价范围内的商品无法下架", false);
                                return;

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

                            case ProductActionStatus.Success:
                                this.litralProductTag.SelectedValue = tagIds;
                                if (opername == "next")
                                {
                                    if (this.isnext != 1)
                                    {
                                        this.thisUrl = this.thisUrl.Replace("productid=" + this.productId, "productid=" + this.productId + "&isnext=1");
                                    }
                                    base.Response.Redirect(this.thisUrl);
                                    base.Response.End();
                                    return;
                                }
                                this.ShowMsgAndReUrl(this.operatorName + "商品信息成功!", true, this.reurl);
                                return;
                            }
                            this.ShowMsg(this.operatorName + "商品失败,未知错误", false);
                        }
                        else
                        {
                            string s     = ProductHelper.AddProductNew(target, skus, attrs, tagIds, wid);
                            int    num13 = Globals.ToNum(s);
                            if (num13 > 0)
                            {
                                base.Response.Redirect("productedit.aspx?productid=" + num13 + "&isnext=1");
                                base.Response.End();
                            }
                            else
                            {
                                this.ShowMsg(this.operatorName + "商品失败," + s, false);
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: ProductEdit.cs プロジェクト: llenroc/kangaroo
        private void SubmitProduct(string opername)
        {
            string text = this.ucFlashUpload1.Value.Trim();

            this.ucFlashUpload1.Value = text;
            string[] array = text.Split(new char[]
            {
                ','
            });
            string[] array2 = new string[]
            {
                "",
                "",
                "",
                "",
                ""
            };
            int num = 0;

            while (num < array.Length && num < 5)
            {
                array2[num] = array[num];
                num++;
            }
            if (this.categoryid == 0)
            {
                this.categoryid = (int)this.ViewState["ProductCategoryId"];
            }
            bool    isSetCommission = !this.cbIsSetCommission.Checked;
            int     showSaleCounts  = 0;
            int     displaySequence;
            decimal num2;
            decimal?num3;
            decimal?marketPrice;
            int     stock;
            decimal?num4;
            decimal firstCommission;
            decimal secondCommission;
            decimal thirdCommission;
            decimal cubicMeter;
            decimal freightWeight;

            if (!this.ValidateConverts(this.txtProductName.Text.Trim(), this.chkSkuEnabled.Checked, out displaySequence, out num2, out num3, out marketPrice, out stock, out num4, out showSaleCounts, out firstCommission, out secondCommission, out thirdCommission, out cubicMeter, out freightWeight))
            {
                return;
            }
            Globals.Debuglog("商品规格:" + this.chkSkuEnabled.Checked.ToString(), "_Debuglog.txt");
            if (!this.chkSkuEnabled.Checked && num2 <= 0m)
            {
                this.ShowMsg("商品现价必须大于0", false);
                return;
            }
            string text2 = this.fckDescription.Text;

            if (this.ckbIsDownPic.Checked)
            {
                text2 = base.DownRemotePic(text2);
            }
            ProductInfo productInfo = new ProductInfo
            {
                ProductId         = this.productId,
                CategoryId        = this.categoryid,
                TypeId            = this.dropProductTypes.SelectedValue,
                ProductName       = this.txtProductName.Text.Trim().Replace("\\", ""),
                ProductShortName  = this.txtProductShortName.Text.Trim(),
                ProductCode       = this.txtProductCode.Text.Trim(),
                DisplaySequence   = displaySequence,
                MarketPrice       = marketPrice,
                Unit              = this.txtUnit.Text.Trim(),
                ImageUrl1         = array2[0],
                ImageUrl2         = array2[1],
                ImageUrl3         = array2[2],
                ImageUrl4         = array2[3],
                ImageUrl5         = array2[4],
                ThumbnailUrl40    = array2[0].Replace("/images/", "/thumbs40/40_"),
                ThumbnailUrl60    = array2[0].Replace("/images/", "/thumbs60/60_"),
                ThumbnailUrl100   = array2[0].Replace("/images/", "/thumbs100/100_"),
                ThumbnailUrl160   = array2[0].Replace("/images/", "/thumbs160/160_"),
                ThumbnailUrl180   = array2[0].Replace("/images/", "/thumbs180/180_"),
                ThumbnailUrl220   = array2[0].Replace("/images/", "/thumbs220/220_"),
                ThumbnailUrl310   = array2[0].Replace("/images/", "/thumbs310/310_"),
                ThumbnailUrl410   = array2[0].Replace("/images/", "/thumbs410/410_"),
                ShortDescription  = this.txtShortDescription.Text,
                IsfreeShipping    = this.ChkisfreeShipping.Checked,
                Description       = ((!string.IsNullOrEmpty(text2) && text2.Length > 0) ? text2 : null),
                AddedDate         = System.DateTime.Now,
                BrandId           = this.dropBrandCategories.SelectedValue,
                FirstCommission   = firstCommission,
                SecondCommission  = secondCommission,
                ThirdCommission   = thirdCommission,
                FreightTemplateId = (this.ChkisfreeShipping.Checked ? 0 : this.FreightTemplateDownList1.SelectedValue),
                IsSetCommission   = isSetCommission,
                CubicMeter        = cubicMeter,
                FreightWeight     = freightWeight
            };
            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;
            CategoryInfo category = CatalogHelper.GetCategory(this.categoryid);

            if (category != null)
            {
                productInfo.MainCategoryPath = category.Path + "|";
            }
            System.Collections.Generic.Dictionary <string, SKUItem> dictionary = null;
            System.Collections.Generic.Dictionary <int, System.Collections.Generic.IList <int> > attrs = null;
            if (this.chkSkuEnabled.Checked)
            {
                decimal minShowPrice = 0m;
                productInfo.HasSKU = true;
                dictionary         = base.GetSkus(this.txtSkus.Text);
                if (dictionary == null)
                {
                    this.ShowMsg("商品规格填写不完整!", false);
                    return;
                }
                decimal[] minSalePrice = new decimal[]
                {
                    79228162514264337593543950335m
                };
                foreach (SKUItem current in from sku in dictionary.Values
                         where sku.SalePrice < minSalePrice[0]
                         select sku)
                {
                    minSalePrice[0] = current.SalePrice;
                }
                minShowPrice = minSalePrice[0];
                decimal[] maxSalePrice = new decimal[]
                {
                    -79228162514264337593543950335m
                };
                foreach (SKUItem current2 in from sku in dictionary.Values
                         where sku.SalePrice > maxSalePrice[0]
                         select sku)
                {
                    maxSalePrice[0] = current2.SalePrice;
                }
                decimal maxShowPrice = maxSalePrice[0];
                productInfo.MinShowPrice = minShowPrice;
                productInfo.MaxShowPrice = maxShowPrice;
            }
            else
            {
                dictionary = new System.Collections.Generic.Dictionary <string, SKUItem>
                {
                    {
                        "0",
                        new SKUItem
                        {
                            SkuId     = "0",
                            SKU       = this.txtSku.Text,
                            SalePrice = num2,
                            CostPrice = (num3.HasValue ? num3.Value : 0m),
                            Stock     = stock,
                            Weight    = (num4.HasValue ? num4.Value : 0m)
                        }
                    }
                };
                if (this.txtMemberPrices.Text.Length > 0)
                {
                    base.GetMemberPrices(dictionary["0"], this.txtMemberPrices.Text);
                }
                productInfo.MinShowPrice = num2;
                productInfo.MaxShowPrice = num2;
            }
            if (!string.IsNullOrEmpty(this.txtAttributes.Text) && this.txtAttributes.Text.Length > 0)
            {
                attrs = base.GetAttributes(this.txtAttributes.Text);
            }
            ValidationResults validationResults = Validation.Validate <ProductInfo>(productInfo);

            if (!validationResults.IsValid)
            {
                this.ShowMsg(validationResults);
                return;
            }
            System.Collections.Generic.IList <int> list = new System.Collections.Generic.List <int>();
            if (!string.IsNullOrEmpty(this.txtProductTag.Text.Trim()))
            {
                string   text3 = this.txtProductTag.Text.Trim();
                string[] array3;
                if (text3.Contains(","))
                {
                    array3 = text3.Split(new char[]
                    {
                        ','
                    });
                }
                else
                {
                    array3 = new string[]
                    {
                        text3
                    };
                }
                string[] array4 = array3;
                for (int i = 0; i < array4.Length; i++)
                {
                    string value = array4[i];
                    list.Add(System.Convert.ToInt32(value));
                }
            }
            if (this.productId > 0)
            {
                ProductInfo productBaseInfo = ProductHelper.GetProductBaseInfo(this.productId);
                productInfo.SaleCounts     = productBaseInfo.SaleCounts;
                productInfo.ShowSaleCounts = productBaseInfo.ShowSaleCounts;
            }
            else
            {
                productInfo.SaleCounts     = 0;
                productInfo.ShowSaleCounts = showSaleCounts;
            }
            if (this.productId > 0)
            {
                ProductActionStatus productActionStatus = ProductHelper.UpdateProduct(productInfo, dictionary, attrs, list);
                if (productActionStatus == ProductActionStatus.Success)
                {
                    ProductHelper.UpdateShoppingCartsTemplateId(this.productId, productInfo.FreightTemplateId);
                    this.litralProductTag.SelectedValue = list;
                    if (opername == "next")
                    {
                        string url = this.thisUrl;
                        if (this.isnext != 1)
                        {
                            url = string.Concat(new object[]
                            {
                                "/Admin/goods/ProductEdit.aspx?productId=",
                                this.productId,
                                "&isnext=1&reurl=",
                                base.Server.UrlEncode(this.reurl)
                            });
                        }
                        base.Response.Redirect(url);
                        base.Response.End();
                        return;
                    }
                    this.spanJs.InnerHtml = "<script>$('#ctl00_ContentPlaceHolder1_btnSave,#preview,#prevBtn').attr('disabled', 'true');setTimeout(function () { $('#ctl00_ContentPlaceHolder1_btnSave,#preview,#prevBtn').removeAttr('disabled'); }, 5000);</script>";
                    this.ShowMsgAndReUrl("保存商品信息成功!", true, this.reurl);
                    return;
                }
                else
                {
                    if (productActionStatus == ProductActionStatus.AttributeError)
                    {
                        this.ShowMsg("保存商品失败,保存商品属性时出错", false);
                        return;
                    }
                    if (productActionStatus == ProductActionStatus.DuplicateName)
                    {
                        this.ShowMsg("保存商品失败,商品名称不能重复", false);
                        return;
                    }
                    if (productActionStatus == ProductActionStatus.DuplicateSKU)
                    {
                        this.ShowMsg("保存商品失败,商品编码不能重复", false);
                        return;
                    }
                    if (productActionStatus == ProductActionStatus.SKUError)
                    {
                        this.ShowMsg("保存商品失败,商品编码不能重复", false);
                        return;
                    }
                    if (productActionStatus == ProductActionStatus.OffShelfError)
                    {
                        this.ShowMsg("保存商品失败,子站没在零售价范围内的商品无法下架", false);
                        return;
                    }
                    if (productActionStatus == ProductActionStatus.ProductTagEroor)
                    {
                        this.ShowMsg("保存商品失败,保存商品标签时出错", false);
                        return;
                    }
                    this.ShowMsg("保存商品失败,未知错误", false);
                    return;
                }
            }
            else
            {
                string text4 = ProductHelper.AddProductNew(productInfo, dictionary, attrs, list);
                int    num5  = Globals.ToNum(text4);
                if (num5 > 0)
                {
                    base.Response.Redirect("productedit.aspx?productid=" + num5 + "&isnext=1");
                    base.Response.End();
                    return;
                }
                this.ShowMsg("保存商品失败," + text4, false);
                return;
            }
        }
コード例 #3
0
        }//"下一步",编辑商品详情"按钮点击事件

        private void SubmitProduct(string opername)
        {
            int    IntegralToNow   = 0;   //积分兑换设置
            string integral        = "0"; //送积分
            string integralCeiling = "0"; //兑换积分上限
            int    LeaseGood       = 0;   //租赁商品
            int    ZeroBuy         = 0;   //零元购

            if (this.cbLeaseOpration.Checked == true)
            {
                LeaseGood = 0;
            }
            else
            {
                LeaseGood = 1;
            }

            if (this.cbZeroByOperation.Checked == true)//零元购
            {
                ZeroBuy = 0;
            }
            else
            {
                ZeroBuy = 1;
            }

            if (this.cbPointsSetUp.Checked == true) //积分兑换设置按钮被选中
            {
                IntegralToNow = 0;                  //不可使用积分兑换
            }
            else
            {
                if (this.txtIntegralCeiling.Text != "")
                {
                    IntegralToNow   = 1;                                   //可以使用积分兑换
                    integralCeiling = this.txtIntegralCeiling.Text.Trim(); //为兑换积分上限赋值
                }
            }

            if (this.cbIntegralOperation.Checked) //送积分设置被选中
            {
                integral = "0";                   //不支持送积分
            }
            else
            {
                if (this.txtIntegral.Text != "")
                {
                    integral = this.txtIntegral.Text.Trim();//为送积分赋值
                }
            }

            int    productId = this.productId;                   //获取商品编号
            string text      = this.ucFlashUpload1.Value.Trim(); //获取商品图片

            this.ucFlashUpload1.Value = text;
            string[] array = text.Split(new char[]
            {
                ','
            });
            string[] array2 = new string[]
            {
                "",
                "",
                "",
                "",
                ""
            };
            int num = 0;

            while (num < array.Length && num < 5)
            {
                array2[num] = array[num];
                num++;
            }
            if (this.categoryid == 0)
            {
                this.categoryid = (int)this.ViewState["ProductCategoryId"];
            }
            bool isSetCommission = !this.cbIsSetCommission.Checked;

            int     showSaleCounts = 0;
            int     displaySequence;
            decimal num2;
            decimal?num3;
            decimal?marketPrice;
            int     stock;
            decimal?num4;
            decimal firstCommission;
            decimal secondCommission;
            decimal thirdCommission;
            decimal cubicMeter;
            decimal freightWeight;

            if (!this.ValidateConverts(this.txtProductName.Text.Trim(), this.chkSkuEnabled.Checked, out displaySequence, out num2, out num3, out marketPrice, out stock, out num4, out showSaleCounts, out firstCommission, out secondCommission, out thirdCommission, out cubicMeter, out freightWeight))
            {
                return;
            }
            Globals.Debuglog("商品规格:" + this.chkSkuEnabled.Checked.ToString(), "_Debuglog.txt");
            if (!this.chkSkuEnabled.Checked && num2 <= 0m)
            {
                this.ShowMsg("商品现价必须大于0", false);
                return;
            }
            string text2 = this.fckDescription.Text;

            if (this.ckbIsDownPic.Checked)
            {
                text2 = base.DownRemotePic(text2);
            }
            ProductInfo productInfo = new ProductInfo
            {
                integral          = integral,//送积分
                ProductId         = this.productId,
                CategoryId        = this.categoryid,
                TypeId            = this.dropProductTypes.SelectedValue,
                ProductName       = this.txtProductName.Text.Trim().Replace("\\", ""),
                ProductShortName  = this.txtProductShortName.Text.Trim(),
                ProductCode       = this.txtProductCode.Text.Trim(),
                DisplaySequence   = displaySequence,
                MarketPrice       = marketPrice,
                Unit              = this.txtUnit.Text.Trim(),
                ImageUrl1         = array2[0],
                ImageUrl2         = array2[1],
                ImageUrl3         = array2[2],
                ImageUrl4         = array2[3],
                ImageUrl5         = array2[4],
                ThumbnailUrl40    = array2[0].Replace("/images/", "/thumbs40/40_"),
                ThumbnailUrl60    = array2[0].Replace("/images/", "/thumbs60/60_"),
                ThumbnailUrl100   = array2[0].Replace("/images/", "/thumbs100/100_"),
                ThumbnailUrl160   = array2[0].Replace("/images/", "/thumbs160/160_"),
                ThumbnailUrl180   = array2[0].Replace("/images/", "/thumbs180/180_"),
                ThumbnailUrl220   = array2[0].Replace("/images/", "/thumbs220/220_"),
                ThumbnailUrl310   = array2[0].Replace("/images/", "/thumbs310/310_"),
                ThumbnailUrl410   = array2[0].Replace("/images/", "/thumbs410/410_"),
                ShortDescription  = this.txtShortDescription.Text,
                IsfreeShipping    = this.ChkisfreeShipping.Checked,
                Description       = (!string.IsNullOrEmpty(text2) && text2.Length > 0) ? text2 : null,
                AddedDate         = System.DateTime.Now,
                BrandId           = this.dropBrandCategories.SelectedValue,
                FirstCommission   = firstCommission,
                SecondCommission  = secondCommission,
                ThirdCommission   = thirdCommission,
                FreightTemplateId = this.ChkisfreeShipping.Checked ? 0 : this.FreightTemplateDownList1.SelectedValue,
                IsSetCommission   = isSetCommission,
                CubicMeter        = cubicMeter,
                FreightWeight     = freightWeight
            };
            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;
            CategoryInfo category = CatalogHelper.GetCategory(this.categoryid);

            if (category != null)
            {
                productInfo.MainCategoryPath = category.Path + "|";
            }
            System.Collections.Generic.Dictionary <string, SKUItem> dictionary = null;
            System.Collections.Generic.Dictionary <int, System.Collections.Generic.IList <int> > attrs = null;
            if (this.chkSkuEnabled.Checked)
            {
                decimal minShowPrice = 0m;
                productInfo.HasSKU = true;
                dictionary         = base.GetSkus(this.txtSkus.Text);
                if (dictionary == null)
                {
                    this.ShowMsg("商品规格填写不完整!", false);
                    return;
                }
                decimal[] minSalePrice = new decimal[]
                {
                    79228162514264337593543950335m
                };
                foreach (SKUItem current in from sku in dictionary.Values
                         where sku.SalePrice < minSalePrice[0]
                         select sku)
                {
                    minSalePrice[0] = current.SalePrice;
                }
                minShowPrice = minSalePrice[0];
                decimal[] maxSalePrice = new decimal[]
                {
                    -79228162514264337593543950335m
                };
                foreach (SKUItem current2 in from sku in dictionary.Values
                         where sku.SalePrice > maxSalePrice[0]
                         select sku)
                {
                    maxSalePrice[0] = current2.SalePrice;
                }
                decimal maxShowPrice = maxSalePrice[0];
                productInfo.MinShowPrice = minShowPrice;
                productInfo.MaxShowPrice = maxShowPrice;
            }
            else
            {
                dictionary = new System.Collections.Generic.Dictionary <string, SKUItem>
                {
                    {
                        "0",
                        new SKUItem
                        {
                            SkuId     = "0",
                            SKU       = this.txtSku.Text,
                            SalePrice = num2,
                            CostPrice = num3.HasValue ? num3.Value : 0m,
                            Stock     = stock,
                            Weight    = num4.HasValue ? num4.Value : 0m
                        }
                    }
                };
                if (this.txtMemberPrices.Text.Length > 0)
                {
                    base.GetMemberPrices(dictionary["0"], this.txtMemberPrices.Text);
                }
                productInfo.MinShowPrice = num2;
                productInfo.MaxShowPrice = num2;
            }
            if (!string.IsNullOrEmpty(this.txtAttributes.Text) && this.txtAttributes.Text.Length > 0)
            {
                attrs = base.GetAttributes(this.txtAttributes.Text);
            }
            ValidationResults validationResults = Validation.Validate <ProductInfo>(productInfo);

            if (!validationResults.IsValid)
            {
                this.ShowMsg(validationResults);
                return;
            }
            System.Collections.Generic.IList <int> list = new System.Collections.Generic.List <int>();
            if (!string.IsNullOrEmpty(this.txtProductTag.Text.Trim()))
            {
                string   text3 = this.txtProductTag.Text.Trim();
                string[] array3;
                if (text3.Contains(","))
                {
                    array3 = text3.Split(new char[]
                    {
                        ','
                    });
                }
                else
                {
                    array3 = new string[]
                    {
                        text3
                    };
                }
                string[] array4 = array3;
                for (int i = 0; i < array4.Length; i++)
                {
                    string value = array4[i];
                    list.Add(System.Convert.ToInt32(value));
                }
            }
            if (this.productId > 0)
            {
                ProductInfo productBaseInfo = ProductHelper.GetProductBaseInfo(this.productId);
                productInfo.SaleCounts     = productBaseInfo.SaleCounts;
                productInfo.ShowSaleCounts = productBaseInfo.ShowSaleCounts;
            }
            else
            {
                productInfo.SaleCounts     = 0;
                productInfo.ShowSaleCounts = showSaleCounts;
            }
            if (this.productId > 0)
            {
                ProductActionStatus productActionStatus = ProductHelper.UpdateProduct(productInfo, dictionary, attrs, list);//修改商品详情
                if (productActionStatus == ProductActionStatus.Success)
                {
                    #region 根据商品编号修改积分
                    try
                    {
                        string         sql   = "update Hishop_products set [integral]=@integral,[IntegralCeiling]=@IntegralCeiling,[IntegralToNow]=@IntegralToNow,[ZeroBuy]=@ZeroBuy,[LeaseGood]=@LeaseGood where productId=@productId";//数据库修改积分
                        SqlParameter[] param = new SqlParameter[] {
                            new SqlParameter("@integral", integral),
                            new SqlParameter("@integralCeiling", integralCeiling),
                            new SqlParameter("@IntegralToNow", IntegralToNow),
                            new SqlParameter("@ZeroBuy", ZeroBuy),
                            new SqlParameter("@LeaseGood", LeaseGood),
                            new SqlParameter("@productId", this.productId)
                        };
                        int nums = help.ExecuteNonQuery(sql, CommandType.Text, param);
                        if (nums > 0)
                        {
                        }
                        else
                        {
                            this.ShowMsg(this.operatorName + "商品修改失败!", false);
                            return;
                        }
                    }
                    catch (Exception)
                    {
                        return;

                        throw;
                    }
                    #endregion

                    this.litralProductTag.SelectedValue = list;
                    if (opername == "next")
                    {
                        if (this.isnext != 1)
                        {
                            this.thisUrl = this.thisUrl.Replace("productid=" + this.productId, "productid=" + this.productId + "&isnext=1");
                        }
                        base.Response.Redirect(this.thisUrl);
                        base.Response.End();
                        return;
                    }
                    this.spanJs.InnerHtml = "<script>$('#ctl00_ContentPlaceHolder1_btnSave,#preview,#prevBtn').attr('disabled', 'true');setTimeout(function () { $('#ctl00_ContentPlaceHolder1_btnSave,#preview,#prevBtn').removeAttr('disabled'); }, 5000);</script>";
                    this.ShowMsgAndReUrl(this.operatorName + "商品信息成功!", true, this.reurl);
                    return;
                }
                else
                {
                    if (productActionStatus == ProductActionStatus.AttributeError)
                    {
                        this.ShowMsg(this.operatorName + "商品失败,保存商品属性时出错", false);
                        return;
                    }
                    if (productActionStatus == ProductActionStatus.DuplicateName)
                    {
                        this.ShowMsg(this.operatorName + "商品失败,商品名称不能重复", false);
                        return;
                    }
                    if (productActionStatus == ProductActionStatus.DuplicateSKU)
                    {
                        this.ShowMsg(this.operatorName + "商品失败,商家编码不能重复", false);
                        return;
                    }
                    if (productActionStatus == ProductActionStatus.SKUError)
                    {
                        this.ShowMsg(this.operatorName + "商品失败,商家编码不能重复", false);
                        return;
                    }
                    if (productActionStatus == ProductActionStatus.OffShelfError)
                    {
                        this.ShowMsg(this.operatorName + "商品失败,子站没在零售价范围内的商品无法下架", false);
                        return;
                    }
                    if (productActionStatus == ProductActionStatus.ProductTagEroor)
                    {
                        this.ShowMsg(this.operatorName + "商品失败,保存商品标签时出错", false);
                        return;
                    }
                    this.ShowMsg(this.operatorName + "商品失败,未知错误", false);
                    return;
                }
            }
            else
            {
                string text4 = ProductHelper.AddProductNew(productInfo, dictionary, attrs, list);
                int    num5  = Globals.ToNum(text4);
                if (num5 > 0)
                {
                    base.Response.Redirect("productedit.aspx?productid=" + num5 + "&isnext=1");
                    base.Response.End();
                    return;
                }
                this.ShowMsg(this.operatorName + "商品失败," + text4, false);
                return;
            }
        }//点击事件