Création de la doc technique (à refaire), création des modeles et de bddmanager
This commit is contained in:
parent
3e1954a97c
commit
cae9989175
15 changed files with 310 additions and 3 deletions
BIN
projet/Help.zip
Normal file
BIN
projet/Help.zip
Normal file
Binary file not shown.
2
projet/View/Admin.Designer.cs
generated
2
projet/View/Admin.Designer.cs
generated
|
|
@ -17,7 +17,7 @@
|
|||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
//private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
|
|
|
|||
1
projet/View/ModifierPersonne.Designer.cs
generated
1
projet/View/ModifierPersonne.Designer.cs
generated
|
|
@ -24,7 +24,6 @@
|
|||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
|
|
|
|||
105
projet/bddmanager/BddManager.cs
Normal file
105
projet/bddmanager/BddManager.cs
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Habilitations.bddmanager
|
||||
{
|
||||
/// <summary>
|
||||
/// Singleton : connexion à la base de données et exécution des requêtes
|
||||
/// </summary>
|
||||
public class BddManager
|
||||
{
|
||||
/// <summary>
|
||||
/// instance unique de la classe
|
||||
/// </summary>
|
||||
private static BddManager instance = null;
|
||||
/// <summary>
|
||||
/// objet de connexion à la BDD à partir d'une chaîne de connexion
|
||||
/// </summary>
|
||||
private readonly MySqlConnection connection;
|
||||
|
||||
/// <summary>
|
||||
/// Constructeur pour créer la connexion à la BDD et l'ouvrir
|
||||
/// </summary>
|
||||
/// <param name="stringConnect">chaine de connexion</param>
|
||||
private BddManager(string stringConnect)
|
||||
{
|
||||
connection = new MySqlConnection(stringConnect);
|
||||
connection.Open();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Création d'une seule instance de la classe
|
||||
/// </summary>
|
||||
/// <param name="stringConnect">chaine de connexion</param>
|
||||
/// <returns>instance unique de la classe</returns>
|
||||
public static BddManager GetInstance(string stringConnect)
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new BddManager(stringConnect);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exécution d'une requête de type LCT (begin transaction...)
|
||||
/// </summary>
|
||||
/// <param name="stringQuery">requête</param>
|
||||
public void ReqControle(string stringQuery)
|
||||
{
|
||||
MySqlCommand command = new MySqlCommand(stringQuery, connection);
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exécution d'une requête de type LMD (insert, update, delete)
|
||||
/// </summary>
|
||||
/// <param name="stringQuery">requête</param>
|
||||
/// <param name="parameters">dictionnire contenant les parametres</param>
|
||||
public void ReqUpdate(string stringQuery, Dictionary<string, object> parameters = null)
|
||||
{
|
||||
MySqlCommand command = new MySqlCommand(stringQuery, connection);
|
||||
if (!(parameters is null))
|
||||
{
|
||||
foreach (KeyValuePair<string, object> parameter in parameters)
|
||||
{
|
||||
command.Parameters.Add(new MySqlParameter(parameter.Key, parameter.Value));
|
||||
}
|
||||
}
|
||||
command.Prepare();
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execution d'une requête de type LID (select)
|
||||
/// </summary>
|
||||
/// <param name="stringQuery">requête</param>
|
||||
/// <param name="parameters">dictoinnaire contenant les parametres</param>
|
||||
/// <returns>liste de tableaux d'objets contenant les valeurs des colonnes</returns>
|
||||
public List<Object[]> ReqSelect(string stringQuery, Dictionary<string, object> parameters = null)
|
||||
{
|
||||
MySqlCommand command = new MySqlCommand(stringQuery, connection);
|
||||
if (!(parameters is null))
|
||||
{
|
||||
foreach (KeyValuePair<string, object> parameter in parameters)
|
||||
{
|
||||
command.Parameters.Add(new MySqlParameter(parameter.Key, parameter.Value));
|
||||
}
|
||||
}
|
||||
command.Prepare();
|
||||
MySqlDataReader reader = command.ExecuteReader();
|
||||
int nbCols = reader.FieldCount;
|
||||
List<Object[]> records = new List<object[]>();
|
||||
while (reader.Read())
|
||||
{
|
||||
Object[] attributs = new Object[nbCols];
|
||||
reader.GetValues(attributs);
|
||||
records.Add(attributs);
|
||||
}
|
||||
reader.Close();
|
||||
return records;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
12
projet/dal/AbsenceAccess.cs
Normal file
12
projet/dal/AbsenceAccess.cs
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
projet/dal/MotifAccess.cs
Normal file
12
projet/dal/MotifAccess.cs
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
projet/dal/PersonnelAccess.cs
Normal file
12
projet/dal/PersonnelAccess.cs
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
projet/dal/ResponsableAccess.cs
Normal file
12
projet/dal/ResponsableAccess.cs
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
projet/dal/ServiceAccess.cs
Normal file
12
projet/dal/ServiceAccess.cs
Normal file
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
projet/modele/Absence.cs
Normal file
33
projet/modele/Absence.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
|
||||
namespace Habilitations.modele
|
||||
{
|
||||
/// <summary>
|
||||
/// Représente une absence d'un personnel.
|
||||
/// </summary>
|
||||
public class Absence
|
||||
{
|
||||
/// <summary>Identifiant du personnel</summary>
|
||||
public int IdPersonnel { get; set; }
|
||||
|
||||
/// <summary>Date de début de l'absence</summary>
|
||||
public DateTime DateDebut { get; set; }
|
||||
|
||||
/// <summary>Date de fin de l'absence (peut être null)</summary>
|
||||
public DateTime? DateFin { get; set; }
|
||||
|
||||
/// <summary>Identifiant du motif d'absence</summary>
|
||||
public int IdMotif { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructeur de la classe Absence
|
||||
/// </summary>
|
||||
public Absence(int idPersonnel, DateTime dateDebut, DateTime? dateFin, int idMotif)
|
||||
{
|
||||
IdPersonnel = idPersonnel;
|
||||
DateDebut = dateDebut;
|
||||
DateFin = dateFin;
|
||||
IdMotif = idMotif;
|
||||
}
|
||||
}
|
||||
}
|
||||
23
projet/modele/Motif.cs
Normal file
23
projet/modele/Motif.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
namespace Habilitations.modele
|
||||
{
|
||||
/// <summary>
|
||||
/// Représente un motif d'absence
|
||||
/// </summary>
|
||||
public class Motif
|
||||
{
|
||||
/// <summary>Identifiant du motif</summary>
|
||||
public int IdMotif { get; set; }
|
||||
|
||||
/// <summary>Libellé du motif</summary>
|
||||
public string Libelle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructeur de la classe Motif
|
||||
/// </summary>
|
||||
public Motif(int idMotif, string libelle)
|
||||
{
|
||||
IdMotif = idMotif;
|
||||
Libelle = libelle;
|
||||
}
|
||||
}
|
||||
}
|
||||
39
projet/modele/Personnel.cs
Normal file
39
projet/modele/Personnel.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
namespace Habilitations.modele
|
||||
{
|
||||
/// <summary>
|
||||
/// Représente un membre du personnel
|
||||
/// </summary>
|
||||
public class Personnel
|
||||
{
|
||||
/// <summary>Identifiant du personnel</summary>
|
||||
public int IdPersonnel { get; set; }
|
||||
|
||||
/// <summary>Nom du personnel</summary>
|
||||
public string Nom { get; set; }
|
||||
|
||||
/// <summary>Prénom du personnel</summary>
|
||||
public string Prenom { get; set; }
|
||||
|
||||
/// <summary>Numéro de téléphone</summary>
|
||||
public string Tel { get; set; }
|
||||
|
||||
/// <summary>Adresse e-mail</summary>
|
||||
public string Mail { get; set; }
|
||||
|
||||
/// <summary>Identifiant du service</summary>
|
||||
public int IdService { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructeur de la classe Personnel
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
23
projet/modele/Responsable.cs
Normal file
23
projet/modele/Responsable.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
namespace Habilitations.modele
|
||||
{
|
||||
/// <summary>
|
||||
/// Représente un responsable (admin)
|
||||
/// </summary>
|
||||
public class Responsable
|
||||
{
|
||||
/// <summary>Nom d'utilisateur</summary>
|
||||
public string Login { get; set; }
|
||||
|
||||
/// <summary>Mot de passe chiffré</summary>
|
||||
public string Pwd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructeur de la classe Responsable
|
||||
/// </summary>
|
||||
public Responsable(string login, string pwd)
|
||||
{
|
||||
Login = login;
|
||||
Pwd = pwd;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
projet/modele/Service.cs
Normal file
20
projet/modele/Service.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/// <summary>
|
||||
/// Représente un service dans l'organisation
|
||||
/// </summary>
|
||||
public class Service
|
||||
{
|
||||
/// <summary>Identifiant du service</summary>
|
||||
public int IdService { get; set; }
|
||||
|
||||
/// <summary>Nom du service</summary>
|
||||
public string Nom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructeur de la classe Service
|
||||
/// </summary>
|
||||
public Service(int idService, string nom)
|
||||
{
|
||||
IdService = idService;
|
||||
Nom = nom;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,11 +6,16 @@
|
|||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<BaseOutputPath>C:\Users\erwan\OneDrive\1 BTS SIO\Professionalisation\Doc</BaseOutputPath>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Model\" />
|
||||
<Folder Include="Controller\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MySql.Data" Version="9.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Loading…
Reference in a new issue