public static bool CreatePlayer(string nickname)
        {
            var dt = ArkanoidDBcn.ExecuteQuery($"SELECT * FROM PLAYER WHERE nickname = '{nickname}' ");

            if (dt.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                ArkanoidDBcn.ExecuteNonquery("INSERT INTO PLAYER(nickname) VALUES " +
                                             $"('{nickname}')");
                return(false);
            }
        }
Ejemplo n.º 2
0
        //obteniendo el ID del jugador
        private void GettingScore()
        {
            string query = $"SELECT idPlayer FROM PLAYER WHERE nickname = '{_gn.CurrentPlayer.Nickname}'";

            var dt       = ArkanoidDBcn.ExecuteQuery(query);
            var dr       = dt.Rows[0];
            var idPlayer = Convert.ToInt32(dr[0].ToString());

            ArkanoidDBcn.ExecuteNonquery("INSERT INTO SCORE(idPlayer,score) VALUES " +
                                         $"({idPlayer},{GameData.score})");

            if (MessageBox.Show($"Su puntuación de {GameData.score}, se ha registrado correctamente",
                                "Arkanoid message", MessageBoxButtons.OK) == DialogResult.OK)
            {
                FrmMainMenu menu = new FrmMainMenu();
                menu.Show();
                Dispose();
            }
        }