Ejemplo n.º 1
0
        private DBProductAttributeLocalized GetProductAttributeLocalizedFromReader(IDataReader dataReader)
        {
            var item = new DBProductAttributeLocalized();

            item.ProductAttributeLocalizedId = NopSqlDataHelper.GetInt(dataReader, "ProductAttributeLocalizedID");
            item.ProductAttributeId          = NopSqlDataHelper.GetInt(dataReader, "ProductAttributeID");
            item.LanguageId  = NopSqlDataHelper.GetInt(dataReader, "LanguageID");
            item.Name        = NopSqlDataHelper.GetString(dataReader, "Name");
            item.Description = NopSqlDataHelper.GetString(dataReader, "Description");
            return(item);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets localized product attribute by product attribute id and language id
        /// </summary>
        /// <param name="productAttributeId">Product attribute identifier</param>
        /// <param name="languageId">Language identifier</param>
        /// <returns>Product attribute content</returns>
        public override DBProductAttributeLocalized GetProductAttributeLocalizedByProductAttributeIdAndLanguageId(int productAttributeId, int languageId)
        {
            DBProductAttributeLocalized item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_ProductAttributeLocalizedLoadByProductAttributeIDAndLanguageID");

            db.AddInParameter(dbCommand, "ProductAttributeID", DbType.Int32, productAttributeId);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetProductAttributeLocalizedFromReader(dataReader);
                }
            }
            return(item);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Update a localized product attribute
        /// </summary>
        /// <param name="productAttributeLocalizedId">Localized product attribute identifier</param>
        /// <param name="productAttributeId">Product attribute identifier</param>
        /// <param name="languageId">Language identifier</param>
        /// <param name="name">Name text</param>
        /// <param name="description">Description text</param>
        /// <returns>Product attribute content</returns>
        public override DBProductAttributeLocalized UpdateProductAttributeLocalized(int productAttributeLocalizedId,
                                                                                    int productAttributeId, int languageId, string name, string description)
        {
            DBProductAttributeLocalized item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_ProductAttributeLocalizedUpdate");

            db.AddInParameter(dbCommand, "ProductAttributeLocalizedID", DbType.Int32, productAttributeLocalizedId);
            db.AddInParameter(dbCommand, "ProductAttributeID", DbType.Int32, productAttributeId);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId);
            db.AddInParameter(dbCommand, "Name", DbType.String, name);
            db.AddInParameter(dbCommand, "Description", DbType.String, description);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                item = GetProductAttributeLocalizedById(productAttributeLocalizedId);
            }

            return(item);
        }