Exemplo n.º 1
0
        private Client AssemblerClient(CVSection clientSection, Employeur emp)
        {
            Client        client  = new Client();
            List <Mandat> mandats = new List <Mandat>();

            XmlDocParagraph emplDesc = (XmlDocParagraph)clientSection.Nodes.DefaultIfEmpty(null).FirstOrDefault(x => x is XmlDocParagraph);

            ClientGraphRepository clientGraphRepository = new ClientGraphRepository();

            if (emplDesc != null)
            {
                string[] info = emplDesc.GetLinesWithTab();
                client.Nom = string.Join(" ", info);
                client     = clientGraphRepository.CreateIfNotExists(new Dictionary <string, object> {
                    { "Nom", client.Nom }
                });
            }

            mandats.AddRange(AssemblerMandats(clientSection));
            mandats.ForEach(x =>
            {
                x.Projet.Client           = client;
                x.Projet.SocieteDeConseil = emp;
            });

            conseiller.Mandats.AddRange(mandats);

            return(client);
        }
Exemplo n.º 2
0
        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);
        }