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(); }
private void AssemblerEmployeur(CVSection employeurSection) { XmlDocParagraph emplDesc = (XmlDocParagraph)employeurSection.Nodes.First(x => x is XmlDocParagraph); List <XmlDocParagraph> jobDescription = new List <XmlDocParagraph>(); EmployeurGraphRepository employeurGraphRepository = new EmployeurGraphRepository(); Employeur emp = new Employeur(); string periode = string.Empty; string[] info = emplDesc.GetLinesWithTab(), periodeSplited; if (info.Length > 1) { emp = employeurGraphRepository.CreateIfNotExists(new Dictionary <string, object> { { "Nom", info[1] } }); periode = info[0]; periodeSplited = periode.Split("-"); if (periodeSplited.Length > 1) { emp.DateDebut = DateTime.Parse($"{periodeSplited[0].Trim()}-01-01"); emp.DateFin = DateTime.Parse($"{periodeSplited[1].Trim()}-12-31"); } else { emp.DateDebut = DateTime.Parse($"{periodeSplited[0].Trim()}-01-01"); emp.DateFin = DateTime.Parse($"{periodeSplited[0].Trim()}-12-31"); } } else { emp = employeurGraphRepository.CreateIfNotExists(new Dictionary <string, object> { { "Nom", info[0] } }); } jobDescription.AddRange(employeurSection.Nodes.Skip(1).TakeWhile(x => x is XmlDocParagraph).Cast <XmlDocParagraph>()); if (jobDescription.Count > 0) { jobDescription.RemoveAt(jobDescription.Count - 1); employeurSection.Nodes.Remove(emplDesc); employeurSection.Nodes.RemoveAll(x => jobDescription.Contains(x)); if (jobDescription.Count > 0) { jobDescription.ForEach(x => { emp.DescriptionDuTravail += x.GetParagraphText(); }); } } else { emp.DescriptionDuTravail = string.Empty; } AssemblerClients(employeurSection, emp); conseiller.Employeurs.Add(emp); }