Esempio 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);
        }
Esempio n. 2
0
        public void TestPmetricsGet()
        {
            var player = new NFLPlayer("MANNPE01");
             var week = new NFLWeek("2014", 1);
             var gameCode = week.GameCodeFor("DB");
             var dao = new DbfPlayerGameMetricsDao();
             var pgm = dao.GetPlayerWeek(gameCode, player.PlayerCode);

             Assert.IsTrue(pgm.ProjYDp.Equals(300));
        }
Esempio n. 3
0
 public void TestYahooScorerOnAPlayer()
 {
     var w = new NFLWeek( 2014, 8 );
      var scorer = new YahooScorer( w );
      var plyr = new NFLPlayer( "LACYED01" );
      var score = scorer.RatePlayer( plyr, w );
      Assert.IsTrue( score == 17.0M );
      var gameKey = w.GameCodeFor( plyr.TeamCode );
      var msg = plyr.MetricsOut(gameKey);
      Console.WriteLine( msg );
 }
Esempio n. 4
0
 public void TestYahooScorerOnBeckham()
 {
     var w = new NFLWeek(2015, 9);
      var scorer = new YahooScorer(w);
      var plyr = new NFLPlayer("BECKOD01");
      var score = scorer.RatePlayer(plyr, w);
      Assert.IsTrue(score > 0.0M);
      var gameKey = w.GameCodeFor(plyr.TeamCode);
      var msg = plyr.MetricsOut(gameKey);
      Console.WriteLine(msg);
 }
Esempio n. 5
0
 public void TestGameCodeGet()
 {
     var sut = new NFLWeek( "2014", 1 );
      var gameCode = sut.GameCodeFor("DB");
      Assert.IsTrue(gameCode.Equals("2014:01-N"));
 }