public static GiftCertificate Load(Int32 giftCertificateId, bool useCache) { if (giftCertificateId == 0) { return(null); } GiftCertificate giftCertificate = null; string key = "GiftCertificate_" + giftCertificateId.ToString(); if (useCache) { giftCertificate = ContextCache.GetObject(key) as GiftCertificate; if (giftCertificate != null) { return(giftCertificate); } } giftCertificate = new GiftCertificate(); if (giftCertificate.Load(giftCertificateId)) { if (useCache) { ContextCache.SetObject(key, giftCertificate); } return(giftCertificate); } return(null); }
public static bool Delete(Int32 giftCertificateId) { GiftCertificate giftCertificate = new GiftCertificate(); if (giftCertificate.Load(giftCertificateId)) { return(giftCertificate.Delete()); } return(false); }