private void btnNext_Click(object sender, EventArgs e) { int num; int num2; string str = string.Empty; if (ValidateValues(out num, out num2)) { if (!addpromoteSales.IsValid) { ShowMsg(addpromoteSales.CurrentErrors, false); } else { WholesaleDiscountInfo target = new WholesaleDiscountInfo(); target.Name = addpromoteSales.Item.Name; target.Description = addpromoteSales.Item.Description; target.Quantity = num; target.DiscountValue = num2; target.MemberGradeIds = chklMemberGrade.SelectedValue; Session["wholesaleDiscountInfo"] = target; if (chklMemberGrade.SelectedValue.Count <= 0) { str = Formatter.FormatErrorMessage("适合的客户必须选择一个"); } ValidationResults results = Hishop.Components.Validation.Validation.Validate <WholesaleDiscountInfo>(target, new string[] { "ValPromotion" }); if (!results.IsValid) { foreach (ValidationResult result in (IEnumerable <ValidationResult>)results) { str = str + Formatter.FormatErrorMessage(result.Message); } } if (!string.IsNullOrEmpty(str)) { ShowMsg(str, false); } else { switch (SubsitePromoteHelper.AddPromotion(target)) { case PromotionActionStatus.Success: { int activeIdByPromotionName = SubsitePromoteHelper.GetActiveIdByPromotionName(target.Name); base.Response.Redirect(Globals.ApplicationPath + "/Shopadmin/promotion/MyPromotionProducts.aspx?ActiveId=" + activeIdByPromotionName, true); return; } case PromotionActionStatus.DuplicateName: ShowMsg("已存在此名称的促销活动", false); return; case PromotionActionStatus.SameCondition: ShowMsg("已经存在相同满足条件的优惠活动", false); return; } ShowMsg("添加促销活动--批发打折错误", false); } } } }