Beispiel #1
0
        private List <Client> AssemblerClients(CVSection employeurSection, Employeur emp)
        {
            List <Client>     clients           = new List <Client>();
            List <CVSection>  clientSections    = new List <CVSection>();
            List <XmlDocNode> empNodes          = new List <XmlDocNode>();
            SectionsExtractor sectionsExtractor = new SectionsExtractor();

            clientSections.AddRange(sectionsExtractor.GetCVSections(employeurSection.GetOriginalNodes,
                                                                    new List <IXmlToken>()
            {
                FormatationToken.CreateFormatationToken(new KeyValuePair <string, string>("w:val", "Titre2"))
            }, "Titre2", true));

            clientSections.ForEach(x =>
            {
                try
                {
                    Client client = AssemblerClient(x, emp);
                    clients.Add(client);
                }
                catch (Exception ex)
                {
                    WriteToErrorLog(ex);
                }
            });

            return(clients);
        }
Beispiel #2
0
        private void AssemblerLangues(CVSection langueSection)
        {
            LangueGraphRepository langueGraphRepository = new LangueGraphRepository();

            List <Langue>    langues = new List <Langue>();
            List <CVSection> langueSections;

            SectionsExtractor extractor = new SectionsExtractor();

            langueSections = extractor.GetCVSections(langueSection.GetOriginalNodes.Skip(1).ToList(),
                                                     new List <IXmlToken>()
            {
                FormatationToken.CreateFormatationToken(new KeyValuePair <string, string>("w:val", "Puce1"))
            }, "w:b", true);

            foreach (CVSection section in langueSections)
            {
                Langue          curLangue = new Langue();
                XmlDocParagraph langueNom = (XmlDocParagraph)section.Nodes.First(x => x is XmlDocParagraph);

                curLangue.Nom = langueNom.GetParagraphText();
                curLangue     = langueGraphRepository.CreateIfNotExists(new Dictionary <string, object> {
                    { "Nom", curLangue.Nom }
                });

                if (section.Nodes.Skip(1).Count() > 0)
                {
                    foreach (XmlDocParagraph langueNiveau in section.Nodes.Skip(1).Cast <XmlDocParagraph>().ToList())
                    {
                        string[] niveau = langueNiveau.GetParagraphText().Split(':');

                        if (niveau[0].Contains("Parlé"))
                        {
                            curLangue.Parle = (Niveau)System.Enum.Parse(typeof(Niveau), niveau[1].Trim().Replace("-", "").ToCamelCase());
                        }

                        if (niveau[0].Contains("Écrit"))
                        {
                            curLangue.Ecrit = (Niveau)System.Enum.Parse(typeof(Niveau), niveau[1].Trim().Replace("-", "").ToCamelCase());
                        }

                        if (niveau[0].Contains("Lu"))
                        {
                            curLangue.Lu = (Niveau)System.Enum.Parse(typeof(Niveau), niveau[1].Trim().Replace("-", "").ToCamelCase());
                        }
                    }
                }
                else
                {
                    curLangue.Parle = curLangue.Ecrit = curLangue.Lu = Niveau.Avancé;
                }

                langues.Add(curLangue);
            }

            conseiller.Langues.AddRange(langues);
        }
Beispiel #3
0
        public Utilisateur CreateConseiller(List <XmlNode> Nodes)
        {
            SectionsExtractor CvSectionsExtractor = new SectionsExtractor();
            List <IXmlToken>  matchTokens         = new List <IXmlToken>();

            matchTokens.Add(TextToken.CreateTextToken());
            matchTokens.Add(FormatationToken.CreateFormatationToken(new KeyValuePair <string, string>("w:val", "Titre1")));

            List <CVSection> Sections = null;

            try
            {
                Sections   = CvSectionsExtractor.GetCVSections(Nodes, matchTokens, "IDENTIFICATION");
                conseiller = new Conseiller();
                AssemblerConseiller(Sections);
            }
            catch (Exception ex)
            {
                WriteToErrorLog(ex);
            }

            return(utilisateur);
        }