Beispiel #1
0
        public static Unea_Company LoadDetailCompany(Unea_HeaderCompany header, bool reload = false, bool loadImage = false)
        {
            Unea_DetailCompany1 detail1 = Unea_LoadDetailCompany1.LoadCompany(header.urlDetail1, reload, loadImage);
            Unea_DetailCompany2 detail2 = Unea_LoadDetailCompany2.LoadCompany(header.urlDetail2, reload, loadImage);
            Unea_Company        company = AggregateCompanyData(header, detail1, detail2);

            AggregateDuplicateData(company);
            return(company);
        }
Beispiel #2
0
        public static Unea_Company AggregateCompanyData(Unea_HeaderCompany header, Unea_DetailCompany1 detail1, Unea_DetailCompany2 detail2)
        {
            Unea_Company company = new Unea_Company();

            company.urlHeader         = header.sourceUrl;
            company.loadFromWebDate   = header.loadFromWebDate;
            company.urlDetail1        = header.urlDetail1;
            company.urlDetail2        = header.urlDetail2;
            company.headerName        = header.name;
            company.headerLocation    = header.location;
            company.headerPhone       = header.phone;
            company.headerFax         = header.fax;
            company.headerEmail       = header.email;
            company.headerActivities  = header.activities;
            company.headerUnknowInfos = header.unknowInfos;

            company.detail1Name              = detail1.name;
            company.detail1Location          = detail1.location;
            company.detail1Activities        = detail1.activities;
            company.detail1Sectors           = detail1.sectors;
            company.detail1Presentation      = detail1.presentation;
            company.detail1Clients           = detail1.clients;
            company.detail1Leader            = detail1.leader;
            company.detail1EmployeNumber     = detail1.employeNumber;
            company.detail1LastYearRevenue   = detail1.lastYearRevenue;
            company.detail1Certification     = detail1.certification;
            company.detail1Siret             = detail1.siret;
            company.detail1Photos            = detail1.photos;
            company.detail1DownloadDocuments = detail1.downloadDocuments;
            company.detail1Address           = detail1.address;
            company.detail1Phone             = detail1.phone;
            company.detail1Fax         = detail1.fax;
            company.detail1Email       = detail1.email;
            company.detail1WebSite     = detail1.webSite;
            company.detail1UnknowInfos = detail1.unknowInfos;

            company.detail2Name              = detail2.name;
            company.detail2Presentation      = detail2.presentation;
            company.detail2Activities        = detail2.activities;
            company.detail2Sectors           = detail2.sectors;
            company.detail2DownloadDocuments = detail2.downloadDocuments;
            company.detail2Address           = detail2.address;
            company.detail2Phone             = detail2.phone;
            company.detail2Fax             = detail2.fax;
            company.detail2Email           = detail2.email;
            company.detail2WebSite         = detail2.webSite;
            company.detail2Leader          = detail2.leader;
            company.detail2EmployeNumber   = detail2.employeNumber;
            company.detail2LastYearRevenue = detail2.lastYearRevenue;
            company.detail2Siret           = detail2.siret;
            company.detail2Certification   = detail2.certification;
            company.detail2Clients         = detail2.clients;
            company.detail2UnknowInfos     = detail2.unknowInfos;

            return(company);
        }
Beispiel #3
0
        protected override Unea_HeaderCompany[] GetData()
        {
            XXElement xeSource = new XXElement(GetXmlDocument().Root);
            string    url      = Url;
            // <div class="ctn_result">
            IEnumerable <XXElement>   xeHeaders = xeSource.XPathElements("//div[@class = 'ctn_result']");
            List <Unea_HeaderCompany> headers   = new List <Unea_HeaderCompany>();

            foreach (XXElement xeHeader in xeHeaders)
            {
                Unea_HeaderCompany header = new Unea_HeaderCompany();
                header.sourceUrl       = url;
                header.loadFromWebDate = DateTime.Now;

                // <div class="ctn_result-header">
                XXElement xe = xeHeader.XPathElement(".//div[@class='ctn_result-header']");

                // <div class="lien"><a href="http://www.unea.fr/union-nationale-entreprises-adaptees/annuaire-unea/71/4583/ACCAA TAKTIM.htm" target="_blank"><strong>></strong> Voir la fiche détaillée</a></div>
                header.urlDetail2 = zurl.GetUrl(url, xe.ExplicitXPathValue(".//div[@class = 'lien']//a/@href"));

                // <iframe src="detail.asp?id=4583" width="420" height="800" frameborder="0" scrolling="auto" marginheight="0" marginwidth="0"></iframe>
                header.urlDetail1 = zurl.GetUrl(url, xe.ExplicitXPathValue(".//iframe/@src"));

                // <h4><a href="http://www.unea.fr/union-nationale-entreprises-adaptees/annuaire-unea/71/4583/ACCAA TAKTIM.htm"  target="_blank">&nbsp;</a><span>|</span> ACCAA TAKTIM</h4>
                //header.name = xe.DescendantTextList(func: __trimFunc2).LastOrDefault();
                header.name = xe.DescendantTexts().Select(__trimFunc2).LastOrDefault();

                // <div class="ctn_result-content clearfix">
                // ...
                // <p>
                // <strong>Activités:</strong> TRAVAUX PAYSAGERS<br>PROPRETE<br>PRESTATION DE SERVICES<br>SOUS TRAITANCE INDUSTRIELLE<br>MECANIQUE<br>AUTOMOBILE<br>METALLURGIE<br />
                // <strong>Région - Département:</strong> Alsace - HAUT RHIN (68)<br />
                // <strong>Téléphone:</strong> 0389570210&nbsp;&nbsp;&nbsp;&nbsp;
                // <strong>Fax:</strong> 0389571761&nbsp;&nbsp;&nbsp;&nbsp;
                // <strong>Adresse e-mail:</strong>
                // <a href="mailto:[email protected]">[email protected]</a>
                // </p>
                // </div>
                Unea_TextType textType = Unea_TextType.unknow;
                //foreach (string s in xeHeader.DescendantTextList(".//div[@class = 'ctn_result-content clearfix']", func: __trimFunc2))
                foreach (string s in xeHeader.XPathElements(".//div[@class = 'ctn_result-content clearfix']").DescendantTexts().Select(__trimFunc2))
                {
                    if (s.Equals("Activités", StringComparison.InvariantCultureIgnoreCase))
                    {
                        textType = Unea_TextType.activity;
                    }
                    else if (s.Equals("Région - Département", StringComparison.InvariantCultureIgnoreCase))
                    {
                        textType = Unea_TextType.location;
                    }
                    else if (s.Equals("Téléphone", StringComparison.InvariantCultureIgnoreCase))
                    {
                        textType = Unea_TextType.phone;
                    }
                    else if (s.Equals("Fax", StringComparison.InvariantCultureIgnoreCase))
                    {
                        textType = Unea_TextType.fax;
                    }
                    else if (s.Equals("Adresse e-mail", StringComparison.InvariantCultureIgnoreCase))
                    {
                        textType = Unea_TextType.email;
                    }
                    else
                    {
                        switch (textType)
                        {
                        case Unea_TextType.activity:
                            if (!header.activities.ContainsKey(s))
                            {
                                header.activities.Add(s, null);
                            }
                            break;

                        case Unea_TextType.location:
                            header.location = s;
                            textType        = Unea_TextType.unknow;
                            break;

                        case Unea_TextType.phone:
                            header.phone = s;
                            textType     = Unea_TextType.unknow;
                            break;

                        case Unea_TextType.fax:
                            header.fax = s;
                            textType   = Unea_TextType.unknow;
                            break;

                        case Unea_TextType.email:
                            header.email = s;
                            textType     = Unea_TextType.unknow;
                            break;

                        default:
                            header.unknowInfos.Add(s);
                            break;
                        }
                    }
                }

                headers.Add(header);
            }
            return(headers.ToArray());
        }