internal Structs.Team getTeam(int teamId) { Trace.WriteLine("CDatabase: Entering getStation(" + teamId.ToString() + ")"); foreach(DatabaseDataset.TeamsRow row in Database.Teams.Select("TeamId=" + teamId)) { Structs.Team team = new Structs.Team(); team.ClubId = row.ClubId; team.Name = row.Name; if (team.CompetitorIds == null) team.CompetitorIds = new ArrayList(); if (!row.IsCompetitorId1Null()) team.CompetitorIds.Add( row.CompetitorId1); if (!row.IsCompetitorId2Null()) team.CompetitorIds.Add( row.CompetitorId2); if (!row.IsCompetitorId3Null()) team.CompetitorIds.Add( row.CompetitorId3); if (!row.IsCompetitorId4Null()) team.CompetitorIds.Add(row.CompetitorId4); if (!row.IsCompetitorId5Null()) team.CompetitorIds.Add(row.CompetitorId5); team.TeamId = row.TeamId; team.WClass = (Structs.ResultWeaponsClass)row.WClass; return team; } throw new CannotFindIdException("Could not find teamid " + teamId.ToString()); }
private void saveMe() { Trace.WriteLine("FCompetitors: saveMe() " + "started on thread \"" + Thread.CurrentThread.Name + "\" ( " + Thread.CurrentThread.ManagedThreadId.ToString() + " )"); Structs.Team team; if ((int)this.DdTeams.SelectedValue != -1) { team = CommonCode.GetTeam((int)this.DdTeams.SelectedValue); team.CompetitorIds = new ArrayList(); } else { team = new Structs.Team(); team.CompetitorIds = new ArrayList(); team.TeamId = -1; } team.Name = this.txtName.Text; team.WClass = (Structs.ResultWeaponsClass)(int)this.ddWeaponClass.SelectedValue; team.ClubId = (string)this.DdClubs.SelectedValue; if ((int)ddCompetitor1.SelectedValue != -1) team.CompetitorIds.Add( (int)ddCompetitor1.SelectedValue); if ((int)ddCompetitor2.SelectedValue != -1) team.CompetitorIds.Add( (int)this.ddCompetitor2.SelectedValue); if ((int)ddCompetitor3.SelectedValue != -1) team.CompetitorIds.Add((int)this.ddCompetitor3.SelectedValue); if ((int)ddCompetitor4.SelectedValue != -1) team.CompetitorIds.Add((int)this.ddCompetitor4.SelectedValue); if ((int)ddCompetitor5.SelectedValue != -1) team.CompetitorIds.Add( (int)this.ddCompetitor5.SelectedValue); if (team.TeamId == -1) CommonCode.NewTeam(team); else CommonCode.UpdateTeam(team); clearEverything(); Trace.WriteLine("FCompetitors: saveMe() ended."); }
internal Structs.Team[] getTeams() { Trace.WriteLine("CDatabase: Entering getTeams()"); ArrayList list = new ArrayList(); foreach(DatabaseDataset.TeamsRow row in Database.Teams) { Structs.Team team = new Structs.Team(); team.CompetitorIds = new ArrayList(); team.ClubId = row.ClubId; team.Name = row.Name; if (!row.IsCompetitorId1Null()) team.CompetitorIds.Add(row.CompetitorId1); if (!row.IsCompetitorId2Null()) team.CompetitorIds.Add(row.CompetitorId2); if (!row.IsCompetitorId3Null()) team.CompetitorIds.Add(row.CompetitorId3); if (!row.IsCompetitorId4Null()) team.CompetitorIds.Add(row.CompetitorId4); if (!row.IsCompetitorId5Null()) team.CompetitorIds.Add(row.CompetitorId5); team.TeamId = row.TeamId; team.WClass = (Structs.ResultWeaponsClass)row.WClass; list.Add(team); } return (Structs.Team[])list.ToArray(typeof(Structs.Team)); }