/// <summary> /// Gets a product specification attribute mapping collection /// </summary> /// <param name="productId">Product identifier</param> /// <param name="allowFiltering">0 to load attributes with AllowFiltering set to false, 0 to load attributes with AllowFiltering set to true, null to load all attributes</param> /// <param name="showOnProductPage">0 to load attributes with ShowOnProductPage set to false, 0 to load attributes with ShowOnProductPage set to true, null to load all attributes</param> /// <returns>Product specification attribute mapping collection</returns> public override DBProductSpecificationAttributeCollection GetProductSpecificationAttributesByProductId(int productId, bool?allowFiltering, bool?showOnProductPage) { var result = new DBProductSpecificationAttributeCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_Product_SpecificationAttribute_MappingLoadByProductID"); db.AddInParameter(dbCommand, "ProductID", DbType.Int32, productId); if (allowFiltering.HasValue) { db.AddInParameter(dbCommand, "AllowFiltering", DbType.Boolean, allowFiltering.Value); } else { db.AddInParameter(dbCommand, "AllowFiltering", DbType.Boolean, null); } if (showOnProductPage.HasValue) { db.AddInParameter(dbCommand, "ShowOnProductPage", DbType.Boolean, showOnProductPage.Value); } else { db.AddInParameter(dbCommand, "ShowOnProductPage", DbType.Boolean, null); } using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { var item = GetProductSpecificationAttributeFromReader(dataReader); result.Add(item); } } return(result); }
/// <summary> /// Gets a product specification attribute mapping collection /// </summary> /// <param name="ProductID">Product identifier</param> /// <param name="AllowFiltering">0 to load attributes with AllowFiltering set to false, 0 to load attributes with AllowFiltering set to true, null to load all attributes</param> /// <param name="ShowOnProductPage">0 to load attributes with ShowOnProductPage set to false, 0 to load attributes with ShowOnProductPage set to true, null to load all attributes</param> /// <returns>Product specification attribute mapping collection</returns> public override DBProductSpecificationAttributeCollection GetProductSpecificationAttributesByProductID(int ProductID, bool?AllowFiltering, bool?ShowOnProductPage) { DBProductSpecificationAttributeCollection productSpecificationAttributes = new DBProductSpecificationAttributeCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_Product_SpecificationAttribute_MappingLoadByProductID"); db.AddInParameter(dbCommand, "ProductID", DbType.Int32, ProductID); if (AllowFiltering.HasValue) { db.AddInParameter(dbCommand, "AllowFiltering", DbType.Boolean, AllowFiltering.Value); } else { db.AddInParameter(dbCommand, "AllowFiltering", DbType.Boolean, null); } if (ShowOnProductPage.HasValue) { db.AddInParameter(dbCommand, "ShowOnProductPage", DbType.Boolean, ShowOnProductPage.Value); } else { db.AddInParameter(dbCommand, "ShowOnProductPage", DbType.Boolean, null); } using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBProductSpecificationAttribute productSpecificationAttribute = GetProductSpecificationAttributeFromReader(dataReader); productSpecificationAttributes.Add(productSpecificationAttribute); } } return(productSpecificationAttributes); }
/// <summary> /// Gets a product specification attribute mapping collection /// </summary> /// <param name="ProductID">Product identifier</param> /// <param name="AllowFiltering">0 to load attributes with AllowFiltering set to false, 0 to load attributes with AllowFiltering set to true, null to load all attributes</param> /// <param name="ShowOnProductPage">0 to load attributes with ShowOnProductPage set to false, 0 to load attributes with ShowOnProductPage set to true, null to load all attributes</param> /// <returns>Product specification attribute mapping collection</returns> public override DBProductSpecificationAttributeCollection GetProductSpecificationAttributesByProductID(int ProductID, bool? AllowFiltering, bool? ShowOnProductPage) { DBProductSpecificationAttributeCollection productSpecificationAttributes = new DBProductSpecificationAttributeCollection(); Database db = NopSqlDataHelper.CreateConnection(_sqlConnectionString); DbCommand dbCommand = db.GetStoredProcCommand("Nop_Product_SpecificationAttribute_MappingLoadByProductID"); db.AddInParameter(dbCommand, "ProductID", DbType.Int32, ProductID); if (AllowFiltering.HasValue) db.AddInParameter(dbCommand, "AllowFiltering", DbType.Boolean, AllowFiltering.Value); else db.AddInParameter(dbCommand, "AllowFiltering", DbType.Boolean, null); if (ShowOnProductPage.HasValue) db.AddInParameter(dbCommand, "ShowOnProductPage", DbType.Boolean, ShowOnProductPage.Value); else db.AddInParameter(dbCommand, "ShowOnProductPage", DbType.Boolean, null); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { DBProductSpecificationAttribute productSpecificationAttribute = GetProductSpecificationAttributeFromReader(dataReader); productSpecificationAttributes.Add(productSpecificationAttribute); } } return productSpecificationAttributes; }