private void btnAddCoupons_Click(object sender, System.EventArgs e) { if (upBgImg.UploadedImageUrl == "") { this.ShowMsg("请上传背景图片", false); return; } Hidistro.Entities.Promotions.CouponsAct ca = null; if (txtID.Value != "") { ca = CouponHelper.GetCouponsAct(Convert.ToInt32(txtID.Value)); } else { ca = new Entities.Promotions.CouponsAct(); } ca.ColValue2 = txtCouponActName.Text.Trim(); ca.CouponsID = Convert.ToInt32(ddlCoupons.SelectedValue); ca.CreateTime = DateTime.Now; ca.BgImg = upBgImg.UploadedImageUrl; ca.ColValue1 = Convert.ToInt32(txtColValue.Text.Trim()); if (txtID.Value != "") { if (CouponHelper.UpdateConponsAct(ca)) { this.ShowMsg("修改优惠卷活动成功!", true); } else { this.ShowMsg("修改优惠卷活动失败!", false); } } else { if (CouponHelper.AddCouponsAct(ca)) { this.ShowMsg("新增优惠卷活动成功!", true); } else { this.ShowMsg("新增优惠卷活动失败!", false); } } }