/// <summary>
        /// Gets all tax providers
        /// </summary>
        /// <returns>Shipping rate computation method collection</returns>
        public override DBTaxProviderCollection GetAllTaxProviders()
        {
            DBTaxProviderCollection taxProviderCollection = new DBTaxProviderCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_TaxProviderLoadAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBTaxProvider taxProvider = GetTaxProviderFromReader(dataReader);
                    taxProviderCollection.Add(taxProvider);
                }
            }
            return(taxProviderCollection);
        }
Пример #2
0
        private static TaxProviderCollection DBMapping(DBTaxProviderCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            var collection = new TaxProviderCollection();

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

            return(collection);
        }
        /// <summary>
        /// Gets all tax providers
        /// </summary>
        /// <returns>Shipping rate computation method collection</returns>
        public static TaxProviderCollection GetAllTaxProviders()
        {
            string key  = string.Format(TAXPROVIDERS_ALL_KEY);
            object obj2 = NopCache.Get(key);

            if (TaxProviderManager.CacheEnabled && (obj2 != null))
            {
                return((TaxProviderCollection)obj2);
            }

            DBTaxProviderCollection dbCollection = DBProviderManager <DBTaxProviderProvider> .Provider.GetAllTaxProviders();

            TaxProviderCollection taxProviderCollection = DBMapping(dbCollection);

            if (TaxProviderManager.CacheEnabled)
            {
                NopCache.Max(key, taxProviderCollection);
            }
            return(taxProviderCollection);
        }
 /// <summary>
 /// Gets all tax providers
 /// </summary>
 /// <returns>Shipping rate computation method collection</returns>
 public override DBTaxProviderCollection GetAllTaxProviders()
 {
     DBTaxProviderCollection taxProviderCollection = new DBTaxProviderCollection();
     Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
     DbCommand dbCommand = db.GetStoredProcCommand("Nop_TaxProviderLoadAll");
     using (IDataReader dataReader = db.ExecuteReader(dbCommand))
     {
         while (dataReader.Read())
         {
             DBTaxProvider taxProvider = GetTaxProviderFromReader(dataReader);
             taxProviderCollection.Add(taxProvider);
         }
     }
     return taxProviderCollection;
 }