public void AddSwimmer(Swimmer aSwimmer) { if (aSwimmer.Club == this.Club) { aSwimmer.Coach = this; } else if (this.Club.Name == "Not assigned") { throw new Exception("Coach is not assigned to a club"); } else { throw new Exception("Coach and swimmer are not in the same club"); } }
public void EnterSwimmersTime(Registrant registrant, string time) { TimeSpan myTime = TimeSpan.Parse("00:" + time); int match = 0; foreach (KeyValuePair <Registrant, Swim> entry in ListOfRegistrantSwim) { if (entry.Key == registrant) { ListOfRegistrantSwim[registrant].TimeSwam = myTime; match++; Swimmer aSwimmer = registrant as Swimmer; if (aSwimmer != null) { aSwimmer.AddAsBestTime(SwimMeet.PType, Stroke, Distance, myTime); } } } if (match == 0) { throw new Exception(registrant.Name + " has not entered " + this.Name); } }