protected void btnSaveAndNext_Click(object sender, System.EventArgs e) { string text = this.txtActivityName.Text; System.DateTime?textToDate = this.dateBeginTime.TextToDate; System.DateTime?textToDate2 = this.dateEndTime.TextToDate; string text2 = this.txtDescription.Text; int limitNumber = 0; System.Web.UI.WebControls.HiddenField hiddenField = this.memberRange.FindControl("txt_Grades") as System.Web.UI.WebControls.HiddenField; System.Web.UI.WebControls.HiddenField hiddenField2 = this.memberRange.FindControl("txt_DefualtGroup") as System.Web.UI.WebControls.HiddenField; System.Web.UI.WebControls.HiddenField hiddenField3 = this.memberRange.FindControl("txt_CustomGroup") as System.Web.UI.WebControls.HiddenField; if (string.IsNullOrEmpty(text)) { this.ShowMsg("活动名称不能为空!", false); return; } if (!textToDate.HasValue || !textToDate2.HasValue) { this.ShowMsg("开始时间和结束时间都不能为空!", false); return; } if (textToDate.Value >= textToDate2.Value) { this.ShowMsg("开始时间不能大于或等于结束时间!", false); return; } if (!int.TryParse(this.txtLimitNumber.Text, out limitNumber)) { this.ShowMsg("每人限购格式不对!", false); return; } if (hiddenField.Value == "-1" && hiddenField2.Value == "-1" && hiddenField3.Value == "-1") { this.ShowMsg("请选择适用会员!", false); return; } int num = LimitedTimeDiscountHelper.AddLimitedTimeDiscount(new LimitedTimeDiscountInfo { ActivityName = text, BeginTime = textToDate.Value, EndTime = textToDate2.Value, Description = text2, LimitNumber = limitNumber, ApplyMembers = hiddenField.Value, DefualtGroup = hiddenField2.Value, CustomGroup = hiddenField3.Value, CreateTime = System.DateTime.Now, Status = 1.ToString() }); if (num > 0) { this.ShowMsgAndReUrl("添加成功", true, "LimitedTimeDiscountAddProduct.aspx?id=" + num); } }
protected void btnSaveAndNext_Click(object sender, EventArgs e) { string text = this.txtActivityName.Text; DateTime? textToDate = this.dateBeginTime.TextToDate; DateTime? nullable2 = this.dateEndTime.TextToDate; string str2 = this.txtDescription.Text; int result = 0; HiddenField field = this.memberRange.FindControl("txt_Grades") as HiddenField; HiddenField field2 = this.memberRange.FindControl("txt_DefualtGroup") as HiddenField; HiddenField field3 = this.memberRange.FindControl("txt_CustomGroup") as HiddenField; if (string.IsNullOrEmpty(text)) { this.ShowMsg("活动名称不能为空!", false); } else if (!textToDate.HasValue || !nullable2.HasValue) { this.ShowMsg("开始时间和结束时间都不能为空!", false); } else if (textToDate.Value >= nullable2.Value) { this.ShowMsg("开始时间不能大于或等于结束时间!", false); } else if (!int.TryParse(this.txtLimitNumber.Text, out result)) { this.ShowMsg("每人限购格式不对!", false); } else if (((field.Value == "-1") && (field2.Value == "-1")) && (field3.Value == "-1")) { this.ShowMsg("请选择适用会员!", false); } else { LimitedTimeDiscountInfo info = new LimitedTimeDiscountInfo { ActivityName = text, BeginTime = textToDate.Value, EndTime = nullable2.Value, Description = str2, LimitNumber = result, ApplyMembers = field.Value, DefualtGroup = field2.Value, CustomGroup = field3.Value, CreateTime = DateTime.Now }; info.Status = 1.ToString(); int num2 = LimitedTimeDiscountHelper.AddLimitedTimeDiscount(info); if (num2 > 0) { this.ShowMsgAndReUrl("添加成功", true, "LimitedTimeDiscountAddProduct.aspx?id=" + num2); } } }