Exemplo n.º 1
0
 // Validate user connection
 private void btnConnexion_Click(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     try
     {
         _compte = _gestionCompteJoueur.ConnexionCompteJoueur(txtNomJoueur.Text, txtMotDePasse.Text);
         if (_compte.Id > 0 && _compte.TypeUtilisateur == 0)
         {
             DialogResult = DialogResult.OK;
         }
         else
         {
             lblEchec.Text = "Connexion failed : attempt # " + ++_tentative;
             txtMotDePasse.Clear();
         }
         Cursor.Current = Cursors.Default;
     }
     catch (Exception)
     {
         // Advice user that the editor can't connect to the server and close editor.
         Cursor.Current = Cursors.Default;
         DialogResult mboxEchecConntivité = MessageBox.Show("Can't connect to the database.\r\nCheck your connexion to the server and try again!", "Can't reach server!");
         if (mboxEchecConntivité == DialogResult.OK)
         {
             DialogResult = DialogResult.Cancel;
         }
     }
 }
Exemplo n.º 2
0
        // Load users list
        private void ShowUsers()
        {
            _gestionCompteJoueur.RafraichirComptes();
            for (int i = 0; i < _gestionCompteJoueur.LstComptes.Count; i++)
            {
                HugoLand.CompteJoueur compte = _gestionCompteJoueur.LstComptes[i];

                if (compte.Connexion == false)
                {
                    dtgUsers.Rows.Add(compte.Id, compte.NomJoueur, Enum.GetName(typeof(Constantes.Role), compte.TypeUtilisateur), Properties.Resources.red);
                }
                else
                {
                    dtgUsers.Rows.Add(compte.Id, compte.NomJoueur, Enum.GetName(typeof(Constantes.Role), compte.TypeUtilisateur), Properties.Resources.green);
                }
            }
            _loaded = true;
        }