Ejemplo n.º 1
0
        private static CurrencyCollection DBMapping(DBCurrencyCollection dbCollection)
        {
            if (dbCollection == null)
                return null;

            CurrencyCollection collection = new CurrencyCollection();
            foreach (DBCurrency dbItem in dbCollection)
            {
                Currency item = DBMapping(dbItem);
                collection.Add(item);
            }

            return collection;
        }
        /// <summary>
        /// Gets all currencies
        /// </summary>
        /// <returns>Currency collection</returns>
        public override DBCurrencyCollection GetAllCurrencies(bool showHidden)
        {
            DBCurrencyCollection currencyCollection = new DBCurrencyCollection();
            Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_CurrencyLoadAll");
            db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBCurrency currency = GetCurrencyFromReader(dataReader);
                    currencyCollection.Add(currency);
                }
            }

            return currencyCollection;
        }
Ejemplo n.º 3
0
        private static CurrencyCollection DBMapping(DBCurrencyCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            CurrencyCollection collection = new CurrencyCollection();

            foreach (DBCurrency dbItem in dbCollection)
            {
                Currency item = DBMapping(dbItem);
                collection.Add(item);
            }

            return(collection);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets all currencies
        /// </summary>
        /// <returns>Currency collection</returns>
        public static CurrencyCollection GetAllCurrencies()
        {
            bool   showHidden = NopContext.Current.IsAdmin;
            string key        = string.Format(CURRENCIES_ALL_KEY, showHidden);
            object obj2       = NopCache.Get(key);

            if (CurrencyManager.CacheEnabled && (obj2 != null))
            {
                return((CurrencyCollection)obj2);
            }

            DBCurrencyCollection dbCollection = DBProviderManager <DBCurrencyProvider> .Provider.GetAllCurrencies(showHidden);

            CurrencyCollection currencyCollection = DBMapping(dbCollection);

            if (CurrencyManager.CacheEnabled)
            {
                NopCache.Max(key, currencyCollection);
            }
            return(currencyCollection);
        }