Ejemplo n.º 1
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;
        }