/// <summary> /// Will remove the competitor from the final and all heats. /// To Do check heat for results before removing /// </summary> public override void removeCompetitor(ACompetitor Competitor) { if (Competitor.getResult() == null) { // 2015-06-12 I've commented out the remove from heat command as the competitor is only stored in the final. //// remove from each of the heats foreach (IndividualTimedHeatEvent heat in Heats) { if (heat.hasCompetitor((Competitor)Competitor)) { // ToDo checking for results this way will not work! if (heat.hasResultFor(Competitor)) { throw new ArgumentException("Can not remove this competitor from this event as they have a result"); } } } //else // heat.EnteredCompetitors.Remove(Competitor); // remove from final if (EnteredCompetitors.Contains(Competitor)) { this.RemoveCompetitor(Competitor); } } else { throw new ArgumentException("Can not remove this competitor from this event as they have a result"); } }
internal override List <CertificateData> buildCertificateData(ACompetitor Competitor, string CertificateType, int counter, ScoringTeam ScoringTeam = null) { List <CertificateData> temp = new List <CertificateData>(); if (Competitor == null) { return(temp); } if (Competitor.getResult() == null) { return(temp); } if (!Competitor.getResult().Rank.HasValue) { // this competitor was not ranked. return(temp); } Squad squad = (Squad)Competitor; foreach (Athlete a in squad.members) { if (a == null) { continue; } string SchStr = string.Empty; if (a is StudentAthlete) { SchStr = ((StudentAthlete)a).Attends.Name; } // modified 2015-06-07 to add PrintName CertificateData CD = new CertificateData() { Championship = this.Championship.ToString(), TeamName = Competitor.getTeam().Name, CompetitorsName = a.PrintName(), EventName = this.Name, SchoolName = SchStr, CertifiacteType = CertificateType, Competitor = Competitor, RankCounter = counter }; if (this.customFieldExists("PrintedName")) { CD.EventName = this.getValue("PrintedName").ToString(); } switch (CertificateType) { case "TopIndividuals": CD.CertificateName = "Top Individuals"; // CompetitorsName updated for SW 2014-15 //CD.CompetitorsName = String.Format("{0} - {1}", Competitor.getName(), Competitor.getTeam().Name); CD.CompetitorsName = String.Format("{0}", a.PrintName()); // SchoolName field updated for SW 2014-15 CD.SchoolName = String.Format("{0} - {1}", Competitor.getTeam().Name, SchStr); //CD.Rank = AResult.IntToString( Competitor.getResult().Rank.Value ); CD.Rank = CD.Competitor.Result.printRankAndResult(); break; case "TopLowerYearGroupIndividuals": // Not used in SW 2014-15 CD.CertificateName = "Top Lower Year Group Individuals"; CD.CompetitorsName = String.Format("{0} - {1} - ({2})", a.PrintName(), Competitor.getTeam().Name, Competitor.getResult().Rank.Value.ToString()); CD.Rank = string.Format("{0} Year {1}", AResult.IntToString(counter), ((StudentCompetitor)Competitor).YearGroup.ToString()); break; case "Team": // updated for SW 2014-15 //CD.CompetitorsName = String.Format("{0} - {1} - ({2})", Competitor.getTeam().Name, Competitor.getName(), Competitor.Result.Rank.Value.ToString()); CD.CompetitorsName = String.Format("{1} - ({2})", Competitor.getTeam().Name, Competitor.getName(), Competitor.getResult().Rank.Value.ToString()); // SchoolName field updated for SW 2014-15 CD.SchoolName = String.Format("{0} - {1}", Competitor.getTeam().Name, SchStr); if (ScoringTeam != null) { // updated for SW 2014-15 CD.Rank = string.Format("{0} Team", AResult.IntToString(ScoringTeam.Rank), ScoringTeam.ScoringTeamName); //CD.Rank = string.Format("{0} {1} Team", AResult.IntToString(ScoringTeam.Rank), ScoringTeam.ScoringTeamName); CD.CertificateName = CD.Rank; } CD.CertificateName = CD.Rank; break; default: break; } temp.Add(CD); } // for each member return(temp); }