private DBProductAttribute GetProductAttributeFromReader(IDataReader dataReader)
 {
     DBProductAttribute productAttribute = new DBProductAttribute();
     productAttribute.ProductAttributeID = NopSqlDataHelper.GetInt(dataReader, "ProductAttributeID");
     productAttribute.Name = NopSqlDataHelper.GetString(dataReader, "Name");
     productAttribute.Description = NopSqlDataHelper.GetString(dataReader, "Description");
     return productAttribute;
 }
Ejemplo n.º 2
0
        private DBProductAttribute GetProductAttributeFromReader(IDataReader dataReader)
        {
            DBProductAttribute productAttribute = new DBProductAttribute();

            productAttribute.ProductAttributeID = NopSqlDataHelper.GetInt(dataReader, "ProductAttributeID");
            productAttribute.Name        = NopSqlDataHelper.GetString(dataReader, "Name");
            productAttribute.Description = NopSqlDataHelper.GetString(dataReader, "Description");
            return(productAttribute);
        }
Ejemplo n.º 3
0
        private DBProductAttribute GetProductAttributeFromReader(IDataReader dataReader)
        {
            var item = new DBProductAttribute();

            item.ProductAttributeId = NopSqlDataHelper.GetInt(dataReader, "ProductAttributeID");
            item.Name        = NopSqlDataHelper.GetString(dataReader, "Name");
            item.Description = NopSqlDataHelper.GetString(dataReader, "Description");
            return(item);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Updates the product attribute
        /// </summary>
        /// <param name="ProductAttributeID">Product attribute identifier</param>
        /// <param name="Name">The name</param>
        /// <param name="Description">The description</param>
        /// <returns>Product attribute </returns>
        public override DBProductAttribute UpdateProductAttribute(int ProductAttributeID, string Name,
                                                                  string Description)
        {
            DBProductAttribute productAttribute = null;
            Database           db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand          dbCommand = db.GetStoredProcCommand("Nop_ProductAttributeUpdate");

            db.AddInParameter(dbCommand, "ProductAttributeID", DbType.Int32, ProductAttributeID);
            db.AddInParameter(dbCommand, "Name", DbType.String, Name);
            db.AddInParameter(dbCommand, "Description", DbType.String, Description);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                productAttribute = GetProductAttributeByID(ProductAttributeID);
            }
            return(productAttribute);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Gets a product attribute
        /// </summary>
        /// <param name="ProductAttributeID">Product attribute identifier</param>
        /// <returns>Product attribute </returns>
        public override DBProductAttribute GetProductAttributeByID(int ProductAttributeID)
        {
            DBProductAttribute productAttribute = null;
            Database           db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand          dbCommand = db.GetStoredProcCommand("Nop_ProductAttributeLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "ProductAttributeID", DbType.Int32, ProductAttributeID);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    productAttribute = GetProductAttributeFromReader(dataReader);
                }
            }
            return(productAttribute);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets all product attributes
        /// </summary>
        /// <returns>Product attribute collection</returns>
        public override DBProductAttributeCollection GetAllProductAttributes()
        {
            DBProductAttributeCollection productAttributes = new DBProductAttributeCollection();
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_ProductAttributeLoadAll");

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    DBProductAttribute productAttribute = GetProductAttributeFromReader(dataReader);
                    productAttributes.Add(productAttribute);
                }
            }
            return(productAttributes);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Updates the product attribute
        /// </summary>
        /// <param name="productAttributeId">Product attribute identifier</param>
        /// <param name="name">The name</param>
        /// <param name="description">The description</param>
        /// <returns>Product attribute </returns>
        public override DBProductAttribute UpdateProductAttribute(int productAttributeId,
                                                                  string name, string description)
        {
            DBProductAttribute item      = null;
            Database           db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand          dbCommand = db.GetStoredProcCommand("Nop_ProductAttributeUpdate");

            db.AddInParameter(dbCommand, "ProductAttributeID", DbType.Int32, productAttributeId);
            db.AddInParameter(dbCommand, "Name", DbType.String, name);
            db.AddInParameter(dbCommand, "Description", DbType.String, description);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                item = GetProductAttributeById(productAttributeId, 0);
            }
            return(item);
        }