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