Exemplo 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( );
        }
Exemplo 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;
        }
Exemplo 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);
        }
        public static List <AEvent> listAllAvailableEvents(Championship Championship, Athlete Athlete)
        {
            List <AEvent> Events = new List <AEvent>();

            // Can not enter an athlete that isn't in a team.
            if (Athlete.getTeam(Championship) == null)
            {
                return(Events);
            }

            foreach (AEvent Event in Championship.listAllEvents())
            {
                //if (Event.isAvailable( Athlete ) )
                if (Event.canBeEntered(Athlete))
                {
                    Events.Add(Event);
                }
            }

            return(Events);
        }
Exemplo 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);
        }