/// <summary>Calculates the metrics of a player's performance.</summary>
        /// <param name="bs">The game's box score from which to calculate the metrics.</param>
        public void CalcMetrics(TeamBoxScore bs)
        {
            var ts    = new TeamStats(TeamID);
            var tsopp = new TeamStats(OppTeamID);

            var team1ID = bs.Team1ID;

            if (TeamID == team1ID)
            {
                TeamStats.AddTeamStatsFromBoxScore(bs, ref ts, ref tsopp);
            }
            else
            {
                TeamStats.AddTeamStatsFromBoxScore(bs, ref tsopp, ref ts);
            }

            var ps = new PlayerStats {
                ID = PlayerID
            };

            ps.AddBoxScore(this, bs.IsPlayoff);
            ps.CalcMetrics(ts, tsopp, new TeamStats(-1), GmScOnly: true);

            GmSc  = ps.Metrics["GmSc"];
            GmScE = ps.Metrics["GmScE"];
        }
        /// <summary>Calculates the metrics of a player's performance.</summary>
        /// <param name="r">
        ///     The SQLite DataRow containing the player's box score. Should be the result of an INNER JOIN'ed query between
        ///     PlayerResults and GameResults.
        /// </param>
        public void CalcMetrics(DataRow r)
        {
            var bs = new TeamBoxScore(r, null);

            var ts    = new TeamStats(TeamID);
            var tsopp = new TeamStats(OppTeamID);

            var team1ID = ParseCell.GetInt32(r, "Team1ID");
            var team2ID = ParseCell.GetInt32(r, "Team2ID");

            if (TeamID == team1ID)
            {
                TeamStats.AddTeamStatsFromBoxScore(bs, ref ts, ref tsopp);
            }
            else
            {
                TeamStats.AddTeamStatsFromBoxScore(bs, ref tsopp, ref ts);
            }

            var ps = new PlayerStats {
                ID = PlayerID
            };

            ps.AddBoxScore(this, bs.IsPlayoff);
            ps.CalcMetrics(ts, tsopp, new TeamStats(-1), GmScOnly: true);

            GmSc  = ps.Metrics["GmSc"];
            GmScE = ps.Metrics["GmScE"];
        }
        /// <summary>Prepares the presentation fields of the class.</summary>
        /// <param name="teamID">The team.</param>
        public void PrepareForDisplay(Dictionary <int, TeamStats> tst, int teamID)
        {
            FGp1  = (float)FGM1 / FGA1;
            TPp1  = (float)TPM1 / TPA1;
            FTp1  = (float)FTM1 / FTA1;
            FGp2  = (float)FGM2 / FGA2;
            TPp2  = (float)TPM2 / TPA2;
            FTp2  = (float)FTM2 / FTA2;
            DREB1 = (ushort)(REB1 - OREB1);
            DREB2 = (ushort)(REB2 - OREB2);
            if (teamID == Team1ID)
            {
                DisplayTeam     = tst[Team1ID].DisplayName;
                DisplayOpponent = tst[Team2ID].DisplayName;
                DisplayLocation = "Away";
                DisplayResult   = PTS1 > PTS2 ? "W " : "L ";
                DisplayREB      = REB1;
                DisplayOREB     = OREB1;
                DisplayAST      = AST1;
                DisplayTO       = TOS1;
                DisplayBLK      = BLK1;
                DisplaySTL      = STL1;
                DisplayFOUL     = FOUL1;
                FGp             = FGp1;
                TPp             = TPp1;
                FTp             = FTp1;

                var temp    = new TeamStats();
                var tempopp = new TeamStats();
                TeamStats.AddTeamStatsFromBoxScore(this, ref temp, ref tempopp);
                temp.CalcMetrics(tempopp);
                tempopp.CalcMetrics(temp);

                DisplayGmSc = temp.Metrics["GmSc"];
                GmSc1       = temp.Metrics["GmSc"];
                GmSc2       = tempopp.Metrics["GmSc"];
            }
            else
            {
                DisplayTeam     = tst[Team2ID].DisplayName;
                DisplayOpponent = tst[Team1ID].DisplayName;
                DisplayLocation = "Home";
                DisplayResult   = PTS1 < PTS2 ? "W " : "L ";
                DisplayREB      = REB2;
                DisplayOREB     = OREB2;
                DisplayAST      = AST2;
                DisplayTO       = TOS2;
                DisplayBLK      = BLK2;
                DisplaySTL      = STL2;
                DisplayFOUL     = FOUL2;
                FGp             = FGp2;
                TPp             = TPp2;
                FTp             = FTp2;

                var temp    = new TeamStats();
                var tempopp = new TeamStats();
                TeamStats.AddTeamStatsFromBoxScore(this, ref tempopp, ref temp);
                temp.CalcMetrics(tempopp);
                tempopp.CalcMetrics(temp);

                DisplayGmSc = temp.Metrics["GmSc"];
                GmSc2       = temp.Metrics["GmSc"];
                GmSc1       = tempopp.Metrics["GmSc"];
            }
            DisplayResult += PTS1 + "-" + PTS2;
        }