public string GetIndividualStats(string individual) { string result = null; if (nhlStats != null) { individual = nhlStats.GetGoalieNameAlias(individual); individual = nhlStats.GetPlayerNameAlias(individual); } JackedStatsSet.PlayerStatsRow statsRow; JackedStatsSet.PlayersRow[] rows = (JackedStatsSet.PlayersRow[])stats.Players.Select(String.Format("Name LIKE '%{0}%'", individual)); if (rows.Length > 0) { if (rows[0].GetChildRows("PlayerStats_Players").Length > 0) { statsRow = (JackedStatsSet.PlayerStatsRow)rows[0].GetChildRows("PlayerStats_Players")[0]; if (statsRow != null) { if (rows[0].Position.CompareTo("Goaltender") == 0) { if (!statsRow.IsSavePercentNull() && !statsRow.IsSavesNull() && !statsRow.IsShotsFacedNull()) { result = string.Format("[{0}/{1}] {2} [Shots:{3}] [Saves:{4}] [Save %:{5}]", NHLGame.FixCase(homeTeamName), NHLGame.FixCase(awayTeamName), rows[0].Name, statsRow.ShotsFaced, statsRow.Saves, statsRow.SavePercent); } else { result = string.Format("No game stats available for {0}", rows[0].Name); } } else { result = string.Format("[{0}/{1}] {2} [Goals:{3}] [Assists:{4}] [Shots: {9}] [Hits:{5}] " + "[+/-:{6}] [PIM:{7}] [FOW:{8}]", NHLGame.FixCase(homeTeamName), NHLGame.FixCase(awayTeamName), rows[0].Name, statsRow.Goals, statsRow.Assists, statsRow.Hits, statsRow.PlusMinus, statsRow.PIM, statsRow.FOW, statsRow.SOG); } } else { result = string.Format("No game stats available yet for {0}", rows[0].Name); } } else { result = string.Format("No game stats available yet for {0}", rows[0].Name); } } return(result); }
public string GetGameStats() { string result; string topGoalsPlayer = String.Empty, topAssistsPlayer = String.Empty, topHitsPlayer = String.Empty, topPlusMinusPlayer = String.Empty, botPlusMinusPlayer = String.Empty, topPIMPlayer = String.Empty, topFOWPlayer = String.Empty, topSOGPlayer = String.Empty; int topGoals = 0, topAssists = 0, topHits = 0, topPlusMinus = 0, botPlusMinus = 0, topPIM = 0, topFOW = 0, topSOG = 0; lock (stats) { GetInfoForStat(ref topGoalsPlayer, ref topGoals, stats.PlayerStats.GoalsColumn, true); GetInfoForStat(ref topAssistsPlayer, ref topAssists, stats.PlayerStats.AssistsColumn, true); GetInfoForStat(ref topHitsPlayer, ref topHits, stats.PlayerStats.HitsColumn, true); GetInfoForStat(ref topPlusMinusPlayer, ref topPlusMinus, stats.PlayerStats.PlusMinusColumn, true); GetInfoForStat(ref botPlusMinusPlayer, ref botPlusMinus, stats.PlayerStats.PlusMinusColumn, false); GetInfoForStat(ref topPIMPlayer, ref topPIM, stats.PlayerStats.PIMColumn, true); GetInfoForStat(ref topFOWPlayer, ref topFOW, stats.PlayerStats.FOWColumn, true); GetInfoForStat(ref topSOGPlayer, ref topSOG, stats.PlayerStats.SOGColumn, true); } result = String.Format("[{0}/{1}] [Most Goals: {2}] [Most Assists: {3}] [Most SOG: {9}] [Most Hits: {4}] " + "[Top +/-: {5}] [Bot +/-: {6}] [Most PIM: {7}] [Most FOW: {8}]", NHLGame.FixCase(homeTeamName), NHLGame.FixCase(awayTeamName), topGoals == 0 ? "--" : String.Format("{0}, {1}", topGoalsPlayer, topGoals), topAssists == 0 ? "--" : String.Format("{0}, {1}", topAssistsPlayer, topAssists), topHits == 0 ? "--" : String.Format("{0}, {1}", topHitsPlayer, topHits), topPlusMinus == 0 ? "--" : String.Format("{0}, {1}", topPlusMinusPlayer, topPlusMinus), botPlusMinus == 0 ? "--" : String.Format("{0}, {1}", botPlusMinusPlayer, botPlusMinus), topPIM == 0 ? "--" : String.Format("{0}, {1}", topPIMPlayer, topPIM), topFOW == 0 ? "--" : String.Format("{0}, {1}", topFOWPlayer, topFOW), topSOG == 0 ? "--" : String.Format("{0}, {1}", topSOGPlayer, topSOG)); return(result); }