private static PaymentMethodCollection DBMapping(DBPaymentMethodCollection dbCollection)
        {
            if (dbCollection == null)
                return null;

            PaymentMethodCollection collection = new PaymentMethodCollection();
            foreach (DBPaymentMethod dbItem in dbCollection)
            {
                PaymentMethod item = DBMapping(dbItem);
                collection.Add(item);
            }

            return collection;
        }
Exemple #2
0
        /// <summary>
        /// Gets all payment methods
        /// </summary>
        /// <returns>Payment method collection</returns>
        public override DBPaymentMethodCollection GetAllPaymentMethods(bool showHidden)
        {
            DBPaymentMethodCollection paymentMethodCollection = new DBPaymentMethodCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_PaymentMethodLoadAll");

            db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBPaymentMethod paymentMethod = GetPaymentMethodFromReader(dataReader);
                    paymentMethodCollection.Add(paymentMethod);
                }
            }
            return(paymentMethodCollection);
        }
Exemple #3
0
        private static PaymentMethodCollection DBMapping(DBPaymentMethodCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            var collection = new PaymentMethodCollection();

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

            return(collection);
        }
Exemple #4
0
        /// <summary>
        /// Gets all payment methods
        /// </summary>
        /// <returns>Payment method collection</returns>
        public static PaymentMethodCollection GetAllPaymentMethods()
        {
            bool   showHidden = NopContext.Current.IsAdmin;
            string key        = string.Format(PAYMENTMETHODS_ALL_KEY, showHidden);
            object obj2       = NopCache.Get(key);

            if (PaymentMethodManager.CacheEnabled && (obj2 != null))
            {
                return((PaymentMethodCollection)obj2);
            }

            DBPaymentMethodCollection dbCollection = DBProviderManager <DBPaymentMethodProvider> .Provider.GetAllPaymentMethods(showHidden);

            PaymentMethodCollection paymentMethodCollection = DBMapping(dbCollection);

            if (PaymentMethodManager.CacheEnabled)
            {
                NopCache.Max(key, paymentMethodCollection);
            }
            return(paymentMethodCollection);
        }
Exemple #5
0
        /// <summary>
        /// Gets all payment methods
        /// </summary>
        /// <param name="showHidden">A value indicating whether to show hidden records</param>
        /// <param name="filterByCountryId">The country indentifier</param>
        /// <returns>Payment method collection</returns>
        public override DBPaymentMethodCollection GetAllPaymentMethods(bool showHidden,
                                                                       int?filterByCountryId)
        {
            var       result    = new DBPaymentMethodCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_PaymentMethodLoadAll");

            db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
            if (filterByCountryId.HasValue)
            {
                db.AddInParameter(dbCommand, "FilterByCountryID", DbType.Int32, filterByCountryId.Value);
            }
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    var item = GetPaymentMethodFromReader(dataReader);
                    result.Add(item);
                }
            }
            return(result);
        }
 /// <summary>
 /// Gets all payment methods
 /// </summary>
 /// <returns>Payment method collection</returns>
 public override DBPaymentMethodCollection GetAllPaymentMethods(bool showHidden)
 {
     DBPaymentMethodCollection paymentMethodCollection = new DBPaymentMethodCollection();
     Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
     DbCommand dbCommand = db.GetStoredProcCommand("Nop_PaymentMethodLoadAll");
     db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
     using (IDataReader dataReader = db.ExecuteReader(dbCommand))
     {
         while (dataReader.Read())
         {
             DBPaymentMethod paymentMethod = GetPaymentMethodFromReader(dataReader);
             paymentMethodCollection.Add(paymentMethod);
         }
     }
     return paymentMethodCollection;
 }