using projet.modele; using projet.Controller; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace projet.View { public partial class PageConnexion : Form { private PageConnexionController controller; /// /// Méthode d'initialisation du formulaire de connexion. /// public PageConnexion() { Init(); InitializeComponent(); } /// /// Initialisation du formulaire de connexion. /// private void Init() { controller = new PageConnexionController(); } /// /// Click sur le bouton se connecter /// /// /// private void buttonLogin_Click(object sender, EventArgs e) { if(string.IsNullOrEmpty(textBoxLogin.Text) || string.IsNullOrEmpty(textBoxPassword.Text)) { MessageBox.Show("Veuillez remplir tous les champs.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { // Connexion à faire tkt Responsable responsable = new Responsable(textBoxLogin.Text, textBoxPassword.Text); //MessageBox.Show("Identifiants : " + responsable.Login + " " + responsable.Pwd, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); bool isConnected = controller.ConnecterResponsable(responsable); if (isConnected) { Admin adminPage = new Admin(); this.Hide(); adminPage.ShowDialog(); this.Close(); } else { MessageBox.Show("Identifiants incorrects. Veuillez réessayer.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } private void linkLabelForgot_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { MessageBox.Show("Veuillez contacter l'administrateur pour réinitialiser votre mot de passe.", "Mot de passe oublié", MessageBoxButtons.OK, MessageBoxIcon.Information); } private void buttonLogin_Click_1(object sender, EventArgs e) { buttonLogin_Click(sender, e); } } }