diff --git a/Modele/EpModele/EP.cs b/Modele/EpModele/EP.cs index 41b14d8..bc99a76 100644 --- a/Modele/EpModele/EP.cs +++ b/Modele/EpModele/EP.cs @@ -8,4 +8,18 @@ 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 index 63530b1..620c539 100644 --- a/Modele/FormationModele/Formation.cs +++ b/Modele/FormationModele/Formation.cs @@ -1,4 +1,5 @@ -using System; +using EPAServeur.Commun; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -7,5 +8,72 @@ 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; + } } }