Пример #1
0
 private void AddPickup(NFLPlayer p, NFLGame g)
 {
     p.LoadOwner(Constants.K_LEAGUE_Yahoo);
     if (p.IsFreeAgent() || p.Owner == "77")
     {
         var prevPts = p.Points;  // so we dont lose Points value
         var pu      = new Pickup
         {
             Season       = Season,
             Player       = p,
             Name         = $"{p.PlayerNameTo( 20 )} ({p.TeamCode}) {p.PlayerPos,-10}",
             Opp          = $"{g.OpponentOut( p.TeamCode )}",
             ProjPts      = p.Points,
             CategoryCode = p.PlayerCat,
             Pos          = p.PlayerPos,
             ActualPts    = ActualOutput(g, p)
         };
         p.Points = prevPts;
         if (p.Owner == "77")
         {
             pu.Name = pu.Name.ToUpper();
         }
         PickupSummary.AddPickup(pu);
         if (PlayerReports)
         {
             p.PlayerReport(forceIt: true);
         }
     }
 }
Пример #2
0
 private void AddPickupForLeague(
     NFLPlayer p,
     NFLGame g,
     string leagueId,
     string prefix,
     string suffix)
 {
     p.LoadOwner(leagueId);
     if (p.IsFreeAgent() || OwnedBySteve(p, leagueId))
     {
         var prevPts = p.Points;                  // so we dont lose Points value
         var pu      = new Pickup
         {
             LeagueId     = leagueId,
             Owner        = p.Owner,
             Season       = Season,
             Player       = p,
             Prefix       = prefix,
             Suffix       = suffix,
             Name         = $"{p.PlayerNameTo(20)} ({p.TeamCode}) {p.PlayerPos,-10}",
             Opp          = $"{g.OpponentOut(p.TeamCode)}",
             ProjPts      = p.Points,
             CategoryCode = p.PlayerCat,
             Pos          = p.PlayerPos,
             ActualPts    = ActualOutput(g, p, null)
         };
         p.Points = prevPts;
         if (p.Owner == "77")
         {
             pu.Name = pu.Name.ToUpper();
         }
         PickupSummary.AddPickup(pu);
         if (PlayerReports)
         {
             p.PlayerReport(forceIt: true);
         }
     }
 }
Пример #3
0
        private DataTable BuildTable()
        {
            var dt   = new DataTable();
            var cols = dt.Columns;

            cols.Add("SLOT", typeof(String));
            cols.Add("PLAYER", typeof(String));
            cols.Add("TEAM", typeof(String));
            cols.Add("FTEAM", typeof(String));
            cols.Add("POS", typeof(String));
            cols.Add("PTS", typeof(Int16));
            cols.Add("UNIT", typeof(String));
            cols.Add("ROLE", typeof(String));
            cols.Add("GAME", typeof(String));
            cols.Add("OPPRATE", typeof(String));
            cols.Add("SPREAD", typeof(Decimal));
            cols.Add("TOTAL", typeof(Decimal));
            cols.Add("BOOKIE", typeof(String));
            cols.Add("ACTUAL", typeof(Int16));

            PgmList = PgmDao.GetWeek(Season, Week);
            var week = Scorer.Week;

            foreach (var pgm in PgmList)
            {
                var p = new NFLPlayer(pgm.PlayerId);

                if (!string.IsNullOrEmpty(TeamFilter))
                {
                    if (p.TeamCode != TeamFilter)
                    {
                        continue;
                    }
                }

                if (!string.IsNullOrEmpty(CategoryFilter))
                {
                    if (p.PlayerCat != CategoryFilter)
                    {
                        continue;
                    }
                }

                p.LoadOwner(League);
                var dr = dt.NewRow();

                var game = new NFLGame(pgm.GameKey);
                p.LoadProjections(pgm);

                var opponent = p.CurrTeam.OpponentFor(Season, Int32.Parse(Week));
                //  player actually available
                dr["PLAYER"] = p.Url(p.PlayerName, forceReport: false);
                dr["TEAM"]   = p.CurrTeam.TeamCode;
                dr["FTEAM"]  = p.Owner;
                dr["ROLE"]   = p.PlayerRole;
                dr["POS"]    = p.PlayerPos;

                dr["PTS"]  = Scorer.RatePlayer(p, week);
                dr["UNIT"] = game.ProjectionLink();
                dr["GAME"] = string.Format("{0} {1} {2}",
                                           game.GameDay(), game.Hour, game.OpponentOut(p.CurrTeam.TeamCode));
                dr["SPREAD"] = game.GetSpread();
                dr["TOTAL"]  = game.Total;
                game.CalculateSpreadResult();
                dr["BOOKIE"] = game.BookieTip.PredictedScore();

                if (opponent != null)
                {
                    dr["OPPRATE"] = opponent.Ratings;
                }

                //if ( game.Played() )
                //	dr[ "ACTUAL" ] = ActualPoints( p );
                dt.Rows.Add(dr);
            }
            dt.DefaultView.Sort = "PTS DESC";
            return(dt);
        }
        private DataTable BuildTable()
        {
            var dt = new DataTable();
             var cols = dt.Columns;
             cols.Add( "SLOT", typeof( String ) );
             cols.Add( "PLAYER", typeof( String ) );
             cols.Add( "TEAM", typeof( String ) );
             cols.Add( "FTEAM", typeof( String ) );
             cols.Add( "POS", typeof( String ) );
             cols.Add( "PTS", typeof( Int16 ) );
             cols.Add( "UNIT", typeof( String ) );
             cols.Add( "ROLE", typeof( String ) );
             cols.Add( "GAME", typeof( String ) );
             cols.Add( "OPPRATE", typeof( String ) );
             cols.Add( "SPREAD", typeof( Decimal ) );
             cols.Add( "TOTAL", typeof( Decimal ) );
             cols.Add( "BOOKIE", typeof( String ) );
             cols.Add( "ACTUAL", typeof( Int16 ) );

             PgmList = PgmDao.GetWeek( Season, Week );
             var week = Scorer.Week;

             foreach ( var pgm in PgmList )
             {
            var p = new NFLPlayer( pgm.PlayerId );

            if ( !string.IsNullOrEmpty( TeamFilter ) )
            {
               if ( p.TeamCode != TeamFilter )
                  continue;
            }

            if ( !string.IsNullOrEmpty( CategoryFilter ) )
            {
               if ( p.PlayerCat != CategoryFilter )
                  continue;
            }

            p.LoadOwner( League );
            var dr = dt.NewRow();

            var game = new NFLGame( pgm.GameKey );
            p.LoadProjections( pgm );

            var opponent = p.CurrTeam.OpponentFor( Season, Int32.Parse( Week ) );
            //  player actually available
            dr[ "PLAYER" ] = p.Url( p.PlayerName, forceReport: false );
            dr[ "TEAM" ] = p.CurrTeam.TeamCode;
            dr[ "FTEAM" ] = p.Owner;
            dr[ "ROLE" ] = p.PlayerRole;
            dr[ "POS" ] = p.PlayerPos;

            dr[ "PTS" ] = Scorer.RatePlayer( p, week );
            dr[ "UNIT" ] = game.ProjectionLink();
            dr[ "GAME" ] = string.Format( "{0} {1} {2}",
                                       game.GameDay(), game.Hour, game.OpponentOut( p.CurrTeam.TeamCode ) );
            dr[ "SPREAD" ] = game.GetSpread();
            dr[ "TOTAL" ] = game.Total;
            game.CalculateSpreadResult();
            dr[ "BOOKIE" ] = game.BookieTip.PredictedScore();

            if ( opponent != null )
               dr[ "OPPRATE" ] = opponent.Ratings;

            //if ( game.Played() )
            //	dr[ "ACTUAL" ] = ActualPoints( p );
            dt.Rows.Add( dr );
             }
             dt.DefaultView.Sort = "PTS DESC";
             return dt;
        }