Пример #1
0
        private DBProductVariantAttributeCombination GetProductVariantAttributeCombinationFromReader(IDataReader dataReader)
        {
            var item = new DBProductVariantAttributeCombination();

            item.ProductVariantAttributeCombinationId = NopSqlDataHelper.GetInt(dataReader, "ProductVariantAttributeCombinationID");
            item.ProductVariantId      = NopSqlDataHelper.GetInt(dataReader, "ProductVariantID");
            item.AttributesXml         = NopSqlDataHelper.GetString(dataReader, "AttributesXML");
            item.StockQuantity         = NopSqlDataHelper.GetInt(dataReader, "StockQuantity");
            item.AllowOutOfStockOrders = NopSqlDataHelper.GetBoolean(dataReader, "AllowOutOfStockOrders");
            return(item);
        }
Пример #2
0
        /// <summary>
        /// Gets a product variant attribute combination
        /// </summary>
        /// <param name="productVariantAttributeCombinationId">Product variant attribute combination identifier</param>
        /// <returns>Product variant attribute combination</returns>
        public override DBProductVariantAttributeCombination GetProductVariantAttributeCombinationById(int productVariantAttributeCombinationId)
        {
            DBProductVariantAttributeCombination item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_ProductVariantAttributeCombinationLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "ProductVariantAttributeCombinationID", DbType.Int32, productVariantAttributeCombinationId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetProductVariantAttributeCombinationFromReader(dataReader);
                }
            }
            return(item);
        }
Пример #3
0
        /// <summary>
        /// Updates a product variant attribute combination
        /// </summary>
        /// <param name="productVariantAttributeCombinationId">Product variant attribute combination identifier</param>
        /// <param name="productVariantId">The product variant identifier</param>
        /// <param name="attributesXml">The attributes</param>
        /// <param name="stockQuantity">The stock quantity</param>
        /// <param name="allowOutOfStockOrders">The value indicating whether to allow orders when out of stock</param>
        /// <returns>Product variant attribute combination</returns>
        public override DBProductVariantAttributeCombination UpdateProductVariantAttributeCombination(int productVariantAttributeCombinationId,
                                                                                                      int productVariantId,
                                                                                                      string attributesXml,
                                                                                                      int stockQuantity,
                                                                                                      bool allowOutOfStockOrders)
        {
            DBProductVariantAttributeCombination item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_ProductVariantAttributeCombinationUpdate");

            db.AddInParameter(dbCommand, "ProductVariantAttributeCombinationID", DbType.Int32, productVariantAttributeCombinationId);
            db.AddInParameter(dbCommand, "ProductVariantID", DbType.Int32, productVariantId);
            db.AddInParameter(dbCommand, "AttributesXML", DbType.Xml, attributesXml);
            db.AddInParameter(dbCommand, "StockQuantity", DbType.Int32, stockQuantity);
            db.AddInParameter(dbCommand, "AllowOutOfStockOrders", DbType.Int32, allowOutOfStockOrders);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                item = GetProductVariantAttributeCombinationById(productVariantAttributeCombinationId);
            }
            return(item);
        }