private void Boutton_Ajouter_Click(object sender, EventArgs e) { IGestionTechnicienDAO IGTDAO = new GestionTechnicienDAO(); Technicien T = new Technicien { CIN = Convert.ToInt32(textBox1.Text), Login = textBox4.Text, Password = textBox5.Text }; var exist = IGTDAO.exist(T); if (exist) { MessageBox.Show("Ce Technicien existe deja"); } else { Personne T1 = new Technicien(); T.CIN = Convert.ToInt32(textBox1.Text); T.Nom = textBox2.Text; T.Prenom = textBox3.Text; T.Login = textBox4.Text; T.Password = textBox5.Text; IGTDAO.AjouterTechnicien(T); MessageBox.Show("Le Technicien a été ajouté"); } }
private void button1_Click(object sender, EventArgs e) { var GetType = this.Personne.GetType().ToString(); var type = GetType.Substring(14); if (type.Equals("Admin")) { IGestionAdminDAO IGADAO = new GestionAdminDAO(); IGADAO.Changer_Mdp(this.Personne, textBox1.Text); } if (type.Equals("Technicien")) { IGestionTechnicienDAO IGTDAO = new GestionTechnicienDAO(); IGTDAO.Changer_Mdp(this.Personne, textBox1.Text); } }
private void button1_Click(object sender, EventArgs e) { var Login = textBox1.Text; var Password = textBox2.Text; Personne P = null; IGestionTechnicienDAO IGTDAO = new GestionTechnicienDAO(); IGestionAdminDAO IGADAO = new GestionAdminDAO(); if (comboBox1.Text.Equals("Technicien")) { P = IGTDAO.RechercherTechnicien(Login, Password); if (P == null) { MessageBox.Show("erreur "); } else { Accueil_Technicien A = new Accueil_Technicien(P); A.Show(); } } else { P = IGADAO.RechercherAdmin(Login, Password); if (P == null) { MessageBox.Show("erreur "); } else { Accueil_Admin A = new Accueil_Admin(P); A.Show(); } } }