Création des modèles et du code qui permet de créer la base de données en code first

master
Yanaël GRETTE 4 years ago
parent c12eb0c654
commit 0846f4e1b2
  1. 4
      .gitignore
  2. 167
      Context/EpContext.cs
  3. 22
      Controllers/CollaborateurController/CollaborateurControlleur.cs
  4. 37
      Controllers/EpController/EPController.cs
  5. 82
      Controllers/FormationController/FormationController.cs
  6. 15
      Controllers/ProfilController/ProfilController.cs
  7. 5
      EPAServeur.csproj
  8. 29
      Modele/CollaborateurModele/Collaborateur.cs
  9. 25
      Modele/EpModele/EP.cs
  10. 79
      Modele/FormationModele/Formation.cs
  11. 11
      Modele/ProfilModele/Profil.cs
  12. 16
      Models/EP/AugmentationSalaire.cs
  13. 15
      Models/EP/Autorisation.cs
  14. 15
      Models/EP/ChoixTypeEntretien.cs
  15. 19
      Models/EP/Delegation.cs
  16. 16
      Models/EP/Document.cs
  17. 20
      Models/EP/Engagement.cs
  18. 55
      Models/EP/Ep.cs
  19. 14
      Models/EP/Objectif.cs
  20. 15
      Models/EP/ObjectifPrecedent.cs
  21. 14
      Models/EP/ParticipantEP.cs
  22. 16
      Models/EP/RdvEntretien.cs
  23. 15
      Models/EP/TypeEntretien.cs
  24. 21
      Models/Formation/DemandeFormation.cs
  25. 21
      Models/Formation/Formation.cs
  26. 19
      Models/Formation/ParticipationFormation.cs
  27. 14
      Models/Formation/StatutFormation.cs
  28. 13
      Models/Formation/Theme.cs
  29. 16
      Models/Notes/Note.cs
  30. 26
      Models/SaisieChamp/Champ.cs
  31. 26
      Models/SaisieChamp/Saisie.cs
  32. 11
      Program.cs

4
.gitignore vendored

@ -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/

@ -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> AugmentationSalaire { get; set; }
public DbSet<Autorisation> Autorisation { get; set; }
public DbSet<ChoixTypeEntretien> ChoixTypeEntretien { get; set; }
public DbSet<Document> Document { get; set; }
public DbSet<Engagement> Engagement { get; set; }
public DbSet<Ep> Ep { get; set; }
public DbSet<Objectif> Objectifs { get; set; }
public DbSet<ObjectifPrecedent> ObjectifPrecedents { get; set; }
public DbSet<RdvEntretien> RdvEntretiens { get; set; }
public DbSet<TypeEntretien> TypeEntretien { get; set; }
//Formation
public DbSet<DemandeFormation> DemandeFormation { get; set; }
public DbSet<Formation> Formation { get; set; }
public DbSet<ParticipationFormation> ParticipationFormation { get; set; }
public DbSet<StatutFormation> StatutFormation { get; set; }
public DbSet<Theme> Theme { get; set; }
//Note
public DbSet<Note> Note { get; set; }
//SaisieChamp
public DbSet<Champ> Champ { get; set; }
public DbSet<Saisie> 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<AugmentationSalaire>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Autorisation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Document>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Engagement>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Ep>(entity =>
{
entity.HasKey(e => e.Id);
entity.HasOne<AugmentationSalaire>(e => e.AugmentationSalaire).WithOne(a => a.Ep).HasForeignKey<AugmentationSalaire>(a => a.EpId);
entity.HasOne<Autorisation>(e => e.Autorisation).WithOne( a => a.Ep).HasForeignKey<Autorisation>(a => a.EpId);
entity.HasMany<ChoixTypeEntretien>(e => e.ChoixTypeEntretien).WithOne(c => c.Ep);
entity.HasOne<Delegation>(e => e.Delegation).WithOne(d => d.Ep).HasForeignKey<Delegation>(d => d.EpId);
entity.HasMany<DemandeFormation>(e => e.DemandesFormation).WithOne(d => d.Ep);
entity.HasMany<Document>(e => e.Documents).WithOne(d => d.Ep);
entity.HasMany<Engagement>(e => e.Engagements).WithOne(e => e.Ep);
entity.HasMany<Objectif>(e => e.Objectifs).WithOne(o => o.Ep);
entity.HasMany<ObjectifPrecedent>(e => e.ObjectifsPrecedents).WithOne(o => o.Ep);
entity.HasMany<ParticipantEP>(e => e.Participants).WithOne(p => p.Ep);
entity.HasOne<RdvEntretien>(e => e.RdvEntretien).WithOne(r => r.EpChoixFinal).HasForeignKey<RdvEntretien>(r => r.EpId);
entity.HasMany<RdvEntretien>(e => e.PropositionsRDV).WithOne(r => r.EpProposition);
});
modelBuilder.Entity<Objectif>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<ObjectifPrecedent>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<RdvEntretien>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<TypeEntretien>(entity =>
{
entity.HasKey(e => e.Id);
});
//Formation
modelBuilder.Entity<DemandeFormation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Formation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<ParticipationFormation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<StatutFormation>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Theme>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
//Notes
modelBuilder.Entity<Note>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
//SaisieChamp
modelBuilder.Entity<Champ>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
modelBuilder.Entity<Saisie>(entity =>
{
entity.HasKey(e => e.Id);
entity.Property(e => e.Id).ValueGeneratedOnAdd();
});
}
}
}

@ -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<Collaborateur> Get(string token)
{
KeycloakAuthentificator.IsvalidToken(token);
List<Collaborateur> liste = APIAccess.requestGetAPI<Collaborateur>("/personne");
return liste;
}
}
}

@ -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<evaluation> Get(string token)
{
KeycloakAuthentificator.IsvalidToken(token);
List<evaluation> retour = new List<evaluation>();
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;
}
}
}

@ -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<Formation> Get(string token)
{
if (!KeycloakAuthentificator.IsvalidToken(token))
{
return null;
}
List<Formation> retour = new List<Formation>();
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
}
}
}

@ -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
{
}
}

@ -1,11 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MySql.Data" Version="8.0.20" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.7" />
<PackageReference Include="MySql.Data.EntityFrameworkCore" Version="8.0.21" />
</ItemGroup>

@ -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;
}
}
}

@ -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;
}
}
}

@ -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;
}
}
}

@ -1,11 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace EPAServeur.Modele.ProfilModele
{
public class Profil
{
}
}

@ -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; }
}
}

@ -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; }
}
}

@ -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; }
}
}

@ -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; }
}
}

@ -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<Saisie> Saisies { get; set; }
}
}

@ -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; }
}
}

@ -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> ChoixTypeEntretien { get; set; }
public List<DemandeFormation> DemandesFormation { get; set; }
public List<Document> Documents { get; set; }
public List<Engagement> Engagements { get; set; }
public List<Objectif> Objectifs { get; set; }
public List<ObjectifPrecedent> ObjectifsPrecedents { get; set; }
public List<ParticipantEP> Participants { get; set; }
public List<RdvEntretien> PropositionsRDV { get; set; }
}
}

@ -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; }
}
}

@ -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; }
}
}

@ -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; }
}
}

@ -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; }
}
}

@ -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<RdvEntretien> RdvEntretiens { get; set; }
public List<ChoixTypeEntretien> ChoixTypeEntretien { get; set; }
}
}

@ -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; }
}
}

@ -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; }
}
}

@ -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<Saisie> Evaluation { get; set; }
}
}

@ -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<Formation> Formations { get; set; }
}
}

@ -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; }
}
}

@ -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; }
}
}

@ -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<Saisie> Saisies { get; set; }
}
}

@ -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; }
}
}

@ -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<Startup>();
});
private static void SetupDatabase()
{
EpContext context = new EpContext();
context.Database.EnsureDeleted();
context.Database.EnsureCreated();
context.SaveChanges();
}
}
}

Loading…
Cancel
Save