예제 #1
0
        public static Coupon Load(Int32 couponId, bool useCache)
        {
            if (couponId == 0)
            {
                return(null);
            }
            Coupon coupon = null;
            string key    = "Coupon_" + couponId.ToString();

            if (useCache)
            {
                coupon = ContextCache.GetObject(key) as Coupon;
                if (coupon != null)
                {
                    return(coupon);
                }
            }
            coupon = new Coupon();
            if (coupon.Load(couponId))
            {
                if (useCache)
                {
                    ContextCache.SetObject(key, coupon);
                }
                return(coupon);
            }
            return(null);
        }
예제 #2
0
        public static bool Delete(Int32 couponId)
        {
            Coupon coupon = new Coupon();

            if (coupon.Load(couponId))
            {
                return(coupon.Delete());
            }
            return(false);
        }