public CVFormationAcademiqueController()
 {
     utilisateurGraphRepository       = new UtilisateurGraphRepository();
     editionObjectGraphRepository     = new EditionObjectGraphRepository();
     formationScolaireGraphRepository = new FormationScolaireGraphRepository();
     instituitionGraphRepository      = new InstituitionGraphRepository();
 }
예제 #2
0
 public CVMandatTechnologiesController()
 {
     utilisateurGraphRepository   = new UtilisateurGraphRepository();
     editionObjectGraphRepository = new EditionObjectGraphRepository();
     mandatGraphRepository        = new MandatGraphRepository();
     technologieGraphRepository   = new TechnologieGraphRepository();
 }
예제 #3
0
 public CVTacheController()
 {
     utilisateurGraphRepository   = new UtilisateurGraphRepository();
     editionObjectGraphRepository = new EditionObjectGraphRepository();
     mandatGraphRepository        = new MandatGraphRepository();
     tacheGraphRepository         = new TacheGraphRepository();
 }
예제 #4
0
        public void TestMappintDomainModelToViewModel()
        {
            CVMapper    mapper      = new CVMapper();
            Utilisateur utilisateur = new UtilisateurGraphRepository("Graph_CV", "CVs").GetOne("7b495fbb-6346-47e8-84dc-84fd3d2fc354");
            CVViewModel cVViewModel = mapper.Map(utilisateur);

            Assert.IsNotNull(cVViewModel);
            Assert.AreEqual(utilisateur.Conseiller.Fonction.Description, cVViewModel.Fonction);
        }
예제 #5
0
        public void TestDAssemblageConseiller()
        {
            UtilisateurGraphRepository utulisateurGraphRepository;
            Conseiller  conseiller;
            Utilisateur utilisateur;

            DirectoryInfo extractedDirectory;
            string        gabaritDirectoryPath = @"..\\..\\..\\Gabarits";

            try
            {
                CVGenerator generator = new CVGenerator();
                utulisateurGraphRepository = new UtilisateurGraphRepository("Graphe_Essay", "graph_cv");

                extractedDirectory = new DirectoryInfo($"{gabaritDirectoryPath}\\Modele_a_generer");
                if (extractedDirectory.Exists)
                {
                    extractedDirectory.Delete(true);
                }

                extractedDirectory = null;

                utulisateurGraphRepository.DeleteAllDocs();
                generator.ProcessCV(gabaritDirectoryPath);

                utilisateur = utulisateurGraphRepository.GetAll().First();
                conseiller  = utilisateur.Conseiller;

                Assert.IsNotNull(utilisateur);

                Assert.AreEqual(2, conseiller.FormationsScolaires.Count);

                Assert.AreEqual(1, conseiller.Associations.Count);

                Assert.AreEqual(9, conseiller.Formations.Count);

                Assert.IsNotNull(conseiller.Fonction);

                Assert.AreEqual(7, conseiller.DomaineDInterventions.Count);

                Assert.AreEqual(1, conseiller.Technologies.Count);

                Assert.AreEqual(2, conseiller.Employeurs.Count);
            }
            finally
            {
                FileInfo fileInfo = new FileInfo($"{gabaritDirectoryPath}\\Modele_a_generer.xml");
                if (fileInfo.Exists)
                {
                    fileInfo.Delete();
                }
            }
        }
예제 #6
0
 public CVMandatController()
 {
     utilisateurGraphRepository   = new UtilisateurGraphRepository();
     editionObjectGraphRepository = new EditionObjectGraphRepository();
     mandatGraphRepository        = new MandatGraphRepository();
     projetGraphRepository        = new ProjetGraphRepository();
     clientGraphRepository        = new ClientGraphRepository();
     employeurGraphRepository     = new EmployeurGraphRepository();
     technologieGraphRepository   = new TechnologieGraphRepository();
     fonctionGraphRepository      = new FonctionGraphRepository();
     tacheGraphRepository         = new TacheGraphRepository();
     conseillerGraphRepository    = new ConseillerGraphRepository();
 }
예제 #7
0
        public async Task <ActionResult> Register([FromBody] RegisterViewModel model)
        {
            var email = $"{model.Email}@lgs.com";
            var user  = new ApplicationUser {
                UserName = email, Email = email, Nom = model.Nom, Prenom = model.Prenom
            };
            var result = await _userManager.CreateAsync(user, model.Password);

            if (result.Succeeded)
            {
                ApplicationRole role = _roleManager.FindByNameAsync("Conseiller").Result;
                await _userManager.AddToRoleAsync(user, role.Name);

                _logger.LogInformation("User created a new account with password.");

                var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                code = System.Net.WebUtility.UrlEncode(code);
                var callbackUrl = $"{_configuration["FrontendBaseUrl"]}/account/confirmemail?userId={user.Id}&code={code}";
                await _emailSender.SendEmailConfirmationAsync(email, callbackUrl);

                await _signInManager.SignInAsync(user, isPersistent : false);

                _logger.LogInformation("User created a new account with password.");

                var utilisateurGraphRepository = new UtilisateurGraphRepository();
                var utilisateur = new Utilisateur()
                {
                    Prenom          = user.Prenom,
                    Nom             = user.Nom,
                    AdresseCourriel = user.Email
                };
                var savedUserModel = utilisateurGraphRepository.CreateIfNotExists(utilisateur);
                return(Json(savedUserModel));
            }
            else
            {
                ErrorViewModel error = new ErrorViewModel();
                error.RequestId = "Le rôle n'a pas pu être modifié";
                return(Json(error));
            }
        }
예제 #8
0
        /// <summary>
        /// Fait l'extraction et la conversion d'un CV LGS vers un fichier en format xml depuis un dossier avec des fichiers docx
        /// </summary>
        /// <param name="path">Chemin du dossier où sont les fichiers de CV en format docx</param>
        public void ProcessCV(string path)
        {
            string extractedXmlText, currentExtractFolder;

            DirectoryInfo directoryInfo;

            FileInfo[]    filesInDirectory;
            DocxExtractor docxExtractor = new DocxExtractor();

            utilisateurRepo = new UtilisateurGraphRepository();

            directoryInfo = new DirectoryInfo(path);

            if (directoryInfo.Exists)
            {
                //Prendre seulement les fichiers docx
                filesInDirectory = directoryInfo.GetFiles("*.docx", SearchOption.TopDirectoryOnly);

                if (filesInDirectory.Length > 0)
                {
#if DEBUG
                    utilisateurRepo.DeleteAllDocs();
#endif

                    foreach (FileInfo file in filesInDirectory)
                    {
                        //Nous avons besoin d'un ficher dont le contenu est le text du docx (.\\word\\document.xml)
                        extractedXmlText = docxExtractor.ExtractDocxTextXml(file);

                        //Fait la génération d'un xml plus structuré
                        GenerateCVXml(extractedXmlText, file.FullName.Replace(file.Extension, ".xml"));

                        //Efface le dossier généré par l'extraction
                        currentExtractFolder = file.FullName.Replace(file.Extension, "");
                        docxExtractor.DeleteExtractedDirectory(currentExtractFolder);
                    }
                }
            }
        }
예제 #9
0
        public async System.Threading.Tasks.Task <IActionResult> IndexAsync(string utilisateurId)
        {
            WordWriter  wordWriter;
            Utilisateur utilisateur;

            UtilisateurGraphRepository utilisateurGraph = new UtilisateurGraphRepository();

            utilisateur = utilisateurGraph.GetOne(utilisateurId);

            var path          = "Files";
            var fileDirectory = new DirectoryInfo(path);

            if (!fileDirectory.Exists)
            {
                fileDirectory.Create();
            }

            var fileName = $"{utilisateur.Nom}.docx";
            var filePath = $"{path}\\{fileName}";

            using (var document = WordprocessingDocument.Create(filePath, WordprocessingDocumentType.Document))
            {
                wordWriter = new WordWriter(document, utilisateur);
                wordWriter.CreateDummyTest();

                var memory = new MemoryStream();
                using (var stream = new FileStream(filePath, FileMode.Open))
                {
                    await stream.CopyToAsync(memory);
                }
                memory.Position = 0;
                System.IO.File.Delete(filePath);
                HttpContext.Response.Headers.Add("Access-Control-Expose-Headers", "*");
                return(File(memory, "application/vnd.ms-word", fileName));
            }
        }
예제 #10
0
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            PasswordHasher <Models.Admin.ApplicationUser> hasher = new PasswordHasher <Models.Admin.ApplicationUser>();

            migrationBuilder.InsertData("AspNetUsers", new string[]
            {
                "Id",
                "AccessFailedCount",
                "ConcurrencyStamp",
                "Email",
                "EmailConfirmed",
                "LockoutEnabled",
                "LockoutEnd",
                "NormalizedEmail",
                "NormalizedUserName",
                "PasswordHash",
                "PhoneNumber",
                "PhoneNumberConfirmed",
                "SecurityStamp",
                "TwoFactorEnabled",
                "UserName"
            },
                                        new object[]
            {
                AdminUserId,               //Id
                0,                         //AccesFailes
                Guid.NewGuid().ToString(), //Concurrency
                "*****@*****.**",           //Email
                1,                         //ConfirmedEmail
                1,                         //Lockout enable
                null,                      //Lockout end:
                "*****@*****.**",
                "*****@*****.**",
                hasher.HashPassword(new Models.Admin.ApplicationUser(), "Bonjour01#"),
                "",
                "",
                Guid.NewGuid().ToString(),
                0,
                "*****@*****.**"
            },
                                        "dbo");

            migrationBuilder.InsertData("AspNetRoles", new string[]
            {
                "Id",
                "ConcurrencyStamp",
                "Name",
                "NormalizedName"
            },
                                        new object[]
            {
                AdminRoleId,
                Guid.NewGuid().ToString(),
                "Administrateur",
                "ADMINISTRATEUR"
            },
                                        "dbo");

            migrationBuilder.InsertData("AspNetUserRoles", new string[]
            {
                "UserId",
                "RoleId"
            },
                                        new object[]
            {
                AdminUserId,
                AdminRoleId
            },
                                        "dbo");

            migrationBuilder.InsertData("AspNetRoles", new string[]
            {
                "Id",
                "ConcurrencyStamp",
                "Name",
                "NormalizedName"
            },
                                        new object[]
            {
                Guid.NewGuid().ToString(),
                Guid.NewGuid().ToString(),
                "Conseiller",
                "CONSEILLER"
            },
                                        "dbo");

            migrationBuilder.InsertData("AspNetRoles", new string[]
            {
                "Id",
                "ConcurrencyStamp",
                "Name",
                "NormalizedName"
            },
                                        new object[]
            {
                Guid.NewGuid().ToString(),
                Guid.NewGuid().ToString(),
                "Approbateur",
                "APPROBATEUR"
            },
                                        "dbo");

            var utilisateurGraphRepository = new UtilisateurGraphRepository();
            var utilisateur = new Utilisateur()
            {
                Prenom          = "Admin",
                AdresseCourriel = "*****@*****.**"
            };

            utilisateurGraphRepository.CreateIfNotExists(utilisateur);
        }
예제 #11
0
 public CVBioController()
 {
     utilisateurGraphRepository   = new UtilisateurGraphRepository();
     editionObjectGraphRepository = new EditionObjectGraphRepository();
     fonctionGraphRepository      = new FonctionGraphRepository();
 }
예제 #12
0
 public CVFormation()
 {
     utilisateurGraphRepository   = new UtilisateurGraphRepository();
     formationGraphRepository     = new FormationGraphRepository();
     editionObjectGraphRepository = new EditionObjectGraphRepository();
 }
예제 #13
0
 public CVResumeInterventionsController()
 {
     utilisateurGraphRepository = new UtilisateurGraphRepository();
     mandatGraphRepository      = new MandatGraphRepository();
 }
예제 #14
0
 public CVLangueController()
 {
     utilisateurGraphRepository   = new UtilisateurGraphRepository();
     editionObjectGraphRepository = new EditionObjectGraphRepository();
     langueGraphRepository        = new LangueGraphRepository();
 }
예제 #15
0
 public CVTechnologiesController() : base()
 {
     technologieGraphRepository   = new TechnologieGraphRepository();
     utilisateurGraphRepository   = new UtilisateurGraphRepository();
     editionObjectGraphRepository = new EditionObjectGraphRepository();
 }
예제 #16
0
 public CVController()
 {
     utilisateurGraphRepository = new UtilisateurGraphRepository();
 }
 public CVDomainInterventionController()
 {
     editionObjectGraphRepository        = new EditionObjectGraphRepository();
     utilisateurGraphRepository          = new UtilisateurGraphRepository();
     domaineDInterventionGraphRepository = new DomaineDInterventionGraphRepository();
 }
예제 #18
0
 public LoginService(SignInManager <ApplicationUser> signInManager)
 {
     UtilisateurDepot = new UtilisateurGraphRepository();
     _signInManager   = signInManager;
 }