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 void AddPlayerLineWithPlayer( DataTable dt, bool freeAgent, NFLPlayer p, [Optional] int slotNumber) { if (!NotUsed(p) || !IsAvailable(p)) { return; } NFLGame game = null; if (p.CurrTeam != null) { game = p.CurrTeam.GameFor(Season, Week); } var dr = dt.NewRow(); if (freeAgent) { dr["SLOT"] = "999"; } else { if (slotNumber > 0) { dr["SLOT"] = string.Format("{0:00}", slotNumber); } else { dr["SLOT"] = "Bench"; } } if ((p.CurrTeam != null) && (game != null)) { var opponent = p.CurrTeam.OpponentFor(Season, Week); // player actually available dr["PLAYER"] = p.Url(p.PlayerName, forceReport: false); dr["TEAM"] = p.CurrTeam.TeamCode; dr["ROLE"] = p.PlayerRole; dr["POS"] = p.PlayerPos; dr["PTS"] = RankPoints(p, game, opponent); dr["GAME"] = $"{game.GameDay()} {game.Hour} {game.OpponentOut( p.CurrTeam.TeamCode )}"; dr["SPREAD"] = game.GetSpread(); dr["TOTAL"] = game.Total; if (opponent != null) { dr["OPPRATE"] = opponent.Ratings; } if (game.Played()) { dr["ACTUAL"] = ActualPoints(p); } _usedPlayers.Add(p); } dt.Rows.Add(dr); }