示例#1
0
 public void AddTotalPlayerDataToList(CustomParameters parameters, List <List <string> > totalPlayerDataList)
 {
     if (this.GetGames(parameters) != null)
     {
         List <string> totalPlayerData = new TotalPlayerData(GetGames(parameters)).Totals;
         totalPlayerData.Insert(0, this.Name);
         totalPlayerDataList.Add(totalPlayerData);
     }
 }
示例#2
0
        public List <string> GetBankrollSeries(CustomParameters parameters)
        {
            double currentTotal = 0;
            List <SingleGamePlayerData> games;
            List <string> series = new List <string>();

            games = GetGames(parameters);

            series.Add(currentTotal.ToString());

            foreach (SingleGamePlayerData game in games)
            {
                currentTotal += game.AmountNetted;
                series.Add(currentTotal.ToString());
            }

            return(series);
        }
示例#3
0
        public List <List <string> > GetLeagueData()
        {
            List <List <string> > leagueData = new List <List <string> >();
            CustomParameters      parameters = new CustomParameters
            {
                location = locations[2],
                names    = pdcLeagueNames,
                league   = true //,
                                //dropGames = true
            };

            foreach (string name in parameters.names)
            {
                allPlayerData.Single(data => data.Name == name).AddTotalPlayerDataToList(parameters, leagueData);
            }

            leagueData.Sort((x, y) => float.Parse(y[4]).CompareTo(float.Parse(x[4])));

            return(leagueData);
        }
示例#4
0
        public List <SingleGamePlayerData> GetGames(CustomParameters parameters)
        {
            List <SingleGamePlayerData> gameList = new List <SingleGamePlayerData>();
            DateTime startDate = new DateTime();
            DateTime endDate   = new DateTime();

            if (parameters.league)
            {
                startDate = FrmStatistics.seasonStartDate;
                endDate   = DateTime.Today;
            }
            else
            {
                startDate = parameters.startDate;
                endDate   = parameters.endDate;
            }

            foreach (SingleGamePlayerData game in _playersGameData)
            {
                if ((parameters.location == "All" || game.GameLocation == parameters.location) &&
                    (game.GameDate >= startDate && game.GameDate <= endDate))
                {
                    gameList.Add(game);
                }
                gameList = gameList.OrderBy(gameData => gameData.GameDate).ToList();
            }

            if (gameList.Count() < parameters.minGames)
            {
                gameList = null;
            }
            else if (parameters.league && parameters.dropGames && gameList.Count() >= numGamesBeforeDrop)
            {
                gameList = gameList.OrderByDescending(data => data.PlayerPoints)
                           .Reverse()
                           .Skip(2)
                           .ToList();
            }

            return(gameList);
        }
        private void FrmStatistics_Load(object sender, EventArgs e)
        {
            CustomParameters parameters = new CustomParameters();

            cbLocation.DataSource = locations;

            parameters.location  = cbLocation.Text;
            parameters.startDate = dtpStart.Value;
            parameters.endDate   = dtpEnd.Value;
            parameters.minGames  = int.Parse(tbMinGamesPlayed.Text);
            parameters.names     = new List <string> {
                "Shawn"
            };
            parameters.dropGames = cbDropLowest.Checked;
            parameters.league    = false;

            PopulateIndividualTab(parameters);

            lbNames.Items.AddRange(allNames.ToArray());
            lbNames.SelectedIndex = 0;
        }
示例#6
0
        private void PopulateLineChartTab(CustomParameters parameters, TabControl tabControl, string tabName)
        {
            List <SinglePlayerData> players = new List <SinglePlayerData>();

            Control[] controlArray = new Control[2];

            // Create page and controls
            CreateChartTabPage(tabName, controlArray);

            // Get player data
            foreach (string name in parameters.names)
            {
                players.Add(allPlayerData.Single(data => data.Name == name));
            }

            // Populate chart
            PopulateLineChart((Chart)controlArray[0], players, parameters);

            // Add and select tab page
            tabControl.TabPages.Add((TabPage)controlArray[1]);
            tabControl.SelectedTab = (TabPage)controlArray[1];
        }
        private void BtnSubmitCustom_Click(object sender, EventArgs e)
        {
            CustomParameters parameters = new CustomParameters
            {
                individual = rbIndividual.Checked,
                table      = rbTable.Checked,
                location   = cbLocation.Text,
                startDate  = dtpStart.Value,
                endDate    = dtpEnd.Value,
                minGames   = int.Parse(tbMinGamesPlayed.Text),
                names      = new List <string>(),
                dropGames  = cbDropLowest.Checked,
                league     = false
            };

            foreach (object item in lbNames.SelectedItems)
            {
                parameters.names.Add(item.ToString());
            }

            if (rbIndividual.Checked)
            {
                if (parameters.names.Count > 0)
                {
                    PopulateIndividualTab(parameters);
                }
            }
            else
            {
                if (rbTable.Checked)
                {
                    PopulateGroupTab(parameters, tabControlCustom, "Custom");
                }
                else
                {
                    PopulateLineChartTab(parameters, tabControlCustom, "Custom");
                }
            }
        }
示例#8
0
        private void PopulateIndividualTab(CustomParameters parameters)
        {
            Control[] controlArray = new Control[3];
            List <SingleGamePlayerData> customDataList;
            List <string> customTotalData;

            // Create page and controls
            CreateIndividualTabPage(parameters.names[0], controlArray);

            // Get player data
            customDataList  = allPlayerData.Single(data => data.Name == parameters.names[0]).GetGames(parameters);
            customTotalData = allPlayerData.Single(data => data.Name == parameters.names[0]).GetTotalPlayerData(parameters);

            // Populate individual game data listView
            PopulateIndividualListView(customDataList, (ListView)controlArray[0]);

            // Populate summary listView
            PopulateSummaryListView(customTotalData, (ListView)controlArray[1]);

            // Add and select tab page
            tabControlCustom.TabPages.Add((TabPage)controlArray[2]);
            tabControlCustom.SelectedTab = (TabPage)controlArray[2];
        }
示例#9
0
        private void PopulateGroupTab(CustomParameters parameters, TabControl tabControl, string tabName)
        {
            List <List <string> > totals = new List <List <string> >();

            Control[] controlArray = new Control[2];

            // Create page and controls
            CreateGroupTabPage(tabName, controlArray);

            // Get player data
            foreach (string name in parameters.names)
            {
                allPlayerData.Single(data => data.Name == name).AddTotalPlayerDataToList(parameters, totals);
            }

            //customDataList = allPlayerData.Single(data => data.Name == parameters.names[0]).GetGames(parameters);

            // Populate group data listView
            PopulateGoupListView(totals, (ListView)controlArray[0]);

            // Add and select tab page
            tabControl.TabPages.Add((TabPage)controlArray[1]);
            tabControl.SelectedTab = (TabPage)controlArray[1];
        }
示例#10
0
        private static void PopulateLineChart(Chart chart, List <SinglePlayerData> players, CustomParameters parameters)
        {
            chart.Series.Clear();
            chart.ChartAreas.Add(new ChartArea());

            foreach (SinglePlayerData player in players)
            {
                if (player.GetGames(parameters) != null)
                {
                    double runningTotal = 0;
                    List <SingleGamePlayerData> games;

                    games = player.GetGames(parameters);
                    chart.Series.Add(player.Name);
                    chart.Series[player.Name].IsVisibleInLegend = true;
                    chart.Series[player.Name].ChartType         = SeriesChartType.Line;
                    chart.Series[player.Name].XValueType        = ChartValueType.DateTime;
                    chart.Series[player.Name].MarkerStyle       = MarkerStyle.Circle;
                    chart.Series[player.Name].BorderWidth       = 2;

                    chart.ChartAreas[0].AxisX.IsMarginVisible  = false;
                    chart.ChartAreas[0].AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;
                    chart.ChartAreas[0].AxisY.IntervalAutoMode = IntervalAutoMode.VariableCount;

                    foreach (SingleGamePlayerData game in games)
                    {
                        runningTotal += game.AmountNetted;
                        chart.Series[player.Name].Points.AddXY(game.GameDate, runningTotal);
                    }
                }
            }
            ChangeYScale(chart);
        }
示例#11
0
        private static void GetCustomGroupData(List <SingleGamePlayerData> customDataList, CustomParameters parameters)
        {
            List <SingleGamePlayerData> playerData = new List <SingleGamePlayerData>();

            foreach (string name in parameters.names)
            {
                if (playerData.Count(data => data.PlayersName == name) < parameters.minGames)
                {
                    playerData.RemoveAll(data => data.PlayersName == name);
                }
            }
        }
示例#12
0
 private List <SingleGamePlayerData> GetCustomIndividualData(CustomParameters parameters)
 {
     return(allPlayerData.Single(data => data.Name == parameters.names[0]).GetGames(parameters));
 }
示例#13
0
 public List <string> GetTotalPlayerData(CustomParameters parameters)
 {
     return(new TotalPlayerData(GetGames(parameters)).Totals);
 }
示例#14
0
        private void BtnSubmitPremade_Click(object sender, EventArgs e)
        {
            CustomParameters            parameters = new CustomParameters();
            List <SingleGamePlayerData> playerData = new List <SingleGamePlayerData>();
            int selectedIndex = 0;

            selectedIndex = tabControlPremade.SelectedIndex;

            tabControlPremade.Visible = false;

            tabControlPremade.TabPages.Clear();

            // Get date range
            parameters.startDate = dtpStartPremade.Value;
            parameters.endDate   = dtpEndPremade.Value;

            // Get min games played
            parameters.minGames = int.Parse(tbMinGamesPlayedPremade.Text);

            parameters.names      = allNames;
            parameters.individual = false;
            parameters.table      = true;
            parameters.dropGames  = cbDropLowest.Checked;
            parameters.league     = false;

            // Get relevant data for each premade tab

            // Overall
            parameters.location = locations[0];
            PopulateGroupTab(parameters, tabControlPremade, "Overall");

            // Avista
            parameters.location = locations[1];
            PopulateGroupTab(parameters, tabControlPremade, "Avista");

            // Avista Season

            // PDC
            parameters.location = locations[2];
            PopulateGroupTab(parameters, tabControlPremade, "PDC");

            // PDC Season
            parameters.names  = pdcLeagueNames;
            parameters.league = true;
            PopulateGroupTab(parameters, tabControlPremade, "PDC League");

            // Bankrolls
            parameters.location = locations[0];
            parameters.names    = allNames;
            parameters.league   = false;
            PopulateLineChartTab(parameters, tabControlPremade, "Bankrolls");

            // Avista Bankrolls
            parameters.location = locations[1];
            PopulateLineChartTab(parameters, tabControlPremade, "Avista Bankrolls");

            // PDC Bankrolls
            parameters.location = locations[2];
            PopulateLineChartTab(parameters, tabControlPremade, "PDC Bankrolls");

            tabControlPremade.SelectedIndex = selectedIndex == -1 ? 0 : selectedIndex;
            tabControlPremade.Visible       = true;
        }