public void DeleteAll(AthleteRecord athlete)
        {
            this.command.CommandText = @"
                DELETE FROM EventParticipation
                    WHERE AtheteId=@AthleteId";
            this.command.Parameters.Add(new SqlParameter("@AthleteId", athlete.Id));

            using (this.command)
                this.command.ExecuteNonQuery();
        }
        public void Insert(AthleteRecord athlete)
        {
            this._command.CommandText = @"
                INSERT INTO Athletes (Id, Nickname, FirstName, LastName, Gender, TrainerSizeM, TrainerSizeW, SpikeSizeM, SpikeSizeW, Notes, Status)
                    VALUES (@Id, @Nickname, @FirstName, @LastName, @Gender, @TrainerSizeM, @TrainerSizeW, @SpikeSizeM, @SpikeSizeW, @Notes, @Status)";
            SetupParameters(athlete);

            using (this._command)
                this._command.ExecuteNonQuery();
        }
        public void Update(AthleteRecord athlete)
        {
            this._command.CommandText = @"
                UPDATE Athletes
                    SET Id=@Id, FirstName=@FirstName, LastName=@LastName, Gender=@Gender, TrainerSizeM=@TrainerSizeM, TrainerSizeW=@TrainerSizeW,
                                SpikeSizeM=@SpikeSizeM, SpikeSizeW=@SpikeSizeW, Notes=@Notes, Status=@Status
                    WHERE Id=@Id";
            SetupParameters(athlete);

            using (this._command)
                this._command.ExecuteNonQuery();
        }
        private AthleteRecord Map(IDataReader reader)
        {
            var athleteRecord = new AthleteRecord();

            athleteRecord.Id = Convert.ToInt32(reader["Id"]);
            athleteRecord.Nickname = Convert.ToString(reader["Nickname"]);
            athleteRecord.FirstName = Convert.ToString(reader["FirstName"]);
            athleteRecord.LastName = Convert.ToString(reader["LastName"]);
            athleteRecord.Gender = Convert.ToChar(reader["Gender"]);
            athleteRecord.TrainerSizeM = Convert.ToDouble(reader["TrainerSizeM"]);
            athleteRecord.TrainerSizeW = Convert.ToDouble(reader["TrainerSizeW"]);
            athleteRecord.SpikeSizeM = Convert.ToDouble(reader["SpikeSizeM"]);
            athleteRecord.SpikeSizeW = Convert.ToDouble(reader["SpikeSizeW"]);
            athleteRecord.Notes = Convert.ToString(reader["Notes"]);
            athleteRecord.Status = Convert.ToString(reader["Status"]);

            return athleteRecord;
        }
 private void SetupParameters(AthleteRecord athlete)
 {
     this._command.Parameters.Add(new SqlParameter("@Id", athlete.Id));
     this._command.Parameters.Add(new SqlParameter("@Nickname", athlete.Nickname));
     this._command.Parameters.Add(new SqlParameter("@FirstName", athlete.FirstName));
     this._command.Parameters.Add(new SqlParameter("@LastName", athlete.LastName));
     this._command.Parameters.Add(new SqlParameter("@Gender", athlete.Gender));
     this._command.Parameters.Add(new SqlParameter("@TrainerSizeM", athlete.TrainerSizeM));
     this._command.Parameters.Add(new SqlParameter("@TrainerSizeW", athlete.TrainerSizeW));
     this._command.Parameters.Add(new SqlParameter("@SpikeSizeM", athlete.SpikeSizeM));
     this._command.Parameters.Add(new SqlParameter("@SpikeSizeW", athlete.SpikeSizeW));
     this._command.Parameters.Add(new SqlParameter("@Notes", athlete.Notes));
     this._command.Parameters.Add(new SqlParameter("@Status", athlete.Status));
 }