示例#1
0
        private void btnUpdateProductTags_Click(object sender, EventArgs e)
        {
            string str = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(str))
            {
                this.ShowMsg("请先选择要关联的商品", false);
            }
            else
            {
                IList <int> tagsId = new List <int>();
                if (!string.IsNullOrEmpty(this.txtProductTag.Text.Trim()))
                {
                    string   str2     = this.txtProductTag.Text.Trim();
                    string[] strArray = null;
                    if (str2.Contains(","))
                    {
                        strArray = str2.Split(new char[] { ',' });
                    }
                    else
                    {
                        strArray = new string[] { str2 };
                    }
                    foreach (string str3 in strArray)
                    {
                        tagsId.Add(Convert.ToInt32(str3));
                    }
                }
                string[] strArray2 = null;
                if (str.Contains(","))
                {
                    strArray2 = str.Split(new char[] { ',' });
                }
                else
                {
                    strArray2 = new string[] { str };
                }
                int num = 0;
                foreach (string str4 in strArray2)
                {
                    SubSiteProducthelper.DeleteProductTags(Convert.ToInt32(str4), null);
                    if ((tagsId.Count > 0) && SubSiteProducthelper.AddProductTags(Convert.ToInt32(str4), tagsId, null))
                    {
                        num++;
                    }
                }
                if (num > 0)
                {
                    this.ShowMsg(string.Format("已成功修改了{0}件商品的商品标签", num), true);
                }
                else
                {
                    this.ShowMsg("已成功取消了商品关联的商品标签", true);
                }
                this.txtProductTag.Text = "";
            }
        }
示例#2
0
        private void btnUpdateProductTags_Click(object sender, System.EventArgs e)
        {
            string text = base.Request.Form["CheckBoxGroup"];

            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请先选择要关联的商品", false);
                return;
            }
            System.Collections.Generic.IList <int> list = new System.Collections.Generic.List <int>();
            if (!string.IsNullOrEmpty(this.txtProductTag.Text.Trim()))
            {
                string   text2 = this.txtProductTag.Text.Trim();
                string[] array;
                if (text2.Contains(","))
                {
                    array = text2.Split(new char[]
                    {
                        ','
                    });
                }
                else
                {
                    array = new string[]
                    {
                        text2
                    };
                }
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string value = array2[i];
                    list.Add(System.Convert.ToInt32(value));
                }
            }
            string[] array3;
            if (text.Contains(","))
            {
                array3 = text.Split(new char[]
                {
                    ','
                });
            }
            else
            {
                array3 = new string[]
                {
                    text
                };
            }
            int num = 0;

            string[] array4 = array3;
            for (int j = 0; j < array4.Length; j++)
            {
                string value2 = array4[j];
                SubSiteProducthelper.DeleteProductTags(System.Convert.ToInt32(value2), null);
                if (list.Count > 0 && SubSiteProducthelper.AddProductTags(System.Convert.ToInt32(value2), list, null))
                {
                    num++;
                }
            }
            if (num > 0)
            {
                this.ShowMsg(string.Format("已成功修改了{0}件商品的商品标签", num), true);
            }
            else
            {
                this.ShowMsg("已成功取消了商品关联的商品标签", true);
            }
            this.txtProductTag.Text = "";
        }