Exemplo n.º 1
0
        protected void btnAddBindProduct_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(base.Request.Form["selectProductsinfo"]))
            {
                this.ShowMsg("获取绑定商品信息错误", false);
                return;
            }
            if (string.IsNullOrEmpty(this.txtBindName.Text) || string.IsNullOrEmpty(this.txtNum.Text) || string.IsNullOrEmpty(this.txtSalePrice.Text))
            {
                this.ShowMsg("你的资料填写不完整", false);
                return;
            }
            BundlingInfo bundlingInfo = new BundlingInfo();

            bundlingInfo.AddTime    = System.DateTime.Now;
            bundlingInfo.Name       = this.txtBindName.Text;
            bundlingInfo.Price      = System.Convert.ToDecimal(this.txtSalePrice.Text);
            bundlingInfo.SaleStatus = System.Convert.ToInt32(this.radstock.SelectedValue);
            bundlingInfo.Num        = System.Convert.ToInt32(this.txtNum.Text);
            if (!string.IsNullOrEmpty(this.txtShortDescription.Text))
            {
                bundlingInfo.ShortDescription = this.txtShortDescription.Text;
            }
            string text = base.Request.Form["selectProductsinfo"];

            string[] array = text.Split(new char[]
            {
                ','
            });
            System.Collections.Generic.List <BundlingItemInfo> list = new System.Collections.Generic.List <BundlingItemInfo>();
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string           text2            = array2[i];
                BundlingItemInfo bundlingItemInfo = new BundlingItemInfo();
                string[]         array3           = text2.Split(new char[]
                {
                    '|'
                });
                bundlingItemInfo.ProductID  = System.Convert.ToInt32(array3[0]);
                bundlingItemInfo.SkuId      = array3[1];
                bundlingItemInfo.ProductNum = System.Convert.ToInt32(array3[2]);
                list.Add(bundlingItemInfo);
            }
            bundlingInfo.BundlingItemInfos = list;
            if (PromoteHelper.AddBundlingProduct(bundlingInfo))
            {
                this.ShowMsg("添加绑定商品成功", true);
                return;
            }
            this.ShowMsg("添加绑定商品错误", false);
        }
 protected void btnAddBindProduct_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(base.Request.Form["selectProductsinfo"]))
     {
         this.ShowMsg("获取绑定商品信息错误", false);
     }
     else if ((!string.IsNullOrEmpty(this.txtBindName.Text) && !string.IsNullOrEmpty(this.txtNum.Text)) && !string.IsNullOrEmpty(this.txtSalePrice.Text))
     {
         BundlingInfo bundlingInfo = new BundlingInfo();
         bundlingInfo.AddTime    = DateTime.Now;
         bundlingInfo.Name       = this.txtBindName.Text;
         bundlingInfo.Price      = Convert.ToDecimal(this.txtSalePrice.Text);
         bundlingInfo.SaleStatus = Convert.ToInt32(this.radstock.SelectedValue);
         bundlingInfo.Num        = Convert.ToInt32(this.txtNum.Text);
         if (!string.IsNullOrEmpty(this.txtShortDescription.Text))
         {
             bundlingInfo.ShortDescription = this.txtShortDescription.Text;
         }
         string[] strArray            = base.Request.Form["selectProductsinfo"].Split(new char[] { ',' });
         List <BundlingItemInfo> list = new List <BundlingItemInfo>();
         foreach (string str2 in strArray)
         {
             BundlingItemInfo item      = new BundlingItemInfo();
             string[]         strArray2 = str2.Split(new char[] { '|' });
             item.ProductID  = Convert.ToInt32(strArray2[0]);
             item.SkuId      = strArray2[1];
             item.ProductNum = Convert.ToInt32(strArray2[2]);
             list.Add(item);
         }
         bundlingInfo.BundlingItemInfos = list;
         if (PromoteHelper.AddBundlingProduct(bundlingInfo))
         {
             this.ShowMsg("添加绑定商品成功", true);
         }
         else
         {
             this.ShowMsg("添加绑定商品错误", false);
         }
     }
     else
     {
         this.ShowMsg("你的资料填写不完整", false);
     }
 }