//Méthode qui va s'exécuter lors du clic sur le bouton de recherche private void imgRecherche_Click(object sender, EventArgs e) { tot.Visible = false; GestionnaireConnexion connect = new GestionnaireConnexion(); //On rechercher un lecteur(étudiant ou professeur) if ((connect.OneEtudiant(txtRecherche.Text) == null) && (connect.OneProfesseur(txtRecherche.Text) == null)) { txtNotLect.Text = "Ce lecteur n est pas enregistré!!!!"; Transition1.ShowSync(notifLect); notifLect.Visible = true; } else { if ((connect.OneEtudiant(txtRecherche.Text) == null) && (connect.OneProfesseur(txtRecherche.Text) != null)) { dgLecteur.Rows.Clear(); Professeur P = connect.OneProfesseur(txtRecherche.Text); //On ajoute l'utilisateur trouvé dans le datagrid dgLecteur.Rows.Add(null, P.Matricule, P.Nom, P.Prenom, P.Sexe, P.Email); } else { dgLecteur.Rows.Clear(); Etudiant E = connect.OneEtudiant(txtRecherche.Text); //On ajoute l'utilisateur trouvé dans le datagrid dgLecteur.Rows.Add(null, E.Matricule, E.Nom, E.Prenom, E.Sexe, E.Email); } } }
//Déclaration de la fonction qui va rechercher un professeur public Professeur OneProfesseur(string matriculeProf) { Professeur newProfesseur = null; UseDB(); commande.CommandText = "select * from professeur where (MatriculeProf = '" + matriculeProf + "')"; reader = commande.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { newProfesseur = new Professeur(reader.GetString("MatriculeProf"), reader.GetString("NomProf"), reader.GetString("PrenomProf"), reader.GetChar("SexeProf"), reader.GetString("Fonction"), reader.GetString("Email")); } } reader.Close(); return(newProfesseur); }
//Déclaration de la fonction qui va rechercher un responsable public Professeur OneResponsable(string nomProf, string passe) { Professeur newResponsable = null; string Fonction = "Responsable"; UseDB(); commande.CommandText = "select * from professeur where (NomProf = '" + nomProf + "')" + "AND ( MatriculeProf = '" + passe + "')" + "AND ( Fonction = '" + Fonction + "')"; reader = commande.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { newResponsable = new Professeur(reader.GetString("MatriculeProf"), reader.GetString("NomProf"), reader.GetString("PrenomProf"), reader.GetChar("SexeProf"), reader.GetString("Fonction"), reader.GetString("Email")); } } reader.Close(); return(newResponsable); }
private void Connexion_Click(object sender, EventArgs e) { formConnexion AcceuiConnexion = new formConnexion(); FormAdmin AcceuilAdmin = new FormAdmin(); GestionnaireConnexion connect = new GestionnaireConnexion(); if (connect.OneResponsable(Login.Text, Password.Text) == null) { transitionErreur.ShowSync(Erreur); Erreur.Visible = true; Login.Text = ""; if ((Password.Text == "") || (Password.Text == "Saisir le Password")) { Password.Text = "Saisir le Password"; } Password.Text = ""; if ((Login.Text == "") || (Login.Text == "Saisir le Login")) { Login.Text = "Saisir le Login"; } } else { currUser = connect.OneResponsable(Login.Text, Password.Text); Transition.HideSync(AcceuiConnexion); System.Windows.Forms.Form.ActiveForm.Visible = false; Transition.ShowSync(AcceuilAdmin); AcceuilAdmin.Activate(); AcceuilAdmin.NomAdmin.Text = currUser.Nom; AcceuilAdmin.Prenom.Text = currUser.Prenom; AcceuilAdmin.Email.Text = currUser.Email; AcceuilAdmin.Taux.Value = (int)connect.tauxEmrpunt(); //AcceuilAdmin.EffectifRespos.Value = (int)connect.nombreTotalProfRespo() / 100; } }