Пример #1
0
        public ManageTeam()
        {
            InitializeComponent();
            TeamDataParser td = new TeamDataParser();

            //For now using team[0], first place team for testing purposes
            myTeam      = td.GetTeams()[0];
            members     = myTeam.Members;
            header.Text = "Manage " + myTeam.TeamName;

            //dataGrid population
            DataGridTextColumn memberName  = new DataGridTextColumn();
            DataGridTextColumn memberScore = new DataGridTextColumn();

            //add whatever other team member data we decide to put
            //look back over and see if there is more efficient way to do this
            teamData.Columns.Add(memberName);
            teamData.Columns.Add(memberScore);
            memberName.Binding  = new Binding("name");
            memberScore.Binding = new Binding("points");
            memberName.Header   = "Member Name";
            memberScore.Header  = "Member Score";


            foreach (Employee empl in members)
            {
                teamData.Items.Add(new rowData {
                    name = empl.GetName(), points = empl.GetPoints()
                });
            }
        }
Пример #2
0
        public ManageTeam()
        {
            InitializeComponent();
            TeamDataParser td = new TeamDataParser();

            //For now using team[0], first place team for testing purposes
            myTeam = td.GetTeams()[0];
            members = myTeam.Members;
            header.Text = "Manage " + myTeam.TeamName;

            //dataGrid population
            DataGridTextColumn memberName = new DataGridTextColumn();
            DataGridTextColumn memberScore = new DataGridTextColumn();
            //add whatever other team member data we decide to put
            //look back over and see if there is more efficient way to do this
            teamData.Columns.Add(memberName);
            teamData.Columns.Add(memberScore);
            memberName.Binding = new Binding("name");
            memberScore.Binding = new Binding("points");
            memberName.Header = "Member Name";
            memberScore.Header = "Member Score";

            
            foreach (Employee empl in members)
            {
                teamData.Items.Add(new rowData { name = empl.GetName(), points = empl.GetPoints() });
            }
              
        }
Пример #3
0
        public MainMenu()
        {
            InitializeComponent();
            TeamDataParser   td = new TeamDataParser();
            LeagueDataParser ld;
            DateTime         CurrentDate = DateTime.Today;

            DateString.Text = "Today's Date: " + CurrentDate.Month + "-" + CurrentDate.Day + "-" + CurrentDate.Year;
            int WeekNum = 0;

            if (File.Exists("leaguerules.xml"))
            {
                leagueButton.Content = "Manage League";

                ld               = new LeagueDataParser("leaguerules.xml");
                WeekNum          = ld.GetWeekNumber(CurrentDate);
                DateString.Text += "\nWeek " + WeekNum + " of current League";
            }
            else
            {
                leagueButton.Content = "Setup League";
            }

            teamString.Text = td.GetTeams()[0].ToString();
        }
Пример #4
0
        public CreateTeam()
        {
            InitializeComponent();
            TeamDataParser td = new TeamDataParser();

            //Replace team[0] with list of potential employees playing
            myTeam  = td.GetTeams()[0];
            members = myTeam.Members;


            //dataGrid population
            DataGridTextColumn memberName   = new DataGridTextColumn();
            DataGridTextColumn memberScore  = new DataGridTextColumn();
            DataGridTextColumn memberName2  = new DataGridTextColumn();
            DataGridTextColumn memberScore2 = new DataGridTextColumn();

            //DataGridTextColumn memberRole = new DataGridTextColumn();
            //add whatever other team member data we decide to put
            //look back over and see if there is more efficient way to do this
            teamData.Columns.Add(memberName);
            teamData.Columns.Add(memberScore);
            team.Columns.Add(memberName2);
            team.Columns.Add(memberScore2);
            memberName2.Binding  = new Binding("name");
            memberScore2.Binding = new Binding("points");
            memberName2.Header   = "Member Name";
            memberScore2.Header  = "Previous Score";

            //teamData.Columns.Add(memberRole);
            memberName.Binding  = new Binding("name");
            memberScore.Binding = new Binding("points");
            //memberRole.Binding = new Binding("role");
            memberName.Header  = "Member Name";
            memberScore.Header = "Previous Score";
            //memberRole.header = "Member Role";

            foreach (Employee empl in members)
            {
                teamData.Items.Add(new rowData {
                    name = empl.GetName(), points = empl.GetPoints()
                });
            }
        }
Пример #5
0
        public MainMenu()
        {
            InitializeComponent();
            TeamDataParser td = new TeamDataParser();
            LeagueDataParser ld;
            DateTime CurrentDate = DateTime.Today;
            DateString.Text = "Today's Date: " + CurrentDate.Month + "-" + CurrentDate.Day + "-" + CurrentDate.Year;
            int WeekNum = 0;

            if (File.Exists("leaguerules.xml"))
            {
                leagueButton.Content = "Manage League";

                ld = new LeagueDataParser("leaguerules.xml");
                WeekNum = ld.GetWeekNumber(CurrentDate);
                DateString.Text += "\nWeek " + WeekNum + " of current League";
            }
            else
            {
                leagueButton.Content = "Setup League";
            }

            teamString.Text = td.GetTeams()[0].ToString();
        }
Пример #6
0
        public void GetTeams()
        {
            TeamDataParser tdp = new TeamDataParser();

            leagueTeams = tdp.GetTeams();
        }
        public TournamentBracket()
        {
            teamParser = new TeamDataParser();
            teamList   = teamParser.GetTeams();

            leagueParser = new LeagueDataParser("leaguerules.xml");
            NumTeams     = leagueParser.StoredRules.PlayoffTeams;

            CurrentDate = DateTime.Today;
            WeekNum     = leagueParser.GetWeekNumber(CurrentDate);

            DetermineTeams();   //Determines which teams made playoffs, takes top 4/8/16 teams at the start of the playoffs and puts them in playoffTeamList

            InitializeComponent();

//Fill in initial playoff standings (week 1)
            DataGridTextColumn round1 = new DataGridTextColumn();

            round1.Header = "Round 1";
            bracketGrid1.Columns.Add(round1);

            TimeSincePlayoffStart = CurrentDate - leagueParser.StoredRules.PlayoffStart;
            DaysSincePlayoffStart = TimeSincePlayoffStart.Days;

            //int row = 0;
            for (int t = 0; t < playoffTeamList.Count; t++)
            {
                bracketGrid1.Items.Add(playoffTeamList[t].TeamName);

                if (t % 2 == 0) //every even indexed team should be versus someone and every odd indexed team should have a blank spot between it and the next matchup
                {
                    bracketGrid1.Items.Add("vs");
                }
                else
                {
                    bracketGrid1.Items.Add("");
                }
            }

//Fill in playoff standings after 1 week (week2)
            if (DaysSincePlayoffStart >= 7 && DaysSincePlayoffStart < 14)
            {
                DataGridTextColumn round2 = new DataGridTextColumn();
                round2.Header = "Round 2";
                bracketGrid2.Columns.Add(round2);

                //List<Team> tempList = playoffTeamList;
                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        //tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid2.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum))
                    {
                        //tempList.Remove(playoffTeamList[t]);

                        bracketGrid2.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                }
            }

//Fill in playoff standings after 2 weeks (up to week 3)
            else if (DaysSincePlayoffStart >= 14 && DaysSincePlayoffStart < 21)
            {
                DataGridTextColumn round2 = new DataGridTextColumn();
                round2.Header = "Round 2";
                bracketGrid2.Columns.Add(round2);

                List <Team> tempList = playoffTeamList;

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum - 1) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 1)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid2.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum - 1) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 1))
                    {
                        tempList.Remove(playoffTeamList[t]);

                        bracketGrid2.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                }
                playoffTeamList = tempList;

                DataGridTextColumn round3 = new DataGridTextColumn();
                round3.Header = "Round 3";
                bracketGrid3.Columns.Add(round3);

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        //tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid3.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid3.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid3.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum))
                    {
                        //tempList.Remove(playoffTeamList[t]);

                        bracketGrid3.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid3.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid3.Items.Add("");
                        }
                    }
                }
            }
//Fill in playoff standings after 3 weeks (up to week 4) (should only display if there are 8 or more teams)
            else if (DaysSincePlayoffStart >= 21 && DaysSincePlayoffStart < 28 && NumTeams >= 8)
            {
                DataGridTextColumn round2 = new DataGridTextColumn();
                round2.Header = "Round 2";
                bracketGrid2.Columns.Add(round2);

                List <Team> tempList = playoffTeamList;

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum - 2) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 2)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid2.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum - 2) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 2))
                    {
                        tempList.Remove(playoffTeamList[t]);

                        bracketGrid2.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                }
                playoffTeamList = tempList;

                DataGridTextColumn round3 = new DataGridTextColumn();
                round3.Header = "Round 3";
                bracketGrid3.Columns.Add(round3);

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum - 1) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 1)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid3.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid3.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid3.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum - 1) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 1))
                    {
                        tempList.Remove(playoffTeamList[t]);

                        bracketGrid3.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid3.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid3.Items.Add("");
                        }
                    }
                }
                playoffTeamList = tempList;

                DataGridTextColumn round4 = new DataGridTextColumn();
                round4.Header = "Round 4";
                bracketGrid4.Columns.Add(round4);

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        //tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid4.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid4.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid4.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum))
                    {
                        //tempList.Remove(playoffTeamList[t]);

                        bracketGrid4.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid4.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid4.Items.Add("");
                        }
                    }
                }
            }
//Fill in playoff standings after 4 weeks (week 5) (should only display if there are 16 or more teams)
//(also last possible display since the max number of playoff weeks is 16 currently)
            else if (DaysSincePlayoffStart >= 28 && NumTeams >= 16)
            {
                DataGridTextColumn round2 = new DataGridTextColumn();
                round2.Header = "Round 2";
                bracketGrid2.Columns.Add(round2);

                List <Team> tempList = playoffTeamList;

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum - 3) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 3)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid2.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum - 3) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 3))
                    {
                        tempList.Remove(playoffTeamList[t]);

                        bracketGrid2.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid2.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid2.Items.Add("");
                        }
                    }
                }
                playoffTeamList = tempList;

                DataGridTextColumn round3 = new DataGridTextColumn();
                round3.Header = "Round 3";
                bracketGrid3.Columns.Add(round3);

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum - 2) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 2)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid3.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid3.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid3.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum - 2) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 2))
                    {
                        tempList.Remove(playoffTeamList[t]);

                        bracketGrid3.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid3.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid3.Items.Add("");
                        }
                    }
                }
                playoffTeamList = tempList;

                DataGridTextColumn round4 = new DataGridTextColumn();
                round4.Header = "Round 4";
                bracketGrid4.Columns.Add(round4);

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum - 1) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 1)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid4.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid4.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid4.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum - 1) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum - 1))
                    {
                        tempList.Remove(playoffTeamList[t]);

                        bracketGrid4.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid4.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid4.Items.Add("");
                        }
                    }
                }
                playoffTeamList = tempList;

                DataGridTextColumn round5 = new DataGridTextColumn();
                round5.Header = "Round 5";
                bracketGrid5.Columns.Add(round5);

                for (int t = 0; t < playoffTeamList.Count; t += 2)
                {
                    if (playoffTeamList[t].GetTotalForWeek(WeekNum) >= playoffTeamList[t + 1].GetTotalForWeek(WeekNum)) //Right now the team that was already ahead goes on in the event of a tie
                    {
                        //tempList.Remove(playoffTeamList[t + 1]);

                        bracketGrid4.Items.Add(playoffTeamList[t].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid4.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid4.Items.Add("");
                        }
                    }
                    else if (playoffTeamList[t].GetTotalForWeek(WeekNum) < playoffTeamList[t + 1].GetTotalForWeek(WeekNum))
                    {
                        //tempList.Remove(playoffTeamList[t]);

                        bracketGrid4.Items.Add(playoffTeamList[t + 1].TeamName);
                        if (t % 4 == 0)
                        {
                            bracketGrid4.Items.Add("vs");
                        }
                        else
                        {
                            bracketGrid4.Items.Add("");
                        }
                    }
                }
            }
        }
Пример #8
0
        public Leaderboard()
        {
            TeamDataParser  teamParser   = new TeamDataParser();
            List <Team>     teamList     = teamParser.GetTeams();
            List <Employee> employeeList = new List <Employee>();

            ldp              = new LeagueDataParser("leaguerules.xml");
            displayedTeams   = new List <TeamsData>();
            displayedPlayers = new List <PlayersData>();
            game             = ldp.StoredRules;
            Trace.WriteLine("Playoff weeks: " + game.PlayoffWeeks + " Season weeks: " + game.SeasonWeeks);
            foreach (Team t in teamList)
            {
                employeeList.AddRange(t.Members);
            }

            employeeList.Sort();



            InitializeComponent();
            DataGridTextColumn tCol1 = new DataGridTextColumn();
            DataGridTextColumn tCol2 = new DataGridTextColumn();
            DataGridTextColumn tCol3 = new DataGridTextColumn();
            DataGridTextColumn tCol4 = new DataGridTextColumn();

            teamsDataGrid.Columns.Add(tCol1);
            teamsDataGrid.Columns.Add(tCol2);
            teamsDataGrid.Columns.Add(tCol3);
            teamsDataGrid.Columns.Add(tCol4);
            tCol1.Binding = new Binding("teamRank");
            tCol2.Binding = new Binding("teamName");
            tCol3.Binding = new Binding("teamScore");
            tCol4.Binding = new Binding("teamProgress");
            tCol1.Header  = "Rank";
            tCol2.Header  = "Team Name";
            tCol3.Header  = "Score";
            tCol4.Header  = "Progress";

            DataGridTextColumn pCol1 = new DataGridTextColumn();
            DataGridTextColumn pCol2 = new DataGridTextColumn();
            DataGridTextColumn pCol3 = new DataGridTextColumn();
            DataGridTextColumn pCol4 = new DataGridTextColumn();

            playersDataGrid.Columns.Add(pCol1);
            playersDataGrid.Columns.Add(pCol2);
            playersDataGrid.Columns.Add(pCol3);
            playersDataGrid.Columns.Add(pCol4);
            pCol1.Binding = new Binding("playerRank");
            pCol2.Binding = new Binding("playerName");
            pCol3.Binding = new Binding("playerScore");
            pCol4.Binding = new Binding("playerProgress");
            pCol1.Header  = "Rank";
            pCol2.Header  = "Player Name";
            pCol3.Header  = "Score";
            pCol4.Header  = "Progress";

            for (int j = 0; j < teamList.Count; j++)
            {
                if (teamList[j].TeamName != "Free Agents")
                {
                    teamList[j].SubCheck(weeks);
                    teamsDataGrid.Items.Add(
                        new TeamsData
                    {
                        teamRank     = j,
                        teamName     = teamList[j].TeamName,
                        teamScore    = teamList[j].GetTotalForWeek(weeks),
                        teamProgress = "+" + teamList[j].GetPointsGainedForWeek(weeks),
                        hostTeam     = teamList[j]
                    });
                    displayedTeams.Add(
                        new TeamsData
                    {
                        teamRank     = j + 1,
                        teamName     = teamList[j].TeamName,
                        teamScore    = teamList[j].GetTotalForWeek(weeks),
                        teamProgress = "+" + teamList[j].GetPointsGainedForWeek(weeks),
                        hostTeam     = teamList[j]
                    });
                }
            }
            teamsDataGrid.Items.Remove(teamsDataGrid.Items[0]);

            for (int k = 0; k < employeeList.Count; k++)
            {
                playersDataGrid.Items.Add(
                    new PlayersData {
                    playerRank     = (k + 1),
                    playerName     = employeeList[k].GetName(),
                    playerScore    = employeeList[k].GetPoints(),
                    playerProgress = "+" + employeeList[k].GetScoreOfWeek(weeks),
                    hostEmp        = employeeList[k]
                });
                displayedPlayers.Add(
                    new PlayersData
                {
                    playerRank     = (k + 1),
                    playerName     = employeeList[k].GetName(),
                    playerScore    = employeeList[k].GetPoints(),
                    playerProgress = "+" + employeeList[k].GetScoreOfWeek(weeks),
                    hostEmp        = employeeList[k]
                });
            }
            playersDataGrid.Items.Remove(playersDataGrid.Items[0]);

            vL1.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL2.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL3.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL4.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL5.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL6.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL7.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL8.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL9.Add(new KeyValuePair <string, int>("Week 1", 0));
            vL10.Add(new KeyValuePair <string, int>("Week 1", 0));
        }
Пример #9
0
        public Leaderboard()
        {
            
			TeamDataParser teamParser = new TeamDataParser();
			List<Team> teamList = teamParser.GetTeams();
			List<Employee> employeeList = new List<Employee>();
            ldp = new LeagueDataParser("leaguerules.xml");
            displayedTeams = new List<TeamsData>();
            displayedPlayers = new List<PlayersData>();
            game = ldp.StoredRules;
            Trace.WriteLine("Playoff weeks: " + game.PlayoffWeeks + " Season weeks: " + game.SeasonWeeks);
			foreach(Team t in teamList)
			{
				employeeList.AddRange(t.Members);
			}
			
			employeeList.Sort();

            

            InitializeComponent();
            DataGridTextColumn tCol1 = new DataGridTextColumn();
            DataGridTextColumn tCol2 = new DataGridTextColumn();
            DataGridTextColumn tCol3 = new DataGridTextColumn();
			DataGridTextColumn tCol4 = new DataGridTextColumn();
            teamsDataGrid.Columns.Add(tCol1);
            teamsDataGrid.Columns.Add(tCol2);
            teamsDataGrid.Columns.Add(tCol3);
			teamsDataGrid.Columns.Add(tCol4);
            tCol1.Binding = new Binding("teamRank");
            tCol2.Binding = new Binding("teamName");
            tCol3.Binding = new Binding("teamScore");
			tCol4.Binding = new Binding("teamProgress");
            tCol1.Header = "Rank";
            tCol2.Header = "Team Name";
            tCol3.Header = "Score";
			tCol4.Header = "Progress";
			
			DataGridTextColumn pCol1 = new DataGridTextColumn();
			DataGridTextColumn pCol2 = new DataGridTextColumn();
			DataGridTextColumn pCol3 = new DataGridTextColumn();
			DataGridTextColumn pCol4 = new DataGridTextColumn();
			playersDataGrid.Columns.Add(pCol1);
			playersDataGrid.Columns.Add(pCol2);
			playersDataGrid.Columns.Add(pCol3);
			playersDataGrid.Columns.Add(pCol4);
			pCol1.Binding = new Binding("playerRank");
			pCol2.Binding = new Binding("playerName");
			pCol3.Binding = new Binding("playerScore");
			pCol4.Binding = new Binding("playerProgress");
			pCol1.Header = "Rank";
			pCol2.Header = "Player Name";
			pCol3.Header = "Score";
			pCol4.Header = "Progress";
			
			for(int j = 0; j<teamList.Count; j++)
			{
                if (teamList[j].TeamName != "Free Agents")
                {
                    teamList[j].SubCheck(weeks);
                    teamsDataGrid.Items.Add(
                        new TeamsData
                        {
                            teamRank = j,
                            teamName = teamList[j].TeamName,
                            teamScore = teamList[j].GetTotalForWeek(weeks),
                            teamProgress = "+" + teamList[j].GetPointsGainedForWeek(weeks),
                            hostTeam = teamList[j]
                        });
                    displayedTeams.Add(
                        new TeamsData
                        {
                            teamRank = j + 1,
                            teamName = teamList[j].TeamName,
                            teamScore = teamList[j].GetTotalForWeek(weeks),
                            teamProgress = "+" + teamList[j].GetPointsGainedForWeek(weeks),
                            hostTeam = teamList[j]
                        });
                }
			}
            teamsDataGrid.Items.Remove(teamsDataGrid.Items[0]);

			for(int k = 0; k<employeeList.Count; k++)
			{
				playersDataGrid.Items.Add(
                    new PlayersData{
                        playerRank = (k+1), 
                        playerName = employeeList[k].GetName(), 
                        playerScore = employeeList[k].GetPoints(), 
                        playerProgress = "+"+employeeList[k].GetScoreOfWeek(weeks),
                        hostEmp = employeeList[k]});
                displayedPlayers.Add(
                        new PlayersData
                        {
                            playerRank = (k + 1),
                            playerName = employeeList[k].GetName(),
                            playerScore = employeeList[k].GetPoints(),
                            playerProgress = "+" + employeeList[k].GetScoreOfWeek(weeks),
                            hostEmp = employeeList[k]
                        });
			}
            playersDataGrid.Items.Remove(playersDataGrid.Items[0]);

            vL1.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL2.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL3.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL4.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL5.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL6.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL7.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL8.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL9.Add(new KeyValuePair<string, int>("Week 1", 0));
            vL10.Add(new KeyValuePair<string, int>("Week 1", 0));
        
        }
Пример #10
0
		public void GetTeams()
		{
			TeamDataParser tdp = new TeamDataParser();
			leagueTeams = tdp.GetTeams();
		}