Esempio n. 1
0
        public override void enterAthlete(Athlete Athlete, VestNumber Vest, bool Guest = false)
        {
            if (isEventFull())
            {
                throw new ArgumentException(String.Format("{0} is already full with {1} competitors.", Name, getEnteredCompetitors().Count));
            }

            if (isTeamFull(Athlete.getTeam(this.Championship)))
            {
                throw new ArgumentException(String.Format("{0} is already full with {1} competitors.", Name, getEnteredCompetitors(Athlete.getTeam(this.Championship)).Count));
            }

            if (EnteredCompetitors.Count(i => i.isAthlete(Athlete)) != 0)
            {
                throw new ArgumentException("Athlete has already been entered");
            }

            StudentCompetitor comp = new StudentCompetitor(Athlete, Vest, this);

            comp.Guest = Guest;

            this.AddCompetitor(comp);

            Athlete.voidStorage( );
        }
Esempio n. 2
0
        public override void enterAthlete(Athlete Athlete, VestNumber Vest, bool Guest = false)
        {
            if (isEventFull())
            {
                throw new ArgumentException(String.Format("{0} is already full with {1} competitors.", Name, getEnteredCompetitors().Count));
            }

            if (isTeamFull(Athlete.getTeam(this.Championship)))
            {
                throw new ArgumentException(String.Format("{0} is already full with {1} competitors.", Name, getEnteredCompetitors(Athlete.getTeam(this.Championship)).Count));
            }

            if (EnteredCompetitors.Count(i => i.isAthlete(Athlete)) != 0)
            {
                throw new ArgumentException("Athlete has already been entered");
            }

            if (!isAvailable(Athlete))
            {
                throw new ArgumentException("Athlete is not eligible for this event");
            }

            // find if there is already a squad for this team.

            Team t = Athlete.getTeam(this.Championship);

            if (t == null)
            {
                return;
            }

            Squad comp = getSquadForTeam(t);

            if (comp == null)
            {
                comp = new Squad()
                {
                    CompetingIn = this, Vest = Vest
                };
                this.AddCompetitor(comp);
            }

            comp.addToSquad(Athlete);

            comp.Guest = Guest;
        }
Esempio n. 3
0
        public override bool canBeEntered(Athlete athlete)
        {
            //if (isEventFull())
            //    return false;

            //if (isTeamFull(Athlete.getTeam(this.Championship)))
            //    return false;

            if (EnteredCompetitors.Count(i => i.isAthlete(athlete)) != 0)
            {
                return(false);
            }

            if (!isAvailable(athlete))
            {
                return(false);
            }

            // To do is the following statement actually true? 2015-06-02
            // You can never enter a single athlete into a squad event

            Team t = athlete.getTeam(this.Championship);

            // no team, no entry!
            if (t == null)
            {
                return(false);
            }

            Squad s = getSquadForTeam(t);

            // no squad so we can make a new one.
            if (s == null)
            {
                return(true);
            }

            // the squad has at least one empty space
            if (!s.isSquadFull())
            {
                return(true);
            }

            return(false);
        }
Esempio n. 4
0
        public override bool requiresLaneUpdate()
        {
            foreach (IndividualTimedHeatEvent heat in Heats)
            {
                if (heat.requiresLaneUpdate( ))
                {
                    return(true);
                }
            }

            // don't bother with lane assignments if this event was run as a heat.
            if (HeatRunAsFinal)
            {
                return(false);
            }


            // do not have to update an empty event
            if (EnteredCompetitors.Count() == 0)
            {
                return(false);
            }

            // do not want to update lanes on an event which has already got results
            if (AllResults().Count > 0)
            {
                return(false);
            }

            if (promotedCompetitors().Count() == 0)
            {
                return(true);
            }

            foreach (ILanedCompetitor c in promotedCompetitors())
            {
                if (!c.hasLaneNumber())
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 5
0
        public override bool canBeEntered(Athlete Athlete)
        {
            if (isEventFull())
            {
                return(false);
            }

            if (isTeamFull(Athlete.getTeam(this.Championship)))
            {
                return(false);
            }

            if (EnteredCompetitors.Count(i => i.isAthlete(Athlete)) != 0)
            {
                return(false);
            }

            if (!isAvailable(Athlete))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 6
0
        public virtual bool requiresLaneUpdate( )
        {
            // do not have to update an empty event
            if (EnteredCompetitors.Count() == 0)
            {
                return(false);
            }

            // do not want to update lanes on an event which has already got results
            if (AllResults().Count > 0)
            {
                return(false);
            }

            foreach (ILanedCompetitor c in getEnteredCompetitors())  // EnteredCompetitors)
            {
                if (!c.hasLaneNumber())
                {
                    return(true);
                }
            }

            return(false);
        }