Example #1
0
        void ImportJudges(TournamentData importedData, DivisionData divisionData, PoolData poolData, XmlNode node)
        {
            foreach (XmlNode teamDataNode in node.ChildNodes)
            {
                TeamData teamData = new TeamData();

                foreach (XmlNode dataNode in teamDataNode.FirstChild.ChildNodes)
                {
                    if (dataNode.Name == "RoutineScores")
                    {
                        foreach (XmlNode resultsNode in dataNode.ChildNodes)
                        {
                            if (resultsNode.Name.Contains("Results"))
                            {
                                foreach (XmlNode judgeDataNode in resultsNode.ChildNodes)
                                {
                                    int judgeNameId           = int.Parse(judgeDataNode.FirstChild.FirstChild.Value);
                                    RegisteredPlayer newJudge = new RegisteredPlayer();
                                    if (tournamentData.FindOrAddImportedRegisterPlayer(judgeNameId, ref newJudge))
                                    {
                                        poolData.judgesData.Add(newJudge, GetJudgeCategory(resultsNode.Name));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        public void RemoveTeamDataFromPools(TeamData removeTeam)
        {
            DivisionData dd = tournamentData.GetDivision(poolsDivision);

            foreach (RoundData rd in dd.rounds)
            {
                foreach (PoolData pd in rd.pools)
                {
                    pd.teamList.teams.Remove(removeTeam);
                }
            }
        }
Example #3
0
        void ImportDivisionData(TournamentData importedData, XmlNode node, EDivision division)
        {
            DivisionData divisionData = new DivisionData(division);

            foreach (XmlNode roundNode in node.ChildNodes)             // Rounds
            {
                ERound round = ERound.Finals;
                foreach (XmlNode roundDataNode in roundNode.ChildNodes)
                {
                    RoundData roundData = new RoundData(division, round);
                    EPool     pool      = EPool.A;
                    foreach (XmlNode poolDataNode in roundDataNode.FirstChild.ChildNodes)                     // Pools
                    {
                        PoolData poolData = new PoolData(pool);
                        foreach (XmlNode poolDataChildNode in poolDataNode.ChildNodes)
                        {
                            if (poolDataChildNode.Name == "PoolName")
                            {
                                poolData.pool = (EPool)Enum.Parse(typeof(EPool), poolDataChildNode.FirstChild.Value);
                            }
                            else if (poolDataChildNode.Name == "Teams")
                            {
                                ImportTeams(importedData, divisionData, poolData, poolDataChildNode);
                                ImportJudges(importedData, divisionData, poolData, poolDataChildNode);
                            }
                            else if (poolDataChildNode.Name == "ResultsByTeamIndex")
                            {
                                ImportPoolResults(poolData, poolDataChildNode);
                            }
                        }

                        roundData.pools.Add(poolData);

                        ++pool;
                    }

                    divisionData.rounds.Add(roundData);

                    ++round;
                }
            }

            importedData.divisions.Add(divisionData);
        }
Example #4
0
        void ImportTeams(TournamentData importedData, DivisionData divisionData, PoolData poolData, XmlNode node)
        {
            foreach (XmlNode teamDataNode in node.ChildNodes)
            {
                TeamData teamData = new TeamData();

                foreach (XmlNode playerDataNode in teamDataNode.FirstChild.FirstChild.ChildNodes)
                {
                    if (playerDataNode.Name == "PlayerData")
                    {
                        RegisteredPlayer newPlayer = new RegisteredPlayer();

                        if (tournamentData.FindOrAddImportedRegisterPlayer(int.Parse(playerDataNode.FirstChild.FirstChild.Value), ref newPlayer))
                        {
                            teamData.players.Add(newPlayer);

                            importedData.AddRegisteredPlayer(newPlayer);
                        }
                    }
                }

                poolData.teamList.teams.Add(teamData);

                bool bNewTeam = true;
                foreach (TeamData td in divisionData.teamList.teams)
                {
                    if (td.Equals(teamData))
                    {
                        bNewTeam = false;
                        break;
                    }
                }

                if (bNewTeam)
                {
                    divisionData.teamList.teams.Add(teamData);
                }
            }
        }
Example #5
0
        public void Init()
        {
            if (divisions.Count == 0)
            {
                for (int i = 0; i < (int)EDivision.Max; ++i)
                {
                    DivisionData dd = new DivisionData((EDivision)i);
                    dd.CreateData();
                    divisions.Add(dd);
                }
            }
            else
            {
                for (EDivision division = EDivision.Open; division < EDivision.Max; ++division)
                {
                    if ((int)division < divisions.Count)
                    {
                        DivisionData dd = divisions[(int)division];

                        if (dd.division == EDivision.None)
                        {
                            dd.division = division;
                        }

                        for (ERound round = ERound.Finals; round < ERound.Max; ++round)
                        {
                            if ((int)round < dd.rounds.Count)
                            {
                                RoundData rd = dd.rounds[(int)round];
                                if (rd.round == ERound.None || rd.round == ERound.Max)
                                {
                                    rd.round = round;
                                }

                                if (rd.maxTeams == 0)
                                {
                                    rd.InitMaxTeams(division, round);
                                }

                                int poolCount = GetPoolCount(round);
                                for (EPool pool = EPool.A; (int)pool < poolCount; ++pool)
                                {
                                    if ((int)pool < rd.pools.Count)
                                    {
                                        PoolData pd = rd.pools[(int)pool];

                                        if (pd.pool == EPool.None)
                                        {
                                            pd.pool = pool;
                                        }
                                    }
                                    else
                                    {
                                        PoolData pd = new PoolData(pool);
                                        pd.CreateData();
                                        rd.pools.Add(pd);
                                    }
                                }
                            }
                            else
                            {
                                RoundData rd = new RoundData(division, round);
                                rd.CreateData();
                                dd.rounds.Add(rd);
                            }
                        }
                    }
                    else
                    {
                        DivisionData dd = new DivisionData(division);
                        dd.CreateData();
                        divisions.Add(dd);
                    }
                }
            }
        }