Exemplo n.º 1
0
        private static LanguageCollection DBMapping(DBLanguageCollection dbCollection)
        {
            if (dbCollection == null)
                return null;

            LanguageCollection collection = new LanguageCollection();
            foreach (DBLanguage dbItem in dbCollection)
            {
                Language item = DBMapping(dbItem);
                collection.Add(item);
            }

            return collection;
        }
Exemplo n.º 2
0
        private static LanguageCollection DBMapping(DBLanguageCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            LanguageCollection collection = new LanguageCollection();

            foreach (DBLanguage dbItem in dbCollection)
            {
                Language item = DBMapping(dbItem);
                collection.Add(item);
            }

            return(collection);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets all languages
        /// </summary>
        /// <param name="showHidden">A value indicating whether to show hidden records</param>
        /// <returns>Language collection</returns>
        public override DBLanguageCollection GetAllLanguages(bool showHidden)
        {
            DBLanguageCollection languageCollection = new DBLanguageCollection();
            Database             db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand            dbCommand = db.GetStoredProcCommand("Nop_LanguageLoadAll");

            db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBLanguage language = GetLanguageFromReader(dataReader);
                    languageCollection.Add(language);
                }
            }
            return(languageCollection);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets all languages
        /// </summary>
        /// <param name="showHidden">A value indicating whether to show hidden records</param>
        /// <returns>Language collection</returns>
        public static LanguageCollection GetAllLanguages(bool showHidden)
        {
            string key  = string.Format(LANGUAGES_ALL_KEY, showHidden);
            object obj2 = NopCache.Get(key);

            if (LanguageManager.CacheEnabled && (obj2 != null))
            {
                return((LanguageCollection)obj2);
            }

            DBLanguageCollection dbCollection = DBProviderManager <DBLanguageProvider> .Provider.GetAllLanguages(showHidden);

            LanguageCollection languageCollection = DBMapping(dbCollection);

            if (LanguageManager.CacheEnabled)
            {
                NopCache.Max(key, languageCollection);
            }
            return(languageCollection);
        }