Пример #1
0
        private static SettingCollection DBMapping(DBSettingCollection dbCollection)
        {
            if (dbCollection == null)
                return null;

            SettingCollection collection = new SettingCollection();
            foreach (DBSetting dbItem in dbCollection)
            {
                Setting item = DBMapping(dbItem);
                collection.Add(item);
            }

            return collection;
        }
        /// <summary>
        /// Gets all settings
        /// </summary>
        /// <returns>Setting collection</returns>
        public override DBSettingCollection GetAllSettings()
        {
            DBSettingCollection settingCollection = new DBSettingCollection();
            Database            db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand           dbCommand = db.GetStoredProcCommand("Nop_SettingLoadAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBSetting setting = GetSettingFromReader(dataReader);
                    settingCollection.Add(setting);
                }
            }
            return(settingCollection);
        }
Пример #3
0
        private static SettingDictionary DBMapping(DBSettingCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            var dictionary = new SettingDictionary();

            foreach (var dbItem in dbCollection)
            {
                var item = DBMapping(dbItem);
                dictionary.Add(item.Name.ToLowerInvariant(), item);
            }

            return(dictionary);
        }
Пример #4
0
        private static SettingCollection DBMapping(DBSettingCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            SettingCollection collection = new SettingCollection();

            foreach (DBSetting dbItem in dbCollection)
            {
                Setting item = DBMapping(dbItem);
                collection.Add(item);
            }

            return(collection);
        }
Пример #5
0
        /// <summary>
        /// Gets all settings
        /// </summary>
        /// <returns>Setting collection</returns>
        public static SettingCollection GetAllSettings()
        {
            string key  = SETTINGS_ALL_KEY;
            object obj2 = NopCache.Get(key);

            if (SettingManager.CacheEnabled && (obj2 != null))
            {
                return((SettingCollection)obj2);
            }

            DBSettingCollection dbCollection = DBProviderManager <DBSettingProvider> .Provider.GetAllSettings();

            SettingCollection settingCollection = DBMapping(dbCollection);

            if (SettingManager.CacheEnabled)
            {
                NopCache.Max(key, settingCollection);
            }
            return(settingCollection);
        }