diff --git a/EPAServeur/Context/DataSeeder.cs b/EPAServeur/Context/DataSeeder.cs index 8201596..6e6f141 100644 --- a/EPAServeur/Context/DataSeeder.cs +++ b/EPAServeur/Context/DataSeeder.cs @@ -84,166 +84,273 @@ namespace EPAServeur.Context /// public static void AddEp(EpContext epContext) { - //Créer des EP qui ont déjà été effectué (pas grave si il y a des informations qui sont incohérentes) - //C1 ---> C5 Collaborateurs - //C5 --> C10 CP+Tech Lead - //RH --> RH - //AS --> Assistant - //COM --> Commercial - //DEL --> Delivery - // 10 EP - Ep ep1, ep2, ep3; - Ep ep4, ep5; - Ep ep6, ep7, ep8; - - - //DemandeFormation df; - //ParticipationFormation pf; - ep1 = new Ep - { - IdCollaborateur = Guid.Parse("1ec99fde-f756-11ea-adc1-0242ac120002"), - IdReferent = Guid.Parse("1ec9a204-f756-11ea-adc1-0242ac120002"), - IdBu = 2, - Fonction = "Dev", + //Ep en cours + Ep epEnCours1, epEnCours2, epEnCours3, epEnCours4, epEnCours5, epEnCours6, epEnCours7, epEnCours8, epEnCours9; + //Tours + + epEnCours1 = new Ep() + { + DateDisponibilite = new DateTime(2021, 1, 15), + DatePrevisionnelle = new DateTime(2021, 3, 10), + Fonction = "Ingénieur en Etudes et Développement", TypeEP = TypeEp.EPA, - NumeroEp = 1, - DateCreation = new DateTime(2017, 7, 7), - DatePrevisionnelle = new DateTime(2018, 7, 8), + Statut = StatutEp.Disponible, + IdBu = 1, + IdReferent = new Guid("56e3d82d-4be4-4449-a1f7-b4004b6bd186"), + IdCollaborateur = new Guid("301ba7f3-095e-4912-8998-a7c942dc5f23"), + Obligatoire = true, + }; + epContext.Ep.Add(epEnCours1); + + epEnCours2 = new Ep() + { + DateDisponibilite = new DateTime(2021, 1, 17), + DatePrevisionnelle = new DateTime(2021, 3, 16), + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPA, + Statut = StatutEp.DatesProposees, + IdBu = 1, + IdReferent = new Guid("3f276ab8-727a-4e26-ad5d-4d296158688e"), + IdCollaborateur = new Guid("e7820f92-eab1-42f5-ae96-5c16e71ff1e6"), Obligatoire = false, - Statut = StatutEp.Signe, - CV = "CV.pdf", - DateSaisie = new DateTime(2018, 6, 20) }; - //df = new DemandeFormation - //{ - // Description = "Description formation", - // DemandeRH = false, - // DateDemande = new DateTime(2018, 7, 8), - //}; + epContext.Ep.Add(epEnCours2); - epContext.Ep.Add(ep1); + epEnCours3 = new Ep() + { + DateDisponibilite = new DateTime(2021, 1, 17), + DatePrevisionnelle = new DateTime(2021, 3, 20), + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPS, + Statut = StatutEp.Effectue, + IdBu = 1, + IdReferent = new Guid("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d"), + IdCollaborateur = new Guid("b5254c6c-7caa-435f-a4bb-e0cf92559832"), + Obligatoire = false, + }; + epContext.Ep.Add(epEnCours3); - ep2 = new Ep + epEnCours4 = new Ep() { - IdCollaborateur = Guid.Parse("779bf1cf-4d38-48fb-8550-3d583384523b"), - IdReferent = Guid.Parse("ecf528c3-e509-402f-87bb-c8821467e350"), + DateDisponibilite = new DateTime(2021, 1, 20), + DatePrevisionnelle = new DateTime(2021, 3, 8), + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPS, + Statut = StatutEp.DatesProposees, IdBu = 2, - Fonction = "Dev", - TypeEP = TypeEp.EPA, - NumeroEp = 1, - DateCreation = new DateTime(2017, 7, 7), - DatePrevisionnelle = new DateTime(2018, 7, 8), + IdReferent = new Guid("eb8b0f33-f529-4985-861e-1207f3312bb5"), + IdCollaborateur = new Guid("a0f40e2a-cc03-4032-a627-5389e1281c64"), Obligatoire = false, - Statut = StatutEp.Signe, - CV = "CV.pdf", - DateSaisie = new DateTime(2018, 6, 20) }; - epContext.Ep.Add(ep2); + epContext.Ep.Add(epEnCours4); - ep3 = new Ep + epEnCours5 = new Ep() { - IdCollaborateur = Guid.Parse("17b87130-0e9d-4b78-b0e3-a11e5f70318d"), - IdReferent = Guid.Parse("ecf528c3-e509-402f-87bb-c8821467e350"), + DateDisponibilite = new DateTime(2021, 1, 20), + DatePrevisionnelle = new DateTime(2021, 3, 22), + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPS, + Statut = StatutEp.AttenteEntretien, IdBu = 2, - Fonction = "Dev", - TypeEP = TypeEp.EPA, - NumeroEp = 1, - DateCreation = new DateTime(2017, 7, 7), - DatePrevisionnelle = new DateTime(2018, 7, 8), - Obligatoire = false, - Statut = StatutEp.Signe, - CV = "CV.pdf", - DateSaisie = new DateTime(2018, 6, 20) + IdReferent = new Guid("d4fc247b-015a-44d6-8f3e-a52f0902d2bf"), + IdCollaborateur = new Guid("17b87130-0e9d-4b78-b0e3-a11e5f70318d"), + Obligatoire = true, }; - epContext.Ep.Add(ep3); + epContext.Ep.Add(epEnCours5); - ep4 = new Ep + epEnCours6 = new Ep() { - IdCollaborateur = Guid.Parse("f960f851-16b6-4631-952e-d05f38d8d80f"), - IdReferent = Guid.Parse("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d"), + DateDisponibilite = new DateTime(2021, 1, 24), + DatePrevisionnelle = new DateTime(2021, 2, 24), + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPS, + Statut = StatutEp.SignatureReferent, IdBu = 2, - Fonction = "Dev", + IdReferent = new Guid("eb8b0f33-f529-4985-861e-1207f3312bb5"), + IdCollaborateur = new Guid("de98a866-736f-4295-a669-92a8694e2ee3"), + Obligatoire = false, + }; + epContext.Ep.Add(epEnCours6); + + epEnCours7 = new Ep() + { + DateDisponibilite = new DateTime(2021, 1, 24), + DatePrevisionnelle = new DateTime(2021, 2, 24), + Fonction = "Ingénieur en Etudes et Développement", TypeEP = TypeEp.EPA, - NumeroEp = 1, - DateCreation = new DateTime(2017, 7, 7), - DatePrevisionnelle = new DateTime(2018, 7, 8), + Statut = StatutEp.SignatureReferent, + IdBu = 3, + IdReferent = new Guid("b799a9de-7743-435e-933f-7f730affc5ae"), + IdCollaborateur = new Guid("4f3fcd23-a1e4-4c9e-afa2-d06ca9216491"), Obligatoire = false, + }; + epContext.Ep.Add(epEnCours7); + + epEnCours8 = new Ep() + { + DateDisponibilite = new DateTime(2021, 2, 13), + DatePrevisionnelle = new DateTime(2021, 3, 13), + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPA, + Statut = StatutEp.Disponible, + IdBu = 3, + IdReferent = new Guid("ea027734-ff0f-4308-8879-133a09fb3c46"), + IdCollaborateur = new Guid("0968ccd3-1ef5-4041-83f3-1c76afb02bbf"), + Obligatoire = true, + }; + epContext.Ep.Add(epEnCours8); + + epEnCours9 = new Ep() + { + DateDisponibilite = new DateTime(2021, 2, 13), + DatePrevisionnelle = new DateTime(2021, 3, 13), + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPA, + Statut = StatutEp.Disponible, + IdBu = 3, + IdReferent = new Guid("80220063-a5fa-472b-b610-2e350566df98"), + IdCollaborateur = new Guid("13fbe621-1bc9-4f04-afde-b54ca076e239"), + Obligatoire = true, + }; + epContext.Ep.Add(epEnCours9); + + + //Orléans + //Paris + + + //Ep signés + Ep epSigne1, epSigne2, epSigne3, epSigne4, epSigne5, epSigne6, epSigne7, epSigne8, epSigne9, epSigne10, epSigne11, epSigne12, epSigne13, epSigne14; + epSigne1 = new Ep() + { + DateDisponibilite = new DateTime(2017, 1, 15), + DatePrevisionnelle = new DateTime(2017, 3, 10), + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPA, Statut = StatutEp.Signe, - CV = "CV.pdf", - DateSaisie = new DateTime(2018, 6, 20) + IdBu = 1, + IdReferent = new Guid("56e3d82d-4be4-4449-a1f7-b4004b6bd186"), + IdCollaborateur = new Guid("301ba7f3-095e-4912-8998-a7c942dc5f23"), + Obligatoire = true, }; - epContext.Ep.Add(ep4); + epContext.Ep.Add(epSigne1); - ep5 = new Ep + epSigne2 = new Ep() { - IdCollaborateur = Guid.Parse("efb063b2-ce1e-4d19-8340-d4b0b022d0d0"), - IdReferent = Guid.Parse("3fa56dc6-8597-4030-a0b2-1619b98c428d"), - IdBu = 2, - Fonction = "Dev", + DateDisponibilite = new DateTime(2018, 1, 17), + DatePrevisionnelle = new DateTime(2018, 3, 16), + Fonction = "Ingénieur en Etudes et Développement", TypeEP = TypeEp.EPA, - NumeroEp = 1, - DateCreation = new DateTime(2017, 7, 7), - DatePrevisionnelle = new DateTime(2018, 7, 8), + Statut = StatutEp.Signe, + IdBu = 1, + IdReferent = new Guid("3f276ab8-727a-4e26-ad5d-4d296158688e"), + IdCollaborateur = new Guid("e7820f92-eab1-42f5-ae96-5c16e71ff1e6"), Obligatoire = false, + }; + epContext.Ep.Add(epSigne2); + + + epSigne3 = new Ep() + { + DateDisponibilite = new DateTime(2019, 1, 17), + DatePrevisionnelle = new DateTime(2019, 3, 20), + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPS, Statut = StatutEp.Signe, - CV = "CV.pdf", - DateSaisie = new DateTime(2018, 6, 20) + IdBu = 1, + IdReferent = new Guid("01ee85ff-d7f3-494b-b1de-26ced8fbfa0d"), + IdCollaborateur = new Guid("b5254c6c-7caa-435f-a4bb-e0cf92559832"), + Obligatoire = false, }; - epContext.Ep.Add(ep5); + epContext.Ep.Add(epSigne3); - ep6 = new Ep + epSigne4 = new Ep() { - IdCollaborateur = Guid.Parse("e5d36da4-df16-4d19-8a11-1ba2f6efc80c"), - IdReferent = Guid.Parse("3fa56dc6-8597-4030-a0b2-1619b98c428d"), + DateDisponibilite = new DateTime(2017, 1, 20), + DatePrevisionnelle = new DateTime(2017, 3, 8), + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPS, + Statut = StatutEp.Signe, IdBu = 2, - Fonction = "Dev", - TypeEP = TypeEp.EPA, - NumeroEp = 1, - DateCreation = new DateTime(2017, 7, 7), - DatePrevisionnelle = new DateTime(2018, 7, 8), + IdReferent = new Guid("eb8b0f33-f529-4985-861e-1207f3312bb5"), + IdCollaborateur = new Guid("a0f40e2a-cc03-4032-a627-5389e1281c64"), Obligatoire = false, + }; + epContext.Ep.Add(epSigne4); + + epSigne5 = new Ep() + { + DateDisponibilite = new DateTime(2018, 1, 20), + DatePrevisionnelle = new DateTime(2018, 3, 22), + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPS, Statut = StatutEp.Signe, - CV = "CV.pdf", - DateSaisie = new DateTime(2018, 6, 20) + IdBu = 2, + IdReferent = new Guid("d4fc247b-015a-44d6-8f3e-a52f0902d2bf"), + IdCollaborateur = new Guid("17b87130-0e9d-4b78-b0e3-a11e5f70318d"), + Obligatoire = true, }; - epContext.Ep.Add(ep6); + epContext.Ep.Add(epSigne5); - ep7 = new Ep + epSigne6 = new Ep() { - IdCollaborateur = Guid.Parse("9e1ee839-4477-4d64-9b4d-80654c97c39f"), - IdReferent = Guid.Parse("efb063b2-ce1e-4d19-8340-d4b0b022d0d0"), + DateDisponibilite = new DateTime(2020, 1, 24), + DatePrevisionnelle = new DateTime(2020, 2, 24), + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPS, + Statut = StatutEp.Signe, IdBu = 2, - Fonction = "Dev", + IdReferent = new Guid("eb8b0f33-f529-4985-861e-1207f3312bb5"), + IdCollaborateur = new Guid("de98a866-736f-4295-a669-92a8694e2ee3"), + Obligatoire = false, + }; + epContext.Ep.Add(epSigne6); + + epSigne7 = new Ep() + { + DateDisponibilite = new DateTime(2019, 1, 24), + DatePrevisionnelle = new DateTime(2019, 2, 24), + Fonction = "Ingénieur en Etudes et Développement", TypeEP = TypeEp.EPA, - NumeroEp = 1, - DateCreation = new DateTime(2017, 7, 7), - DatePrevisionnelle = new DateTime(2018, 7, 8), + Statut = StatutEp.Signe, + IdBu = 3, + IdReferent = new Guid("b799a9de-7743-435e-933f-7f730affc5ae"), + IdCollaborateur = new Guid("4f3fcd23-a1e4-4c9e-afa2-d06ca9216491"), Obligatoire = false, + }; + epContext.Ep.Add(epSigne7); + + epSigne8 = new Ep() + { + DateDisponibilite = new DateTime(2020, 2, 13), + DatePrevisionnelle = new DateTime(2020, 3, 13), + Fonction = "Ingénieur en Etudes et Développement", + TypeEP = TypeEp.EPA, Statut = StatutEp.Signe, - CV = "CV.pdf", - DateSaisie = new DateTime(2018, 6, 20) + IdBu = 3, + IdReferent = new Guid("ea027734-ff0f-4308-8879-133a09fb3c46"), + IdCollaborateur = new Guid("0968ccd3-1ef5-4041-83f3-1c76afb02bbf"), + Obligatoire = true, }; - epContext.Ep.Add(ep7); + epContext.Ep.Add(epSigne8); - ep8 = new Ep + epSigne9 = new Ep() { - IdCollaborateur = Guid.Parse("3f532f4c-a5c9-466c-b7c1-fdc6bc48780e"), - IdReferent = Guid.Parse("efb063b2-ce1e-4d19-8340-d4b0b022d0d0"), - IdBu = 2, - Fonction = "Dev", + DateDisponibilite = new DateTime(2019, 2, 13), + DatePrevisionnelle = new DateTime(2019, 3, 13), + Fonction = "Ingénieur en Etudes et Développement", TypeEP = TypeEp.EPA, - NumeroEp = 1, - DateCreation = new DateTime(2017, 7, 7), - DatePrevisionnelle = new DateTime(2018, 7, 8), - Obligatoire = false, Statut = StatutEp.Signe, - CV = "CV.pdf", - DateSaisie = new DateTime(2018, 6, 20) + IdBu = 3, + IdReferent = new Guid("80220063-a5fa-472b-b610-2e350566df98"), + IdCollaborateur = new Guid("13fbe621-1bc9-4f04-afde-b54ca076e239"), + Obligatoire = true, }; - epContext.Ep.Add(ep8); + epContext.Ep.Add(epSigne9); epContext.SaveChanges(); + } /// diff --git a/EPAServeur/Services/EpInformationService.cs b/EPAServeur/Services/EpInformationService.cs index 27ea38d..cdbf79c 100644 --- a/EPAServeur/Services/EpInformationService.cs +++ b/EPAServeur/Services/EpInformationService.cs @@ -32,7 +32,7 @@ namespace EPAServeur.Services #region Services async public async Task> GetEPEnCours(List idBUs, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) { - IEnumerable eps = context.Ep.Where(ep => idBUs.Contains(ep.IdBu)).Where(ep => estEpEnCours(ep.Statut)); + IEnumerable eps = context.Ep.Where(ep => idBUs.Contains(ep.IdBu)).Where(ep => EstEpEnCours(ep.Statut)); eps = TriDate(eps, dateDebut, dateFin); List guids = eps.SelectMany(ep => new Guid?[] { ep.IdReferent, ep.IdCollaborateur }).ToList(); @@ -55,7 +55,7 @@ namespace EPAServeur.Services public async Task GetEPEnCoursCount(List idBUs, bool? asc, int? numPage, int? parPage, string texte, string tri, DateTime? dateDebut, DateTime? dateFin) { - IEnumerable eps = context.Ep.Where(ep => idBUs.Contains(ep.IdBu)).Where(ep => estEpEnCours(ep.Statut)); + IEnumerable eps = context.Ep.Where(ep => idBUs.Contains(ep.IdBu)).Where(ep => EstEpEnCours(ep.Statut)); eps = TriDate(eps, dateDebut, dateFin); @@ -208,7 +208,7 @@ namespace EPAServeur.Services } - private bool estEpEnCours(StatutEp statut) + private bool EstEpEnCours(StatutEp statut) { return statut != StatutEp.Annule && statut != StatutEp.Cree && statut != StatutEp.Rejete && statut != StatutEp.Signe; }