/// <summary>
        /// Inserts a record into the TournamentFee table.
        /// </summary>
        /// <param name=""></param>
        public static IdType Insert(TournamentFeeData data, SqlTransaction transaction)
        {
            // Create and execute the command
            SqlCommand cmd = GetSqlCommand(CONNECTION_STRING_KEY, "spTournamentFee_Insert", CommandType.StoredProcedure, COMMAND_TIMEOUT, transaction);

            SqlParameter rv = cmd.Parameters.Add("RETURN_VALUE", SqlDbType.Int);

            rv.Direction = ParameterDirection.ReturnValue;
            //Create the parameters and append them to the command object
            cmd.Parameters.Add(new SqlParameter("@TournamentId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "TournamentId", DataRowVersion.Proposed, data.TournamentId.DBValue));
            cmd.Parameters.Add(new SqlParameter("@Key", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Key", DataRowVersion.Proposed, data.Key.DBValue));
            cmd.Parameters.Add(new SqlParameter("@Fee", SqlDbType.Money, 0, ParameterDirection.Input, false, 0, 0, "Fee", DataRowVersion.Proposed, data.Fee.DBValue));

            // Execute the query
            cmd.ExecuteNonQuery();

            // do not close the connection if it is part of a transaction
            if (transaction == null)
            {
                cmd.Connection.Close();
            }

            // Set the output paramter value(s)
            return(new IdType((Int32)(cmd.Parameters["RETURN_VALUE"].Value)));
        }
        /// <summary>
        /// Finds a TournamentFee entity using it's primary key.
        /// </summary>
        /// <param name="TournamentFeeId">A key field.</param>
        /// <returns>A TournamentFeeData object.</returns>
        /// <exception cref="Spring2.Core.DAO.FinderException">Thrown when no entity exists witht he specified primary key..</exception>
        public static TournamentFeeData Load(IdType tournamentFeeId)
        {
            WhereClause w = new WhereClause();

            w.And("TournamentFeeId", tournamentFeeId.DBValue);
            SqlDataReader dataReader = GetListReader(CONNECTION_STRING_KEY, VIEW, w, null);

            if (!dataReader.Read())
            {
                dataReader.Close();
                throw new FinderException("Load found no rows for TournamentFee.");
            }
            TournamentFeeData data = GetDataObjectFromReader(dataReader);

            dataReader.Close();
            return(data);
        }
        /// <summary>
        /// Updates a record in the TournamentFee table.
        /// </summary>
        /// <param name=""></param>
        public static void Update(TournamentFeeData data, SqlTransaction transaction)
        {
            // Create and execute the command
            SqlCommand cmd = GetSqlCommand(CONNECTION_STRING_KEY, "spTournamentFee_Update", CommandType.StoredProcedure, COMMAND_TIMEOUT, transaction);

            //Create the parameters and append them to the command object
            cmd.Parameters.Add(new SqlParameter("@TournamentFeeId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "TournamentFeeId", DataRowVersion.Proposed, data.TournamentFeeId.DBValue));
            cmd.Parameters.Add(new SqlParameter("@TournamentId", SqlDbType.Int, 0, ParameterDirection.Input, false, 10, 0, "TournamentId", DataRowVersion.Proposed, data.TournamentId.DBValue));
            cmd.Parameters.Add(new SqlParameter("@Key", SqlDbType.VarChar, 50, ParameterDirection.Input, false, 0, 0, "Key", DataRowVersion.Proposed, data.Key.DBValue));
            cmd.Parameters.Add(new SqlParameter("@Fee", SqlDbType.Money, 0, ParameterDirection.Input, false, 0, 0, "Fee", DataRowVersion.Proposed, data.Fee.DBValue));

            // Execute the query
            cmd.ExecuteNonQuery();

            // do not close the connection if it is part of a transaction
            if (transaction == null)
            {
                cmd.Connection.Close();
            }
        }
        /// <summary>
        /// Builds a data object from the current row in a data reader..
        /// </summary>
        /// <param name="dataReader">Container for database row.</param>
        /// <returns>Data object built from current row.</returns>
        private static TournamentFeeData GetDataObjectFromReader(SqlDataReader dataReader)
        {
            TournamentFeeData data = new TournamentFeeData();

            if (dataReader.IsDBNull(dataReader.GetOrdinal("TournamentFeeId")))
            {
                data.TournamentFeeId = IdType.UNSET;
            }
            else
            {
                data.TournamentFeeId = new IdType(dataReader.GetInt32(dataReader.GetOrdinal("TournamentFeeId")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("TournamentId")))
            {
                data.TournamentId = IdType.UNSET;
            }
            else
            {
                data.TournamentId = new IdType(dataReader.GetInt32(dataReader.GetOrdinal("TournamentId")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("Key")))
            {
                data.Key = StringType.UNSET;
            }
            else
            {
                data.Key = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Key")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("Fee")))
            {
                data.Fee = CurrencyType.UNSET;
            }
            else
            {
                data.Fee = new CurrencyType(dataReader.GetDecimal(dataReader.GetOrdinal("Fee")));
            }

            return(data);
        }
 /// <summary>
 /// Updates a record in the TournamentFee table.
 /// </summary>
 /// <param name=""></param>
 public static void Update(TournamentFeeData data)
 {
     Update(data, null);
 }
 /// <summary>
 /// Inserts a record into the TournamentFee table.
 /// </summary>
 /// <param name=""></param>
 public static IdType Insert(TournamentFeeData data)
 {
     return(Insert(data, null));
 }