diff --git a/projet/Help.zip b/projet/Help.zip new file mode 100644 index 0000000..1feae9c Binary files /dev/null and b/projet/Help.zip differ diff --git a/projet/View/Admin.Designer.cs b/projet/View/Admin.Designer.cs index 546bff1..10b7e52 100644 --- a/projet/View/Admin.Designer.cs +++ b/projet/View/Admin.Designer.cs @@ -17,7 +17,7 @@ /// /// Required designer variable. /// - private System.ComponentModel.IContainer components = null; + //private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. diff --git a/projet/View/ModifierPersonne.Designer.cs b/projet/View/ModifierPersonne.Designer.cs index 59ba48d..4bac009 100644 --- a/projet/View/ModifierPersonne.Designer.cs +++ b/projet/View/ModifierPersonne.Designer.cs @@ -24,7 +24,6 @@ /// /// Required designer variable. /// - private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. diff --git a/projet/bddmanager/BddManager.cs b/projet/bddmanager/BddManager.cs new file mode 100644 index 0000000..6d5cd67 --- /dev/null +++ b/projet/bddmanager/BddManager.cs @@ -0,0 +1,105 @@ +using MySql.Data.MySqlClient; +using System; +using System.Collections.Generic; + +namespace Habilitations.bddmanager +{ + /// + /// Singleton : connexion à la base de données et exécution des requêtes + /// + public class BddManager + { + /// + /// instance unique de la classe + /// + private static BddManager instance = null; + /// + /// objet de connexion à la BDD à partir d'une chaîne de connexion + /// + private readonly MySqlConnection connection; + + /// + /// Constructeur pour créer la connexion à la BDD et l'ouvrir + /// + /// chaine de connexion + private BddManager(string stringConnect) + { + connection = new MySqlConnection(stringConnect); + connection.Open(); + } + + /// + /// Création d'une seule instance de la classe + /// + /// chaine de connexion + /// instance unique de la classe + public static BddManager GetInstance(string stringConnect) + { + if (instance == null) + { + instance = new BddManager(stringConnect); + } + return instance; + } + + /// + /// Exécution d'une requête de type LCT (begin transaction...) + /// + /// requête + public void ReqControle(string stringQuery) + { + MySqlCommand command = new MySqlCommand(stringQuery, connection); + command.ExecuteNonQuery(); + } + + /// + /// Exécution d'une requête de type LMD (insert, update, delete) + /// + /// requête + /// dictionnire contenant les parametres + public void ReqUpdate(string stringQuery, Dictionary parameters = null) + { + MySqlCommand command = new MySqlCommand(stringQuery, connection); + if (!(parameters is null)) + { + foreach (KeyValuePair parameter in parameters) + { + command.Parameters.Add(new MySqlParameter(parameter.Key, parameter.Value)); + } + } + command.Prepare(); + command.ExecuteNonQuery(); + } + + /// + /// Execution d'une requête de type LID (select) + /// + /// requête + /// dictoinnaire contenant les parametres + /// liste de tableaux d'objets contenant les valeurs des colonnes + public List ReqSelect(string stringQuery, Dictionary parameters = null) + { + MySqlCommand command = new MySqlCommand(stringQuery, connection); + if (!(parameters is null)) + { + foreach (KeyValuePair parameter in parameters) + { + command.Parameters.Add(new MySqlParameter(parameter.Key, parameter.Value)); + } + } + command.Prepare(); + MySqlDataReader reader = command.ExecuteReader(); + int nbCols = reader.FieldCount; + List records = new List(); + while (reader.Read()) + { + Object[] attributs = new Object[nbCols]; + reader.GetValues(attributs); + records.Add(attributs); + } + reader.Close(); + return records; + } + + } +} \ No newline at end of file diff --git a/projet/dal/AbsenceAccess.cs b/projet/dal/AbsenceAccess.cs new file mode 100644 index 0000000..82d8973 --- /dev/null +++ b/projet/dal/AbsenceAccess.cs @@ -0,0 +1,12 @@ +namespace Habilitations.dal +{ + public class AbsenceAccess + { + private static readonly string connectionString = "server=localhost;user id=root;password=;database=mediatek;"; + + public static string GetConnexion() + { + return connectionString; + } + } +} diff --git a/projet/dal/MotifAccess.cs b/projet/dal/MotifAccess.cs new file mode 100644 index 0000000..0d9d831 --- /dev/null +++ b/projet/dal/MotifAccess.cs @@ -0,0 +1,12 @@ +namespace Habilitations.dal +{ + public class MotifAccess + { + private static readonly string connectionString = "server=localhost;user id=root;password=;database=mediatek;"; + + public static string GetConnexion() + { + return connectionString; + } + } +} diff --git a/projet/dal/PersonnelAccess.cs b/projet/dal/PersonnelAccess.cs new file mode 100644 index 0000000..eb6f1d8 --- /dev/null +++ b/projet/dal/PersonnelAccess.cs @@ -0,0 +1,12 @@ +namespace Habilitations.dal +{ + public class PersonnelAccess + { + private static readonly string connectionString = "server=localhost;user id=root;password=;database=mediatek;"; + + public static string GetConnexion() + { + return connectionString; + } + } +} diff --git a/projet/dal/ResponsableAccess.cs b/projet/dal/ResponsableAccess.cs new file mode 100644 index 0000000..bb4faf7 --- /dev/null +++ b/projet/dal/ResponsableAccess.cs @@ -0,0 +1,12 @@ +namespace Habilitations.dal +{ + public class ResponsableAccess + { + private static readonly string connectionString = "server=localhost;user id=root;password=;database=mediatek;"; + + public static string GetConnexion() + { + return connectionString; + } + } +} diff --git a/projet/dal/ServiceAccess.cs b/projet/dal/ServiceAccess.cs new file mode 100644 index 0000000..59d3d72 --- /dev/null +++ b/projet/dal/ServiceAccess.cs @@ -0,0 +1,12 @@ +namespace Habilitations.dal +{ + public class ServiceAccess + { + private static readonly string connectionString = "server=localhost;user id=root;password=;database=mediatek;"; + + public static string GetConnexion() + { + return connectionString; + } + } +} diff --git a/projet/modele/Absence.cs b/projet/modele/Absence.cs new file mode 100644 index 0000000..20ee12b --- /dev/null +++ b/projet/modele/Absence.cs @@ -0,0 +1,33 @@ +using System; + +namespace Habilitations.modele +{ + /// + /// Représente une absence d'un personnel. + /// + public class Absence + { + /// Identifiant du personnel + public int IdPersonnel { get; set; } + + /// Date de début de l'absence + public DateTime DateDebut { get; set; } + + /// Date de fin de l'absence (peut être null) + public DateTime? DateFin { get; set; } + + /// Identifiant du motif d'absence + public int IdMotif { get; set; } + + /// + /// Constructeur de la classe Absence + /// + public Absence(int idPersonnel, DateTime dateDebut, DateTime? dateFin, int idMotif) + { + IdPersonnel = idPersonnel; + DateDebut = dateDebut; + DateFin = dateFin; + IdMotif = idMotif; + } + } +} diff --git a/projet/modele/Motif.cs b/projet/modele/Motif.cs new file mode 100644 index 0000000..bd90ec7 --- /dev/null +++ b/projet/modele/Motif.cs @@ -0,0 +1,23 @@ +namespace Habilitations.modele +{ + /// + /// Représente un motif d'absence + /// + public class Motif + { + /// Identifiant du motif + public int IdMotif { get; set; } + + /// Libellé du motif + public string Libelle { get; set; } + + /// + /// Constructeur de la classe Motif + /// + public Motif(int idMotif, string libelle) + { + IdMotif = idMotif; + Libelle = libelle; + } + } +} diff --git a/projet/modele/Personnel.cs b/projet/modele/Personnel.cs new file mode 100644 index 0000000..72585e4 --- /dev/null +++ b/projet/modele/Personnel.cs @@ -0,0 +1,39 @@ +namespace Habilitations.modele +{ + /// + /// Représente un membre du personnel + /// + public class Personnel + { + /// Identifiant du personnel + public int IdPersonnel { get; set; } + + /// Nom du personnel + public string Nom { get; set; } + + /// Prénom du personnel + public string Prenom { get; set; } + + /// Numéro de téléphone + public string Tel { get; set; } + + /// Adresse e-mail + public string Mail { get; set; } + + /// Identifiant du service + public int IdService { get; set; } + + /// + /// Constructeur de la classe Personnel + /// + public Personnel(int idPersonnel, string nom, string prenom, string tel, string mail, int idService) + { + IdPersonnel = idPersonnel; + Nom = nom; + Prenom = prenom; + Tel = tel; + Mail = mail; + IdService = idService; + } + } +} diff --git a/projet/modele/Responsable.cs b/projet/modele/Responsable.cs new file mode 100644 index 0000000..69b35a4 --- /dev/null +++ b/projet/modele/Responsable.cs @@ -0,0 +1,23 @@ +namespace Habilitations.modele +{ + /// + /// Représente un responsable (admin) + /// + public class Responsable + { + /// Nom d'utilisateur + public string Login { get; set; } + + /// Mot de passe chiffré + public string Pwd { get; set; } + + /// + /// Constructeur de la classe Responsable + /// + public Responsable(string login, string pwd) + { + Login = login; + Pwd = pwd; + } + } +} diff --git a/projet/modele/Service.cs b/projet/modele/Service.cs new file mode 100644 index 0000000..348d12f --- /dev/null +++ b/projet/modele/Service.cs @@ -0,0 +1,20 @@ +/// +/// Représente un service dans l'organisation +/// +public class Service +{ + /// Identifiant du service + public int IdService { get; set; } + + /// Nom du service + public string Nom { get; set; } + + /// + /// Constructeur de la classe Service + /// + public Service(int idService, string nom) + { + IdService = idService; + Nom = nom; + } +} \ No newline at end of file diff --git a/projet/projet.csproj b/projet/projet.csproj index 74cfa03..c412b33 100644 --- a/projet/projet.csproj +++ b/projet/projet.csproj @@ -6,11 +6,16 @@ enable true enable + C:\Users\erwan\OneDrive\1 BTS SIO\Professionalisation\Doc + True - + + + + \ No newline at end of file