public void CountFaPoints(string seasonIn) { // Load the moves for the team from the start of the year to the beginning of the season const int nMoves = 0; var ds = Utility.TflWs.MovesDs(TeamCode, DateTime.Parse("01/01/" + seasonIn), DateTime.Parse("01/09/" + seasonIn)); // Process each move var dt = ds.Tables["SERVE"]; foreach (DataRow dr in dt.Rows) { if (dr.RowState != DataRowState.Deleted) { //nMoves++; var playerId = dr["PLAYERID"].ToString(); var plyr = new NFLPlayer(playerId); if (plyr.PlayerCat != null) { string moveType; if (MoveOut(dr["TO"].ToString())) { moveType = "out"; FaPoints -= plyr.Value(); PlayersLost += FormatPlayer(plyr) + "<br>"; PlayersOut++; } else { moveType = "in "; FaPoints += plyr.Value(); PlayersGot += FormatPlayer(plyr) + "<br>"; PlayersIn++; } Utility.Announce( string.Format("Player {0,-20} {7,-6} {6} From {1} To {2} {3,-15} POINTS = {4,3} TOTAL = {5,4}", plyr.PlayerName, dr["FROM"].ToString().Substring(0, 10), dr["TO"].ToString().Substring(0, 10), dr["HOW"].ToString().Trim(), plyr.Value(), FaPoints, moveType, plyr.PlayerPos)); } } } Utility.Announce(string.Format(" {0} moves processed for {1} IN:{2,3} OUT:{3,3}={4,4}", nMoves, Name, PlayersIn, PlayersOut, PlayersIn - PlayersOut)); }
private static string FormatPlayer(NFLPlayer plyr) { return string.Format("{0},{1}{2}", plyr.PlayerName, plyr.PlayerPos.Trim(), string.Format("{0,4}", plyr.Value())); }