Esempio n. 1
0
        private void CalculateFpts(NflTeam team)
        {
            // Process Stats and Scores for the week
            // save the calculations
            var ds = Utility.TflWs.GameForTeam(Season, Week, team.TeamCode);

            if (ds.Tables[0].Rows.Count != 1)
            {
                return;
            }

            DataRow teamRow = Data.NewRow();

            teamRow["TEAM"]  = team.NameOut();
            teamRow["TOTAL"] = 0;
            teamRow["SCORE"] = 0;
            var game = new NFLGame(ds.Tables[0].Rows[0]);

            teamRow["RESULT"] = game.ResultFor(team.TeamCode, abbreviate: true, barIt: false);
            teamRow["SCORE"]  = game.ScoreFor(team);

            List <NFLPlayer> playerList = new List <NFLPlayer>();

            if (game.IsAway(team.TeamCode))
            {
                playerList = game.LoadAllFantasyAwayPlayers();
            }
            else
            {
                playerList = game.LoadAllFantasyHomePlayers();
            }

            var totPts = 0.0M;
            var qbPts  = 0.0M;
            var rbPts  = 0.0M;
            var wrPts  = 0.0M;
            var tePts  = 0.0M;
            var pkPts  = 0.0M;
            var week   = new NFLWeek(Season, Week);

            TallyPts(playerList, ref totPts, ref qbPts, ref rbPts, ref wrPts, ref tePts, ref pkPts, week);

            teamRow["TOTAL"] = totPts;
            teamRow["QB"]    = qbPts;
            teamRow["RB"]    = rbPts;
            teamRow["WR"]    = wrPts;
            teamRow["TE"]    = tePts;
            teamRow["PK"]    = pkPts;
            teamRow["DEF"]   = game.DefensiveFantasyPtsFor(team.TeamCode);

            Data.Rows.Add(teamRow);
        }