private DBCheckoutAttributeValue GetCheckoutAttributeValueFromReader(IDataReader dataReader)
        {
            var item = new DBCheckoutAttributeValue();

            item.CheckoutAttributeValueId = NopSqlDataHelper.GetInt(dataReader, "CheckoutAttributeValueID");
            item.CheckoutAttributeId      = NopSqlDataHelper.GetInt(dataReader, "CheckoutAttributeID");
            item.Name             = NopSqlDataHelper.GetString(dataReader, "Name");
            item.PriceAdjustment  = NopSqlDataHelper.GetDecimal(dataReader, "PriceAdjustment");
            item.WeightAdjustment = NopSqlDataHelper.GetDecimal(dataReader, "WeightAdjustment");
            item.IsPreSelected    = NopSqlDataHelper.GetBoolean(dataReader, "IsPreSelected");
            item.DisplayOrder     = NopSqlDataHelper.GetInt(dataReader, "DisplayOrder");
            return(item);
        }
        /// <summary>
        /// Gets a checkout attribute value
        /// </summary>
        /// <param name="checkoutAttributeValueId">Checkout attribute value identifier</param>
        /// <param name="languageId">Language identifier</param>
        /// <returns>Checkout attribute value</returns>
        public override DBCheckoutAttributeValue GetCheckoutAttributeValueById(int checkoutAttributeValueId, int languageId)
        {
            DBCheckoutAttributeValue item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_CheckoutAttributeValueLoadByPrimaryKey");

            db.AddInParameter(dbCommand, "CheckoutAttributeValueID", DbType.Int32, checkoutAttributeValueId);
            db.AddInParameter(dbCommand, "LanguageID", DbType.Int32, languageId);
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    item = GetCheckoutAttributeValueFromReader(dataReader);
                }
            }
            return(item);
        }
        /// <summary>
        /// Updates the checkout attribute value
        /// </summary>
        /// <param name="checkoutAttributeValueId">The checkout attribute value identifier</param>
        /// <param name="checkoutAttributeId">The checkout attribute identifier</param>
        /// <param name="name">The checkout attribute name</param>
        /// <param name="priceAdjustment">The price adjustment</param>
        /// <param name="weightAdjustment">The weight adjustment</param>
        /// <param name="isPreSelected">The value indicating whether the value is pre-selected</param>
        /// <param name="displayOrder">The display order</param>
        /// <returns>Checkout attribute value</returns>
        public override DBCheckoutAttributeValue UpdateCheckoutAttributeValue(int checkoutAttributeValueId,
                                                                              int checkoutAttributeId, string name, decimal priceAdjustment, decimal weightAdjustment,
                                                                              bool isPreSelected, int displayOrder)
        {
            DBCheckoutAttributeValue item = null;
            Database  db        = NopSqlDataHelper.CreateConnection(_sqlConnectionString);
            DbCommand dbCommand = db.GetStoredProcCommand("Nop_CheckoutAttributeValueUpdate");

            db.AddInParameter(dbCommand, "CheckoutAttributeValueID", DbType.Int32, checkoutAttributeValueId);
            db.AddInParameter(dbCommand, "CheckoutAttributeID", DbType.Int32, checkoutAttributeId);
            db.AddInParameter(dbCommand, "Name", DbType.String, name);
            db.AddInParameter(dbCommand, "PriceAdjustment", DbType.Decimal, priceAdjustment);
            db.AddInParameter(dbCommand, "WeightAdjustment", DbType.Decimal, weightAdjustment);
            db.AddInParameter(dbCommand, "IsPreSelected", DbType.Boolean, isPreSelected);
            db.AddInParameter(dbCommand, "DisplayOrder", DbType.Int32, displayOrder);
            if (db.ExecuteNonQuery(dbCommand) > 0)
            {
                item = GetCheckoutAttributeValueById(checkoutAttributeValueId, 0);
            }
            return(item);
        }