2025-06-02 13:19:31 +00:00
using projet.modele ;
using projet.Controller ;
using System ;
2025-05-27 09:07:13 +00:00
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
{
2025-06-02 13:19:31 +00:00
private PageConnexionController controller ;
2025-06-03 10:30:47 +00:00
/// <summary>
/// Méthode d'initialisation du formulaire de connexion.
/// </summary>
2025-05-27 09:07:13 +00:00
public PageConnexion ( )
{
2025-06-02 13:19:31 +00:00
Init ( ) ;
2025-05-27 09:07:13 +00:00
InitializeComponent ( ) ;
}
2025-06-02 13:19:31 +00:00
/// <summary>
/// Initialisation du formulaire de connexion.
/// </summary>
private void Init ( )
2025-05-27 09:07:13 +00:00
{
2025-06-02 13:19:31 +00:00
controller = new PageConnexionController ( ) ;
}
/// <summary>
/// Click sur le bouton se connecter
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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 ) ;
2025-05-27 09:07:13 +00:00
2025-06-02 13:19:31 +00:00
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 ) ;
}
}
2025-05-27 09:07:13 +00:00
}
2025-06-04 17:10:08 +00:00
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 ) ;
}
2025-05-27 09:07:13 +00:00
}
}