/// <summary> /// Gets a credit card type /// </summary> /// <param name="CreditCardTypeID">Credit card type identifier</param> /// <returns>Credit card type</returns> public static CreditCardType GetCreditCardTypeByID(int CreditCardTypeID) { if (CreditCardTypeID == 0) { return(null); } string key = string.Format(CREDITCARDS_BY_ID_KEY, CreditCardTypeID); object obj2 = NopCache.Get(key); if (CreditCardTypeManager.CacheEnabled && (obj2 != null)) { return((CreditCardType)obj2); } DBCreditCardType dbItem = DBProviderManager <DBCreditCardTypeProvider> .Provider.GetCreditCardTypeByID(CreditCardTypeID); CreditCardType creditCardType = DBMapping(dbItem); if (CreditCardTypeManager.CacheEnabled) { NopCache.Max(key, creditCardType); } return(creditCardType); }
/// <summary> /// Inserts a credit card type /// </summary> /// <param name="Name">The name</param> /// <param name="SystemKeyword">The system keyword</param> /// <param name="DisplayOrder">The display order</param> /// <param name="Deleted">A value indicating whether the entity has been deleted</param> /// <returns>A credit card type</returns> public static CreditCardType InsertCreditCardType(string Name, string SystemKeyword, int DisplayOrder, bool Deleted) { DBCreditCardType dbItem = DBProviderManager <DBCreditCardTypeProvider> .Provider.InsertCreditCardType(Name, SystemKeyword, DisplayOrder, Deleted); CreditCardType creditCardType = DBMapping(dbItem); if (CreditCardTypeManager.CacheEnabled) { NopCache.RemoveByPattern(CREDITCARDS_PATTERN_KEY); } return(creditCardType); }
private static CreditCardType DBMapping(DBCreditCardType dbItem) { if (dbItem == null) { return(null); } CreditCardType item = new CreditCardType(); item.CreditCardTypeID = dbItem.CreditCardTypeID; item.Name = dbItem.Name; item.SystemKeyword = dbItem.SystemKeyword; item.DisplayOrder = dbItem.DisplayOrder; item.Deleted = dbItem.Deleted; return(item); }