Beispiel #1
0
        public static Handeco_Company LoadDetailCompany(Handeco_HeaderCompany header, bool reload = false, bool loadImage = false)
        {
            Handeco_DetailCompany detail = Handeco_LoadDetailCompany.LoadCompany(header.urlDetail, reload, loadImage);

            return(new Handeco_Company {
                header = header, detail = detail
            });
        }
Beispiel #2
0
        protected override Handeco_HeaderPage GetData()
        {
            XXElement          xeSource = new XXElement(GetXmlDocument().Root);
            string             url      = Url;
            Handeco_HeaderPage data     = new Handeco_HeaderPage();

            // <div class="paginationControl">
            // page n    : <a href="/fournisseurs/rechercher/page/2#resultats">&gt;</a> |
            // last page : <span class="disabled">&gt;</span> |
            data.urlNextPage = zurl.GetUrl(url, xeSource.XPathValue("//div[@class='paginationControl']//*[position()=last()-1]/@href"));

            IEnumerable <XXElement>      xeHeaders = xeSource.XPathElements("//table//tr[position() > 1]");
            List <Handeco_HeaderCompany> headers   = new List <Handeco_HeaderCompany>();

            foreach (XXElement xeHeader in xeHeaders)
            {
                Handeco_HeaderCompany header = new Handeco_HeaderCompany();
                header.sourceUrl       = url;
                header.loadFromWebDate = DateTime.Now;
                //header.name = xeHeader.XPathValue(".//td[1]//text()", _trimFunc1);
                header.name      = _trimFunc1(xeHeader.XPathValue(".//td[1]//text()"));
                header.urlDetail = zurl.GetUrl(url, xeHeader.XPathValue(".//td[1]//a/@href"));
                //header.siret = xeHeader.XPathValue(".//td[2]//text()", _trimFunc1);
                header.siret = _trimFunc1(xeHeader.XPathValue(".//td[2]//text()"));
                //header.type = xeHeader.XPathValue(".//td[3]//text()", _trimFunc1);
                header.type = _trimFunc1(xeHeader.XPathValue(".//td[3]//text()"));
                //header.group = xeHeader.XPathValue(".//td[4]//text()", _trimFunc1);
                //header.groupes = xeHeader.XPathValues(".//td[4]//text()", _trimFunc1);
                header.groupes = xeHeader.XPathValues(".//td[4]//text()").Select(_trimFunc1).ToArray();
                //header.sector = xeHeader.XPathValue(".//td[5]//text()");
                //header.activités = xeHeader.XPathValues(".//td[5]//text()", _trimFunc1);
                header.activités = xeHeader.XPathValues(".//td[5]//text()").Select(_trimFunc1).ToArray();
                //header.postalCode = xeHeader.XPathValue(".//td[6]//text()", _trimFunc1);
                header.postalCode = _trimFunc1(xeHeader.XPathValue(".//td[6]//text()"));
                headers.Add(header);
            }
            data.headerCompanies = headers.ToArray();
            return(data);
        }