From 877004fc63d22166ac29497a9bb0a948d3f9885a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Wed, 19 Aug 2020 17:34:25 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20d'une=20fonction=20qui=20permet=20d'ajo?= =?UTF-8?q?uter=20dans=20la=20base=20de=20donn=C3=A9es=20les=20statuts,=20?= =?UTF-8?q?les=20mode,=20les=20types=20de=20les=20orgines=20d'une=20format?= =?UTF-8?q?ion,=20les=20origines=20d'une=20demande=20de=20formation=20et?= =?UTF-8?q?=20le=20type=20de=20l'entretien?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Context/EpContext.cs | 89 ++++++++++++++++++++++++++++++++++++++++++++ Program.cs | 3 +- 2 files changed, 91 insertions(+), 1 deletion(-) diff --git a/Context/EpContext.cs b/Context/EpContext.cs index 669715a..a04449c 100644 --- a/Context/EpContext.cs +++ b/Context/EpContext.cs @@ -198,5 +198,94 @@ namespace EPAServeur.Context entity.Property(e => e.Id).ValueGeneratedOnAdd(); }); } + + + public void AjoutTheme() //Les thèmes pourront être ajoutés et conservés + { + Theme management, securite, developpement, gestionprojet; + management = new Theme { Libelle = "Management" }; + this.Theme.Add(management); + securite = new Theme { Libelle = "Sécurité" }; + this.Theme.Add(securite); + developpement = new Theme { Libelle = "Développement" }; + this.Theme.Add(developpement); + gestionprojet = new Theme { Libelle = "Gestion de projet" }; + this.Theme.Add(gestionprojet); + this.SaveChanges(); + } + + /*Les informations ajou + * */ + public void AjoutInformationsDeBase() //Les statuts pourront être ajoutés et conservés + { + //StatutFormation + StatutFormation s; + s = new StatutFormation { Libelle = "Planifiée" }; + this.StatutFormation.Add(s); + s = new StatutFormation { Libelle = "Replanifié" }; + this.StatutFormation.Add(s); + s = new StatutFormation { Libelle = "Réalisée" }; + this.StatutFormation.Add(s); + s = new StatutFormation { Libelle = "Annulée" }; + this.StatutFormation.Add(s); + + //ModeFormation + ModeFormation m; + m = new ModeFormation { Libelle = "Externe" }; + this.ModeFormation.Add(m); + m = new ModeFormation { Libelle = "Interne" }; + this.ModeFormation.Add(m); + m = new ModeFormation { Libelle = "Présentiel" }; + this.ModeFormation.Add(m); + m = new ModeFormation { Libelle = "E-learning" }; + this.ModeFormation.Add(m); + + //TypeFormation + TypeFormation type; + type = new TypeFormation { Libelle = "Externe" }; + this.TypeFormation.Add(type); + type = new TypeFormation { Libelle = "Interne" }; + this.TypeFormation.Add(type); + type = new TypeFormation { Libelle = "E-learning" }; + this.TypeFormation.Add(type); + type = new TypeFormation { Libelle = "Academy by Apside" }; + this.TypeFormation.Add(type); + + //OrigineFormation + OrigineFormation of; + of = new OrigineFormation { Libelle = "Demande collaborateur" }; + this.OrigineFormation.Add(of); + of = new OrigineFormation { Libelle = "Exigence client" }; + this.OrigineFormation.Add(of); + of = new OrigineFormation { Libelle = "Exigence Apside" }; + this.OrigineFormation.Add(of); + of = new OrigineFormation { Libelle = "Formation réglementaire" }; + this.OrigineFormation.Add(of); + + //OrigineDemandeFormation + OrigineDemandeFormation o; + o = new OrigineDemandeFormation { Libelle = "Demande collaborateur" }; + this.OrigineDemandeFormation.Add(o); + o = new OrigineDemandeFormation { Libelle = "Demande EP" }; + this.OrigineDemandeFormation.Add(o); + o = new OrigineDemandeFormation { Libelle = "Exigence Client" }; + this.OrigineDemandeFormation.Add(o); + o = new OrigineDemandeFormation { Libelle = "Formation réglementaire" }; + this.OrigineDemandeFormation.Add(o); + o = new OrigineDemandeFormation { Libelle = "Demande Apside" }; + this.OrigineDemandeFormation.Add(o); + + //TypeEntretien + TypeEntretien t; + t = new TypeEntretien { Libelle = "Sur site" }; + this.TypeEntretien.Add(t); + t = new TypeEntretien { Libelle = "Chez le client" }; + this.TypeEntretien.Add(t); + t = new TypeEntretien { Libelle = "Visioconférence" }; + this.TypeEntretien.Add(t); + t = new TypeEntretien { Libelle = "Téléphonique" }; + this.TypeEntretien.Add(t); + this.SaveChanges(); + } } } diff --git a/Program.cs b/Program.cs index e7661f3..1c1abac 100644 --- a/Program.cs +++ b/Program.cs @@ -30,9 +30,10 @@ namespace EPAServeur private static void SetupDatabase() { EpContext context = new EpContext(); - context.Database.EnsureDeleted(); + context.Database.EnsureDeleted(); //PENSEZ A ENLEVER CETTE LIGNE ET A NE JAMAIS LA REMETTRE QUAND LE SERVEUR SERA MIS EN PRODUCTION ^^ context.Database.EnsureCreated(); context.SaveChanges(); + context.AjoutInformationsDeBase(); } } }