예제 #1
0
 public void AddSwimmer(Registrant registrant)
 {
     Swims = new Swim();
     if (NoOfRegistrantInEvent > 0)
     {
         int match = 0;
         for (int i = 0; i < NoOfRegistrantInEvent; i++)
         {
             Registrant aRegistrantName = EventRegistrantList[i];
             if (aRegistrantName.Name == registrant.Name)
             {
                 match++;
                 throw new Exception("Swimmer " + registrant.Name + "," + registrant.RegistrationNumber + " already entered " + this.Distance + this.Stroke + "\n");
             }
         }
         if (match == 0)
         {
             EventRegistrantList[NoOfRegistrantInEvent] = registrant;
             EventRegistrantSwim[NoOfRegistrantInEvent] = Swims;
             NoOfRegistrantInEvent++;
         }
     }
     else
     {
         EventRegistrantList[NoOfRegistrantInEvent] = registrant;
         EventRegistrantSwim[NoOfRegistrantInEvent] = this.Swims;
         NoOfRegistrantInEvent++;
     }
 }
        public void AddSwimmer(Registrant registrant)
        {
            aSwim = new Swim();
            int match = 0;

            if (this.ListOfRegistrantSwim.Count > 0)
            {
                for (int i = 0; i < this.ListOfRegistrantSwim.Count; i++)
                {
                    if (this.ListOfRegistrantSwim.ContainsKey(registrant))
                    {
                        match++;
                        throw new Exception("Swimmer " + registrant.Name + "," + registrant.RegistrationNumber + " already entered " + this.Distance + this.Stroke + "\n");
                    }
                }
                if (match == 0)
                {
                    this.ListOfRegistrantSwim.Add(registrant, aSwim);
                }
            }
            else
            {
                this.ListOfRegistrantSwim.Add(registrant, aSwim);
            }
        }
예제 #3
0
 public Event(EventDistance distance, Stroke stroke)
 {
     Distance              = distance;
     Stroke                = stroke;
     EventSeed             = false;
     SwimMeet              = new SwimMeet();
     EventRegistrantList   = new Registrant[100];
     EventRegistrantSwim   = new Swim[100];
     NoOfRegistrantInEvent = 0;
 }