public static CouponActionStatus UpdateCoupon2(CouponInfo coupon) { CouponDao couponDao = new CouponDao(); CouponActionStatus result = CouponActionStatus.UnknowError; try { if (couponDao.ExiCouponName(coupon.CouponId, coupon.CouponName)) { result = CouponActionStatus.DuplicateName; } else if (couponDao.Update(coupon, null)) { result = CouponActionStatus.Success; } } catch (Exception) { } return(result); }
public static CouponActionStatus AddCoupon(CouponInfo coupon) { CouponDao couponDao = new CouponDao(); try { if (couponDao.ExiCouponName(coupon.CouponId, coupon.CouponName)) { return(CouponActionStatus.DuplicateName); } if (couponDao.Add(coupon, null) > 0) { return(CouponActionStatus.Success); } return(CouponActionStatus.UnknowError); } catch (Exception) { return(CouponActionStatus.UnknowError); } }