private void btnLog_Click(object sender, EventArgs e) { /*MySqlConnection cnx; * * try * { * cnx = ConnexionCoffe.GetInstance(); * MySqlCommand cmd = new MySqlCommand("select * from tcompte where type=@type and nomUtilisateur='" + txtUserName.Text + "' and motPasse='" + txtPw.Text + "'", cnx); * cmd.Parameters.Add("@type", "admin");// * MySqlCommand cmd2 = new MySqlCommand("select * from tcompte where type=@type2 and nomUtilisateur='" + txtUserName.Text + "' and motPasse='" + txtPw.Text + "'", cnx); * cmd2.Parameters.Add("@type2", "employer");// * MySqlDataReader myReader; * MySqlDataReader myReader2; * * myReader = cmd.ExecuteReader(); * // myReader2 = cmd2.ExecuteReader(); * int count = 0; * int count2 = 0; * while (myReader.Read()) * { * count = count + 1; * } * * if (count == 1) * { * myReader.Close(); * * // MessageBox.Show("accepter \n ", "Attention"); * //int user = Convert.ToInt32(txtUserName.Text); * EmployerDAO emee = new EmployerDAO(); * Employer emp = emee.FindbyName(txtUserName.Text); * // this.Hide(); * Administrateur f1 = new Administrateur(emp.Id); * f1.Show(); * // myReader.Close(); * * } * else * { * lblverif.Visible = true; * myReader.Close(); * } * myReader2 = cmd2.ExecuteReader(); * * while (myReader2.Read()) * { * count2 = count2 + 1; * } * if (count2 == 1) * { * lblverif.Visible = false; * // MessageBox.Show("accepter \n ", "Attention"); * this.Hide(); * Administrateur f1 = new Administrateur(); * f1.Show(); * * } * else * { * lblverif.Visible = true; * } * myReader2.Close(); * * cnx.Close(); * * } * catch (Exception ex) * { * MessageBox.Show("Pb de la requete de l'ajout\n " + ex.Message, "Attention"); * } * */ EmployerDAO empd = new EmployerDAO(); if (empd.Conadmin(txtUserName.Text, txtPw.Text) == true) { this.Hide(); Administrateur emp = new Administrateur(empd.FindbyName(txtUserName.Text)); emp.ShowDialog(); } else { lblverif.Visible = true; } /* this.Hide(); * Administrateur f1 = new Administrateur(); * f1.Show();*/ }