/// <summary>
        /// Gets all shipping rate computation methods
        /// </summary>
        /// <returns>Shipping rate computation method collection</returns>
        public override DBShippingRateComputationMethodCollection GetAllShippingRateComputationMethods()
        {
            DBShippingRateComputationMethodCollection shippingRateComputationMethodCollection = new DBShippingRateComputationMethodCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_ShippingRateComputationMethodLoadAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBShippingRateComputationMethod shippingRateComputationMethod = GetShippingRateComputationMethodFromReader(dataReader);
                    shippingRateComputationMethodCollection.Add(shippingRateComputationMethod);
                }
            }
            return(shippingRateComputationMethodCollection);
        }
        /// <summary>
        /// Gets all shipping rate computation methods
        /// </summary>
        /// <param name="showHidden">A value indicating whether to show hidden records</param>
        /// <returns>Shipping rate computation method collection</returns>
        public override DBShippingRateComputationMethodCollection GetAllShippingRateComputationMethods(bool showHidden)
        {
            var       result    = new DBShippingRateComputationMethodCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_ShippingRateComputationMethodLoadAll");

            db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    var item = GetShippingRateComputationMethodFromReader(dataReader);
                    result.Add(item);
                }
            }
            return(result);
        }
Beispiel #3
0
        private static ShippingRateComputationMethodCollection DBMapping(DBShippingRateComputationMethodCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            ShippingRateComputationMethodCollection collection = new ShippingRateComputationMethodCollection();

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

            return(collection);
        }
Beispiel #4
0
        /// <summary>
        /// Gets all shipping rate computation methods
        /// </summary>
        /// <returns>Shipping rate computation method collection</returns>
        public static ShippingRateComputationMethodCollection GetAllShippingRateComputationMethods()
        {
            string key  = string.Format(SHIPPINGRATECOMPUTATIONMETHODS_ALL_KEY);
            object obj2 = NopCache.Get(key);

            if (ShippingRateComputationMethodManager.CacheEnabled && (obj2 != null))
            {
                return((ShippingRateComputationMethodCollection)obj2);
            }

            DBShippingRateComputationMethodCollection dbCollection = DBProviderManager <DBShippingRateComputationMethodProvider> .Provider.GetAllShippingRateComputationMethods();

            ShippingRateComputationMethodCollection shippingRateComputationMethods = DBMapping(dbCollection);

            if (ShippingRateComputationMethodManager.CacheEnabled)
            {
                NopCache.Max(key, shippingRateComputationMethods);
            }
            return(shippingRateComputationMethods);
        }
 /// <summary>
 /// Gets all shipping rate computation methods
 /// </summary>
 /// <returns>Shipping rate computation method collection</returns>
 public override DBShippingRateComputationMethodCollection GetAllShippingRateComputationMethods()
 {
     DBShippingRateComputationMethodCollection shippingRateComputationMethodCollection = new DBShippingRateComputationMethodCollection();
     Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
     DbCommand dbCommand = db.GetStoredProcCommand("Nop_ShippingRateComputationMethodLoadAll");
     using (IDataReader dataReader = db.ExecuteReader(dbCommand))
     {
         while (dataReader.Read())
         {
             DBShippingRateComputationMethod shippingRateComputationMethod = GetShippingRateComputationMethodFromReader(dataReader);
             shippingRateComputationMethodCollection.Add(shippingRateComputationMethod);
         }
     }
     return shippingRateComputationMethodCollection;
 }