Esempio n. 1
0
 public void AddGame(NFLGame g)
 {
     if (! _gameHt.ContainsKey(g.GameKey()))
     {
         _gameHt.Add(g.GameKey(), g);
         IsDirty = true;
     }
 }
        public static int GameProjection(NFLGame g, string playerTeamCode, string playerCategory, string playerRole)
        {
            var projection = 0;
              if (playerRole != Constants.K_ROLE_STARTER) return projection;

            //  is a starter
              switch (playerCategory)
              {
              case Constants.K_QUARTERBACK_CAT:
                  projection = g.IsHome(playerTeamCode) ? g.ProjectedHomeTdp : g.ProjectedAwayTdp;
                  break;
              case Constants.K_RUNNINGBACK_CAT:
                  projection = g.IsHome(playerTeamCode) ? g.ProjectedHomeTdr : g.ProjectedAwayTdr;
                  break;
              case Constants.K_RECEIVER_CAT:
                  projection = g.IsHome(playerTeamCode) ? g.ProjectedHomeTdp/2 : g.ProjectedAwayTdp/2;
                  break;
              case Constants.K_KICKER_CAT:
                  projection = g.IsHome( playerTeamCode ) ? g.ProjectedHomeFg : g.ProjectedAwayFg;
                  break;
              }
            #if DEBUG
              Utility.Announce(string.Format("Game {0} projection for {1} {2} {3} is {4}",
              g.GameKey(), playerTeamCode, playerCategory, playerRole, projection ) );
            #endif
              return projection;
        }
        public string RecordMetrics(NFLPlayer player, NFLGame game)
        {
            var gameKey = game.GameKey();
             var pgm = Dao.Get(player.PlayerCode, gameKey );

             if (pgm.GameKey != null)
             {
            pgm.TDp = player.CurrentGameMetrics.TDp;
            pgm.TDr = player.CurrentGameMetrics.TDr;
            pgm.TDc = player.CurrentGameMetrics.TDc;
            pgm.YDp = player.CurrentGameMetrics.YDp;
            pgm.YDr = player.CurrentGameMetrics.YDr;
            pgm.YDc = player.CurrentGameMetrics.YDc;
            pgm.FG = player.CurrentGameMetrics.FG;
            pgm.Pat = player.CurrentGameMetrics.Pat;

            Dao.Save(pgm);
            return string.Format("Game:{0} Player:{1} metrics:{2}", game.GameName(), player.PlayerName, pgm );
             }
             else
            return string.Format("Failed to find pgm for {0}:{1}", game.GameName(), player.PlayerName);
        }