101 lines
3.2 KiB
C#
101 lines
3.2 KiB
C#
using projet.Controller;
|
|
using projet.modele;
|
|
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 Admin : Form
|
|
{
|
|
private AdminController controller;
|
|
/// <summary>
|
|
/// Méthode d'initialisation du formulaire Admin.
|
|
/// </summary>
|
|
public Admin()
|
|
{
|
|
Init();
|
|
InitializeComponent();
|
|
RemplirComboBoxPersonnel();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Méthode d'initialisation du contrôleur AdminController.
|
|
/// </summary>
|
|
public void Init()
|
|
{
|
|
controller = new AdminController();
|
|
}
|
|
|
|
private void RemplirComboBoxPersonnel()
|
|
{
|
|
List<Personnel> personnelList = controller.GetAllPersonnel();
|
|
foreach (Personnel personnel in personnelList)
|
|
{
|
|
comboBoxPersonnel.Items.Add(personnel);
|
|
}
|
|
}
|
|
|
|
private void buttonAdd_Click(object sender, EventArgs e)
|
|
{
|
|
this.Hide();
|
|
this.Close();
|
|
AddPersonnel addPersonnelForm = new AddPersonnel();
|
|
addPersonnelForm.ShowDialog();
|
|
}
|
|
|
|
private void buttonAbsence_Click(object sender, EventArgs e)
|
|
{
|
|
if (comboBoxPersonnel.SelectedItem != null)
|
|
{
|
|
Personnel personne = (Personnel)comboBoxPersonnel.SelectedItem;
|
|
this.Hide();
|
|
this.Close();
|
|
GestionAbsence gestionAbsence = new GestionAbsence(personne);
|
|
gestionAbsence.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Veuillez sélectionner un membre du personnel.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
|
|
private void buttonDelete_Click(object sender, EventArgs e)
|
|
{
|
|
if (comboBoxPersonnel.SelectedItem != null)
|
|
{
|
|
Personnel personne = (Personnel)comboBoxPersonnel.SelectedItem;
|
|
this.Hide();
|
|
this.Close();
|
|
ConfirmeSupressionPersonnel confirmeSupressionPersonnel = new ConfirmeSupressionPersonnel(personne);
|
|
confirmeSupressionPersonnel.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Veuillez sélectionner un membre du personnel.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
|
|
private void buttonEdit_Click(object sender, EventArgs e)
|
|
{
|
|
if(comboBoxPersonnel.SelectedItem != null)
|
|
{
|
|
Personnel personne = (Personnel)comboBoxPersonnel.SelectedItem;
|
|
this.Hide();
|
|
this.Close();
|
|
ModifierPersonne modifierPersonne = new ModifierPersonne(personne);
|
|
modifierPersonne.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("Veuillez sélectionner un membre du personnel.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
}
|
|
}
|