From 0846f4e1b29da09c77af0b9d8f89aa35f4dbc430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Wed, 19 Aug 2020 15:03:33 +0200 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20des=20mod=C3=A8les=20et=20du=20?= =?UTF-8?q?code=20qui=20permet=20de=20cr=C3=A9er=20la=20base=20de=20donn?= =?UTF-8?q?=C3=A9es=20en=20code=20first?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 + Context/EpContext.cs | 167 ++++++++++++++++++ .../CollaborateurControlleur.cs | 22 --- Controllers/EpController/EPController.cs | 37 ---- .../FormationController.cs | 82 --------- .../ProfilController/ProfilController.cs | 15 -- EPAServeur.csproj | 5 +- Modele/CollaborateurModele/Collaborateur.cs | 29 --- Modele/EpModele/EP.cs | 25 --- Modele/FormationModele/Formation.cs | 79 --------- Modele/ProfilModele/Profil.cs | 11 -- Models/EP/AugmentationSalaire.cs | 16 ++ Models/EP/Autorisation.cs | 15 ++ Models/EP/ChoixTypeEntretien.cs | 15 ++ Models/EP/Delegation.cs | 19 ++ Models/EP/Document.cs | 16 ++ Models/EP/Engagement.cs | 20 +++ Models/EP/Ep.cs | 55 ++++++ Models/EP/Objectif.cs | 14 ++ Models/EP/ObjectifPrecedent.cs | 15 ++ Models/EP/ParticipantEP.cs | 14 ++ Models/EP/RdvEntretien.cs | 16 ++ Models/EP/TypeEntretien.cs | 15 ++ Models/Formation/DemandeFormation.cs | 21 +++ Models/Formation/Formation.cs | 21 +++ Models/Formation/ParticipationFormation.cs | 19 ++ Models/Formation/StatutFormation.cs | 14 ++ Models/Formation/Theme.cs | 13 ++ Models/Notes/Note.cs | 16 ++ Models/SaisieChamp/Champ.cs | 26 +++ Models/SaisieChamp/Saisie.cs | 26 +++ Program.cs | 11 +- 32 files changed, 570 insertions(+), 303 deletions(-) create mode 100644 Context/EpContext.cs delete mode 100644 Controllers/CollaborateurController/CollaborateurControlleur.cs delete mode 100644 Controllers/EpController/EPController.cs delete mode 100644 Controllers/FormationController/FormationController.cs delete mode 100644 Controllers/ProfilController/ProfilController.cs delete mode 100644 Modele/CollaborateurModele/Collaborateur.cs delete mode 100644 Modele/EpModele/EP.cs delete mode 100644 Modele/FormationModele/Formation.cs delete mode 100644 Modele/ProfilModele/Profil.cs create mode 100644 Models/EP/AugmentationSalaire.cs create mode 100644 Models/EP/Autorisation.cs create mode 100644 Models/EP/ChoixTypeEntretien.cs create mode 100644 Models/EP/Delegation.cs create mode 100644 Models/EP/Document.cs create mode 100644 Models/EP/Engagement.cs create mode 100644 Models/EP/Ep.cs create mode 100644 Models/EP/Objectif.cs create mode 100644 Models/EP/ObjectifPrecedent.cs create mode 100644 Models/EP/ParticipantEP.cs create mode 100644 Models/EP/RdvEntretien.cs create mode 100644 Models/EP/TypeEntretien.cs create mode 100644 Models/Formation/DemandeFormation.cs create mode 100644 Models/Formation/Formation.cs create mode 100644 Models/Formation/ParticipationFormation.cs create mode 100644 Models/Formation/StatutFormation.cs create mode 100644 Models/Formation/Theme.cs create mode 100644 Models/Notes/Note.cs create mode 100644 Models/SaisieChamp/Champ.cs create mode 100644 Models/SaisieChamp/Saisie.cs diff --git a/.gitignore b/.gitignore index 4ce6fdd..5d4f348 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,10 @@ bld/ # Visual Studio 2015/2017 cache/options directory .vs/ + +# Visual Code +.vscode/ + # Uncomment if you have tasks that create the project's static files in wwwroot #wwwroot/ diff --git a/Context/EpContext.cs b/Context/EpContext.cs new file mode 100644 index 0000000..42ba59c --- /dev/null +++ b/Context/EpContext.cs @@ -0,0 +1,167 @@ +using EPAServeur.Models.EP; +using EPAServeur.Models.Formation; +using EPAServeur.Models.Notes; +using EPAServeur.Models.SaisieChamp; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Context +{ + public class EpContext : DbContext + { + //EP + public DbSet AugmentationSalaire { get; set; } + public DbSet Autorisation { get; set; } + public DbSet ChoixTypeEntretien { get; set; } + public DbSet Document { get; set; } + public DbSet Engagement { get; set; } + public DbSet Ep { get; set; } + public DbSet Objectifs { get; set; } + public DbSet ObjectifPrecedents { get; set; } + public DbSet RdvEntretiens { get; set; } + public DbSet TypeEntretien { get; set; } + + //Formation + public DbSet DemandeFormation { get; set; } + public DbSet Formation { get; set; } + public DbSet ParticipationFormation { get; set; } + public DbSet StatutFormation { get; set; } + public DbSet Theme { get; set; } + + //Note + public DbSet Note { get; set; } + + //SaisieChamp + public DbSet Champ { get; set; } + public DbSet Saisie { get; set; } + + + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder.UseMySQL("server=localhost;database=server_ep;user=root;password=root");//PENSER A METTRE DANS UN FICHIER DE CONFIG + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + //EP + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.HasOne(e => e.AugmentationSalaire).WithOne(a => a.Ep).HasForeignKey(a => a.EpId); + entity.HasOne(e => e.Autorisation).WithOne( a => a.Ep).HasForeignKey(a => a.EpId); + entity.HasMany(e => e.ChoixTypeEntretien).WithOne(c => c.Ep); + entity.HasOne(e => e.Delegation).WithOne(d => d.Ep).HasForeignKey(d => d.EpId); + entity.HasMany(e => e.DemandesFormation).WithOne(d => d.Ep); + entity.HasMany(e => e.Documents).WithOne(d => d.Ep); + entity.HasMany(e => e.Engagements).WithOne(e => e.Ep); + entity.HasMany(e => e.Objectifs).WithOne(o => o.Ep); + entity.HasMany(e => e.ObjectifsPrecedents).WithOne(o => o.Ep); + entity.HasMany(e => e.Participants).WithOne(p => p.Ep); + entity.HasOne(e => e.RdvEntretien).WithOne(r => r.EpChoixFinal).HasForeignKey(r => r.EpId); + entity.HasMany(e => e.PropositionsRDV).WithOne(r => r.EpProposition); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + }); + + //Formation + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + //Notes + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + //SaisieChamp + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id); + entity.Property(e => e.Id).ValueGeneratedOnAdd(); + }); + } + } +} diff --git a/Controllers/CollaborateurController/CollaborateurControlleur.cs b/Controllers/CollaborateurController/CollaborateurControlleur.cs deleted file mode 100644 index dbfabdb..0000000 --- a/Controllers/CollaborateurController/CollaborateurControlleur.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Collections.Generic; -using EPAServeur.BDAccess; -using EPAServeur.CollaborateurModele.Collaborateur; -using EPAServeur.Commun; -using Microsoft.AspNetCore.Mvc; -using MySql.Data.MySqlClient; - -namespace EPAServeur.Controllers.CollaborateurController -{ - [Route("api/")] - [ApiController] - public class CollaborateurControlleur : ControllerBase - { - [HttpGet("collaborateurs")] - public IEnumerable Get(string token) - { - KeycloakAuthentificator.IsvalidToken(token); - List liste = APIAccess.requestGetAPI("/personne"); - return liste; - } - } -} diff --git a/Controllers/EpController/EPController.cs b/Controllers/EpController/EPController.cs deleted file mode 100644 index 26ade24..0000000 --- a/Controllers/EpController/EPController.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using EPAServeur.Commun; -using EPAServeur.Modele.EpModele; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using MySql.Data.MySqlClient; -using Org.BouncyCastle.Bcpg; - -namespace EPAServeur.Controllers.EpController -{ - [Route("api/ep/")] - [ApiController] - public class EPController : ControllerBase - { - [HttpGet("evaluation")] - public IEnumerable Get(string token) - { - KeycloakAuthentificator.IsvalidToken(token); - List retour = new List(); - string query = "select ce.Libelle, ev.note, ev.Commentaire" + - " from participation_formation pf " + - " inner join Evaluation ev on pf.IdParticipation = ev.IdParticipation " + - " inner join critere_evaluation ce on ce.IdCritère = ev.IdCritère " + - " inner join ep on ep.IdEP = pf.IdEP " + - " left join participant p on(p.IdEP = ep.IdEP and p.idRole = 'collaborateur');"; - MySqlDataReader liste = BDAccess.BDAccess.executeQuery(query); - while (liste.Read()) - { - retour.Add(new evaluation((string) liste.GetValue(0), int.Parse((string)liste.GetValue(1)), (string) liste.GetValue(2))); - } - return retour; - } - } -} diff --git a/Controllers/FormationController/FormationController.cs b/Controllers/FormationController/FormationController.cs deleted file mode 100644 index 5c09f1e..0000000 --- a/Controllers/FormationController/FormationController.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using EPAServeur.Commun; -using EPAServeur.Modele.FormationModele; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using MySql.Data.MySqlClient; - -namespace EPAServeur.Controllers.FormationController -{ - [Route("api/")] - [ApiController] - public class FormationController : ControllerBase - { - [HttpGet("formations")] - public IEnumerable Get(string token) - { - if (!KeycloakAuthentificator.IsvalidToken(token)) - { - return null; - } - - List retour = new List(); - string query = "SELECT IdFormation,Intitulé,DateDebut,DateFin,Statut,Lieu,Duree,Organisme,NomFormateur " + - " FROM formation ;"; - MySqlDataReader queryResult = BDAccess.BDAccess.executeQuery(query); - while (queryResult.Read()) - { - retour.Add(new Formation( - queryResult.GetInt32(0), //id - queryResult.GetString(1), // intitulé - queryResult.GetDateTime(2), //DateDebut - queryResult.GetDateTime(3), // dateFin - queryResult.GetString(4), //status - queryResult.GetString(5), //lieu - queryResult.GetString(6), //durée - queryResult.GetString(7), //organisme - queryResult.GetString(8) //nomformateur - )); - } - return retour; - } - - [HttpGet("formation")] - public Formation Get(int id, string token) - { - KeycloakAuthentificator.IsvalidToken(token); - - Formation retour; - string query = "SELECT IdFormation,Intitulé,DateDebut,DateFin,Statut,Lieu,Duree,Organisme,NomFormateur " + - " FROM formation " + - $" where IdFormation={id};"; - MySqlDataReader queryResult = BDAccess.BDAccess.executeQuery(query); - queryResult.Read(); - retour = new Formation( - queryResult.GetInt32(0), //id - queryResult.GetString(1), //intitulé - queryResult.GetDateTime(2), //dateDebut - queryResult.GetDateTime(3), //dateFin - queryResult.GetString(4), //status - queryResult.GetString(5), //lieu - queryResult.GetString(6), //durée - queryResult.GetString(7), //organisme - queryResult.GetString(8) //nomformateur - ); - return retour; - } - - [HttpPost("formation/new")] - public Formation Post(string token) - { - KeycloakAuthentificator.IsvalidToken(token); - - Formation formation = new Formation(-1, Request.Form["intitule"], DateTime.Parse(Request.Form["dateDebut"]), DateTime.Parse(Request.Form["dateFin"]), Request.Form["statut"], Request.Form["lieu"], Request.Form["duree"], Request.Form["organisme"], Request.Form["nomFormateur"]); - BDAccess.BDAccess.executeQuery(formation.generateInsertStatement()); - return this.Get(1, token); // TODO : retourner la formation que l'on vient de créer - } - } -} diff --git a/Controllers/ProfilController/ProfilController.cs b/Controllers/ProfilController/ProfilController.cs deleted file mode 100644 index 71c728b..0000000 --- a/Controllers/ProfilController/ProfilController.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; - -namespace EPAServeur.Controllers.ProfilController -{ - [Route("api/[controller]")] - [ApiController] - public class ProfilController : ControllerBase - { - } -} diff --git a/EPAServeur.csproj b/EPAServeur.csproj index cf0fa15..0a72423 100644 --- a/EPAServeur.csproj +++ b/EPAServeur.csproj @@ -1,11 +1,12 @@ - + netcoreapp3.1 - + + diff --git a/Modele/CollaborateurModele/Collaborateur.cs b/Modele/CollaborateurModele/Collaborateur.cs deleted file mode 100644 index 20514f0..0000000 --- a/Modele/CollaborateurModele/Collaborateur.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Org.BouncyCastle.Crypto.Digests; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace EPAServeur.CollaborateurModele.Collaborateur -{ - public class Collaborateur - { - public int id { get; set; } - public string nom { get; set; } - public string prenom { get; set; } - public string mail { get; set; } - - public Collaborateur() - { - - } - - public Collaborateur(int id, string nom, string prenom, string mail) - { - this.id = id; - this.nom = nom; - this.prenom = prenom; - this.mail = mail; - } - } -} diff --git a/Modele/EpModele/EP.cs b/Modele/EpModele/EP.cs deleted file mode 100644 index bc99a76..0000000 --- a/Modele/EpModele/EP.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace EPAServeur.Modele.EpModele -{ - public class EP - { - } - - public class evaluation - { - public string libelle { get; set; } - public int note { get; set; } - public string commentaire { get; set; } - - public evaluation(string libelle, int note, string commentaire) - { - this.libelle = libelle; - this.note = note; - this.commentaire = commentaire; - } - } -} diff --git a/Modele/FormationModele/Formation.cs b/Modele/FormationModele/Formation.cs deleted file mode 100644 index 620c539..0000000 --- a/Modele/FormationModele/Formation.cs +++ /dev/null @@ -1,79 +0,0 @@ -using EPAServeur.Commun; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace EPAServeur.Modele.FormationModele -{ - public class Formation - { - public int idFormation { set; get; } - public string intitule { set; get; } - public DateTime dateDebut { set; get; } - public DateTime dateFin { set; get; } - int _statut; - public string statut - { - set { this._statut = int.Parse(value); } - get - { - string returnValue; - switch (this._statut) - { - case 0: - returnValue = "En Cours"; - break; - default: - returnValue = ""; - break; - }; - return returnValue; - } - } - public string lieu { set; get; } - public string duree { set; get; } - public string organisme { set; get; } - public string nomFormateur { set; get; } - - public Formation(int idFormation, string intitule, DateTime dateDebut, DateTime dateFin, string statut, string lieu, string duree, string organisme, string nomFormateur) - { - this.idFormation = idFormation; - this.intitule = intitule; - this.dateDebut = dateDebut; - this.dateFin = dateFin; - this.statut = statut; - this.lieu = lieu; - this.duree = duree; - this.organisme = organisme; - this.nomFormateur = nomFormateur; - } - - public string generateInsertStatement() - { - string query = "INSERT INTO formation " + - " (Intitulé, DateDebut, DateFin, Statut, Lieu, Duree, Organisme, NomFormateur)" + - " VALUES" + - $" ('{this.intitule}','{Function.TransformNetDateTimeToSqlDate(this.dateDebut)}'," + - $"'{Function.TransformNetDateTimeToSqlDate(this.dateFin)}',{this._statut},'{this.lieu}'," + - $"'{this.duree}','{this.organisme}','{this.nomFormateur}');"; - return query; - } - - public string generateUpdateStatement() - { - string query = "UPDATE formation " + - "SET " + - $"Intitulé = {this.intitule}, " + - $"DateDebut = {Function.TransformNetDateTimeToSqlDate(this.dateDebut)}, " + - $"DateFin = {Function.TransformNetDateTimeToSqlDate(this.dateFin)}, " + - $"Statut = {this._statut}, " + - $"Lieu = {this.lieu}, " + - $"Duree = {this.duree}, " + - $"Organisme = {this.organisme}, " + - $"NomFormateur = {this.nomFormateur} " + - $"WHERE IdFormation = {this.idFormation};"; - return query; - } - } -} diff --git a/Modele/ProfilModele/Profil.cs b/Modele/ProfilModele/Profil.cs deleted file mode 100644 index da6d864..0000000 --- a/Modele/ProfilModele/Profil.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace EPAServeur.Modele.ProfilModele -{ - public class Profil - { - } -} diff --git a/Models/EP/AugmentationSalaire.cs b/Models/EP/AugmentationSalaire.cs new file mode 100644 index 0000000..f08c9d5 --- /dev/null +++ b/Models/EP/AugmentationSalaire.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.EP +{ + public class AugmentationSalaire + { + public int Id { get; set; } + public double Augmentation { get; set; } + public double? PrimeMission { get; set; } + public int EpId { get; set; } + public Ep Ep { get; set; } + } +} \ No newline at end of file diff --git a/Models/EP/Autorisation.cs b/Models/EP/Autorisation.cs new file mode 100644 index 0000000..970d5a4 --- /dev/null +++ b/Models/EP/Autorisation.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.EP +{ + public class Autorisation + { + public int Id { get; set; } + public string IdReferent { get; set; } + public int EpId { get; set; } + public Ep Ep { get; set; } + } +} diff --git a/Models/EP/ChoixTypeEntretien.cs b/Models/EP/ChoixTypeEntretien.cs new file mode 100644 index 0000000..cf932f3 --- /dev/null +++ b/Models/EP/ChoixTypeEntretien.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.EP +{ + public class ChoixTypeEntretien + { + public int Id { get; set; } + public int Ordre { get; set; } + public Ep Ep { get; set; } + public TypeEntretien TypeEntretien { get; set; } + } +} \ No newline at end of file diff --git a/Models/EP/Delegation.cs b/Models/EP/Delegation.cs new file mode 100644 index 0000000..615dff5 --- /dev/null +++ b/Models/EP/Delegation.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.EP +{ + public class Delegation + { + public int Id { get; set; } + public string IdReferent { get; set; } + public DateTime DateDemande { get; set; } + public bool? Reponse { get; set; } + public DateTime DateReponse { get; set; } + public string RaisonRefus { get; set; } + public int EpId { get; set; } + public Ep Ep { get; set; } + } +} \ No newline at end of file diff --git a/Models/EP/Document.cs b/Models/EP/Document.cs new file mode 100644 index 0000000..090cb29 --- /dev/null +++ b/Models/EP/Document.cs @@ -0,0 +1,16 @@ +using EPAServeur.Models.SaisieChamp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.EP +{ + public class Document + { + public int Id { get; set; } + public TypeChamp TypeDocument { get; set; } + public Ep Ep { get; set; } + public List Saisies { get; set; } + } +} diff --git a/Models/EP/Engagement.cs b/Models/EP/Engagement.cs new file mode 100644 index 0000000..d235708 --- /dev/null +++ b/Models/EP/Engagement.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.EP +{ + public class Engagement + { + public int Id { get; set; } + public string Action { get; set; } + public string Disposition { get; set; } + public string Modalite { get; set; } + public DateTime DateLimite { get; set; } + public bool? Realise { get; set; } + public bool? Realisable { get; set; } + public string RaisonNonRealisable { get; set; } + public Ep Ep { get; set; } + } +} \ No newline at end of file diff --git a/Models/EP/Ep.cs b/Models/EP/Ep.cs new file mode 100644 index 0000000..51a5b28 --- /dev/null +++ b/Models/EP/Ep.cs @@ -0,0 +1,55 @@ +using EPAServeur.Models.Formation; +using EPAServeur.Models.SaisieChamp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.EP +{ + public enum StatutEP + { + Attente, //entretien créé en attendant le mois précédent la date d'anniversaire (ou d'anniversaire +6 mois) + Disponible, //entretien disponible pour être saisi par le collaborateur + Saisie, //entretien saisi par le collaborateur et en attente des dates de RDV proposées par le référent (la saisie est disponible pour l'assistant qui veut ajouter son commentaire) + PropositionsRDV, //entretien en attente du choix du collaborateur parmi des lates de RDV ont été proposé par le référent + AttenteEntretien,//choix du RDV effectué par le collaborateur, attente que le référent valide que l'entretien a bien eu lieu + EntretienPasse, //déroulement validé par le référent, celui-ci peut ajouter ses commentaires, prendre des engagements, faire des demandes de formation, etc... (la saisie de l'assistant est désactivé + AttenteSignatureCollaborateur, //le référent a rempli ses commentaires, l'entretien est en attente de la signature du collaborateur + Signe, //l'entretien a été signé par le collaborateur + NonEffectue //l'entretien a été refusé ou n'a pas été fait dans les temps + } + + + public class Ep + { + public int Id { get; set; } + public string IdCollaborateur { get; set; } + public string IdReferent { get; set; } + public int IdAgence { get; set; } + public int IdBu { get; set; } + public string Fonction { get; set; } + public TypeChamp TypeEP { get; set; } + public int? NumeroEp { get; set; } + public bool Obligatoire { get; set; } + public DateTime DateCreation { get; set; } + public DateTime DateSaisie { get; set; } + public DateTime DatePrevisionnelle { get; set; } + public int Statut { get; set; } + public string CV { get; set; } + public string CommentaireAssistante { get; set; } + public string CommentaireReferent { get; set; } + public AugmentationSalaire AugmentationSalaire { get; set; } + public Autorisation Autorisation { get; set; } + public Delegation Delegation { get; set; } + public RdvEntretien RdvEntretien { get; set; } + public List ChoixTypeEntretien { get; set; } + public List DemandesFormation { get; set; } + public List Documents { get; set; } + public List Engagements { get; set; } + public List Objectifs { get; set; } + public List ObjectifsPrecedents { get; set; } + public List Participants { get; set; } + public List PropositionsRDV { get; set; } + } +} diff --git a/Models/EP/Objectif.cs b/Models/EP/Objectif.cs new file mode 100644 index 0000000..c71eb94 --- /dev/null +++ b/Models/EP/Objectif.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.EP +{ + public class Objectif + { + public int Id { get; set; } + public string Libelle { get; set; } + public Ep Ep { get; set; } + } +} diff --git a/Models/EP/ObjectifPrecedent.cs b/Models/EP/ObjectifPrecedent.cs new file mode 100644 index 0000000..746e0c8 --- /dev/null +++ b/Models/EP/ObjectifPrecedent.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.EP +{ + public class ObjectifPrecedent + { + public int Id { get; set; } + public string Libelle { get; set; } + public bool? Atteint { get; set; } + public Ep Ep { get; set; } + } +} diff --git a/Models/EP/ParticipantEP.cs b/Models/EP/ParticipantEP.cs new file mode 100644 index 0000000..71e23b8 --- /dev/null +++ b/Models/EP/ParticipantEP.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.EP +{ + public class ParticipantEP + { + public int Id { get; set; } + public string IdCollaborateur { get; set; } + public Ep Ep { get; set; } + } +} diff --git a/Models/EP/RdvEntretien.cs b/Models/EP/RdvEntretien.cs new file mode 100644 index 0000000..c797f0e --- /dev/null +++ b/Models/EP/RdvEntretien.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.EP +{ + public class RdvEntretien + { + public int Id { get; set; } + public TypeEntretien TypeEntretien { get; set; } + public int EpId { get; set; } + public Ep EpChoixFinal { get; set; } + public Ep EpProposition { get; set; } + } +} \ No newline at end of file diff --git a/Models/EP/TypeEntretien.cs b/Models/EP/TypeEntretien.cs new file mode 100644 index 0000000..7f1ba1a --- /dev/null +++ b/Models/EP/TypeEntretien.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.EP +{ + public class TypeEntretien + { + public int Id { get; set; } + public string Libelle { get; set; } + public List RdvEntretiens { get; set; } + public List ChoixTypeEntretien { get; set; } + } +} \ No newline at end of file diff --git a/Models/Formation/DemandeFormation.cs b/Models/Formation/DemandeFormation.cs new file mode 100644 index 0000000..eba6ca4 --- /dev/null +++ b/Models/Formation/DemandeFormation.cs @@ -0,0 +1,21 @@ +using EPAServeur.Models.EP; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.Formation +{ + public class DemandeFormation + { + public int Id { get; set; } + public string Description { get; set; } + public DateTime DateDemande { get; set; } + public bool DemandeRH { get; set; } + public bool? Reponse { get; set; } + public string CommentaireRefus { get; set; } + public DateTime DateDerniereReponse { get; set; } + public Ep Ep { get; set; } + public ParticipationFormation ParticipationFormation { get; set; } + } +} diff --git a/Models/Formation/Formation.cs b/Models/Formation/Formation.cs new file mode 100644 index 0000000..9bb556a --- /dev/null +++ b/Models/Formation/Formation.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.Formation +{ + public class Formation + { + public int Id { get; set; } + public string Intitule { get; set; } + public string Origine { get; set; } + public DateTime DateDebut { get; set; } + public DateTime DateFin { get; set; } + public int Jour { get; set; } + public int Heure { get; set; } + public string Organisme { get; set; } + public bool EstCertifiee { get; set; } + public StatutFormation Statut { get; set; } + } +} diff --git a/Models/Formation/ParticipationFormation.cs b/Models/Formation/ParticipationFormation.cs new file mode 100644 index 0000000..ea57fa6 --- /dev/null +++ b/Models/Formation/ParticipationFormation.cs @@ -0,0 +1,19 @@ +using EPAServeur.Models.SaisieChamp; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.Formation +{ + public class ParticipationFormation + { + public int Id { get; set; } + public DateTime DateCreation { get; set; } + public bool EstEvaluee { get; set; } + public int DemandeFormationId { get; set; } + public DemandeFormation DemandeFormation { get; set; } + public Formation Formation { get; set; } + public List Evaluation { get; set; } + } +} diff --git a/Models/Formation/StatutFormation.cs b/Models/Formation/StatutFormation.cs new file mode 100644 index 0000000..baf377a --- /dev/null +++ b/Models/Formation/StatutFormation.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.Formation +{ + public class StatutFormation + { + public int Id { get; set; } + public string Libelle { get; set; } + public List Formations { get; set; } + } +} diff --git a/Models/Formation/Theme.cs b/Models/Formation/Theme.cs new file mode 100644 index 0000000..e28a05d --- /dev/null +++ b/Models/Formation/Theme.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.Formation +{ + public class Theme + { + public int Id { get; set; } + public string Nom { get; set; } + } +} diff --git a/Models/Notes/Note.cs b/Models/Notes/Note.cs new file mode 100644 index 0000000..9905843 --- /dev/null +++ b/Models/Notes/Note.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.Notes +{ + public class Note + { + public int Id { get; set; } + public string Titre { get; set; } + public string Texte { get; set; } + public string IdAuteur { get; set; } + public string IdCollaborateur { get; set; } + } +} diff --git a/Models/SaisieChamp/Champ.cs b/Models/SaisieChamp/Champ.cs new file mode 100644 index 0000000..b9ac974 --- /dev/null +++ b/Models/SaisieChamp/Champ.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.SaisieChamp +{ + public enum TypeChamp + { + EPS, + EPA, + EPASIXANS, + Evaluation + } + + public class Champ + { + public int Id { get; set; } + public string Texte { get; set; } + public string Section { get; set; } + public string SousSection { get; set; } + public int Ordre { get; set; } + public TypeChamp TypeChamp { get; set; } + public List Saisies { get; set; } + } +} diff --git a/Models/SaisieChamp/Saisie.cs b/Models/SaisieChamp/Saisie.cs new file mode 100644 index 0000000..05311b8 --- /dev/null +++ b/Models/SaisieChamp/Saisie.cs @@ -0,0 +1,26 @@ +using EPAServeur.Models.EP; +using EPAServeur.Models.Formation; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.SaisieChamp +{ + public enum TypeSaisie + { + Commentaire, + Competence, + Notation + } + + public class Saisie + { + public int Id { get; set; } + public Champ Champ { get; set; } + public int? Note { get; set; } + public string Texte { get; set; } + public int? Niveau { get; set; } + public TypeSaisie TypeSaisie { get; set; } + } +} diff --git a/Program.cs b/Program.cs index 8733b52..e7661f3 100644 --- a/Program.cs +++ b/Program.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Net; using System.Threading.Tasks; +using EPAServeur.Context; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using MySql.Data.MySqlClient; namespace EPAServeur { @@ -15,6 +15,7 @@ namespace EPAServeur { public static void Main(string[] args) { + SetupDatabase(); CreateHostBuilder(args).Build().Run(); } @@ -25,5 +26,13 @@ namespace EPAServeur { webBuilder.UseStartup(); }); + + private static void SetupDatabase() + { + EpContext context = new EpContext(); + context.Database.EnsureDeleted(); + context.Database.EnsureCreated(); + context.SaveChanges(); + } } }