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

View file

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

View file

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

View file

@ -1,4 +1,6 @@
using System; using projet.Controller;
using projet.modele;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
@ -12,9 +14,65 @@ namespace projet.View
{ {
public partial class Admin : Form public partial class Admin : Form
{ {
private AdminController controller;
public Admin() public Admin()
{ {
Init();
InitializeComponent(); 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> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.pictureBoxTop = new System.Windows.Forms.PictureBox(); pictureBoxTop = new PictureBox();
this.pictureBoxBottom = new System.Windows.Forms.PictureBox(); pictureBoxBottom = new PictureBox();
this.labelTitle = new System.Windows.Forms.Label(); labelTitle = new Label();
this.buttonAnnuler = new System.Windows.Forms.Button(); buttonAnnuler = new Button();
this.buttonConfirmer = new System.Windows.Forms.Button(); buttonConfirmer = new Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTop)).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxTop).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxBottom)).BeginInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxBottom).BeginInit();
this.SuspendLayout(); SuspendLayout();
// //
// pictureBoxTop // pictureBoxTop
// //
this.pictureBoxTop.BackColor = System.Drawing.Color.SteelBlue; pictureBoxTop.BackColor = Color.SteelBlue;
this.pictureBoxTop.Dock = System.Windows.Forms.DockStyle.Top; pictureBoxTop.Dock = DockStyle.Top;
this.pictureBoxTop.Location = new System.Drawing.Point(0, 0); pictureBoxTop.Location = new Point(0, 0);
this.pictureBoxTop.Name = "pictureBoxTop"; pictureBoxTop.Name = "pictureBoxTop";
this.pictureBoxTop.Size = new System.Drawing.Size(800, 180); pictureBoxTop.Size = new Size(800, 180);
this.pictureBoxTop.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; pictureBoxTop.SizeMode = PictureBoxSizeMode.StretchImage;
this.pictureBoxTop.TabIndex = 0; pictureBoxTop.TabIndex = 0;
this.pictureBoxTop.TabStop = false; pictureBoxTop.TabStop = false;
// //
// pictureBoxBottom // pictureBoxBottom
// //
this.pictureBoxBottom.BackColor = System.Drawing.Color.SteelBlue; pictureBoxBottom.BackColor = Color.SteelBlue;
this.pictureBoxBottom.Dock = System.Windows.Forms.DockStyle.Bottom; pictureBoxBottom.Dock = DockStyle.Bottom;
this.pictureBoxBottom.Location = new System.Drawing.Point(0, 520); pictureBoxBottom.Location = new Point(0, 520);
this.pictureBoxBottom.Name = "pictureBoxBottom"; pictureBoxBottom.Name = "pictureBoxBottom";
this.pictureBoxBottom.Size = new System.Drawing.Size(800, 140); pictureBoxBottom.Size = new Size(800, 140);
this.pictureBoxBottom.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; pictureBoxBottom.SizeMode = PictureBoxSizeMode.StretchImage;
this.pictureBoxBottom.TabIndex = 1; pictureBoxBottom.TabIndex = 1;
this.pictureBoxBottom.TabStop = false; pictureBoxBottom.TabStop = false;
// //
// labelTitle // labelTitle
// //
this.labelTitle.Font = new System.Drawing.Font("Segoe UI", 20F); labelTitle.Font = new Font("Segoe UI", 20F);
this.labelTitle.Location = new System.Drawing.Point(0, 180); labelTitle.Location = new Point(0, 180);
this.labelTitle.Name = "labelTitle"; labelTitle.Name = "labelTitle";
this.labelTitle.Size = new System.Drawing.Size(800, 50); labelTitle.Size = new Size(800, 50);
this.labelTitle.TabIndex = 2; labelTitle.TabIndex = 2;
this.labelTitle.Text = "Voulez vous vraiment supprimer : PRÉNOM"; labelTitle.Text = "Voulez vous vraiment supprimer : PRÉNOM";
this.labelTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; labelTitle.TextAlign = ContentAlignment.MiddleCenter;
// //
// buttonAnnuler // buttonAnnuler
// //
this.buttonAnnuler.Font = new System.Drawing.Font("Segoe UI", 10F); buttonAnnuler.Font = new Font("Segoe UI", 10F);
this.buttonAnnuler.Location = new System.Drawing.Point(200, 260); buttonAnnuler.Location = new Point(200, 260);
this.buttonAnnuler.Name = "buttonAnnuler"; buttonAnnuler.Name = "buttonAnnuler";
this.buttonAnnuler.Size = new System.Drawing.Size(100, 30); buttonAnnuler.Size = new Size(100, 30);
this.buttonAnnuler.TabIndex = 3; buttonAnnuler.TabIndex = 3;
this.buttonAnnuler.Text = "Annuler"; buttonAnnuler.Text = "Annuler";
this.buttonAnnuler.UseVisualStyleBackColor = true; buttonAnnuler.UseVisualStyleBackColor = true;
buttonAnnuler.Click += buttonAnnuler_Click;
// //
// buttonConfirmer // buttonConfirmer
// //
this.buttonConfirmer.Font = new System.Drawing.Font("Segoe UI", 10F); buttonConfirmer.Font = new Font("Segoe UI", 10F);
this.buttonConfirmer.Location = new System.Drawing.Point(500, 260); buttonConfirmer.Location = new Point(500, 260);
this.buttonConfirmer.Name = "buttonConfirmer"; buttonConfirmer.Name = "buttonConfirmer";
this.buttonConfirmer.Size = new System.Drawing.Size(100, 30); buttonConfirmer.Size = new Size(100, 30);
this.buttonConfirmer.TabIndex = 4; buttonConfirmer.TabIndex = 4;
this.buttonConfirmer.Text = "Confirmer"; buttonConfirmer.Text = "Confirmer";
this.buttonConfirmer.UseVisualStyleBackColor = true; buttonConfirmer.UseVisualStyleBackColor = true;
buttonConfirmer.Click += buttonConfirmer_Click;
// //
// ConfirmeSupressionPersonnel // ConfirmeSupressionPersonnel
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 660); ClientSize = new Size(800, 660);
this.Controls.Add(this.pictureBoxTop); Controls.Add(pictureBoxTop);
this.Controls.Add(this.pictureBoxBottom); Controls.Add(pictureBoxBottom);
this.Controls.Add(this.labelTitle); Controls.Add(labelTitle);
this.Controls.Add(this.buttonAnnuler); Controls.Add(buttonAnnuler);
this.Controls.Add(this.buttonConfirmer); Controls.Add(buttonConfirmer);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; FormBorderStyle = FormBorderStyle.FixedSingle;
this.MaximizeBox = false; MaximizeBox = false;
this.Name = "ConfirmeSupressionPersonnel"; Name = "ConfirmeSupressionPersonnel";
this.Text = "Confirmation suppression"; Text = "Confirmation suppression";
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTop)).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxTop).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxBottom)).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxBottom).EndInit();
this.ResumeLayout(false); ResumeLayout(false);
} }
#endregion #endregion

View file

@ -1,4 +1,6 @@
using System; using projet.Controller;
using projet.modele;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
@ -12,9 +14,36 @@ namespace projet.View
{ {
public partial class ConfirmeSupressionPersonnel : Form public partial class ConfirmeSupressionPersonnel : Form
{ {
public ConfirmeSupressionPersonnel() private ConfirmeSupressionPersonnelController controller;
private Personnel personne;
public ConfirmeSupressionPersonnel(Personnel personne)
{ {
Init();
InitializeComponent(); 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.Name = "textBoxLogin";
textBoxLogin.Size = new Size(200, 23); textBoxLogin.Size = new Size(200, 23);
textBoxLogin.TabIndex = 3; textBoxLogin.TabIndex = 3;
textBoxLogin.TextChanged += textBoxLogin_TextChanged;
// //
// labelPassword // labelPassword
// //
@ -133,8 +132,9 @@
buttonLogin.Size = new Size(100, 23); buttonLogin.Size = new Size(100, 23);
buttonLogin.TabIndex = 8; buttonLogin.TabIndex = 8;
buttonLogin.Text = "Se connecter"; buttonLogin.Text = "Se connecter";
buttonLogin.Click += buttonLogin_Click;
// //
// Form1 // PageConnexion
// //
ClientSize = new Size(886, 600); ClientSize = new Size(886, 600);
Controls.Add(pictureBoxHeader); Controls.Add(pictureBoxHeader);
@ -148,7 +148,7 @@
Controls.Add(buttonLogin); Controls.Add(buttonLogin);
FormBorderStyle = FormBorderStyle.FixedSingle; FormBorderStyle = FormBorderStyle.FixedSingle;
MaximizeBox = false; MaximizeBox = false;
Name = "Form1"; Name = "PageConnexion";
((System.ComponentModel.ISupportInitialize)pictureBoxHeader).EndInit(); ((System.ComponentModel.ISupportInitialize)pictureBoxHeader).EndInit();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();

View file

@ -1,4 +1,6 @@
using System; using projet.modele;
using projet.Controller;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
@ -12,14 +14,52 @@ namespace projet.View
{ {
public partial class PageConnexion : Form public partial class PageConnexion : Form
{ {
private PageConnexionController controller;
public PageConnexion() public PageConnexion()
{ {
Init();
InitializeComponent(); 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;
using System.Collections.Generic; using System.Collections.Generic;
namespace Habilitations.bddmanager namespace projet.bddmanager
{ {
/// <summary> /// <summary>
/// Singleton : connexion à la base de données et exécution des requêtes /// 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 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 public class MotifAccess
{ {

View file

@ -1,12 +1,93 @@
namespace Habilitations.dal using projet.modele;
namespace projet.dal
{ {
public class PersonnelAccess 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 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 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; using System;
namespace Habilitations.modele namespace projet.modele
{ {
/// <summary> /// <summary>
/// Représente une absence d'un personnel. /// Représente une absence d'un personnel.

View file

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

View file

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

View file

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

View file

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