1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
| private void button1_Click(object sender, EventArgs e)
{
m_ErreurLogin.Dispose();
m_ErreurPwd.Dispose();
int m_IntCompteur = 0;
int x = 0;
string testadmin = "Administrateur";
string testuser = "Utilisateur";
if (txtmatricule.Text != null & txtmatricule.Text != "")
{
m_strLogin = txtmatricule.Text;
m_IntCompteur = m_IntCompteur + 1;
}
else
{
m_ErreurLogin.SetError(txtmatricule, "Veuillez vérifier votre matricule !");
return;
}
if (txtpassword.Text != null & txtpassword.Text != "")
{
m_strPwd = txtpassword.Text;
m_IntCompteur = m_IntCompteur + 1;
}
else
{
m_ErreurPwd.SetError(txtpassword, "Veuillez vérifier votre mot de passe !");
return;
}
if (m_IntCompteur == 2)
{
try
{
CONNECTION MyConnexion = new CONNECTION("SEDKI-FAMILY\\SEDKIPC", "BASE_BT");
MyConnexion.Connect();
cmd = new SqlCommand("select * from INTERVENANT where MATR_INVT='" + m_strLogin + "'and PWD_INVT='"
+ m_strPwd + "'and NAT_PVG='" + testadmin + "'", MyConnexion.m_dbConnextion);
cmd1 = new SqlCommand("select * from INTERVENANT where MATR_INVT='" + m_strLogin + "'and PWD_INVT='"
+ m_strPwd + "'and NAT_PVG='" + testuser + "'", MyConnexion.m_dbConnextion);
SqlDataReader Dbreader = cmd.ExecuteReader();
SqlDataReader Dbreaderuser = cmd.ExecuteReader();
if (Dbreader.Read() == true)
{
progressBar1.Visible = true;
progressBar1.Minimum = 1;
progressBar1.Maximum = 100000;
progressBar1.Value = 1;
progressBar1.Step = 1;
for (x = 1; x <= 100000; x++)
{
progressBar1.PerformStep();
}
this.isUserOperation = false;
this.Close();
}
else if (Dbreaderuser.Read() == true)
{
Acceuil_user testuserur = new Acceuil_user();
testuserur.Show();
this.Close();
}
else
{
progressBar1.Visible = true;
progressBar1.Minimum = 1;
progressBar1.Maximum = 100000;
progressBar1.Value = 1;
progressBar1.Step = 1;
for (x = 1; x <= 100000; x++)
{
progressBar1.PerformStep();
}
if (MessageBox.Show("Utilisateur inconnu,voulez vous reesssayé ?", "Information", MessageBoxButtons.RetryCancel) == DialogResult.Retry)
{
progressBar1.Visible = false;
txtmatricule.ResetText();
txtpassword.ResetText();
MyConnexion.Disconnect();
}
else
{
Application.Exit();
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
} |
Partager