79 lines
2.6 KiB
C#
79 lines
2.6 KiB
C#
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;
|
|
|
|
/// <summary>
|
|
/// Méthode d'initialisation du formulaire de connexion.
|
|
/// </summary>
|
|
public PageConnexion()
|
|
{
|
|
Init();
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initialisation du formulaire de connexion.
|
|
/// </summary>
|
|
private void Init()
|
|
{
|
|
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);
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|