Exemplo n.º 1
0
        private decimal PointsFor(NFLPlayer plyr, int increment, string forScoreType, string id)
        {
            // nScores could be TDs, FGs or PATs
            decimal nScores = 0M;

            if (Week.HasPassed())
            {
                var ds = plyr.LastScores(forScoreType, Week.WeekNo, Week.WeekNo, Week.Season, id);
                nScores = ds.Tables[0].Rows.Count;
            }
            else
            {
                var dao      = new DbfPlayerGameMetricsDao();
                var gameCode = Week.GameCodeFor(plyr.TeamCode);
                if (!string.IsNullOrEmpty(gameCode))
                {
                    var pgm = dao.GetPlayerWeek(gameCode, plyr.PlayerCode);
                    nScores = pgm.ProjectedScoresOfType(forScoreType, id);
                }
            }
            decimal points = nScores * increment;

            switch (forScoreType)
            {
            case Constants.K_SCORE_TD_PASS:
                if (plyr.PlayerCat.Equals(Constants.K_QUARTERBACK_CAT) && (id == "2"))
                {
                    plyr.ProjectedTDp = nScores;
                    PointsLine("Tdp", plyr.PlayerNameShort, points);
                }
                else
                {
                    plyr.ProjectedTDc = nScores;
                    PointsLine("TDc", plyr.PlayerNameShort, points);
                }
                break;

            case Constants.K_SCORE_TD_RUN:
                PointsLine("Tdr", plyr.PlayerNameShort, points);
                plyr.ProjectedTDr = nScores;
                break;

            case Constants.K_SCORE_FIELD_GOAL:
                PointsLine("FG ", plyr.PlayerNameShort, points);
                plyr.ProjectedFg = ( int )nScores;
                break;

            case Constants.K_SCORE_PAT:
                break;

            default:
                Utility.Announce(string.Format("GS4Scorer: Unknown score type {0}", forScoreType));
                break;
            }
#if DEBUG
            Utility.Announce($"{plyr.PlayerNameShort} gets {points} for score type {Utility.ScoreTypeOut( forScoreType )}");
#endif
            return(points);
        }
Exemplo n.º 2
0
        public void Calculate( string season, string week )
        {
            var theWeek = new NFLWeek( season, week );
             if (!theWeek.HasPassed()) return;

            theWeek.LoadGameList();
            foreach ( var nflStat in theWeek.GameList().Cast<NFLGame>()
                .Select( game => game.GenerateStats() ).SelectMany( statList => statList ) )
                PutStat( nflStat );
        }
Exemplo n.º 3
0
        public void Calculate(string season, string week)
        {
            var theWeek = new NFLWeek(season, week);

            if (!theWeek.HasPassed())
            {
                return;
            }

            theWeek.LoadGameList();
            foreach (var nflStat in theWeek.GameList().Cast <NFLGame>()
                     .Select(game => game.GenerateStats()).SelectMany(statList => statList))
            {
                PutStat(nflStat);
            }
        }
Exemplo n.º 4
0
        public string RenderBets(ArrayList betList, bool showResults, bool persist)
        {
            RosterLib.Utility.Announce("Producing Best Bets");

            string resultsSuffix = String.Empty;

            if (theWeek.HasPassed())
            {
                resultsSuffix = "-results";
            }

            DataTable         dt = LoadBets(betList);
            SimpleTableReport st =
                new SimpleTableReport("Best Bets Week " + Week + ":" + Season, Footer(showResults));

            st.ColumnHeadings = true;
            st.AddColumn(new ReportColumn("Team", "TEAM", "{0,-20}"));
            st.AddColumn(new ReportColumn("H/A", "TURF", "{0}"));
            st.AddColumn(new ReportColumn("Opp", "OPPONENT", "{0,-20}"));
            st.AddColumn(new ReportColumn("Spread", "SPREAD", "{0}"));
            st.AddColumn(new ReportColumn("Date (au)", "DATE", "{0}"));
            st.AddColumn(new ReportColumn("Time (au)", "TIME", "{0}"));
            st.AddColumn(new ReportColumn("Reason(s)", "REASONS", "{0}"));
            st.AddColumn(new ReportColumn("Amount", "AMOUNT", "{0}"));
            st.AddColumn(new ReportColumn("Result", "RESULT", "{0}"));
            st.AddColumn(new ReportColumn("Return", "WINNINGS", "{0}"));

            dt.DefaultView.Sort = "GAMECODE ASC";
            st.LoadBody(dt);
            st.CarryRow        = false;
            st.ShowElapsedTime = false;
            string betHTML = st.RenderAsHtml(
                string.Format("{0}bets//BestBets Week {1:0#} {2}{3}.htm",
                              Utility.OutputDirectory(), Int32.Parse(Week), Utility.CurrentSeason(), resultsSuffix), persist);

            return(betHTML);
        }
Exemplo n.º 5
0
 public void TestWeekHasPassed()
 {
     var sut = new NFLWeek("2014", 1);
      Assert.IsFalse(sut.HasPassed());
 }