private static mGame dataGame(DataTable list) { String Player1name = ""; String Player2name = ""; int Player1id = -1; int Player2id = -1; mGame game=null; for (int i = 0; i < list.Rows.Count; i++) { var row = list.Rows[i]; Player1id = Int16.Parse(row["IdUser1_"].ToString()); var value = row["IdUser2_"]; if (value != DBNull.Value) Player2id = Int16.Parse(row["IdUser2_"].ToString()); if (Player1id > 0) Player1name = Uta.Username(Player1id); if (Player2id > 0) Player2name = Uta.Username(Player2id); game = new mGame(Int16.Parse(row["IdGame"].ToString()), Player1id, Player2id); game.Player1name = Player1name; game.Player2name = Player2name; } return game; }
public static mGame newGame(int player) { mGame game; mChecker checker=newChecker(); var idGame=Gta.NewGame(checker.getId(), player); if (idGame != null) { game = new mGame(Decimal.ToInt16((decimal)idGame), player, checker); } else return null; return game; }