Esempio n. 1
0
        private static CountryCollection DBMapping(DBCountryCollection dbCollection)
        {
            if (dbCollection == null)
                return null;

            CountryCollection collection = new CountryCollection();
            foreach (DBCountry dbItem in dbCollection)
            {
                Country item = DBMapping(dbItem);
                collection.Add(item);
            }

            return collection;
        }
Esempio n. 2
0
        private static CountryCollection DBMapping(DBCountryCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            CountryCollection collection = new CountryCollection();

            foreach (DBCountry dbItem in dbCollection)
            {
                Country item = DBMapping(dbItem);
                collection.Add(item);
            }

            return(collection);
        }
        /// <summary>
        /// Gets all countries that allow shipping
        /// </summary>
        /// <returns>Country collection</returns>
        public override DBCountryCollection GetAllCountriesForShipping(bool showHidden)
        {
            var       result    = new DBCountryCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_CountryLoadAllForShipping");

            db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    var item = GetCountryFromReader(dataReader);
                    result.Add(item);
                }
            }
            return(result);
        }
Esempio n. 4
0
        /// <summary>
        /// Gets all countries that allow registration
        /// </summary>
        /// <returns>Country collection</returns>
        public override DBCountryCollection GetAllCountriesForRegistration(bool showHidden)
        {
            DBCountryCollection countryCollection = new DBCountryCollection();
            Database            db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand           dbCommand = db.GetStoredProcCommand("Nop_CountryLoadAllForRegistration");

            db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBCountry country = GetCountryFromReader(dataReader);
                    countryCollection.Add(country);
                }
            }
            return(countryCollection);
        }
Esempio n. 5
0
        /// <summary>
        /// Gets all countries
        /// </summary>
        /// <returns>Country collection</returns>
        public static CountryCollection GetAllCountries()
        {
            bool   showHidden = NopContext.Current.IsAdmin;
            string key        = string.Format(COUNTRIES_ALL_KEY, showHidden);
            object obj2       = NopCache.Get(key);

            if (CountryManager.CacheEnabled && (obj2 != null))
            {
                return((CountryCollection)obj2);
            }

            DBCountryCollection dbCollection = DBProviderManager <DBCountryProvider> .Provider.GetAllCountries(showHidden);

            CountryCollection countryCollection = DBMapping(dbCollection);

            if (CountryManager.CacheEnabled)
            {
                NopCache.Max(key, countryCollection);
            }
            return(countryCollection);
        }
 /// <summary>
 /// Gets all countries that allow shipping
 /// </summary>
 /// <returns>Country collection</returns>
 public override DBCountryCollection GetAllCountriesForShipping(bool showHidden)
 {
     DBCountryCollection countryCollection = new DBCountryCollection();
     Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
     DbCommand dbCommand = db.GetStoredProcCommand("Nop_CountryLoadAllForShipping");
     db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
     using (IDataReader dataReader = db.ExecuteReader(dbCommand))
     {
         while (dataReader.Read())
         {
             DBCountry country = GetCountryFromReader(dataReader);
             countryCollection.Add(country);
         }
     }
     return countryCollection;
 }