Пример #1
0
        /// <summary>
        /// Gets the currency dto by currencyId.
        /// </summary>
        /// <returns></returns>
        public static CurrencyDto GetCurrencyByCurrencyId(int currencyId)
        {
            CurrencyAdmin admin = new CurrencyAdmin();

            admin.LoadByCurrencyId(currencyId);
            return(admin.CurrentDto);
        }
Пример #2
0
        /// <summary>
        /// Gets the currency dto by currencyCode.
        /// </summary>
        /// <returns></returns>
        public static CurrencyDto GetCurrencyByCurrencyCode(string currencyCode)
        {
            CurrencyAdmin admin = new CurrencyAdmin();

            admin.LoadByCurrencyCode(currencyCode);
            return(admin.CurrentDto);
        }
Пример #3
0
        /// <summary>
        /// Gets the currency dto.
        /// </summary>
        /// <returns></returns>
        public static CurrencyDto GetCurrencyDto()
        {
            // Assign new cache key, specific for site guid and response groups requested
            string cacheKey = CatalogCache.CreateCacheKey("catalog-currency", CatalogConfiguration.Instance.ApplicationId.ToString());

            CurrencyDto dto = null;

            // check cache first
            object cachedObject = CatalogCache.Get(cacheKey);

            if (cachedObject != null)
            {
                dto = (CurrencyDto)cachedObject;
            }

            // Load the object
            if (dto == null)
            {
                CurrencyAdmin admin = new CurrencyAdmin();
                admin.Load();
                dto = admin.CurrentDto;

                // Insert to the cache collection
                CatalogCache.Insert(cacheKey, dto, CatalogConfiguration.Instance.Cache.CatalogSchemaTimeout);
            }

            dto.AcceptChanges();

            return(dto);
        }
Пример #4
0
        /// <summary>
        /// Saves the currency.
        /// </summary>
        /// <param name="dto">The dto.</param>
        public static void SaveCurrency(CurrencyDto dto)
        {
            if (dto == null)
            {
                throw new ArgumentNullException("dto", String.Format("CurrencyDto can not be null"));
            }

            CurrencyAdmin admin = new CurrencyAdmin(dto);

            admin.Save();
        }