Exemplo n.º 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)
                {
                    ProductHelper.DeleteProductTags(Convert.ToInt32(str4), null);
                    if ((tagsId.Count > 0) && ProductHelper.AddProductTags(Convert.ToInt32(str4), tagsId, null))
                    {
                        num++;
                    }
                }
                if (num > 0)
                {
                    this.ShowMsg(string.Format("已成功修改了{0}件商品的商品标签", num), true);
                }
                else
                {
                    this.ShowMsg("已成功取消了商品的关联商品标签", true);
                }
                this.txtProductTag.Text = "";
            }
        }
Exemplo n.º 2
0
        private void btnUpdateProductTags_Click(object sender, EventArgs e)
        {
            string text = base.Request.Form["productTags"];

            if (string.IsNullOrEmpty(this.productIds))
            {
                this.ShowMsg("请先选择要关联的商品", false);
            }
            else
            {
                IList <int> list = new List <int>();
                if (!string.IsNullOrEmpty(text))
                {
                    string   text2 = text;
                    string[] array = null;
                    array = ((!text2.Contains(",")) ? new string[1]
                    {
                        text2
                    } : text2.Split(','));
                    string[] array2 = array;
                    foreach (string value in array2)
                    {
                        list.Add(Convert.ToInt32(value));
                    }
                }
                string[] array3 = null;
                array3 = ((!this.productIds.Contains(",")) ? new string[1]
                {
                    this.productIds
                } : this.productIds.Split(','));
                int      num    = 0;
                string[] array4 = array3;
                foreach (string value2 in array4)
                {
                    ProductHelper.DeleteProductTags(Convert.ToInt32(value2), null);
                    if (list.Count > 0 && ProductHelper.AddProductTags(Convert.ToInt32(value2), list, null))
                    {
                        num++;
                    }
                }
                if (num > 0)
                {
                    string text3 = $"已成功修改了{num}件商品的商品标签";
                    this.ShowMsg(text3, true);
                    base.CloseWindow(text3);
                }
                else
                {
                    this.ShowMsg("已成功取消了商品的关联商品标签", true);
                }
            }
        }
Exemplo n.º 3
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>();
            System.Collections.Generic.IList <int> list2 = 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];
                    list2.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];
                ProductHelper.DeleteProductTags(System.Convert.ToInt32(value2), null);
                if (list.Count > 0 && ProductHelper.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 = "";
        }