Ejemplo n.º 1
0
        /// <summary>
        /// Gets all discount types
        /// </summary>
        /// <returns>Discount type collection</returns>
        public override DBDiscountTypeCollection GetAllDiscountTypes()
        {
            var       result    = new DBDiscountTypeCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_DiscountTypeLoadAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    var item = GetDiscountTypeFromReader(dataReader);
                    result.Add(item);
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        private static DiscountTypeCollection DBMapping(DBDiscountTypeCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            DiscountTypeCollection collection = new DiscountTypeCollection();

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

            return(collection);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets all discount types
        /// </summary>
        /// <returns>Discount type collection</returns>
        public static DiscountTypeCollection GetAllDiscountTypes()
        {
            string key  = string.Format(DISCOUNTTYPES_ALL_KEY);
            object obj2 = NopCache.Get(key);

            if (DiscountManager.CacheEnabled && (obj2 != null))
            {
                return((DiscountTypeCollection)obj2);
            }

            DBDiscountTypeCollection dbCollection = DBProviderManager <DBDiscountProvider> .Provider.GetAllDiscountTypes();

            DiscountTypeCollection discountTypeCollection = DBMapping(dbCollection);

            if (DiscountManager.CacheEnabled)
            {
                NopCache.Max(key, discountTypeCollection);
            }
            return(discountTypeCollection);
        }
Ejemplo n.º 4
0
        private static DiscountTypeCollection DBMapping(DBDiscountTypeCollection dbCollection)
        {
            if (dbCollection == null)
                return null;

            DiscountTypeCollection collection = new DiscountTypeCollection();
            foreach (DBDiscountType dbItem in dbCollection)
            {
                DiscountType item = DBMapping(dbItem);
                collection.Add(item);
            }

            return collection;
        }
        /// <summary>
        /// Gets all discount types
        /// </summary>
        /// <returns>Discount type collection</returns>
        public override DBDiscountTypeCollection GetAllDiscountTypes()
        {
            DBDiscountTypeCollection discountTypeCollection = new DBDiscountTypeCollection();
            Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_DiscountTypeLoadAll");
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBDiscountType discountType = GetDiscountTypeFromReader(dataReader);
                    discountTypeCollection.Add(discountType);
                }
            }

            return discountTypeCollection;
        }