Ajout des fonctionnalités des boutons "Ajouter personnel", "supprimer personnel". Système de connexion.

This commit is contained in:
Erwann PHILIPPE 2025-06-02 15:19:31 +02:00
parent cae9989175
commit b68adb42ee
28 changed files with 1033 additions and 398 deletions

View file

@ -0,0 +1,28 @@
using projet.dal;
using projet.modele;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace projet.Controller
{
internal class AdminController
{
private readonly PersonnelAccess personnelAccess;
/// <summary>
/// Récupère l'accès aux données des responsables.
/// </summary>
public AdminController()
{
personnelAccess = new PersonnelAccess();
}
public List<Personnel> GetAllPersonnel()
{
return personnelAccess.GetAllPersonnel();
}
}
}

View file

@ -0,0 +1,25 @@
using projet.dal;
using projet.modele;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace projet.Controller
{
internal class ConfirmeSupressionPersonnelController
{
private PersonnelAccess personnelAccess;
public ConfirmeSupressionPersonnelController()
{
personnelAccess = new PersonnelAccess();
}
public void deletePersonnel(Personnel personnel)
{
personnelAccess.deletePersonnel(personnel);
}
}
}

View file

@ -0,0 +1,33 @@
using projet.dal;
using projet.modele;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace projet.Controller
{
public class PageConnexionController
{
private readonly ResponsableAccess responsableAccess;
/// <summary>
/// Récupère l'accès aux données des responsables.
/// </summary>
public PageConnexionController()
{
responsableAccess = new ResponsableAccess();
}
/// <summary>
/// Connecte un responsable à l'application.
/// </summary>
/// <param name="responsable"></param>
/// <returns></returns>
public bool ConnecterResponsable(Responsable responsable)
{
return responsableAccess.ConnecterResponsable(responsable);
}
}
}

View file

@ -0,0 +1,32 @@
using projet.dal;
using projet.modele;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace projet.Controller
{
internal class addPersonnelController
{
private readonly PersonnelAccess personnelAccess;
private readonly ServiceAccess serviceAccess;
public addPersonnelController()
{
personnelAccess = new PersonnelAccess();
serviceAccess = new ServiceAccess();
}
public List<Service> GetAllServices()
{
return serviceAccess.GetAllServices();
}
public void addPersonnel(Personnel personnel)
{
personnelAccess.addPersonnel(personnel);
}
}
}

View file

@ -1,3 +1,5 @@
using projet.View;
namespace projet
{
internal static class Program
@ -11,7 +13,7 @@ namespace projet
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(new PageConnexion());
}
}
}

View file

@ -3,25 +3,93 @@
partial class AddPersonnel
{
/// <summary>
/// Required designer variable.
/// Variable nécessaire au concepteur.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Bannière supérieure du formulaire
/// </summary>
private System.Windows.Forms.PictureBox pictureBoxTop;
/// <summary>
/// Bannière inférieure du formulaire
/// </summary>
private System.Windows.Forms.PictureBox pictureBoxBottom;
/// <summary>
/// Titre du formulaire
/// </summary>
private System.Windows.Forms.Label labelTitle;
/// <summary>
/// Conteneur principal organisant les champs de saisie
/// </summary>
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
/// <summary>
/// Étiquette pour le champ Nom
/// </summary>
private System.Windows.Forms.Label labelNom;
/// <summary>
/// Zone de saisie du nom
/// </summary>
private System.Windows.Forms.TextBox textBoxNom;
/// <summary>
/// Étiquette pour le champ Prénom
/// </summary>
private System.Windows.Forms.Label labelPrenom;
/// <summary>
/// Zone de saisie du prénom
/// </summary>
private System.Windows.Forms.TextBox textBoxPrenom;
/// <summary>
/// Étiquette pour le champ Téléphone
/// </summary>
private System.Windows.Forms.Label labelTel;
/// <summary>
/// Zone de saisie du numéro de téléphone
/// </summary>
private System.Windows.Forms.TextBox textBoxTel;
/// <summary>
/// Étiquette pour le champ Email
/// </summary>
private System.Windows.Forms.Label labelMail;
/// <summary>
/// Zone de saisie de l'adresse email
/// </summary>
private System.Windows.Forms.TextBox textBoxMail;
/// <summary>
/// Étiquette pour le champ Service
/// </summary>
private System.Windows.Forms.Label labelService;
/// <summary>
/// Liste déroulante pour la sélection du service
/// </summary>
private System.Windows.Forms.ComboBox comboBoxService;
/// <summary>
/// Conteneur pour les boutons d'action
/// </summary>
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelButtons;
/// <summary>
/// Bouton de validation pour ajouter le personnel
/// </summary>
private System.Windows.Forms.Button buttonAjouter;
/// <summary>
/// Bouton pour annuler l'opération
/// </summary>
private System.Windows.Forms.Button buttonAnnuler;
/// <summary>
@ -45,191 +113,235 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.pictureBoxTop = new System.Windows.Forms.PictureBox();
this.pictureBoxBottom = new System.Windows.Forms.PictureBox();
this.labelTitle = new System.Windows.Forms.Label();
this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.labelNom = new System.Windows.Forms.Label();
this.textBoxNom = new System.Windows.Forms.TextBox();
this.labelPrenom = new System.Windows.Forms.Label();
this.textBoxPrenom = new System.Windows.Forms.TextBox();
this.labelTel = new System.Windows.Forms.Label();
this.textBoxTel = new System.Windows.Forms.TextBox();
this.labelMail = new System.Windows.Forms.Label();
this.textBoxMail = new System.Windows.Forms.TextBox();
this.labelService = new System.Windows.Forms.Label();
this.comboBoxService = new System.Windows.Forms.ComboBox();
this.flowLayoutPanelButtons = new System.Windows.Forms.FlowLayoutPanel();
this.buttonAjouter = new System.Windows.Forms.Button();
this.buttonAnnuler = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTop)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxBottom)).BeginInit();
this.tableLayoutPanel.SuspendLayout();
this.flowLayoutPanelButtons.SuspendLayout();
this.SuspendLayout();
pictureBoxTop = new PictureBox();
pictureBoxBottom = new PictureBox();
labelTitle = new Label();
tableLayoutPanel = new TableLayoutPanel();
labelNom = new Label();
textBoxNom = new TextBox();
labelPrenom = new Label();
textBoxPrenom = new TextBox();
labelTel = new Label();
textBoxTel = new TextBox();
labelMail = new Label();
textBoxMail = new TextBox();
labelService = new Label();
comboBoxService = new ComboBox();
flowLayoutPanelButtons = new FlowLayoutPanel();
buttonAjouter = new Button();
buttonAnnuler = new Button();
((System.ComponentModel.ISupportInitialize)pictureBoxTop).BeginInit();
((System.ComponentModel.ISupportInitialize)pictureBoxBottom).BeginInit();
tableLayoutPanel.SuspendLayout();
flowLayoutPanelButtons.SuspendLayout();
SuspendLayout();
//
// pictureBoxTop
//
this.pictureBoxTop.Dock = System.Windows.Forms.DockStyle.Top;
// this.pictureBoxTop.Image = global::projet.Properties.Resources.BlueHeader; // Désactivé car ressource manquante
this.pictureBoxTop.BackColor = System.Drawing.Color.SteelBlue;
this.pictureBoxTop.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxTop.Location = new System.Drawing.Point(0, 0);
this.pictureBoxTop.Name = "pictureBoxTop";
this.pictureBoxTop.Size = new System.Drawing.Size(800, 180);
this.pictureBoxTop.TabIndex = 0;
this.pictureBoxTop.TabStop = false;
pictureBoxTop.BackColor = Color.SteelBlue;
pictureBoxTop.Dock = DockStyle.Top;
pictureBoxTop.Location = new Point(0, 0);
pictureBoxTop.Name = "pictureBoxTop";
pictureBoxTop.Size = new Size(800, 180);
pictureBoxTop.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBoxTop.TabIndex = 0;
pictureBoxTop.TabStop = false;
//
// pictureBoxBottom
//
this.pictureBoxBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
// this.pictureBoxBottom.Image = global::projet.Properties.Resources.BlueFooter; // Désactivé car ressource manquante
this.pictureBoxBottom.BackColor = System.Drawing.Color.SteelBlue;
this.pictureBoxBottom.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxBottom.Location = new System.Drawing.Point(0, 500);
this.pictureBoxBottom.Name = "pictureBoxBottom";
this.pictureBoxBottom.Size = new System.Drawing.Size(800, 100);
this.pictureBoxBottom.TabIndex = 1;
this.pictureBoxBottom.TabStop = false;
pictureBoxBottom.BackColor = Color.SteelBlue;
pictureBoxBottom.Dock = DockStyle.Bottom;
pictureBoxBottom.Location = new Point(0, 500);
pictureBoxBottom.Name = "pictureBoxBottom";
pictureBoxBottom.Size = new Size(800, 100);
pictureBoxBottom.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBoxBottom.TabIndex = 1;
pictureBoxBottom.TabStop = false;
//
// labelTitle
//
this.labelTitle.Font = new System.Drawing.Font("Segoe UI", 28F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.labelTitle.Location = new System.Drawing.Point(0, 180);
this.labelTitle.Name = "labelTitle";
this.labelTitle.Size = new System.Drawing.Size(800, 60);
this.labelTitle.TabIndex = 2;
this.labelTitle.Text = "Ajouter une personne";
this.labelTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
labelTitle.Font = new Font("Segoe UI", 28F);
labelTitle.Location = new Point(0, 180);
labelTitle.Name = "labelTitle";
labelTitle.Size = new Size(800, 60);
labelTitle.TabIndex = 2;
labelTitle.Text = "Ajouter une personne";
labelTitle.TextAlign = ContentAlignment.MiddleCenter;
//
// tableLayoutPanel
//
this.tableLayoutPanel.ColumnCount = 2;
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 30F));
this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 70F));
this.tableLayoutPanel.RowCount = 6;
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.tableLayoutPanel.Controls.Add(this.labelNom, 0, 0);
this.tableLayoutPanel.Controls.Add(this.textBoxNom, 1, 0);
this.tableLayoutPanel.Controls.Add(this.labelPrenom, 0, 1);
this.tableLayoutPanel.Controls.Add(this.textBoxPrenom, 1, 1);
this.tableLayoutPanel.Controls.Add(this.labelTel, 0, 2);
this.tableLayoutPanel.Controls.Add(this.textBoxTel, 1, 2);
this.tableLayoutPanel.Controls.Add(this.labelMail, 0, 3);
this.tableLayoutPanel.Controls.Add(this.textBoxMail, 1, 3);
this.tableLayoutPanel.Controls.Add(this.labelService, 0, 4);
this.tableLayoutPanel.Controls.Add(this.comboBoxService, 1, 4);
this.tableLayoutPanel.Controls.Add(this.flowLayoutPanelButtons, 1, 5);
this.tableLayoutPanel.Location = new System.Drawing.Point(120, 260);
this.tableLayoutPanel.Name = "tableLayoutPanel";
this.tableLayoutPanel.Size = new System.Drawing.Size(560, 250);
this.tableLayoutPanel.TabIndex = 3;
tableLayoutPanel.ColumnCount = 2;
tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 30F));
tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 70F));
tableLayoutPanel.Controls.Add(labelNom, 0, 0);
tableLayoutPanel.Controls.Add(textBoxNom, 1, 0);
tableLayoutPanel.Controls.Add(labelPrenom, 0, 1);
tableLayoutPanel.Controls.Add(textBoxPrenom, 1, 1);
tableLayoutPanel.Controls.Add(labelTel, 0, 2);
tableLayoutPanel.Controls.Add(textBoxTel, 1, 2);
tableLayoutPanel.Controls.Add(labelMail, 0, 3);
tableLayoutPanel.Controls.Add(textBoxMail, 1, 3);
tableLayoutPanel.Controls.Add(labelService, 0, 4);
tableLayoutPanel.Controls.Add(comboBoxService, 1, 4);
tableLayoutPanel.Controls.Add(flowLayoutPanelButtons, 1, 5);
tableLayoutPanel.Location = new Point(120, 260);
tableLayoutPanel.Name = "tableLayoutPanel";
tableLayoutPanel.RowCount = 6;
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 40F));
tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 50F));
tableLayoutPanel.Size = new Size(560, 250);
tableLayoutPanel.TabIndex = 3;
//
// labelNom
//
this.labelNom.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelNom.AutoSize = true;
this.labelNom.Font = new System.Drawing.Font("Segoe UI", 16F);
this.labelNom.Text = "Nom :";
labelNom.Anchor = AnchorStyles.Right;
labelNom.AutoSize = true;
labelNom.Font = new Font("Segoe UI", 16F);
labelNom.Location = new Point(93, 5);
labelNom.Name = "labelNom";
labelNom.Size = new Size(72, 30);
labelNom.TabIndex = 0;
labelNom.Text = "Nom :";
//
// textBoxNom
//
this.textBoxNom.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.textBoxNom.Width = 250;
this.textBoxNom.PlaceholderText = "Nom";
textBoxNom.Anchor = AnchorStyles.Left;
textBoxNom.Location = new Point(171, 8);
textBoxNom.Name = "textBoxNom";
textBoxNom.PlaceholderText = "Nom";
textBoxNom.Size = new Size(250, 23);
textBoxNom.TabIndex = 1;
//
// labelPrenom
//
this.labelPrenom.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelPrenom.AutoSize = true;
this.labelPrenom.Font = new System.Drawing.Font("Segoe UI", 16F);
this.labelPrenom.Text = "Prénom :";
labelPrenom.Anchor = AnchorStyles.Right;
labelPrenom.AutoSize = true;
labelPrenom.Font = new Font("Segoe UI", 16F);
labelPrenom.Location = new Point(65, 45);
labelPrenom.Name = "labelPrenom";
labelPrenom.Size = new Size(100, 30);
labelPrenom.TabIndex = 2;
labelPrenom.Text = "Prénom :";
//
// textBoxPrenom
//
this.textBoxPrenom.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.textBoxPrenom.Width = 250;
this.textBoxPrenom.PlaceholderText = "Prénom";
textBoxPrenom.Anchor = AnchorStyles.Left;
textBoxPrenom.Location = new Point(171, 48);
textBoxPrenom.Name = "textBoxPrenom";
textBoxPrenom.PlaceholderText = "Prénom";
textBoxPrenom.Size = new Size(250, 23);
textBoxPrenom.TabIndex = 3;
//
// labelTel
//
this.labelTel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelTel.AutoSize = true;
this.labelTel.Font = new System.Drawing.Font("Segoe UI", 16F);
this.labelTel.Text = "Tél :";
labelTel.Anchor = AnchorStyles.Right;
labelTel.AutoSize = true;
labelTel.Font = new Font("Segoe UI", 16F);
labelTel.Location = new Point(114, 85);
labelTel.Name = "labelTel";
labelTel.Size = new Size(51, 30);
labelTel.TabIndex = 4;
labelTel.Text = "Tél :";
//
// textBoxTel
//
this.textBoxTel.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.textBoxTel.Width = 250;
this.textBoxTel.PlaceholderText = "Numéro de téléphone";
textBoxTel.Anchor = AnchorStyles.Left;
textBoxTel.Location = new Point(171, 88);
textBoxTel.Name = "textBoxTel";
textBoxTel.PlaceholderText = "Numéro de téléphone";
textBoxTel.Size = new Size(250, 23);
textBoxTel.TabIndex = 5;
//
// labelMail
//
this.labelMail.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelMail.AutoSize = true;
this.labelMail.Font = new System.Drawing.Font("Segoe UI", 16F);
this.labelMail.Text = "Mail :";
labelMail.Anchor = AnchorStyles.Right;
labelMail.AutoSize = true;
labelMail.Font = new Font("Segoe UI", 16F);
labelMail.Location = new Point(100, 125);
labelMail.Name = "labelMail";
labelMail.Size = new Size(65, 30);
labelMail.TabIndex = 6;
labelMail.Text = "Mail :";
//
// textBoxMail
//
this.textBoxMail.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.textBoxMail.Width = 250;
this.textBoxMail.PlaceholderText = "Adresse mail";
textBoxMail.Anchor = AnchorStyles.Left;
textBoxMail.Location = new Point(171, 128);
textBoxMail.Name = "textBoxMail";
textBoxMail.PlaceholderText = "Adresse mail";
textBoxMail.Size = new Size(250, 23);
textBoxMail.TabIndex = 7;
//
// labelService
//
this.labelService.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.labelService.AutoSize = true;
this.labelService.Font = new System.Drawing.Font("Segoe UI", 16F);
this.labelService.Text = "Service :";
labelService.Anchor = AnchorStyles.Right;
labelService.AutoSize = true;
labelService.Font = new Font("Segoe UI", 16F);
labelService.Location = new Point(71, 165);
labelService.Name = "labelService";
labelService.Size = new Size(94, 30);
labelService.TabIndex = 8;
labelService.Text = "Service :";
//
// comboBoxService
//
this.comboBoxService.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.comboBoxService.Width = 250;
this.comboBoxService.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
// this.comboBoxService.PlaceholderText = "Service d'affectation"; // Supprimé car non supporté
comboBoxService.Anchor = AnchorStyles.Left;
comboBoxService.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxService.Location = new Point(171, 168);
comboBoxService.Name = "comboBoxService";
comboBoxService.Size = new Size(250, 23);
comboBoxService.TabIndex = 9;
//
// flowLayoutPanelButtons
//
this.flowLayoutPanelButtons.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.flowLayoutPanelButtons.AutoSize = true;
this.flowLayoutPanelButtons.Controls.Add(this.buttonAjouter);
this.flowLayoutPanelButtons.Controls.Add(this.buttonAnnuler);
flowLayoutPanelButtons.Anchor = AnchorStyles.Left;
flowLayoutPanelButtons.AutoSize = true;
flowLayoutPanelButtons.Controls.Add(buttonAjouter);
flowLayoutPanelButtons.Controls.Add(buttonAnnuler);
flowLayoutPanelButtons.Location = new Point(171, 210);
flowLayoutPanelButtons.Name = "flowLayoutPanelButtons";
flowLayoutPanelButtons.Size = new Size(212, 29);
flowLayoutPanelButtons.TabIndex = 10;
//
// buttonAjouter
//
this.buttonAjouter.Text = "Ajouter";
this.buttonAjouter.Width = 100;
buttonAjouter.Location = new Point(3, 3);
buttonAjouter.Name = "buttonAjouter";
buttonAjouter.Size = new Size(100, 23);
buttonAjouter.TabIndex = 0;
buttonAjouter.Text = "Ajouter";
buttonAjouter.Click += buttonAjouter_Click_1;
//
// buttonAnnuler
//
this.buttonAnnuler.Text = "Annuler";
this.buttonAnnuler.Width = 100;
buttonAnnuler.Location = new Point(109, 3);
buttonAnnuler.Name = "buttonAnnuler";
buttonAnnuler.Size = new Size(100, 23);
buttonAnnuler.TabIndex = 1;
buttonAnnuler.Text = "Annuler";
buttonAnnuler.Click += buttonAnnuler_Click_1;
//
// AddPersonnel
//
this.ClientSize = new System.Drawing.Size(800, 600);
this.Controls.Add(this.pictureBoxTop);
this.Controls.Add(this.pictureBoxBottom);
this.Controls.Add(this.labelTitle);
this.Controls.Add(this.tableLayoutPanel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "AddPersonnel";
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTop)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxBottom)).EndInit();
this.tableLayoutPanel.ResumeLayout(false);
this.tableLayoutPanel.PerformLayout();
this.flowLayoutPanelButtons.ResumeLayout(false);
this.ResumeLayout(false);
ClientSize = new Size(800, 600);
Controls.Add(pictureBoxTop);
Controls.Add(pictureBoxBottom);
Controls.Add(labelTitle);
Controls.Add(tableLayoutPanel);
FormBorderStyle = FormBorderStyle.FixedSingle;
MaximizeBox = false;
Name = "AddPersonnel";
Load += AddPersonnel_Load;
((System.ComponentModel.ISupportInitialize)pictureBoxTop).EndInit();
((System.ComponentModel.ISupportInitialize)pictureBoxBottom).EndInit();
tableLayoutPanel.ResumeLayout(false);
tableLayoutPanel.PerformLayout();
flowLayoutPanelButtons.ResumeLayout(false);
ResumeLayout(false);
}
#endregion

View file

@ -1,4 +1,6 @@
using System;
using projet.Controller;
using projet.modele;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -10,11 +12,100 @@ using System.Windows.Forms;
namespace projet.View
{
/// <summary>
/// Formulaire permettant l'ajout d'un nouveau membre du personnel.
/// Cette fenêtre gère la saisie et la validation des informations personnelles.
/// </summary>
public partial class AddPersonnel : Form
{
private addPersonnelController controller;
/// <summary>
/// Initialise une nouvelle instance du formulaire AddPersonnel.
/// Configure les composants de l'interface utilisateur et initialise les validations.
/// </summary>
public AddPersonnel()
{
Init();
InitializeComponent();
}
private void Init()
{
controller = new addPersonnelController();
}
/// <summary>
/// Gère l'événement de clic sur le bouton Ajouter.
/// Valide les données saisies et ajoute le nouveau membre du personnel.
/// </summary>
/// <param name="sender">L'objet qui a déclenché l'événement</param>
/// <param name="e">Les arguments de l'événement</param>
private void buttonAjouter_Click(object sender, EventArgs e)
{
// TODO: Implémenter la logique d'ajout
}
/// <summary>
/// Gère l'événement de clic sur le bouton Annuler.
/// Ferme le formulaire sans sauvegarder les modifications.
/// </summary>
/// <param name="sender">L'objet qui a déclenché l'événement</param>
/// <param name="e">Les arguments de l'événement</param>
private void buttonAnnuler_Click(object sender, EventArgs e)
{
// TODO: Implémenter la logique d'annulation
}
private void buttonAnnuler_Click_1(object sender, EventArgs e)
{
Admin admin = new Admin();
this.Hide();
this.Close();
admin.ShowDialog();
}
/// <summary>
/// Procédure d'événement pour le bouton Ajouter.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonAjouter_Click_1(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxNom.Text) || string.IsNullOrEmpty(textBoxPrenom.Text) || string.IsNullOrEmpty(textBoxMail.Text) || string.IsNullOrEmpty(textBoxTel.Text) || comboBoxService.SelectedItem == null)
{
MessageBox.Show("Veuillez remplir tous les champs.", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
else
{
Personnel personnel = new Personnel(
0, // IdPersonnel
textBoxNom.Text, // Nom
textBoxPrenom.Text, // Prenom
textBoxTel.Text, // Tel
textBoxMail.Text, // Mail
comboBoxService.SelectedIndex+1 // IdService
);
controller.addPersonnel(personnel);
this.Hide();
this.Close();
Admin admin = new Admin();
admin.ShowDialog();
}
}
private void RemplirComboBoxService()
{
List<Service> services = controller.GetAllServices();
foreach (Service service in services)
{
comboBoxService.Items.Add(service.Nom);
}
}
private void AddPersonnel_Load(object sender, EventArgs e)
{
RemplirComboBoxService();
}
}
}

View file

@ -40,128 +40,131 @@
/// </summary>
private void InitializeComponent()
{
this.pictureBoxTop = new System.Windows.Forms.PictureBox();
this.pictureBoxBottom = new System.Windows.Forms.PictureBox();
this.labelTitle = new System.Windows.Forms.Label();
this.labelList = new System.Windows.Forms.Label();
this.labelSeparator = new System.Windows.Forms.Label();
this.comboBoxPersonnel = new System.Windows.Forms.ComboBox();
this.buttonAdd = new System.Windows.Forms.Button();
this.buttonDelete = new System.Windows.Forms.Button();
this.buttonEdit = new System.Windows.Forms.Button();
this.buttonAbsence = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTop)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxBottom)).BeginInit();
this.SuspendLayout();
pictureBoxTop = new PictureBox();
pictureBoxBottom = new PictureBox();
labelTitle = new Label();
labelList = new Label();
labelSeparator = new Label();
comboBoxPersonnel = new ComboBox();
buttonAdd = new Button();
buttonDelete = new Button();
buttonEdit = new Button();
buttonAbsence = new Button();
((System.ComponentModel.ISupportInitialize)pictureBoxTop).BeginInit();
((System.ComponentModel.ISupportInitialize)pictureBoxBottom).BeginInit();
SuspendLayout();
//
// pictureBoxTop
//
this.pictureBoxTop.BackColor = System.Drawing.Color.SteelBlue;
this.pictureBoxTop.Dock = System.Windows.Forms.DockStyle.Top;
this.pictureBoxTop.Location = new System.Drawing.Point(0, 0);
this.pictureBoxTop.Name = "pictureBoxTop";
this.pictureBoxTop.Size = new System.Drawing.Size(800, 180);
this.pictureBoxTop.TabIndex = 0;
this.pictureBoxTop.TabStop = false;
pictureBoxTop.BackColor = Color.SteelBlue;
pictureBoxTop.Dock = DockStyle.Top;
pictureBoxTop.Location = new Point(0, 0);
pictureBoxTop.Name = "pictureBoxTop";
pictureBoxTop.Size = new Size(800, 180);
pictureBoxTop.TabIndex = 0;
pictureBoxTop.TabStop = false;
//
// pictureBoxBottom
//
this.pictureBoxBottom.BackColor = System.Drawing.Color.SteelBlue;
this.pictureBoxBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pictureBoxBottom.Location = new System.Drawing.Point(0, 600 - 60);
this.pictureBoxBottom.Name = "pictureBoxBottom";
this.pictureBoxBottom.Size = new System.Drawing.Size(800, 60);
this.pictureBoxBottom.TabIndex = 1;
this.pictureBoxBottom.TabStop = false;
pictureBoxBottom.BackColor = Color.SteelBlue;
pictureBoxBottom.Dock = DockStyle.Bottom;
pictureBoxBottom.Location = new Point(0, 540);
pictureBoxBottom.Name = "pictureBoxBottom";
pictureBoxBottom.Size = new Size(800, 60);
pictureBoxBottom.TabIndex = 1;
pictureBoxBottom.TabStop = false;
//
// labelTitle
//
this.labelTitle.Font = new System.Drawing.Font("Segoe UI", 28F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.labelTitle.Location = new System.Drawing.Point(0, 200);
this.labelTitle.Name = "labelTitle";
this.labelTitle.Size = new System.Drawing.Size(800, 60);
this.labelTitle.TabIndex = 2;
this.labelTitle.Text = "Gérer le personnel";
this.labelTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
labelTitle.Font = new Font("Segoe UI", 28F);
labelTitle.Location = new Point(0, 200);
labelTitle.Name = "labelTitle";
labelTitle.Size = new Size(800, 60);
labelTitle.TabIndex = 2;
labelTitle.Text = "Gérer le personnel";
labelTitle.TextAlign = ContentAlignment.MiddleCenter;
//
// labelList
//
this.labelList.Font = new System.Drawing.Font("Segoe UI", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.labelList.Location = new System.Drawing.Point(0, 260);
this.labelList.Name = "labelList";
this.labelList.Size = new System.Drawing.Size(800, 40);
this.labelList.TabIndex = 3;
this.labelList.Text = "Liste du personnel";
this.labelList.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
labelList.Font = new Font("Segoe UI", 18F);
labelList.Location = new Point(0, 260);
labelList.Name = "labelList";
labelList.Size = new Size(800, 40);
labelList.TabIndex = 3;
labelList.Text = "Liste du personnel";
labelList.TextAlign = ContentAlignment.MiddleCenter;
//
// labelSeparator
//
this.labelSeparator.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.labelSeparator.Location = new System.Drawing.Point(300, 300);
this.labelSeparator.Name = "labelSeparator";
this.labelSeparator.Size = new System.Drawing.Size(200, 2);
this.labelSeparator.TabIndex = 4;
labelSeparator.BorderStyle = BorderStyle.Fixed3D;
labelSeparator.Location = new Point(300, 300);
labelSeparator.Name = "labelSeparator";
labelSeparator.Size = new Size(200, 2);
labelSeparator.TabIndex = 4;
//
// comboBoxPersonnel
//
this.comboBoxPersonnel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxPersonnel.Font = new System.Drawing.Font("Segoe UI", 10F);
this.comboBoxPersonnel.Location = new System.Drawing.Point(300, 320);
this.comboBoxPersonnel.Name = "comboBoxPersonnel";
this.comboBoxPersonnel.Size = new System.Drawing.Size(200, 25);
this.comboBoxPersonnel.TabIndex = 5;
comboBoxPersonnel.DropDownStyle = ComboBoxStyle.DropDownList;
comboBoxPersonnel.Font = new Font("Segoe UI", 10F);
comboBoxPersonnel.Location = new Point(300, 320);
comboBoxPersonnel.Name = "comboBoxPersonnel";
comboBoxPersonnel.Size = new Size(200, 25);
comboBoxPersonnel.TabIndex = 5;
//
// buttonAdd
//
this.buttonAdd.Location = new System.Drawing.Point(220, 370);
this.buttonAdd.Name = "buttonAdd";
this.buttonAdd.Size = new System.Drawing.Size(150, 30);
this.buttonAdd.TabIndex = 6;
this.buttonAdd.Text = "Ajouter une personne";
//
// buttonAbsence
//
this.buttonAbsence.Location = new System.Drawing.Point(430, 370);
this.buttonAbsence.Name = "buttonAbsence";
this.buttonAbsence.Size = new System.Drawing.Size(150, 30);
this.buttonAbsence.TabIndex = 7;
this.buttonAbsence.Text = "Gérer ses absences";
buttonAdd.Location = new Point(220, 370);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(150, 30);
buttonAdd.TabIndex = 6;
buttonAdd.Text = "Ajouter une personne";
buttonAdd.Click += buttonAdd_Click;
//
// buttonDelete
//
this.buttonDelete.Location = new System.Drawing.Point(220, 410);
this.buttonDelete.Name = "buttonDelete";
this.buttonDelete.Size = new System.Drawing.Size(150, 30);
this.buttonDelete.TabIndex = 8;
this.buttonDelete.Text = "Supprimer la personne";
buttonDelete.Location = new Point(220, 410);
buttonDelete.Name = "buttonDelete";
buttonDelete.Size = new Size(150, 30);
buttonDelete.TabIndex = 8;
buttonDelete.Text = "Supprimer la personne";
buttonDelete.Click += buttonDelete_Click;
//
// buttonEdit
//
this.buttonEdit.Location = new System.Drawing.Point(430, 410);
this.buttonEdit.Name = "buttonEdit";
this.buttonEdit.Size = new System.Drawing.Size(150, 30);
this.buttonEdit.TabIndex = 9;
this.buttonEdit.Text = "Modifier personne";
buttonEdit.Location = new Point(430, 410);
buttonEdit.Name = "buttonEdit";
buttonEdit.Size = new Size(150, 30);
buttonEdit.TabIndex = 9;
buttonEdit.Text = "Modifier personne";
//
// buttonAbsence
//
buttonAbsence.Location = new Point(430, 370);
buttonAbsence.Name = "buttonAbsence";
buttonAbsence.Size = new Size(150, 30);
buttonAbsence.TabIndex = 7;
buttonAbsence.Text = "Gérer ses absences";
buttonAbsence.Click += buttonAbsence_Click;
//
// Admin
//
this.ClientSize = new System.Drawing.Size(800, 600);
this.Controls.Add(this.pictureBoxTop);
this.Controls.Add(this.pictureBoxBottom);
this.Controls.Add(this.labelTitle);
this.Controls.Add(this.labelList);
this.Controls.Add(this.labelSeparator);
this.Controls.Add(this.comboBoxPersonnel);
this.Controls.Add(this.buttonAdd);
this.Controls.Add(this.buttonAbsence);
this.Controls.Add(this.buttonDelete);
this.Controls.Add(this.buttonEdit);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "Admin";
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTop)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxBottom)).EndInit();
this.ResumeLayout(false);
ClientSize = new Size(800, 600);
Controls.Add(pictureBoxTop);
Controls.Add(pictureBoxBottom);
Controls.Add(labelTitle);
Controls.Add(labelList);
Controls.Add(labelSeparator);
Controls.Add(comboBoxPersonnel);
Controls.Add(buttonAdd);
Controls.Add(buttonAbsence);
Controls.Add(buttonDelete);
Controls.Add(buttonEdit);
FormBorderStyle = FormBorderStyle.FixedSingle;
MaximizeBox = false;
Name = "Admin";
((System.ComponentModel.ISupportInitialize)pictureBoxTop).EndInit();
((System.ComponentModel.ISupportInitialize)pictureBoxBottom).EndInit();
ResumeLayout(false);
}
#endregion

View file

@ -1,4 +1,6 @@
using System;
using projet.Controller;
using projet.modele;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -12,9 +14,65 @@ namespace projet.View
{
public partial class Admin : Form
{
private AdminController controller;
public Admin()
{
Init();
InitializeComponent();
RemplirComboBoxPersonnel();
}
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)
{
this.Hide();
this.Close();
GestionAbsence gestionAbsence = new GestionAbsence();
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);
}
}
}
}

View file

@ -34,84 +34,86 @@
/// </summary>
private void InitializeComponent()
{
this.pictureBoxTop = new System.Windows.Forms.PictureBox();
this.pictureBoxBottom = new System.Windows.Forms.PictureBox();
this.labelTitle = new System.Windows.Forms.Label();
this.buttonAnnuler = new System.Windows.Forms.Button();
this.buttonConfirmer = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTop)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxBottom)).BeginInit();
this.SuspendLayout();
pictureBoxTop = new PictureBox();
pictureBoxBottom = new PictureBox();
labelTitle = new Label();
buttonAnnuler = new Button();
buttonConfirmer = new Button();
((System.ComponentModel.ISupportInitialize)pictureBoxTop).BeginInit();
((System.ComponentModel.ISupportInitialize)pictureBoxBottom).BeginInit();
SuspendLayout();
//
// pictureBoxTop
//
this.pictureBoxTop.BackColor = System.Drawing.Color.SteelBlue;
this.pictureBoxTop.Dock = System.Windows.Forms.DockStyle.Top;
this.pictureBoxTop.Location = new System.Drawing.Point(0, 0);
this.pictureBoxTop.Name = "pictureBoxTop";
this.pictureBoxTop.Size = new System.Drawing.Size(800, 180);
this.pictureBoxTop.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxTop.TabIndex = 0;
this.pictureBoxTop.TabStop = false;
pictureBoxTop.BackColor = Color.SteelBlue;
pictureBoxTop.Dock = DockStyle.Top;
pictureBoxTop.Location = new Point(0, 0);
pictureBoxTop.Name = "pictureBoxTop";
pictureBoxTop.Size = new Size(800, 180);
pictureBoxTop.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBoxTop.TabIndex = 0;
pictureBoxTop.TabStop = false;
//
// pictureBoxBottom
//
this.pictureBoxBottom.BackColor = System.Drawing.Color.SteelBlue;
this.pictureBoxBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pictureBoxBottom.Location = new System.Drawing.Point(0, 520);
this.pictureBoxBottom.Name = "pictureBoxBottom";
this.pictureBoxBottom.Size = new System.Drawing.Size(800, 140);
this.pictureBoxBottom.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxBottom.TabIndex = 1;
this.pictureBoxBottom.TabStop = false;
pictureBoxBottom.BackColor = Color.SteelBlue;
pictureBoxBottom.Dock = DockStyle.Bottom;
pictureBoxBottom.Location = new Point(0, 520);
pictureBoxBottom.Name = "pictureBoxBottom";
pictureBoxBottom.Size = new Size(800, 140);
pictureBoxBottom.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBoxBottom.TabIndex = 1;
pictureBoxBottom.TabStop = false;
//
// labelTitle
//
this.labelTitle.Font = new System.Drawing.Font("Segoe UI", 20F);
this.labelTitle.Location = new System.Drawing.Point(0, 180);
this.labelTitle.Name = "labelTitle";
this.labelTitle.Size = new System.Drawing.Size(800, 50);
this.labelTitle.TabIndex = 2;
this.labelTitle.Text = "Voulez vous vraiment supprimer : PRÉNOM";
this.labelTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
labelTitle.Font = new Font("Segoe UI", 20F);
labelTitle.Location = new Point(0, 180);
labelTitle.Name = "labelTitle";
labelTitle.Size = new Size(800, 50);
labelTitle.TabIndex = 2;
labelTitle.Text = "Voulez vous vraiment supprimer : PRÉNOM";
labelTitle.TextAlign = ContentAlignment.MiddleCenter;
//
// buttonAnnuler
//
this.buttonAnnuler.Font = new System.Drawing.Font("Segoe UI", 10F);
this.buttonAnnuler.Location = new System.Drawing.Point(200, 260);
this.buttonAnnuler.Name = "buttonAnnuler";
this.buttonAnnuler.Size = new System.Drawing.Size(100, 30);
this.buttonAnnuler.TabIndex = 3;
this.buttonAnnuler.Text = "Annuler";
this.buttonAnnuler.UseVisualStyleBackColor = true;
buttonAnnuler.Font = new Font("Segoe UI", 10F);
buttonAnnuler.Location = new Point(200, 260);
buttonAnnuler.Name = "buttonAnnuler";
buttonAnnuler.Size = new Size(100, 30);
buttonAnnuler.TabIndex = 3;
buttonAnnuler.Text = "Annuler";
buttonAnnuler.UseVisualStyleBackColor = true;
buttonAnnuler.Click += buttonAnnuler_Click;
//
// buttonConfirmer
//
this.buttonConfirmer.Font = new System.Drawing.Font("Segoe UI", 10F);
this.buttonConfirmer.Location = new System.Drawing.Point(500, 260);
this.buttonConfirmer.Name = "buttonConfirmer";
this.buttonConfirmer.Size = new System.Drawing.Size(100, 30);
this.buttonConfirmer.TabIndex = 4;
this.buttonConfirmer.Text = "Confirmer";
this.buttonConfirmer.UseVisualStyleBackColor = true;
buttonConfirmer.Font = new Font("Segoe UI", 10F);
buttonConfirmer.Location = new Point(500, 260);
buttonConfirmer.Name = "buttonConfirmer";
buttonConfirmer.Size = new Size(100, 30);
buttonConfirmer.TabIndex = 4;
buttonConfirmer.Text = "Confirmer";
buttonConfirmer.UseVisualStyleBackColor = true;
buttonConfirmer.Click += buttonConfirmer_Click;
//
// ConfirmeSupressionPersonnel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 660);
this.Controls.Add(this.pictureBoxTop);
this.Controls.Add(this.pictureBoxBottom);
this.Controls.Add(this.labelTitle);
this.Controls.Add(this.buttonAnnuler);
this.Controls.Add(this.buttonConfirmer);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.Name = "ConfirmeSupressionPersonnel";
this.Text = "Confirmation suppression";
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTop)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxBottom)).EndInit();
this.ResumeLayout(false);
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 660);
Controls.Add(pictureBoxTop);
Controls.Add(pictureBoxBottom);
Controls.Add(labelTitle);
Controls.Add(buttonAnnuler);
Controls.Add(buttonConfirmer);
FormBorderStyle = FormBorderStyle.FixedSingle;
MaximizeBox = false;
Name = "ConfirmeSupressionPersonnel";
Text = "Confirmation suppression";
((System.ComponentModel.ISupportInitialize)pictureBoxTop).EndInit();
((System.ComponentModel.ISupportInitialize)pictureBoxBottom).EndInit();
ResumeLayout(false);
}
#endregion

View file

@ -1,4 +1,6 @@
using System;
using projet.Controller;
using projet.modele;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -12,9 +14,36 @@ namespace projet.View
{
public partial class ConfirmeSupressionPersonnel : Form
{
public ConfirmeSupressionPersonnel()
private ConfirmeSupressionPersonnelController controller;
private Personnel personne;
public ConfirmeSupressionPersonnel(Personnel personne)
{
Init();
InitializeComponent();
this.personne = personne;
labelTitle.Text = $"Voulez vous vraiment supprimer : {personne} ?";
}
public void Init()
{
controller = new ConfirmeSupressionPersonnelController();
}
private void buttonAnnuler_Click(object sender, EventArgs e)
{
this.Hide();
this.Close();
Admin admin = new Admin();
admin.ShowDialog();
}
private void buttonConfirmer_Click(object sender, EventArgs e)
{
controller.deletePersonnel(personne);
this.Hide();
this.Close();
Admin admin = new Admin();
admin.ShowDialog();
}
}
}

View file

@ -88,7 +88,6 @@
textBoxLogin.Name = "textBoxLogin";
textBoxLogin.Size = new Size(200, 23);
textBoxLogin.TabIndex = 3;
textBoxLogin.TextChanged += textBoxLogin_TextChanged;
//
// labelPassword
//
@ -133,8 +132,9 @@
buttonLogin.Size = new Size(100, 23);
buttonLogin.TabIndex = 8;
buttonLogin.Text = "Se connecter";
buttonLogin.Click += buttonLogin_Click;
//
// Form1
// PageConnexion
//
ClientSize = new Size(886, 600);
Controls.Add(pictureBoxHeader);
@ -148,7 +148,7 @@
Controls.Add(buttonLogin);
FormBorderStyle = FormBorderStyle.FixedSingle;
MaximizeBox = false;
Name = "Form1";
Name = "PageConnexion";
((System.ComponentModel.ISupportInitialize)pictureBoxHeader).EndInit();
ResumeLayout(false);
PerformLayout();

View file

@ -1,4 +1,6 @@
using System;
using projet.modele;
using projet.Controller;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@ -12,14 +14,52 @@ namespace projet.View
{
public partial class PageConnexion : Form
{
private PageConnexionController controller;
public PageConnexion()
{
Init();
InitializeComponent();
}
private void textBoxLogin_TextChanged(object sender, EventArgs e)
/// <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);
}
}
}
}
}

View file

@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;
namespace Habilitations.bddmanager
namespace projet.bddmanager
{
/// <summary>
/// Singleton : connexion à la base de données et exécution des requêtes

View file

@ -1,4 +1,4 @@
namespace Habilitations.dal
namespace projet.dal
{
public class AbsenceAccess
{

37
projet/dal/Access.cs Normal file
View file

@ -0,0 +1,37 @@
using projet.bddmanager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace projet.dal
{
public class Access
{
private static readonly string connectionString = "server=localhost;user id=root;password=;database=mediatek;";
private static Access instance = null;
public BddManager Manager { get; }
private Access()
{
try
{
Manager = BddManager.GetInstance(connectionString);
}
catch (Exception)
{
Environment.Exit(0);
}
}
public static Access GetInstance()
{
if (instance == null)
{
instance = new Access();
}
return instance;
}
}
}

View file

@ -1,4 +1,4 @@
namespace Habilitations.dal
namespace projet.dal
{
public class MotifAccess
{

View file

@ -1,12 +1,93 @@
namespace Habilitations.dal
using projet.modele;
namespace projet.dal
{
public class PersonnelAccess
{
private static readonly string connectionString = "server=localhost;user id=root;password=;database=mediatek;";
private readonly Access access;
public static string GetConnexion()
public PersonnelAccess()
{
return connectionString;
access = Access.GetInstance();
}
public List<Personnel> GetAllPersonnel()
{
List<Personnel> personnelList = new List<Personnel>();
if (access.Manager != null)
{
string req = "SELECT * FROM personnel ORDER BY nom, prenom;";
try
{
List<Object[]> resultats = access.Manager.ReqSelect(req);
if (resultats != null)
{
foreach (Object[] resultat in resultats)
{
Personnel personnel = new Personnel(
Convert.ToInt32(resultat[0]), // IdPersonnel
Convert.ToString(resultat[1]), // Nom
Convert.ToString(resultat[2]), // Prenom
Convert.ToString(resultat[3]), // Tel
Convert.ToString(resultat[4]), // Mail
Convert.ToInt32(resultat[5]) // IdService
);
personnelList.Add(personnel);
}
}
}
catch (Exception)
{
Console.WriteLine("Erreur lors de la récupération des données du personnel.");
Environment.Exit(0);
}
}
return personnelList;
}
public void addPersonnel(Personnel personne)
{
if (access.Manager != null)
{
string req = "INSERT INTO personnel (nom, prenom, tel, mail, idService) VALUES (@nom, @prenom, @tel, @mail, @idService);";
var parameters = new Dictionary<string, object>
{
{ "@nom", personne.Nom },
{ "@prenom", personne.Prenom },
{ "@tel", personne.Tel },
{ "@mail", personne.Mail },
{ "@idService", personne.IdService }
};
try
{
access.Manager.ReqUpdate(req, parameters);
}
catch (Exception)
{
Console.WriteLine("Erreur lors de l'ajout du personnel dans la base de données.");
Environment.Exit(0);
}
}
}
public void deletePersonnel(Personnel personnel)
{
if (access.Manager != null)
{
string req = "DELETE FROM personnel WHERE idPersonnel = @idPersonnel;";
var parameters = new Dictionary<string, object>
{
{ "@idPersonnel", personnel.IdPersonnel }
};
try
{
access.Manager.ReqUpdate(req, parameters);
}
catch (Exception)
{
Console.WriteLine("Erreur lors de la suppression du personnel dans la base de données.");
Environment.Exit(0);
}
}
}
}
}

View file

@ -1,12 +1,42 @@
namespace Habilitations.dal
using projet.modele;
namespace projet.dal
{
public class ResponsableAccess
{
private static readonly string connectionString = "server=localhost;user id=root;password=;database=mediatek;";
private readonly Access access;
public static string GetConnexion()
public ResponsableAccess()
{
return connectionString;
access = Access.GetInstance();
}
public bool ConnecterResponsable(Responsable responsable)
{
if(access.Manager != null)
{
string req = "SELECT * FROM responsable WHERE login = @login AND pwd = SHA2(@pwd, 256);";
var parameters = new Dictionary<string, object>
{
{ "@login", responsable.Login },
{ "@pwd", responsable.Pwd }
};
try
{
List<Object[]> result = access.Manager.ReqSelect(req, parameters);
if(result != null)
{
return (result.Count > 0);
}
}
catch (Exception)
{
Console.WriteLine("Erreur lors de la connexion à la base de données.");
Environment.Exit(0);
}
return false;
}
return false;
}
}
}

View file

@ -1,12 +1,43 @@
namespace Habilitations.dal
using projet.modele;
namespace projet.dal
{
public class ServiceAccess
{
private static readonly string connectionString = "server=localhost;user id=root;password=;database=mediatek;";
private readonly Access access;
public static string GetConnexion()
public ServiceAccess()
{
return connectionString;
access = Access.GetInstance();
}
public List<Service> GetAllServices()
{
List<Service> serviceList = new List<Service>();
if (access.Manager != null)
{
string req = "SELECT * FROM service ORDER BY nom;";
try
{
List<Object[]> resultats = access.Manager.ReqSelect(req);
if (resultats != null)
{
foreach (Object[] resultat in resultats)
{
Service service = new Service(
Convert.ToInt32(resultat[0]), // IdService
Convert.ToString(resultat[1]) // Nom
);
serviceList.Add(service);
}
}
}
catch (Exception)
{
Console.WriteLine("Erreur lors de la récupération des données des services.");
Environment.Exit(0);
}
}
return serviceList;
}
}
}

View file

@ -1,6 +1,6 @@
using System;
namespace Habilitations.modele
namespace projet.modele
{
/// <summary>
/// Représente une absence d'un personnel.

View file

@ -1,4 +1,4 @@
namespace Habilitations.modele
namespace projet.modele
{
/// <summary>
/// Représente un motif d'absence

View file

@ -1,4 +1,4 @@
namespace Habilitations.modele
namespace projet.modele
{
/// <summary>
/// Représente un membre du personnel
@ -35,5 +35,10 @@
Mail = mail;
IdService = idService;
}
public override string ToString()
{
return $"{this.Nom} {this.Prenom}";
}
}
}

View file

@ -1,4 +1,4 @@
namespace Habilitations.modele
namespace projet.modele
{
/// <summary>
/// Représente un responsable (admin)

View file

@ -10,10 +10,6 @@
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<Folder Include="Controller\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MySql.Data" Version="9.3.0" />
</ItemGroup>