Exemple #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);
        }
Exemple #2
0
        private string GenerateBody()
        {
            var bodyOut = new StringBuilder();

            var ds = Utility.TflWs.GetTeams(Utility.CurrentSeason());
            var dt = ds.Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                var theKey     = dr["TEAMID"].ToString();
                var team       = new NflTeam(theKey);
                var inPlayoffs = false;
                Logger.Info($"{theKey} : {team.NameOut()} : {team.Clip()}");
                if (team.Above500())
                {
                    bodyOut.AppendLine($"{team.NameOut(),-25} {team.RecordOut()}");
                    inPlayoffs = true;
                }
                Utility.TflWs.UpdatePlayoff(team.Season, team.TeamCode, inPlayoffs);
            }

            return(bodyOut.ToString());
        }
Exemple #3
0
        public void PoSnippet(NflTeam t)
        {
            FileOut = $"{RootPath(t.Season)}\\PassOff\\PO-{t.TeamCode}.htm";
            var h = new HtmlFile(
                FileOut,
                $@" {t.NameOut()} Passing Unit as of {DateTime.Now.ToString("dd MMM yy")}  Week {
				 Utility.CurrentWeek()
				 }"                );

            h.AddToBody(
                HeaderPo(t));
            h.AddToBody(
                t.PoReport());
            h.Render();
        }
        private string GenerateBody()
        {
            var bodyOut = new StringBuilder();

             var ds = Utility.TflWs.GetTeams(Utility.CurrentSeason());
             var dt = ds.Tables[0];
             foreach (DataRow dr in dt.Rows)
             {
            var theKey = dr["TEAMID"].ToString();
            var team = new NflTeam(theKey);
            var inPlayoffs = false;
            if (team.WinningRecord())
            {
               bodyOut.AppendLine(string.Format("{0,-25} {1}", team.NameOut(), team.RecordOut()));
               inPlayoffs = true;
            }
            Utility.TflWs.UpdatePlayoff(team.Season, team.TeamCode, inPlayoffs);
             }

             return bodyOut.ToString();
        }
Exemple #5
0
 private static string HeaderPp(NflTeam t)
 {
     return(HtmlLib.H2($"Pass Protection Unit for {t.NameOut()}"));
 }
Exemple #6
0
 private static string HeaderRo(NflTeam t)
 {
     return(HtmlLib.H2($"Rushing Unit for {t.NameOut()}"));
 }
Exemple #7
0
 private static string Header(NflTeam t)
 {
     return(HtmlLib.H2(string.Format("Unit Reports for {0} as of {1}",
                                     t.NameOut(), DateTime.Now.ToString("ddd dd MMM yy hh:mm"))
                       ));
 }
Exemple #8
0
        public void PdSnippet(NflTeam t)
        {
            FileOut = string.Format("{0}\\PassDef\\PD-{1}.htm", RootPath(t.Season), t.TeamCode);
            var h = new HtmlFile(FileOut,
                                 string.Format(" {2} Pass Defense Unit as of {0}  Week {1}",
                                               DateTime.Now.ToString("dd MMM yy"), Utility.CurrentWeek(), t.NameOut()));

            h.AddToBody(HeaderPd(t));
            h.AddToBody(t.PdReport());
            h.Render();
        }
Exemple #9
0
        public void RoSnippet(NflTeam t)
        {
            FileOut = string.Format("{0}\\RunOff\\RO-{1}.htm", RootPath(t.Season), t.TeamCode);
            var h = new HtmlFile(FileOut,
                                 string.Format(" {2} Rushing Unit as of {0}  Week {1}",
                                               DateTime.Now.ToString("dd MMM yy"), Utility.CurrentWeek(), t.NameOut()));

            h.AddToBody(HeaderRo(t));
            h.AddToBody(t.RoReport());
            h.Render();
        }
Exemple #10
0
 private static string HeaderPd(NflTeam t)
 {
     return(HtmlLib.H2($"Pass Defense Unit for {t.NameOut()}"));
 }
Exemple #11
0
 private static string HeaderPr(NflTeam t)
 {
     return(HtmlLib.H2($"Pass Rush Unit for {t.NameOut()}"));
 }
Exemple #12
0
 private static string Header(NflTeam t)
 {
     return(HtmlLib.H2(string.Format("Free Agents for {0}", t.NameOut())));
 }
 private static string HeaderPd(NflTeam t)
 {
     return(HtmlLib.H2(string.Format("Pass Defense Unit for {0}", t.NameOut())));
 }
 private static string HeaderPp(NflTeam t)
 {
     return(HtmlLib.H2(string.Format("Pass Protection Unit for {0}", t.NameOut())));
 }
 private static string HeaderRo(NflTeam t)
 {
     return(HtmlLib.H2(string.Format("Rushing Unit for {0}", t.NameOut())));
 }