public CVMandatTechnologiesController() { utilisateurGraphRepository = new UtilisateurGraphRepository(); editionObjectGraphRepository = new EditionObjectGraphRepository(); mandatGraphRepository = new MandatGraphRepository(); technologieGraphRepository = new TechnologieGraphRepository(); }
private void LoadDataInCache(IMemoryCache cache) { TechnologieGraphRepository technologieGraphRepository = new TechnologieGraphRepository(); LangueGraphRepository langueGraphRepository = new LangueGraphRepository(); FonctionGraphRepository fonctionGraphRepository = new FonctionGraphRepository(); cache.Set("Technologies", technologieGraphRepository.GetAll()); cache.Set("Langues", langueGraphRepository.GetAll()); cache.Set("Fonctions", fonctionGraphRepository.GetAll()); }
public void TestAddVertexWithEdge() { try { //ClientGraphRepository repo = new ClientGraphRepository("Graphe_Essay", "graph_cv"); //List<Client> listOfClient; //Guid identifier = Guid.NewGuid(); //Client client = new Client(); //client.Nom = identifier.ToString(); //Mandat mandat = new Mandat(); //mandat.Numero = "999"; //mandat.Projet = "Essay de persistence"; //mandat.Fonction = "Developeur"; //mandat.Envenrgure = "159"; //mandat.Description = "Loren Ipsum"; //client.Mandats.Add(mandat); //repo.Add(client); //listOfClient = repo.GetAll(); //Assert.IsTrue(listOfClient.Any(x => x.Nom == identifier.ToString())); } catch (System.Exception e) { throw; } ConseillerGraphRepository conseillerGraphRepository = new ConseillerGraphRepository("Graphe_Essay", "graph_cv"); TechnologieGraphRepository technologieGraphRepository = new TechnologieGraphRepository("Graphe_Essay", "graph_cv"); List <Conseiller> conseiller = conseillerGraphRepository.GetAll(); List <Technologie> technologie = technologieGraphRepository.GetAll(); List <bool> hasEdgesResults = new List <bool>(); Edge edge = new Edge("Knows"); foreach (var item in conseiller) { foreach (var item2 in technologie) { hasEdgesResults.Add(conseillerGraphRepository.HasEdge(edge, item, item2)); } } Assert.IsTrue(hasEdgesResults.Any(x => x)); }
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 AssamblerTechnologies(CVSection sectionTechnologies) { TechnologieGraphRepository technologieGraphRepository = new TechnologieGraphRepository(); CategorieDeTechnologieGraphRepository categorieDeTechnologieGraphRepository = new CategorieDeTechnologieGraphRepository(); XmlDocTable tableTechnologies = (XmlDocTable)sectionTechnologies.Nodes.First(x => x is XmlDocTable); List <XmlDocParagraph> lineParagraphsColumn1 = new List <XmlDocParagraph>(), lineParagraphsColumn2 = new List <XmlDocParagraph>(); List <KeyValuePair <string, string> > listOfTech = new List <KeyValuePair <string, string> >(); Technologie technologie; CategorieDeTechnologie categorie = null; string techNom, mois; for (int i = 1; i <= tableTechnologies.CountColumns(); i = i + 3) { lineParagraphsColumn1 = tableTechnologies.GetParagraphsFromColumn(i); lineParagraphsColumn2 = tableTechnologies.GetParagraphsFromColumn(i + 1); for (int j = 1; j < lineParagraphsColumn1.Count; j++) { if (string.IsNullOrEmpty(lineParagraphsColumn1[j].GetParagraphText())) { continue; } if (string.IsNullOrEmpty(lineParagraphsColumn2[j].GetParagraphText())) { categorie = categorieDeTechnologieGraphRepository.CreateIfNotExists(new Dictionary <string, object> { { "Nom", lineParagraphsColumn1[j].GetParagraphText().Replace(":", "").Trim() } }); } else { techNom = lineParagraphsColumn1[j].GetParagraphText(); mois = lineParagraphsColumn2[j].GetParagraphText().Replace(".", ","); technologie = technologieGraphRepository.CreateIfNotExists(new Dictionary <string, object> { { "Nom", techNom } }); technologie.MoisDExperience = Convert.ToInt32(mois); if (categorie != null) { technologie.Categorie = categorie; } conseiller.Technologies.Add(technologie); } } } }
private void AssemblerEnvironnementTecnologic(CVSection environnementSection, Projet projet) { var x = (XmlDocParagraph)environnementSection.Nodes.First(); if (x.GetParagraphText().ToUpper().StartsWith("ENVIRONNEMENT TECHNOLOGIQUE")) { var environnement = x.GetParagraphText().ToUpper().Replace("ENVIRONNEMENT TECHNOLOGIQUE", "").Trim(); if (environnement.Count() == 0) { return; } if (environnement.First().Equals(':')) { environnement = environnement.Substring(1); } if (environnement.Count() == 0) { return; } if (environnement.Last().Equals('.')) { environnement = environnement.Substring(0, environnement.Length - 1); } if (environnement.Count() == 0) { return; } var technologies = environnement.Split(","); TechnologieGraphRepository technologieGraphRepository = new TechnologieGraphRepository(); for (int i = 0; i < technologies.Length; i++) { var tech = technologies[i].Trim(); var technologie = technologieGraphRepository.CreateIfNotExists(new Dictionary <string, object> { { "Nom", tech } }); if (technologie != null) { projet.Technologies.Add(technologie); } } } }
public CVTechnologiesController() : base() { technologieGraphRepository = new TechnologieGraphRepository(); utilisateurGraphRepository = new UtilisateurGraphRepository(); editionObjectGraphRepository = new EditionObjectGraphRepository(); }
private Mandat AssemblerMandat(List <XmlDocNode> mandatNodes) { ProjetGraphRepository projetGraphRepository = new ProjetGraphRepository(); FonctionGraphRepository fonctionGraphRepository = new FonctionGraphRepository(); TechnologieGraphRepository technologieGraphRepository = new TechnologieGraphRepository(); Mandat mandat = new Mandat(); Projet projet = new Projet(); Technologie technologie = null; int parseInt = 0, mois, annee; string concatenatedString, envergureText, environnement, tech; string[] periode, debut, fin, splitedString, technologies; List <XmlDocParagraph> infoParagraphs = new List <XmlDocParagraph>(), infoParagraphsSecondColumn = new List <XmlDocParagraph>(); XmlDocTable infoTable = (XmlDocTable)mandatNodes.First(x => x is XmlDocTable); infoParagraphs.AddRange(infoTable.GetParagraphsFromColumn(1)); infoParagraphsSecondColumn.AddRange(infoTable.GetParagraphsFromColumn(2)); for (int i = 0; i < infoParagraphs.Count; i++) { concatenatedString = string.Empty; if (infoParagraphs[i].GetParagraphText().Contains("Projet")) { projet.Nom = infoParagraphsSecondColumn[i].GetParagraphText(); } if (infoParagraphs[i].GetParagraphText().Contains("Mandat")) { mandat.Numero = infoParagraphsSecondColumn[i].GetParagraphText(); } if (infoParagraphs[i].GetParagraphText().Contains("Envergure")) { envergureText = infoParagraphsSecondColumn[i].GetParagraphText().Trim(); if (envergureText.Any(x => char.IsDigit(x))) { projet.Envergure = int.Parse(string.Join("", envergureText.Where(x => char.IsDigit(x)).ToArray())); } } if (infoParagraphs[i].GetParagraphText().Contains("Fonction")) { Fonction fonction; fonction = fonctionGraphRepository.CreateIfNotExists(new Dictionary <string, object> { { "Description", infoParagraphsSecondColumn[i].GetParagraphText() } }); mandat.Fonction = fonction; } if (infoParagraphs[i].GetParagraphText().Contains("Période")) { periode = infoParagraphsSecondColumn[i].GetParagraphText().Split("à"); if (periode.Length > 1) { debut = periode[0].Trim().Split(" ").Where(x => !string.IsNullOrEmpty(x)).ToArray(); if (debut.Length > 1) { mois = DicMois[RemoveAcentuation(debut[0].Trim().ToUpper())]; annee = int.Parse(debut[1].Trim()); mandat.DateDebut = DateTime.Parse($"{annee}-{mois}-01"); } if (periode[1].Contains("ce jour")) { mandat.DateFin = DateTime.MinValue; } else { fin = periode[1].Trim().Split(" ").Where(x => !string.IsNullOrEmpty(x)).ToArray(); if (fin.Length > 1) { mois = DicMois[RemoveAcentuation(fin[0].Trim().ToUpper())]; annee = int.Parse(fin[1].Sanitize()); mandat.DateFin = DateTime.Parse($"{annee}-{mois}-01"); } } } } if (infoParagraphs[i].GetParagraphText().Contains("Efforts")) { splitedString = infoParagraphsSecondColumn[i].GetParagraphText().Split(" "); parseInt = 0; if (int.TryParse(splitedString[0], out parseInt)) { mandat.Efforts = parseInt; } } if (infoParagraphs[i].GetParagraphText().Contains("Référence")) { projet.NomReference = infoParagraphsSecondColumn[i].GetParagraphText(); } } infoParagraphsSecondColumn.Clear(); infoParagraphsSecondColumn = null; infoParagraphs.Clear(); infoParagraphs = mandatNodes.SkipWhile(x => x is XmlDocTable).Cast <XmlDocParagraph>().ToList(); var sections = new List <CVSection>(); SectionsExtractor CvSectionsExtractor = new SectionsExtractor(); List <XmlNode> Nodes = (List <XmlNode>)infoParagraphs.Select(x => x.OriginalNode).ToList(); List <IXmlToken> matchTokens = new List <IXmlToken>(); matchTokens.Add(MandatTextToken.CreateTextToken()); try { sections = CvSectionsExtractor.GetCVSections(Nodes, matchTokens, "DESCRIPTION"); aSection = sections.DefaultIfEmpty(null).FirstOrDefault(x => x.Identifiant == "DESCRIPTION"); AssemblerDescription(aSection, projet); } catch (Exception ex) { WriteToErrorLog(ex); } try { aSection = sections.DefaultIfEmpty(null).FirstOrDefault(x => x.Identifiant == "ENVIRONNEMENT TECHNOLOGIQUE"); AssemblerEnvironnementTecnologic(aSection, projet); } catch (Exception ex) { WriteToErrorMessageLog("Mandat" + projet.Description); WriteToErrorLog(ex); } try { aSection = sections.DefaultIfEmpty(null).FirstOrDefault(x => x.Identifiant == "LES TÂCHES SUIVANTES"); AssemblerTache(aSection, mandat); } catch (Exception ex) { WriteToErrorMessageLog("Mandat: " + projet.Nom); WriteToErrorLog(ex); } mandat.Titre = projet.Nom; mandat.Projet = projet; projet.DateDebut = mandat.DateDebut; projet.DateFin = mandat.DateFin; return(mandat); }