예제 #1
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            string text = base.Request.Form["CheckBoxGroup"] == null ? string.Empty : base.Request.Form["CheckBoxGroup"];

            string[] strs = text.Split(',');
            if (presentNum > 0 && strs.Length > this.presentNum)
            {
                this.ShowMsg("只能选择【" + presentNum + "】件商品!", false);
                return;
            }
            if (string.IsNullOrEmpty(text))
            {
                this.ShowMsg("请选择一件商品!", false);
                return;
            }
            DataTable dt     = PromoteHelper.GetPromotionPresentPro(this.activityId);
            int       nowNum = this.presentNum - (dt == null ? 0 : dt.Rows.Count);

            if (presentNum > 0 && dt != null && nowNum <= 0)
            {
                this.ShowMsg("赠送商品已经加满,不能继续添加", false);
                return;
            }
            else
            {
                if (presentNum > 0 && strs.Length > nowNum)
                {
                    this.ShowMsg("只能选择【" + nowNum + "】件商品!", false);
                    return;
                }
            }
            if (PromoteHelper.AddPromotionPresentPro(this.activityId, text))
            {
                this.CloseWindow();
                return;
            }
            this.ShowMsg("选择的商品已经参加其他促销活动,不能添加到此促销活动中!", false);
        }