private static ProductManufacturerCollection DBMapping(DBProductManufacturerCollection dbCollection)
        {
            if (dbCollection == null)
                return null;

            ProductManufacturerCollection collection = new ProductManufacturerCollection();
            foreach (DBProductManufacturer dbItem in dbCollection)
            {
                ProductManufacturer item = DBMapping(dbItem);
                collection.Add(item);
            }

            return collection;
        }
        private static ProductManufacturerCollection DBMapping(DBProductManufacturerCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            ProductManufacturerCollection collection = new ProductManufacturerCollection();

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

            return(collection);
        }
示例#3
0
        /// <summary>
        /// Gets a product manufacturer mapping collection
        /// </summary>
        /// <param name="ProductID">Product identifier</param>
        /// <param name="showHidden">A value indicating whether to show hidden records</param>
        /// <returns>Product manufacturer mapping collection</returns>
        public override DBProductManufacturerCollection GetProductManufacturersByProductID(int ProductID, bool showHidden)
        {
            DBProductManufacturerCollection productManufacturerCollection = new DBProductManufacturerCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_Product_Manufacturer_MappingLoadByProductID");

            db.AddInParameter(dbCommand, "ProductID", DbType.Int32, ProductID);
            db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBProductManufacturer productManufacturer = GetProductManufacturerFromReader(dataReader);
                    productManufacturerCollection.Add(productManufacturer);
                }
            }

            return(productManufacturerCollection);
        }
示例#4
0
        /// <summary>
        /// Gets product product manufacturer collection
        /// </summary>
        /// <param name="manufacturerId">Manufacturer identifier</param>
        /// <param name="showHidden">A value indicating whether to show hidden records</param>
        /// <returns>Product manufacturer collection</returns>
        public override DBProductManufacturerCollection GetProductManufacturersByManufacturerId(int manufacturerId, bool showHidden)
        {
            var       result    = new DBProductManufacturerCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_Product_Manufacturer_MappingLoadByManufacturerID");

            db.AddInParameter(dbCommand, "ManufacturerID", DbType.Int32, manufacturerId);
            db.AddInParameter(dbCommand, "ShowHidden", DbType.Boolean, showHidden);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    var item = GetProductManufacturerFromReader(dataReader);
                    result.Add(item);
                }
            }

            return(result);
        }
        /// <summary>
        /// Gets a product manufacturer mapping collection
        /// </summary>
        /// <param name="ProductID">Product identifier</param>
        /// <returns>Product manufacturer mapping collection</returns>
        public static ProductManufacturerCollection GetProductManufacturersByProductID(int ProductID)
        {
            bool   showHidden = NopContext.Current.IsAdmin;
            string key        = string.Format(PRODUCTMANUFACTURERS_ALLBYPRODUCTID_KEY, showHidden, ProductID);
            object obj2       = NopCache.Get(key);

            if (ManufacturerManager.MappingsCacheEnabled && (obj2 != null))
            {
                return((ProductManufacturerCollection)obj2);
            }

            DBProductManufacturerCollection dbCollection = DBProviderManager <DBManufacturerProvider> .Provider.GetProductManufacturersByProductID(ProductID, showHidden);

            ProductManufacturerCollection productManufacturerCollection = DBMapping(dbCollection);

            if (ManufacturerManager.MappingsCacheEnabled)
            {
                NopCache.Max(key, productManufacturerCollection);
            }
            return(productManufacturerCollection);
        }