Exemplo n.º 1
0
        /// <summary>Adds a box score resulting from an SQLite query to a TeamStats instance.</summary>
        /// <param name="r">The result of the query containing the box score record.</param>
        /// <param name="ts">The TeamStats instance to be modified.</param>
        /// <param name="tsopp">The opposing TeamStats instance to be modified.</param>
        private static void addToTeamStatsFromSQLBoxScore(DataRow r, ref TeamStats ts, ref TeamStats tsopp)
        {
            var playoffs = ParseCell.GetBoolean(r, "isPlayoff");
            if (!playoffs)
            {
                var t1PTS = Convert.ToInt32(r["T1PTS"].ToString());
                var t2PTS = Convert.ToInt32(r["T2PTS"].ToString());
                if (r["T1Name"].ToString().Equals(ts.Name))
                {
                    if (t1PTS > t2PTS)
                    {
                        ts.Record[0]++;
                    }
                    else
                    {
                        ts.Record[1]++;
                    }
                    tsopp.Totals[TAbbrT.MINS] = ts.Totals[TAbbrT.MINS] += Convert.ToUInt16(r["T1MINS"].ToString());
                    tsopp.Totals[TAbbrT.PA] = ts.Totals[TAbbrT.PF] += Convert.ToUInt16(r["T1PTS"].ToString());
                    tsopp.Totals[TAbbrT.PF] = ts.Totals[TAbbrT.PA] += Convert.ToUInt16(r["T2PTS"].ToString());

                    ts.Totals[TAbbrT.FGM] += Convert.ToUInt16(r["T1FGM"].ToString());
                    ts.Totals[TAbbrT.FGA] += Convert.ToUInt16(r["T1FGA"].ToString());
                    ts.Totals[TAbbrT.TPM] += Convert.ToUInt16(r["T13PM"].ToString());
                    ts.Totals[TAbbrT.TPA] += Convert.ToUInt16(r["T13PA"].ToString());
                    ts.Totals[TAbbrT.FTM] += Convert.ToUInt16(r["T1FTM"].ToString());
                    ts.Totals[TAbbrT.FTA] += Convert.ToUInt16(r["T1FTA"].ToString());

                    var t1REB = Convert.ToUInt16(r["T1REB"].ToString());
                    var t1OREB = Convert.ToUInt16(r["T1OREB"].ToString());
                    ts.Totals[TAbbrT.DREB] += (ushort) (t1REB - t1OREB);
                    ts.Totals[TAbbrT.OREB] += t1OREB;

                    ts.Totals[TAbbrT.STL] += Convert.ToUInt16(r["T1STL"].ToString());
                    ts.Totals[TAbbrT.TOS] += Convert.ToUInt16(r["T1TOS"].ToString());
                    ts.Totals[TAbbrT.BLK] += ParseCell.GetUInt16(r, "T1BLK");
                    ts.Totals[TAbbrT.AST] += ParseCell.GetUInt16(r, "T1AST");
                    ts.Totals[TAbbrT.FOUL] += ParseCell.GetUInt16(r, "T1FOUL");

                    tsopp.Totals[TAbbrT.FGM] += Convert.ToUInt16(r["T2FGM"].ToString());
                    tsopp.Totals[TAbbrT.FGA] += Convert.ToUInt16(r["T2FGA"].ToString());
                    tsopp.Totals[TAbbrT.TPM] += Convert.ToUInt16(r["T23PM"].ToString());
                    tsopp.Totals[TAbbrT.TPA] += Convert.ToUInt16(r["T23PA"].ToString());
                    tsopp.Totals[TAbbrT.FTM] += Convert.ToUInt16(r["T2FTM"].ToString());
                    tsopp.Totals[TAbbrT.FTA] += Convert.ToUInt16(r["T2FTA"].ToString());

                    var t2REB = Convert.ToUInt16(r["T2REB"].ToString());
                    var t2OREB = Convert.ToUInt16(r["T2OREB"].ToString());
                    tsopp.Totals[TAbbrT.DREB] += (ushort) (t2REB - t2OREB);
                    tsopp.Totals[TAbbrT.OREB] += t2OREB;

                    tsopp.Totals[TAbbrT.STL] += Convert.ToUInt16(r["T2STL"].ToString());
                    tsopp.Totals[TAbbrT.TOS] += Convert.ToUInt16(r["T2TOS"].ToString());
                    tsopp.Totals[TAbbrT.BLK] += ParseCell.GetUInt16(r, "T2BLK");
                    tsopp.Totals[TAbbrT.AST] += ParseCell.GetUInt16(r, "T2AST");
                    tsopp.Totals[TAbbrT.FOUL] += ParseCell.GetUInt16(r, "T2FOUL");
                }
                else
                {
                    if (t2PTS > t1PTS)
                    {
                        ts.Record[0]++;
                    }
                    else
                    {
                        ts.Record[1]++;
                    }
                    tsopp.Totals[TAbbrT.MINS] = ts.Totals[TAbbrT.MINS] += Convert.ToUInt16(r["T2MINS"].ToString());
                    tsopp.Totals[TAbbrT.PA] = ts.Totals[TAbbrT.PF] += Convert.ToUInt16(r["T2PTS"].ToString());
                    tsopp.Totals[TAbbrT.PF] = ts.Totals[TAbbrT.PA] += Convert.ToUInt16(r["T1PTS"].ToString());

                    ts.Totals[TAbbrT.FGM] += Convert.ToUInt16(r["T2FGM"].ToString());
                    ts.Totals[TAbbrT.FGA] += Convert.ToUInt16(r["T2FGA"].ToString());
                    ts.Totals[TAbbrT.TPM] += Convert.ToUInt16(r["T23PM"].ToString());
                    ts.Totals[TAbbrT.TPA] += Convert.ToUInt16(r["T23PA"].ToString());
                    ts.Totals[TAbbrT.FTM] += Convert.ToUInt16(r["T2FTM"].ToString());
                    ts.Totals[TAbbrT.FTA] += Convert.ToUInt16(r["T2FTA"].ToString());

                    var t2REB = Convert.ToUInt16(r["T2REB"].ToString());
                    var t2OREB = Convert.ToUInt16(r["T2OREB"].ToString());
                    ts.Totals[TAbbrT.DREB] += (ushort) (t2REB - t2OREB);
                    ts.Totals[TAbbrT.OREB] += t2OREB;

                    ts.Totals[TAbbrT.STL] += Convert.ToUInt16(r["T2STL"].ToString());
                    ts.Totals[TAbbrT.TOS] += Convert.ToUInt16(r["T2TOS"].ToString());
                    ts.Totals[TAbbrT.BLK] += ParseCell.GetUInt16(r, "T2BLK");
                    ts.Totals[TAbbrT.AST] += ParseCell.GetUInt16(r, "T2AST");
                    ts.Totals[TAbbrT.FOUL] += ParseCell.GetUInt16(r, "T2FOUL");

                    tsopp.Totals[TAbbrT.FGM] += Convert.ToUInt16(r["T1FGM"].ToString());
                    tsopp.Totals[TAbbrT.FGA] += Convert.ToUInt16(r["T1FGA"].ToString());
                    tsopp.Totals[TAbbrT.TPM] += Convert.ToUInt16(r["T13PM"].ToString());
                    tsopp.Totals[TAbbrT.TPA] += Convert.ToUInt16(r["T13PA"].ToString());
                    tsopp.Totals[TAbbrT.FTM] += Convert.ToUInt16(r["T1FTM"].ToString());
                    tsopp.Totals[TAbbrT.FTA] += Convert.ToUInt16(r["T1FTA"].ToString());

                    var t1REB = Convert.ToUInt16(r["T1REB"].ToString());
                    var t1OREB = Convert.ToUInt16(r["T1OREB"].ToString());
                    tsopp.Totals[TAbbrT.DREB] += (ushort) (t1REB - t1OREB);
                    tsopp.Totals[TAbbrT.OREB] += t1OREB;

                    tsopp.Totals[TAbbrT.STL] += Convert.ToUInt16(r["T1STL"].ToString());
                    tsopp.Totals[TAbbrT.TOS] += Convert.ToUInt16(r["T1TOS"].ToString());
                    tsopp.Totals[TAbbrT.BLK] += ParseCell.GetUInt16(r, "T1BLK");
                    tsopp.Totals[TAbbrT.AST] += ParseCell.GetUInt16(r, "T1AST");
                    tsopp.Totals[TAbbrT.FOUL] += ParseCell.GetUInt16(r, "T1FOUL");
                }

                tsopp.Record[1] = ts.Record[0];
                tsopp.Record[0] = ts.Record[1];
            }
            else
            {
                var t1PTS = Convert.ToInt32(r["T1PTS"].ToString());
                var t2PTS = Convert.ToInt32(r["T2PTS"].ToString());
                if (r["T1Name"].ToString().Equals(ts.Name))
                {
                    if (t1PTS > t2PTS)
                    {
                        ts.PlRecord[0]++;
                    }
                    else
                    {
                        ts.PlRecord[1]++;
                    }
                    tsopp.PlTotals[TAbbrT.MINS] = ts.PlTotals[TAbbrT.MINS] += Convert.ToUInt16(r["T1MINS"].ToString());
                    tsopp.PlTotals[TAbbrT.PA] = ts.PlTotals[TAbbrT.PF] += Convert.ToUInt16(r["T1PTS"].ToString());
                    tsopp.PlTotals[TAbbrT.PF] = ts.PlTotals[TAbbrT.PA] += Convert.ToUInt16(r["T2PTS"].ToString());

                    ts.PlTotals[TAbbrT.FGM] += Convert.ToUInt16(r["T1FGM"].ToString());
                    ts.PlTotals[TAbbrT.FGA] += Convert.ToUInt16(r["T1FGA"].ToString());
                    ts.PlTotals[TAbbrT.TPM] += Convert.ToUInt16(r["T13PM"].ToString());
                    ts.PlTotals[TAbbrT.TPA] += Convert.ToUInt16(r["T13PA"].ToString());
                    ts.PlTotals[TAbbrT.FTM] += Convert.ToUInt16(r["T1FTM"].ToString());
                    ts.PlTotals[TAbbrT.FTA] += Convert.ToUInt16(r["T1FTA"].ToString());

                    var t1REB = Convert.ToUInt16(r["T1REB"].ToString());
                    var t1OREB = Convert.ToUInt16(r["T1OREB"].ToString());
                    ts.PlTotals[TAbbrT.DREB] += (ushort) (t1REB - t1OREB);
                    ts.PlTotals[TAbbrT.OREB] += t1OREB;

                    ts.PlTotals[TAbbrT.STL] += Convert.ToUInt16(r["T1STL"].ToString());
                    ts.PlTotals[TAbbrT.TOS] += Convert.ToUInt16(r["T1TOS"].ToString());
                    ts.PlTotals[TAbbrT.BLK] += ParseCell.GetUInt16(r, "T1BLK");
                    ts.PlTotals[TAbbrT.AST] += ParseCell.GetUInt16(r, "T1AST");
                    ts.PlTotals[TAbbrT.FOUL] += ParseCell.GetUInt16(r, "T1FOUL");

                    tsopp.PlTotals[TAbbrT.FGM] += Convert.ToUInt16(r["T2FGM"].ToString());
                    tsopp.PlTotals[TAbbrT.FGA] += Convert.ToUInt16(r["T2FGA"].ToString());
                    tsopp.PlTotals[TAbbrT.TPM] += Convert.ToUInt16(r["T23PM"].ToString());
                    tsopp.PlTotals[TAbbrT.TPA] += Convert.ToUInt16(r["T23PA"].ToString());
                    tsopp.PlTotals[TAbbrT.FTM] += Convert.ToUInt16(r["T2FTM"].ToString());
                    tsopp.PlTotals[TAbbrT.FTA] += Convert.ToUInt16(r["T2FTA"].ToString());

                    var t2REB = Convert.ToUInt16(r["T2REB"].ToString());
                    var t2OREB = Convert.ToUInt16(r["T2OREB"].ToString());
                    tsopp.PlTotals[TAbbrT.DREB] += (ushort) (t2REB - t2OREB);
                    tsopp.PlTotals[TAbbrT.OREB] += t2OREB;

                    tsopp.PlTotals[TAbbrT.STL] += Convert.ToUInt16(r["T2STL"].ToString());
                    tsopp.PlTotals[TAbbrT.TOS] += Convert.ToUInt16(r["T2TOS"].ToString());
                    tsopp.PlTotals[TAbbrT.BLK] += ParseCell.GetUInt16(r, "T2BLK");
                    tsopp.PlTotals[TAbbrT.AST] += ParseCell.GetUInt16(r, "T2AST");
                    tsopp.PlTotals[TAbbrT.FOUL] += ParseCell.GetUInt16(r, "T2FOUL");
                }
                else
                {
                    if (t2PTS > t1PTS)
                    {
                        ts.PlRecord[0]++;
                    }
                    else
                    {
                        ts.PlRecord[1]++;
                    }
                    tsopp.PlTotals[TAbbrT.MINS] = ts.PlTotals[TAbbrT.MINS] += Convert.ToUInt16(r["T2MINS"].ToString());
                    tsopp.PlTotals[TAbbrT.PA] = ts.PlTotals[TAbbrT.PF] += Convert.ToUInt16(r["T2PTS"].ToString());
                    tsopp.PlTotals[TAbbrT.PF] = ts.PlTotals[TAbbrT.PA] += Convert.ToUInt16(r["T1PTS"].ToString());

                    ts.PlTotals[TAbbrT.FGM] += Convert.ToUInt16(r["T2FGM"].ToString());
                    ts.PlTotals[TAbbrT.FGA] += Convert.ToUInt16(r["T2FGA"].ToString());
                    ts.PlTotals[TAbbrT.TPM] += Convert.ToUInt16(r["T23PM"].ToString());
                    ts.PlTotals[TAbbrT.TPA] += Convert.ToUInt16(r["T23PA"].ToString());
                    ts.PlTotals[TAbbrT.FTM] += Convert.ToUInt16(r["T2FTM"].ToString());
                    ts.PlTotals[TAbbrT.FTA] += Convert.ToUInt16(r["T2FTA"].ToString());

                    var t2REB = Convert.ToUInt16(r["T2REB"].ToString());
                    var t2OREB = Convert.ToUInt16(r["T2OREB"].ToString());
                    ts.PlTotals[TAbbrT.DREB] += (ushort) (t2REB - t2OREB);
                    ts.PlTotals[TAbbrT.OREB] += t2OREB;

                    ts.PlTotals[TAbbrT.STL] += Convert.ToUInt16(r["T2STL"].ToString());
                    ts.PlTotals[TAbbrT.TOS] += Convert.ToUInt16(r["T2TOS"].ToString());
                    ts.PlTotals[TAbbrT.BLK] += ParseCell.GetUInt16(r, "T2BLK");
                    ts.PlTotals[TAbbrT.AST] += ParseCell.GetUInt16(r, "T2AST");
                    ts.PlTotals[TAbbrT.FOUL] += ParseCell.GetUInt16(r, "T2FOUL");

                    tsopp.PlTotals[TAbbrT.FGM] += Convert.ToUInt16(r["T1FGM"].ToString());
                    tsopp.PlTotals[TAbbrT.FGA] += Convert.ToUInt16(r["T1FGA"].ToString());
                    tsopp.PlTotals[TAbbrT.TPM] += Convert.ToUInt16(r["T13PM"].ToString());
                    tsopp.PlTotals[TAbbrT.TPA] += Convert.ToUInt16(r["T13PA"].ToString());
                    tsopp.PlTotals[TAbbrT.FTM] += Convert.ToUInt16(r["T1FTM"].ToString());
                    tsopp.PlTotals[TAbbrT.FTA] += Convert.ToUInt16(r["T1FTA"].ToString());

                    var t1REB = Convert.ToUInt16(r["T1REB"].ToString());
                    var t1OREB = Convert.ToUInt16(r["T1OREB"].ToString());
                    tsopp.PlTotals[TAbbrT.DREB] += (ushort) (t1REB - t1OREB);
                    tsopp.PlTotals[TAbbrT.OREB] += t1OREB;

                    tsopp.PlTotals[TAbbrT.STL] += Convert.ToUInt16(r["T1STL"].ToString());
                    tsopp.PlTotals[TAbbrT.TOS] += Convert.ToUInt16(r["T1TOS"].ToString());
                    tsopp.PlTotals[TAbbrT.BLK] += ParseCell.GetUInt16(r, "T1BLK");
                    tsopp.PlTotals[TAbbrT.AST] += ParseCell.GetUInt16(r, "T1AST");
                    tsopp.PlTotals[TAbbrT.FOUL] += ParseCell.GetUInt16(r, "T1FOUL");
                }

                tsopp.PlRecord[1] = ts.PlRecord[0];
                tsopp.PlRecord[0] = ts.PlRecord[1];
            }

            ts.CalcAvg();
            tsopp.CalcAvg();
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Creates the team and opposing team stats instances using data from the downloaded DataTable.
        /// </summary>
        /// <param name="dt">The DataTable.</param>
        /// <param name="name">The name of the team.</param>
        /// <param name="recordparts">The parts of the team's record string.</param>
        /// <param name="ts">The resulting team stats instance.</param>
        /// <param name="tsopp">The resulting opposing team stats instance.</param>
        private static void teamStatsFromDataTable(DataTable dt, string name, string[] recordparts, out TeamStats ts,
                                                   out TeamStats tsopp)
        {
            ts = new TeamStats(MainWindow.TST.Single(pair => pair.Value.Name == name).Key, name);
            tsopp = new TeamStats(MainWindow.TST.Single(pair => pair.Value.Name == name).Key, name);

            tsopp.Record[1] = ts.Record[0] = Convert.ToByte(recordparts[0]);
            tsopp.Record[0] = ts.Record[1] = Convert.ToByte(recordparts[1]);

            DataRow tr = dt.Rows[0];
            DataRow toppr = dt.Rows[2];

            ts.Totals[TAbbr.MINS] = (ushort) (ParseCell.GetUInt16(tr, "MP")/5);
            ts.Totals[TAbbr.FGM] = ParseCell.GetUInt16(tr, "FG");
            ts.Totals[TAbbr.FGA] = ParseCell.GetUInt16(tr, "FGA");
            ts.Totals[TAbbr.TPM] = ParseCell.GetUInt16(tr, "3P");
            ts.Totals[TAbbr.TPA] = ParseCell.GetUInt16(tr, "3PA");
            ts.Totals[TAbbr.FTM] = ParseCell.GetUInt16(tr, "FT");
            ts.Totals[TAbbr.FTA] = ParseCell.GetUInt16(tr, "FTA");
            ts.Totals[TAbbr.OREB] = ParseCell.GetUInt16(tr, "ORB");
            ts.Totals[TAbbr.DREB] = ParseCell.GetUInt16(tr, "DRB");
            ts.Totals[TAbbr.AST] = ParseCell.GetUInt16(tr, "AST");
            ts.Totals[TAbbr.STL] = ParseCell.GetUInt16(tr, "STL");
            ts.Totals[TAbbr.BLK] = ParseCell.GetUInt16(tr, "BLK");
            ts.Totals[TAbbr.TOS] = ParseCell.GetUInt16(tr, "TOV");
            ts.Totals[TAbbr.FOUL] = ParseCell.GetUInt16(tr, "PF");
            ts.Totals[TAbbr.PF] = ParseCell.GetUInt16(tr, "PTS");
            ts.Totals[TAbbr.PA] = ParseCell.GetUInt16(toppr, "PTS");

            ts.CalcAvg();

            tsopp.Totals[TAbbr.MINS] = (ushort) (ParseCell.GetUInt16(toppr, "MP")/5);
            tsopp.Totals[TAbbr.FGM] = ParseCell.GetUInt16(toppr, "FG");
            tsopp.Totals[TAbbr.FGA] = ParseCell.GetUInt16(toppr, "FGA");
            tsopp.Totals[TAbbr.TPM] = ParseCell.GetUInt16(toppr, "3P");
            tsopp.Totals[TAbbr.TPA] = ParseCell.GetUInt16(toppr, "3PA");
            tsopp.Totals[TAbbr.FTM] = ParseCell.GetUInt16(toppr, "FT");
            tsopp.Totals[TAbbr.FTA] = ParseCell.GetUInt16(toppr, "FTA");
            tsopp.Totals[TAbbr.OREB] = ParseCell.GetUInt16(toppr, "ORB");
            tsopp.Totals[TAbbr.DREB] = ParseCell.GetUInt16(toppr, "DRB");
            tsopp.Totals[TAbbr.AST] = ParseCell.GetUInt16(toppr, "AST");
            tsopp.Totals[TAbbr.STL] = ParseCell.GetUInt16(toppr, "STL");
            tsopp.Totals[TAbbr.BLK] = ParseCell.GetUInt16(toppr, "BLK");
            tsopp.Totals[TAbbr.TOS] = ParseCell.GetUInt16(toppr, "TOV");
            tsopp.Totals[TAbbr.FOUL] = ParseCell.GetUInt16(toppr, "PF");
            tsopp.Totals[TAbbr.PF] = ParseCell.GetUInt16(toppr, "PTS");
            tsopp.Totals[TAbbr.PA] = ParseCell.GetUInt16(tr, "PTS");

            tsopp.CalcAvg();
        }
        private void prepareHeadToHeadTab(out List<PlayerStatsRow> teamPMSRList, out List<PlayerStatsRow> oppPMSRList)
        {
            var iown = _curTeam;
            var iopp = _curOpp;

            var dtHTHBS = new DataTable();
            dtHTHBS.Columns.Add("Date");
            dtHTHBS.Columns.Add("Home-Away");
            dtHTHBS.Columns.Add("Result");
            dtHTHBS.Columns.Add("Score");
            dtHTHBS.Columns.Add("GameID");

            var ts = new TeamStats(_curTeam);
            var tsopp = new TeamStats(_curOpp);

            _db = new SQLiteDatabase(MainWindow.CurrentDB);

            if (_dtHTH.Rows.Count > 1)
            {
                _dtHTH.Rows.RemoveAt(_dtHTH.Rows.Count - 1);
            }

            var bsHist = MainWindow.BSHist;

            var bseList =
                bsHist.Where(
                    bse =>
                    (bse.BS.Team1ID == _curTeam && bse.BS.Team2ID == _curOpp)
                    || (bse.BS.Team1ID == _curOpp && bse.BS.Team2ID == _curTeam)).ToList();

            if (rbHTHStatsAnyone.IsChecked.GetValueOrDefault())
            {
                ts = _tst[iown];
                ts.CalcAvg();

                tsopp = _tst[iopp];
                tsopp.CalcAvg();
            }
            else
            {
                foreach (var bse in bseList)
                {
                    TeamStats.AddTeamStatsFromBoxScore(bse.BS, ref ts, ref tsopp, true);
                }
            }

            //ts.CalcMetrics(tsopp);
            //tsopp.CalcMetrics(ts);
            var ls = new TeamStats();
            ls.AddTeamStats(ts, Span.SeasonAndPlayoffsToSeason);
            ls.AddTeamStats(tsopp, Span.SeasonAndPlayoffsToSeason);
            var keys = _pst.Keys.ToList();
            teamPMSRList = new List<PlayerStatsRow>();
            oppPMSRList = new List<PlayerStatsRow>();
            foreach (var key in keys)
            {
                if (_pst[key].TeamF == ts.ID)
                {
                    teamPMSRList.Add(new PlayerStatsRow(_pst[key]));
                }
                else if (_pst[key].TeamF == tsopp.ID)
                {
                    oppPMSRList.Add(new PlayerStatsRow(_pst[key]));
                }
            }

            foreach (var bse in bseList)
            {
                int t1PTS = bse.BS.PTS1;
                int t2PTS = bse.BS.PTS2;
                var bsr = dtHTHBS.NewRow();
                bsr["Date"] = bse.BS.GameDate.ToString().Split(' ')[0];
                if (bse.BS.Team1ID.Equals(_curTeam))
                {
                    bsr["Home-Away"] = "Away";

                    if (t1PTS > t2PTS)
                    {
                        bsr["Result"] = "W";
                    }
                    else
                    {
                        bsr["Result"] = "L";
                    }
                }
                else
                {
                    bsr["Home-Away"] = "Home";

                    if (t2PTS > t1PTS)
                    {
                        bsr["Result"] = "W";
                    }
                    else
                    {
                        bsr["Result"] = "L";
                    }
                }

                bsr["Score"] = bse.BS.PTS1 + "-" + bse.BS.PTS2;
                bsr["GameID"] = bse.BS.ID.ToString();

                dtHTHBS.Rows.Add(bsr);
            }

            _dtHTH.Clear();

            var dr = _dtHTH.NewRow();

            createDataRowFromTeamStats(ts, ref dr, "Averages");

            _dtHTH.Rows.Add(dr);

            dr = _dtHTH.NewRow();

            createDataRowFromTeamStats(tsopp, ref dr, "Opp Avg");

            _dtHTH.Rows.Add(dr);

            dr = _dtHTH.NewRow();

            createDataRowFromTeamStats(ts, ref dr, "Playoffs", true);

            _dtHTH.Rows.Add(dr);

            dr = _dtHTH.NewRow();

            createDataRowFromTeamStats(tsopp, ref dr, "Opp Pl Avg", true);

            _dtHTH.Rows.Add(dr);

            _dvHTH = new DataView(_dtHTH) { AllowNew = false, AllowEdit = false };

            dgvHTHStats.DataContext = _dvHTH;

            var dvHTHBS = new DataView(dtHTHBS) { AllowNew = false, AllowEdit = false };

            dgvHTHBoxScores.DataContext = dvHTHBS;
        }
        /// <summary>Updates the Overview tab and loads the appropriate box scores depending on the timeframe.</summary>
        private void updateOverviewAndBoxScores()
        {
            var id = _curTeam;

            _curts = _tst[id];
            _curtsopp = _tstOpp[id];

            _tbsList = new List<TeamBoxScore>();

            #region Prepare Team Overview

            _bseList = MainWindow.BSHist.Where(bse => bse.BS.Team1ID == _curTeam || bse.BS.Team2ID == _curTeam).ToList();
            _bseListSea = _bseList.Where(bse => bse.BS.IsPlayoff == false).ToList();
            _bseListPl = _bseList.Where(bse => bse.BS.IsPlayoff).ToList();

            foreach (var r in _bseList)
            {
                var bsr = r.BS.CustomClone();
                bsr.PrepareForDisplay(_tst, _curTeam);
                _tbsList.Add(bsr);
            }

            #region Regular Season

            var dr = _dtOv.NewRow();

            dr["Type"] = "Stats";
            dr["Games"] = _curts.GetGames();
            dr["Wins (W%)"] = _curts.Record[0].ToString();
            dr["Losses (Weff)"] = _curts.Record[1].ToString();
            dr["PF"] = _curts.Totals[TAbbrT.PF].ToString();
            dr["PA"] = _curts.Totals[TAbbrT.PA].ToString();
            dr["PD"] = " ";
            dr["FG"] = _curts.Totals[TAbbrT.FGM].ToString() + "-" + _curts.Totals[TAbbrT.FGA].ToString();
            dr["3PT"] = _curts.Totals[TAbbrT.TPM].ToString() + "-" + _curts.Totals[TAbbrT.TPA].ToString();
            dr["FT"] = _curts.Totals[TAbbrT.FTM].ToString() + "-" + _curts.Totals[TAbbrT.FTA].ToString();
            dr["REB"] = (_curts.Totals[TAbbrT.DREB] + _curts.Totals[TAbbrT.OREB]).ToString();
            dr["OREB"] = _curts.Totals[TAbbrT.OREB].ToString();
            dr["DREB"] = _curts.Totals[TAbbrT.DREB].ToString();
            dr["AST"] = _curts.Totals[TAbbrT.AST].ToString();
            dr["TO"] = _curts.Totals[TAbbrT.TOS].ToString();
            dr["STL"] = _curts.Totals[TAbbrT.STL].ToString();
            dr["BLK"] = _curts.Totals[TAbbrT.BLK].ToString();
            dr["FOUL"] = _curts.Totals[TAbbrT.FOUL].ToString();
            dr["MINS"] = _curts.Totals[TAbbrT.MINS].ToString();

            _dtOv.Rows.Add(dr);

            dr = _dtOv.NewRow();

            _curts.CalcAvg(); // Just to be sure...

            dr["Type"] = "Averages";
            //dr["Games"] = curts.getGames();
            dr["Wins (W%)"] = String.Format("{0:F3}", _curts.PerGame[TAbbrPG.Wp]);
            dr["Losses (Weff)"] = String.Format("{0:F2}", _curts.PerGame[TAbbrPG.Weff]);
            dr["PF"] = String.Format("{0:F1}", _curts.PerGame[TAbbrPG.PPG]);
            dr["PA"] = String.Format("{0:F1}", _curts.PerGame[TAbbrPG.PAPG]);
            dr["PD"] = String.Format("{0:F1}", _curts.PerGame[TAbbrPG.PD]);
            dr["FG"] = String.Format("{0:F3}", _curts.PerGame[TAbbrPG.FGp]);
            dr["FGeff"] = String.Format("{0:F2}", _curts.PerGame[TAbbrPG.FGeff]);
            dr["3PT"] = String.Format("{0:F3}", _curts.PerGame[TAbbrPG.TPp]);
            dr["3Peff"] = String.Format("{0:F2}", _curts.PerGame[TAbbrPG.TPeff]);
            dr["FT"] = String.Format("{0:F3}", _curts.PerGame[TAbbrPG.FTp]);
            dr["FTeff"] = String.Format("{0:F2}", _curts.PerGame[TAbbrPG.FTeff]);
            dr["REB"] = String.Format("{0:F1}", _curts.PerGame[TAbbrPG.RPG]);
            dr["OREB"] = String.Format("{0:F1}", _curts.PerGame[TAbbrPG.ORPG]);
            dr["DREB"] = String.Format("{0:F1}", _curts.PerGame[TAbbrPG.DRPG]);
            dr["AST"] = String.Format("{0:F1}", _curts.PerGame[TAbbrPG.APG]);
            dr["TO"] = String.Format("{0:F1}", _curts.PerGame[TAbbrPG.TPG]);
            dr["STL"] = String.Format("{0:F1}", _curts.PerGame[TAbbrPG.SPG]);
            dr["BLK"] = String.Format("{0:F1}", _curts.PerGame[TAbbrPG.BPG]);
            dr["FOUL"] = String.Format("{0:F1}", _curts.PerGame[TAbbrPG.FPG]);

            _dtOv.Rows.Add(dr);

            // Rankings can only be shown based on total stats
            // ...for now
            var dr2 = _dtOv.NewRow();

            dr2["Type"] = "Rankings";
            dr2["Wins (W%)"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.Wp];
            dr2["Losses (Weff)"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.Weff];
            dr2["PF"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.PPG];
            dr2["PA"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.PAPG];
            dr2["PD"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.PD];
            dr2["FG"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.FGp];
            dr2["FGeff"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.FGeff];
            dr2["3PT"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.TPp];
            dr2["3Peff"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.TPeff];
            dr2["FT"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.FTp];
            dr2["FTeff"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.FTeff];
            dr2["REB"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.RPG];
            dr2["OREB"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.ORPG];
            dr2["DREB"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.DRPG];
            dr2["AST"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.APG];
            dr2["TO"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.TPG];
            dr2["STL"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.SPG];
            dr2["BLK"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.BPG];
            dr2["FOUL"] = _seasonRankings.RankingsPerGame[id][TAbbrPG.FPG];

            _dtOv.Rows.Add(dr2);

            dr2 = _dtOv.NewRow();

            dr2["Type"] = "Opp Stats";
            dr2["Games"] = _curtsopp.GetGames();
            dr2["Wins (W%)"] = _curtsopp.Record[0].ToString();
            dr2["Losses (Weff)"] = _curtsopp.Record[1].ToString();
            dr2["PF"] = _curtsopp.Totals[TAbbrT.PF].ToString();
            dr2["PA"] = _curtsopp.Totals[TAbbrT.PA].ToString();
            dr2["PD"] = " ";
            dr2["FG"] = _curtsopp.Totals[TAbbrT.FGM].ToString() + "-" + _curtsopp.Totals[TAbbrT.FGA].ToString();
            dr2["3PT"] = _curtsopp.Totals[TAbbrT.TPM].ToString() + "-" + _curtsopp.Totals[TAbbrT.TPA].ToString();
            dr2["FT"] = _curtsopp.Totals[TAbbrT.FTM].ToString() + "-" + _curtsopp.Totals[TAbbrT.FTA].ToString();
            dr2["REB"] = (_curtsopp.Totals[TAbbrT.DREB] + _curtsopp.Totals[TAbbrT.OREB]).ToString();
            dr2["OREB"] = _curtsopp.Totals[TAbbrT.OREB].ToString();
            dr2["DREB"] = _curtsopp.Totals[TAbbrT.DREB].ToString();
            dr2["AST"] = _curtsopp.Totals[TAbbrT.AST].ToString();
            dr2["TO"] = _curtsopp.Totals[TAbbrT.TOS].ToString();
            dr2["STL"] = _curtsopp.Totals[TAbbrT.STL].ToString();
            dr2["BLK"] = _curtsopp.Totals[TAbbrT.BLK].ToString();
            dr2["FOUL"] = _curtsopp.Totals[TAbbrT.FOUL].ToString();
            dr2["MINS"] = _curtsopp.Totals[TAbbrT.MINS].ToString();

            _dtOv.Rows.Add(dr2);

            dr2 = _dtOv.NewRow();

            dr2["Type"] = "Opp Avg";
            dr2["Wins (W%)"] = String.Format("{0:F3}", _curtsopp.PerGame[TAbbrPG.Wp]);
            dr2["Losses (Weff)"] = String.Format("{0:F2}", _curtsopp.PerGame[TAbbrPG.Weff]);
            dr2["PF"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbrPG.PPG]);
            dr2["PA"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbrPG.PAPG]);
            dr2["PD"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbrPG.PD]);
            dr2["FG"] = String.Format("{0:F3}", _curtsopp.PerGame[TAbbrPG.FGp]);
            dr2["FGeff"] = String.Format("{0:F2}", _curtsopp.PerGame[TAbbrPG.FGeff]);
            dr2["3PT"] = String.Format("{0:F3}", _curtsopp.PerGame[TAbbrPG.TPp]);
            dr2["3Peff"] = String.Format("{0:F2}", _curtsopp.PerGame[TAbbrPG.TPeff]);
            dr2["FT"] = String.Format("{0:F3}", _curtsopp.PerGame[TAbbrPG.FTp]);
            dr2["FTeff"] = String.Format("{0:F2}", _curtsopp.PerGame[TAbbrPG.FTeff]);
            dr2["REB"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbrPG.RPG]);
            dr2["OREB"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbrPG.ORPG]);
            dr2["DREB"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbrPG.DRPG]);
            dr2["AST"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbrPG.APG]);
            dr2["TO"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbrPG.TPG]);
            dr2["STL"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbrPG.SPG]);
            dr2["BLK"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbrPG.BPG]);
            dr2["FOUL"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbrPG.FPG]);

            _dtOv.Rows.Add(dr2);

            #endregion

            #region Playoffs

            _dtOv.Rows.Add(_dtOv.NewRow());

            dr = _dtOv.NewRow();

            dr["Type"] = "Playoffs";
            dr["Games"] = _curts.GetPlayoffGames();
            dr["Wins (W%)"] = _curts.PlRecord[0].ToString();
            dr["Losses (Weff)"] = _curts.PlRecord[1].ToString();
            dr["PF"] = _curts.PlTotals[TAbbrT.PF].ToString();
            dr["PA"] = _curts.PlTotals[TAbbrT.PA].ToString();
            dr["PD"] = " ";
            dr["FG"] = _curts.PlTotals[TAbbrT.FGM].ToString() + "-" + _curts.PlTotals[TAbbrT.FGA].ToString();
            dr["3PT"] = _curts.PlTotals[TAbbrT.TPM].ToString() + "-" + _curts.PlTotals[TAbbrT.TPA].ToString();
            dr["FT"] = _curts.PlTotals[TAbbrT.FTM].ToString() + "-" + _curts.PlTotals[TAbbrT.FTA].ToString();
            dr["REB"] = (_curts.PlTotals[TAbbrT.DREB] + _curts.PlTotals[TAbbrT.OREB]).ToString();
            dr["OREB"] = _curts.PlTotals[TAbbrT.OREB].ToString();
            dr["DREB"] = _curts.PlTotals[TAbbrT.DREB].ToString();
            dr["AST"] = _curts.PlTotals[TAbbrT.AST].ToString();
            dr["TO"] = _curts.PlTotals[TAbbrT.TOS].ToString();
            dr["STL"] = _curts.PlTotals[TAbbrT.STL].ToString();
            dr["BLK"] = _curts.PlTotals[TAbbrT.BLK].ToString();
            dr["FOUL"] = _curts.PlTotals[TAbbrT.FOUL].ToString();
            dr["MINS"] = _curts.PlTotals[TAbbrT.MINS].ToString();

            _dtOv.Rows.Add(dr);

            dr = _dtOv.NewRow();

            dr["Type"] = "Pl Avg";
            dr["Wins (W%)"] = String.Format("{0:F3}", _curts.PlPerGame[TAbbrPG.Wp]);
            dr["Losses (Weff)"] = String.Format("{0:F2}", _curts.PlPerGame[TAbbrPG.Weff]);
            dr["PF"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbrPG.PPG]);
            dr["PA"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbrPG.PAPG]);
            dr["PD"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbrPG.PD]);
            dr["FG"] = String.Format("{0:F3}", _curts.PlPerGame[TAbbrPG.FGp]);
            dr["FGeff"] = String.Format("{0:F2}", _curts.PlPerGame[TAbbrPG.FGeff]);
            dr["3PT"] = String.Format("{0:F3}", _curts.PlPerGame[TAbbrPG.TPp]);
            dr["3Peff"] = String.Format("{0:F2}", _curts.PlPerGame[TAbbrPG.TPeff]);
            dr["FT"] = String.Format("{0:F3}", _curts.PlPerGame[TAbbrPG.FTp]);
            dr["FTeff"] = String.Format("{0:F2}", _curts.PlPerGame[TAbbrPG.FTeff]);
            dr["REB"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbrPG.RPG]);
            dr["OREB"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbrPG.ORPG]);
            dr["DREB"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbrPG.DRPG]);
            dr["AST"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbrPG.APG]);
            dr["TO"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbrPG.TPG]);
            dr["STL"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbrPG.SPG]);
            dr["BLK"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbrPG.BPG]);
            dr["FOUL"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbrPG.FPG]);

            _dtOv.Rows.Add(dr);

            dr2 = _dtOv.NewRow();

            var count = _tst.Count(z => z.Value.GetPlayoffGames() > 0);

            dr2["Type"] = "Pl Rank";
            dr2["Wins (W%)"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.Wp];
            dr2["Losses (Weff)"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.Weff];
            dr2["PF"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.PPG];
            dr2["PA"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.PAPG];
            dr2["PD"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.PD];
            dr2["FG"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.FGp];
            dr2["FGeff"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.FGeff];
            dr2["3PT"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.TPp];
            dr2["3Peff"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.TPeff];
            dr2["FT"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.FTp];
            dr2["FTeff"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.FTeff];
            dr2["REB"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.RPG];
            dr2["OREB"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.ORPG];
            dr2["DREB"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.DRPG];
            dr2["AST"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.APG];
            dr2["TO"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.TPG];
            dr2["STL"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.SPG];
            dr2["BLK"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.BPG];
            dr2["FOUL"] = _playoffRankings.RankingsPerGame[id][TAbbrPG.FPG];

            _dtOv.Rows.Add(dr2);

            dr2 = _dtOv.NewRow();

            dr2["Type"] = "Opp Pl Stats";
            dr2["Games"] = _curtsopp.GetPlayoffGames();
            dr2["Wins (W%)"] = _curtsopp.PlRecord[0].ToString();
            dr2["Losses (Weff)"] = _curtsopp.PlRecord[1].ToString();
            dr2["PF"] = _curtsopp.PlTotals[TAbbrT.PF].ToString();
            dr2["PA"] = _curtsopp.PlTotals[TAbbrT.PA].ToString();
            dr2["PD"] = " ";
            dr2["FG"] = _curtsopp.PlTotals[TAbbrT.FGM].ToString() + "-" + _curtsopp.PlTotals[TAbbrT.FGA].ToString();
            dr2["3PT"] = _curtsopp.PlTotals[TAbbrT.TPM].ToString() + "-" + _curtsopp.PlTotals[TAbbrT.TPA].ToString();
            dr2["FT"] = _curtsopp.PlTotals[TAbbrT.FTM].ToString() + "-" + _curtsopp.PlTotals[TAbbrT.FTA].ToString();
            dr2["REB"] = (_curtsopp.PlTotals[TAbbrT.DREB] + _curtsopp.PlTotals[TAbbrT.OREB]).ToString();
            dr2["OREB"] = _curtsopp.PlTotals[TAbbrT.OREB].ToString();
            dr2["DREB"] = _curtsopp.PlTotals[TAbbrT.DREB].ToString();
            dr2["AST"] = _curtsopp.PlTotals[TAbbrT.AST].ToString();
            dr2["TO"] = _curtsopp.PlTotals[TAbbrT.TOS].ToString();
            dr2["STL"] = _curtsopp.PlTotals[TAbbrT.STL].ToString();
            dr2["BLK"] = _curtsopp.PlTotals[TAbbrT.BLK].ToString();
            dr2["FOUL"] = _curtsopp.PlTotals[TAbbrT.FOUL].ToString();
            dr2["MINS"] = _curtsopp.PlTotals[TAbbrT.MINS].ToString();

            _dtOv.Rows.Add(dr2);

            dr2 = _dtOv.NewRow();

            dr2["Type"] = "Opp Pl Avg";
            dr2["Wins (W%)"] = String.Format("{0:F3}", _curtsopp.PlPerGame[TAbbrPG.Wp]);
            dr2["Losses (Weff)"] = String.Format("{0:F2}", _curtsopp.PlPerGame[TAbbrPG.Weff]);
            dr2["PF"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbrPG.PPG]);
            dr2["PA"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbrPG.PAPG]);
            dr2["PD"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbrPG.PD]);
            dr2["FG"] = String.Format("{0:F3}", _curtsopp.PlPerGame[TAbbrPG.FGp]);
            dr2["FGeff"] = String.Format("{0:F2}", _curtsopp.PlPerGame[TAbbrPG.FGeff]);
            dr2["3PT"] = String.Format("{0:F3}", _curtsopp.PlPerGame[TAbbrPG.TPp]);
            dr2["3Peff"] = String.Format("{0:F2}", _curtsopp.PlPerGame[TAbbrPG.TPeff]);
            dr2["FT"] = String.Format("{0:F3}", _curtsopp.PlPerGame[TAbbrPG.FTp]);
            dr2["FTeff"] = String.Format("{0:F2}", _curtsopp.PlPerGame[TAbbrPG.FTeff]);
            dr2["REB"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbrPG.RPG]);
            dr2["OREB"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbrPG.ORPG]);
            dr2["DREB"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbrPG.DRPG]);
            dr2["AST"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbrPG.APG]);
            dr2["TO"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbrPG.TPG]);
            dr2["STL"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbrPG.SPG]);
            dr2["BLK"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbrPG.BPG]);
            dr2["FOUL"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbrPG.FPG]);

            _dtOv.Rows.Add(dr2);

            #endregion

            createViewAndUpdateOverview();

            dgvBoxScores.ItemsSource = _tbsList;

            #endregion

            _curTSR = new TeamStatsRow(_curts);
            dgMetrics.ItemsSource = new List<TeamStatsRow> { _curTSR };

            updatePBPStats();
        }
        /// <summary>
        ///     Updates the Overview tab and loads the appropriate box scores depending on the timeframe.
        /// </summary>
        private void updateOverviewAndBoxScores()
        {
            int id = _curTeam;

            _curts = _tst[id];
            _curtsopp = _tstOpp[id];

            _bsrList = new List<TeamBoxScore>();

            #region Prepare Team Overview

            IEnumerable<BoxScoreEntry> boxScoreEntries =
                MainWindow.BSHist.Where(bse => bse.BS.Team1ID == _curTeam || bse.BS.Team2ID == _curTeam);

            foreach (BoxScoreEntry r in boxScoreEntries)
            {
                TeamBoxScore bsr = r.BS.DeepClone();
                bsr.PrepareForDisplay(_tst, _curTeam);
                _bsrList.Add(bsr);
            }

            #region Regular Season

            DataRow dr = _dtOv.NewRow();

            dr["Type"] = "Stats";
            dr["Games"] = _curts.GetGames();
            dr["Wins (W%)"] = _curts.Record[0].ToString();
            dr["Losses (Weff)"] = _curts.Record[1].ToString();
            dr["PF"] = _curts.Totals[TAbbr.PF].ToString();
            dr["PA"] = _curts.Totals[TAbbr.PA].ToString();
            dr["PD"] = " ";
            dr["FG"] = _curts.Totals[TAbbr.FGM].ToString() + "-" + _curts.Totals[TAbbr.FGA].ToString();
            dr["3PT"] = _curts.Totals[TAbbr.TPM].ToString() + "-" + _curts.Totals[TAbbr.TPA].ToString();
            dr["FT"] = _curts.Totals[TAbbr.FTM].ToString() + "-" + _curts.Totals[TAbbr.FTA].ToString();
            dr["REB"] = (_curts.Totals[TAbbr.DREB] + _curts.Totals[TAbbr.OREB]).ToString();
            dr["OREB"] = _curts.Totals[TAbbr.OREB].ToString();
            dr["DREB"] = _curts.Totals[TAbbr.DREB].ToString();
            dr["AST"] = _curts.Totals[TAbbr.AST].ToString();
            dr["TO"] = _curts.Totals[TAbbr.TOS].ToString();
            dr["STL"] = _curts.Totals[TAbbr.STL].ToString();
            dr["BLK"] = _curts.Totals[TAbbr.BLK].ToString();
            dr["FOUL"] = _curts.Totals[TAbbr.FOUL].ToString();
            dr["MINS"] = _curts.Totals[TAbbr.MINS].ToString();

            _dtOv.Rows.Add(dr);

            dr = _dtOv.NewRow();

            _curts.CalcAvg(); // Just to be sure...

            dr["Type"] = "Averages";
            //dr["Games"] = curts.getGames();
            dr["Wins (W%)"] = String.Format("{0:F3}", _curts.PerGame[TAbbr.Wp]);
            dr["Losses (Weff)"] = String.Format("{0:F2}", _curts.PerGame[TAbbr.Weff]);
            dr["PF"] = String.Format("{0:F1}", _curts.PerGame[TAbbr.PPG]);
            dr["PA"] = String.Format("{0:F1}", _curts.PerGame[TAbbr.PAPG]);
            dr["PD"] = String.Format("{0:F1}", _curts.PerGame[TAbbr.PD]);
            dr["FG"] = String.Format("{0:F3}", _curts.PerGame[TAbbr.FGp]);
            dr["FGeff"] = String.Format("{0:F2}", _curts.PerGame[TAbbr.FGeff]);
            dr["3PT"] = String.Format("{0:F3}", _curts.PerGame[TAbbr.TPp]);
            dr["3Peff"] = String.Format("{0:F2}", _curts.PerGame[TAbbr.TPeff]);
            dr["FT"] = String.Format("{0:F3}", _curts.PerGame[TAbbr.FTp]);
            dr["FTeff"] = String.Format("{0:F2}", _curts.PerGame[TAbbr.FTeff]);
            dr["REB"] = String.Format("{0:F1}", _curts.PerGame[TAbbr.RPG]);
            dr["OREB"] = String.Format("{0:F1}", _curts.PerGame[TAbbr.ORPG]);
            dr["DREB"] = String.Format("{0:F1}", _curts.PerGame[TAbbr.DRPG]);
            dr["AST"] = String.Format("{0:F1}", _curts.PerGame[TAbbr.APG]);
            dr["TO"] = String.Format("{0:F1}", _curts.PerGame[TAbbr.TPG]);
            dr["STL"] = String.Format("{0:F1}", _curts.PerGame[TAbbr.SPG]);
            dr["BLK"] = String.Format("{0:F1}", _curts.PerGame[TAbbr.BPG]);
            dr["FOUL"] = String.Format("{0:F1}", _curts.PerGame[TAbbr.FPG]);

            _dtOv.Rows.Add(dr);

            // Rankings can only be shown based on total stats
            // ...for now
            DataRow dr2;
            dr2 = _dtOv.NewRow();

            dr2["Type"] = "Rankings";
            dr2["Wins (W%)"] = _seasonRankings.RankingsPerGame[id][TAbbr.Wp];
            dr2["Losses (Weff)"] = _seasonRankings.RankingsPerGame[id][TAbbr.Weff];
            dr2["PF"] = _seasonRankings.RankingsPerGame[id][TAbbr.PPG];
            dr2["PA"] = cmbTeam.Items.Count + 1 - _seasonRankings.RankingsPerGame[id][TAbbr.PAPG];
            dr2["PD"] = _seasonRankings.RankingsPerGame[id][TAbbr.PD];
            dr2["FG"] = _seasonRankings.RankingsPerGame[id][TAbbr.FGp];
            dr2["FGeff"] = _seasonRankings.RankingsPerGame[id][TAbbr.FGeff];
            dr2["3PT"] = _seasonRankings.RankingsPerGame[id][TAbbr.TPp];
            dr2["3Peff"] = _seasonRankings.RankingsPerGame[id][TAbbr.TPeff];
            dr2["FT"] = _seasonRankings.RankingsPerGame[id][TAbbr.FTp];
            dr2["FTeff"] = _seasonRankings.RankingsPerGame[id][TAbbr.FTeff];
            dr2["REB"] = _seasonRankings.RankingsPerGame[id][TAbbr.RPG];
            dr2["OREB"] = _seasonRankings.RankingsPerGame[id][TAbbr.ORPG];
            dr2["DREB"] = _seasonRankings.RankingsPerGame[id][TAbbr.DRPG];
            dr2["AST"] = _seasonRankings.RankingsPerGame[id][TAbbr.APG];
            dr2["TO"] = cmbTeam.Items.Count + 1 - _seasonRankings.RankingsPerGame[id][TAbbr.TPG];
            dr2["STL"] = _seasonRankings.RankingsPerGame[id][TAbbr.SPG];
            dr2["BLK"] = _seasonRankings.RankingsPerGame[id][TAbbr.BPG];
            dr2["FOUL"] = cmbTeam.Items.Count + 1 - _seasonRankings.RankingsPerGame[id][TAbbr.FPG];

            _dtOv.Rows.Add(dr2);

            dr2 = _dtOv.NewRow();

            dr2["Type"] = "Opp Stats";
            dr2["Games"] = _curtsopp.GetGames();
            dr2["Wins (W%)"] = _curtsopp.Record[0].ToString();
            dr2["Losses (Weff)"] = _curtsopp.Record[1].ToString();
            dr2["PF"] = _curtsopp.Totals[TAbbr.PF].ToString();
            dr2["PA"] = _curtsopp.Totals[TAbbr.PA].ToString();
            dr2["PD"] = " ";
            dr2["FG"] = _curtsopp.Totals[TAbbr.FGM].ToString() + "-" + _curtsopp.Totals[TAbbr.FGA].ToString();
            dr2["3PT"] = _curtsopp.Totals[TAbbr.TPM].ToString() + "-" + _curtsopp.Totals[TAbbr.TPA].ToString();
            dr2["FT"] = _curtsopp.Totals[TAbbr.FTM].ToString() + "-" + _curtsopp.Totals[TAbbr.FTA].ToString();
            dr2["REB"] = (_curtsopp.Totals[TAbbr.DREB] + _curtsopp.Totals[TAbbr.OREB]).ToString();
            dr2["OREB"] = _curtsopp.Totals[TAbbr.OREB].ToString();
            dr2["DREB"] = _curtsopp.Totals[TAbbr.DREB].ToString();
            dr2["AST"] = _curtsopp.Totals[TAbbr.AST].ToString();
            dr2["TO"] = _curtsopp.Totals[TAbbr.TOS].ToString();
            dr2["STL"] = _curtsopp.Totals[TAbbr.STL].ToString();
            dr2["BLK"] = _curtsopp.Totals[TAbbr.BLK].ToString();
            dr2["FOUL"] = _curtsopp.Totals[TAbbr.FOUL].ToString();
            dr2["MINS"] = _curtsopp.Totals[TAbbr.MINS].ToString();

            _dtOv.Rows.Add(dr2);

            dr2 = _dtOv.NewRow();

            dr2["Type"] = "Opp Avg";
            dr2["Wins (W%)"] = String.Format("{0:F3}", _curtsopp.PerGame[TAbbr.Wp]);
            dr2["Losses (Weff)"] = String.Format("{0:F2}", _curtsopp.PerGame[TAbbr.Weff]);
            dr2["PF"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbr.PPG]);
            dr2["PA"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbr.PAPG]);
            dr2["PD"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbr.PD]);
            dr2["FG"] = String.Format("{0:F3}", _curtsopp.PerGame[TAbbr.FGp]);
            dr2["FGeff"] = String.Format("{0:F2}", _curtsopp.PerGame[TAbbr.FGeff]);
            dr2["3PT"] = String.Format("{0:F3}", _curtsopp.PerGame[TAbbr.TPp]);
            dr2["3Peff"] = String.Format("{0:F2}", _curtsopp.PerGame[TAbbr.TPeff]);
            dr2["FT"] = String.Format("{0:F3}", _curtsopp.PerGame[TAbbr.FTp]);
            dr2["FTeff"] = String.Format("{0:F2}", _curtsopp.PerGame[TAbbr.FTeff]);
            dr2["REB"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbr.RPG]);
            dr2["OREB"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbr.ORPG]);
            dr2["DREB"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbr.DRPG]);
            dr2["AST"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbr.APG]);
            dr2["TO"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbr.TPG]);
            dr2["STL"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbr.SPG]);
            dr2["BLK"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbr.BPG]);
            dr2["FOUL"] = String.Format("{0:F1}", _curtsopp.PerGame[TAbbr.FPG]);

            _dtOv.Rows.Add(dr2);

            #endregion

            #region Playoffs

            _dtOv.Rows.Add(_dtOv.NewRow());

            dr = _dtOv.NewRow();

            dr["Type"] = "Playoffs";
            dr["Games"] = _curts.GetPlayoffGames();
            dr["Wins (W%)"] = _curts.PlRecord[0].ToString();
            dr["Losses (Weff)"] = _curts.PlRecord[1].ToString();
            dr["PF"] = _curts.PlTotals[TAbbr.PF].ToString();
            dr["PA"] = _curts.PlTotals[TAbbr.PA].ToString();
            dr["PD"] = " ";
            dr["FG"] = _curts.PlTotals[TAbbr.FGM].ToString() + "-" + _curts.PlTotals[TAbbr.FGA].ToString();
            dr["3PT"] = _curts.PlTotals[TAbbr.TPM].ToString() + "-" + _curts.PlTotals[TAbbr.TPA].ToString();
            dr["FT"] = _curts.PlTotals[TAbbr.FTM].ToString() + "-" + _curts.PlTotals[TAbbr.FTA].ToString();
            dr["REB"] = (_curts.PlTotals[TAbbr.DREB] + _curts.PlTotals[TAbbr.OREB]).ToString();
            dr["OREB"] = _curts.PlTotals[TAbbr.OREB].ToString();
            dr["DREB"] = _curts.PlTotals[TAbbr.DREB].ToString();
            dr["AST"] = _curts.PlTotals[TAbbr.AST].ToString();
            dr["TO"] = _curts.PlTotals[TAbbr.TOS].ToString();
            dr["STL"] = _curts.PlTotals[TAbbr.STL].ToString();
            dr["BLK"] = _curts.PlTotals[TAbbr.BLK].ToString();
            dr["FOUL"] = _curts.PlTotals[TAbbr.FOUL].ToString();
            dr["MINS"] = _curts.PlTotals[TAbbr.MINS].ToString();

            _dtOv.Rows.Add(dr);

            dr = _dtOv.NewRow();

            dr["Type"] = "Pl Avg";
            dr["Wins (W%)"] = String.Format("{0:F3}", _curts.PlPerGame[TAbbr.Wp]);
            dr["Losses (Weff)"] = String.Format("{0:F2}", _curts.PlPerGame[TAbbr.Weff]);
            dr["PF"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbr.PPG]);
            dr["PA"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbr.PAPG]);
            dr["PD"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbr.PD]);
            dr["FG"] = String.Format("{0:F3}", _curts.PlPerGame[TAbbr.FGp]);
            dr["FGeff"] = String.Format("{0:F2}", _curts.PlPerGame[TAbbr.FGeff]);
            dr["3PT"] = String.Format("{0:F3}", _curts.PlPerGame[TAbbr.TPp]);
            dr["3Peff"] = String.Format("{0:F2}", _curts.PlPerGame[TAbbr.TPeff]);
            dr["FT"] = String.Format("{0:F3}", _curts.PlPerGame[TAbbr.FTp]);
            dr["FTeff"] = String.Format("{0:F2}", _curts.PlPerGame[TAbbr.FTeff]);
            dr["REB"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbr.RPG]);
            dr["OREB"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbr.ORPG]);
            dr["DREB"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbr.DRPG]);
            dr["AST"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbr.APG]);
            dr["TO"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbr.TPG]);
            dr["STL"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbr.SPG]);
            dr["BLK"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbr.BPG]);
            dr["FOUL"] = String.Format("{0:F1}", _curts.PlPerGame[TAbbr.FPG]);

            _dtOv.Rows.Add(dr);

            dr2 = _dtOv.NewRow();

            int count = _tst.Count(z => z.Value.GetPlayoffGames() > 0);

            dr2["Type"] = "Pl Rank";
            dr2["Wins (W%)"] = _playoffRankings.RankingsPerGame[id][TAbbr.Wp];
            dr2["Losses (Weff)"] = _playoffRankings.RankingsPerGame[id][TAbbr.Weff];
            dr2["PF"] = _playoffRankings.RankingsPerGame[id][TAbbr.PPG];
            dr2["PA"] = count + 1 - _playoffRankings.RankingsPerGame[id][TAbbr.PAPG];
            dr2["PD"] = _playoffRankings.RankingsPerGame[id][TAbbr.PD];
            dr2["FG"] = _playoffRankings.RankingsPerGame[id][TAbbr.FGp];
            dr2["FGeff"] = _playoffRankings.RankingsPerGame[id][TAbbr.FGeff];
            dr2["3PT"] = _playoffRankings.RankingsPerGame[id][TAbbr.TPp];
            dr2["3Peff"] = _playoffRankings.RankingsPerGame[id][TAbbr.TPeff];
            dr2["FT"] = _playoffRankings.RankingsPerGame[id][TAbbr.FTp];
            dr2["FTeff"] = _playoffRankings.RankingsPerGame[id][TAbbr.FTeff];
            dr2["REB"] = _playoffRankings.RankingsPerGame[id][TAbbr.RPG];
            dr2["OREB"] = _playoffRankings.RankingsPerGame[id][TAbbr.ORPG];
            dr2["DREB"] = _playoffRankings.RankingsPerGame[id][TAbbr.DRPG];
            dr2["AST"] = _playoffRankings.RankingsPerGame[id][TAbbr.APG];
            dr2["TO"] = count + 1 - _playoffRankings.RankingsPerGame[id][TAbbr.TPG];
            dr2["STL"] = _playoffRankings.RankingsPerGame[id][TAbbr.SPG];
            dr2["BLK"] = _playoffRankings.RankingsPerGame[id][TAbbr.BPG];
            dr2["FOUL"] = count + 1 - _playoffRankings.RankingsPerGame[id][TAbbr.FPG];

            _dtOv.Rows.Add(dr2);

            dr2 = _dtOv.NewRow();

            dr2["Type"] = "Opp Pl Stats";
            dr2["Games"] = _curtsopp.GetPlayoffGames();
            dr2["Wins (W%)"] = _curtsopp.PlRecord[0].ToString();
            dr2["Losses (Weff)"] = _curtsopp.PlRecord[1].ToString();
            dr2["PF"] = _curtsopp.PlTotals[TAbbr.PF].ToString();
            dr2["PA"] = _curtsopp.PlTotals[TAbbr.PA].ToString();
            dr2["PD"] = " ";
            dr2["FG"] = _curtsopp.PlTotals[TAbbr.FGM].ToString() + "-" + _curtsopp.PlTotals[TAbbr.FGA].ToString();
            dr2["3PT"] = _curtsopp.PlTotals[TAbbr.TPM].ToString() + "-" + _curtsopp.PlTotals[TAbbr.TPA].ToString();
            dr2["FT"] = _curtsopp.PlTotals[TAbbr.FTM].ToString() + "-" + _curtsopp.PlTotals[TAbbr.FTA].ToString();
            dr2["REB"] = (_curtsopp.PlTotals[TAbbr.DREB] + _curtsopp.PlTotals[TAbbr.OREB]).ToString();
            dr2["OREB"] = _curtsopp.PlTotals[TAbbr.OREB].ToString();
            dr2["DREB"] = _curtsopp.PlTotals[TAbbr.DREB].ToString();
            dr2["AST"] = _curtsopp.PlTotals[TAbbr.AST].ToString();
            dr2["TO"] = _curtsopp.PlTotals[TAbbr.TOS].ToString();
            dr2["STL"] = _curtsopp.PlTotals[TAbbr.STL].ToString();
            dr2["BLK"] = _curtsopp.PlTotals[TAbbr.BLK].ToString();
            dr2["FOUL"] = _curtsopp.PlTotals[TAbbr.FOUL].ToString();
            dr2["MINS"] = _curtsopp.PlTotals[TAbbr.MINS].ToString();

            _dtOv.Rows.Add(dr2);

            dr2 = _dtOv.NewRow();

            dr2["Type"] = "Opp Pl Avg";
            dr2["Wins (W%)"] = String.Format("{0:F3}", _curtsopp.PlPerGame[TAbbr.Wp]);
            dr2["Losses (Weff)"] = String.Format("{0:F2}", _curtsopp.PlPerGame[TAbbr.Weff]);
            dr2["PF"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbr.PPG]);
            dr2["PA"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbr.PAPG]);
            dr2["PD"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbr.PD]);
            dr2["FG"] = String.Format("{0:F3}", _curtsopp.PlPerGame[TAbbr.FGp]);
            dr2["FGeff"] = String.Format("{0:F2}", _curtsopp.PlPerGame[TAbbr.FGeff]);
            dr2["3PT"] = String.Format("{0:F3}", _curtsopp.PlPerGame[TAbbr.TPp]);
            dr2["3Peff"] = String.Format("{0:F2}", _curtsopp.PlPerGame[TAbbr.TPeff]);
            dr2["FT"] = String.Format("{0:F3}", _curtsopp.PlPerGame[TAbbr.FTp]);
            dr2["FTeff"] = String.Format("{0:F2}", _curtsopp.PlPerGame[TAbbr.FTeff]);
            dr2["REB"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbr.RPG]);
            dr2["OREB"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbr.ORPG]);
            dr2["DREB"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbr.DRPG]);
            dr2["AST"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbr.APG]);
            dr2["TO"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbr.TPG]);
            dr2["STL"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbr.SPG]);
            dr2["BLK"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbr.BPG]);
            dr2["FOUL"] = String.Format("{0:F1}", _curtsopp.PlPerGame[TAbbr.FPG]);

            _dtOv.Rows.Add(dr2);

            #endregion

            createViewAndUpdateOverview();

            dgvBoxScores.ItemsSource = _bsrList;

            #endregion
        }