Beispiel #1
0
        public static void ExportXml_Company(XmlWriter xw, Gesat_Company company, bool detail)
        {
            IEnumerator <string> infos      = null;
            IEnumerator <string> activities = null;

            if (detail)
            {
                infos      = ((IEnumerable <string>)company.infos).GetEnumerator();
                activities = ((IEnumerable <string>)company.activities).GetEnumerator();
            }

            xw.WriteStartElement("Company");
            xw.zWriteElementText("société", company.name);
            xw.zWriteElementText("société2", company.headerName);
            xw.zWriteElementText("type", company.type);
            if (detail)
            {
                if (infos.MoveNext())
                {
                    xw.zWriteElementText("info", infos.Current);
                }
                if (activities.MoveNext())
                {
                    xw.zWriteElementText("activité", activities.Current);
                }
            }
            xw.zWriteElementText("ville", company.city);
            xw.zWriteElementText("département", company.department);
            xw.zWriteElementText("tel", company.phone);
            xw.zWriteElementText("tel2", company.headerPhone);
            xw.zWriteElementText("fax", company.fax);
            xw.zWriteElementText("email", company.email);
            xw.zWriteElementText("site", company.webSite);
            xw.zWriteElementText("descryption", company.descryption);
            xw.zWriteElementText("adresse", company.address);
            xw.zWriteElementText("load_date", string.Format("{0:dd/MM/yyyy HH:mm}", company.loadFromWebDate));
            xw.zWriteElementText("url", company.url);
            xw.zWriteElementText("emplacement", company.location);
            xw.WriteEndElement();

            while (detail)
            {
                bool info     = infos.MoveNext();
                bool activity = activities.MoveNext();
                if (!info && !activity)
                {
                    break;
                }
                xw.WriteStartElement("Company");
                if (info)
                {
                    xw.zWriteElementText("info", infos.Current);
                }
                if (activity)
                {
                    xw.zWriteElementText("activité", activities.Current);
                }
                xw.WriteEndElement();
            }
        }
Beispiel #2
0
        protected override void _LoadDocumentFromWeb(string file = null, bool reload = false, bool loadImage = false)
        {
            //TelechargementPlus_LoadPostFromWeb loadFromWeb = new TelechargementPlus_LoadPostFromWeb(_url, file, reload, loadImage);
            Gesat_LoadCompanyFromWeb loadFromWeb = new Gesat_LoadCompanyFromWeb(_url, _header, file, reload, loadImage);

            loadFromWeb.Load();
            _data = loadFromWeb.Data;
        }
Beispiel #3
0
 protected override void _LoadDocumentFromMongo(BsonDocument doc, bool loadImage = false)
 {
     //Trace.CurrentTrace.WriteLine("_DocumentMongoLoad loadImage {0}", loadImage);
     _data = new Gesat_Company();
     _data.DocumentMongoLoad(doc);
 }
Beispiel #4
0
        protected void InitXml()
        {
            _data                 = new Gesat_Company();
            _data.url             = _url;
            _data.loadFromWebDate = DateTime.Now;

            if (_header != null)
            {
                _data.name     = _header.name;
                _data.type     = _header.type;
                _data.location = _header.location;
                _data.phone    = _header.phone;
                _data.infos    = _header.infos;
            }

            // <div class="PAGES" id="content">
            XXElement xe = _xeSource.XPathElement(".//div[@id='content']");

            // <h1><span>ESAT BETTY LAUNAY-MOULIN VERT >></span><br />Coordonnées & activités</h1>
            //string s = xe.XPathValue(".//h1//text()", _trimFunc2);
            string s = _trimFunc2(xe.XPathValue(".//h1//text()"));

            //s = s.Trim(' ', '>');
            if (!s.Equals(_data.name, StringComparison.InvariantCultureIgnoreCase))
            {
                _data.headerName = _data.name;
                _data.name       = s;
            }

            // <div class="BLOC B100 ACCROCHE">
            // <div class="CONTENU-BLOC">Cet E.S.A.T. est ouvert depuis 1989 et accueille 55 personnes reconnues travailleurs handicapés.  Il est situé dans la ville de
            // <a href="/Gesat/Hauts-de-Seine,92/Bois-Colombes,35494/" title="Bois-Colombes // Les ESAT et EA de la ville">Bois-Colombes</a> (
            // <a href="/Gesat/Hauts-de-Seine,92/" title="Hauts-de-Seine // Les ESAT et EA du département">Hauts-de-Seine</a>)
            // </div></div>
            _data.descryption = xe.XPathConcatText(".//div[@class='BLOC B100 ACCROCHE']//text()", resultFunc: _trimFunc1);
            _data.descryption = _data.descryption.Replace("\r", "");
            _data.descryption = _data.descryption.Replace("\n", "");
            _data.descryption = _data.descryption.Replace("\t", "");
            //_data.city = xe.XPathValue(".//div[@class='BLOC B100 ACCROCHE']//a[1]//text()", _trimFunc1);
            _data.city = _trimFunc1(xe.XPathValue(".//div[@class='BLOC B100 ACCROCHE']//a[1]//text()"));
            //_data.department = xe.XPathValue(".//div[@class='BLOC B100 ACCROCHE']//a[2]//text()", _trimFunc1);
            _data.department = _trimFunc1(xe.XPathValue(".//div[@class='BLOC B100 ACCROCHE']//a[2]//text()"));

            // <div class="ADRESSE">78, RUE RASPAIL<br />92270  Bois-Colombes</div>
            _data.address = xe.XPathConcatText(".//div[@class='ADRESSE']//text()", " ", itemFunc: _trimFunc1);
            _data.address = _data.address.Replace("\r", "");
            _data.address = _data.address.Replace("\n", "");
            _data.address = _data.address.Replace("\t", "");

            // <div class="TEL">01 47 86 11 48</div>
            //s = xe.XPathValue(".//div[@class='TEL']//text()", _trimFunc1);
            s = _trimFunc1(xe.XPathValue(".//div[@class='TEL']//text()"));
            if (!s.Equals(_data.phone, StringComparison.InvariantCultureIgnoreCase))
            {
                _data.headerPhone = _data.phone;
                _data.phone       = s;
            }

            // <div class="FAX">01 47 82 42 64</div>
            //_data.fax = xe.XPathValue(".//div[@class='FAX']//text()", _trimFunc1);
            _data.fax = _trimFunc1(xe.XPathValue(".//div[@class='FAX']//text()"));

            // <div class="EMAIL">production.launay<img border="0" alt="arobase.png" src="/images/bulles/arobase.png" style=" border: 0;" />lemoulinvert.org</div>
            _data.email = xe.XPathConcatText(".//div[@class='EMAIL']//text()", "@", itemFunc: _trimFunc1);

            // <div class="WWW"><a href="http://www.esat-b-launay.com" target="_blank">www.esat-b-launay.com</a></div>
            //_data.webSite = xe.XPathValue(".//div[@class='WWW']//a/@href", _trimFunc1);
            _data.webSite = _trimFunc1(xe.XPathValue(".//div[@class='WWW']//a/@href"));

            // <div class="BLOC-FICHE BLOC-ACTIVITES">
            // <dl><dt>Conditionnement, travaux &agrave; fa&ccedil;on</dt></dl>
            // <dl><dt>Assemblage, montage</dt></dl>
            // <dl><dt>Mise sous pli, mailing, routage</dt></dl>
            // <dl><dt>Toutes activit&eacute;s en entreprise </dt></dl>
            // <dl><dt>Num&eacute;risation, saisie informatique</dt></dl>
            // <dl><dt>Remplissage, ensachage, flaconnage</dt></dl>
            // <dl><dt>Etiquetage, codage, badges</dt></dl>
            // <dl><dt>Secr&eacute;tariat, travaux administratifs</dt></dl>
            // <dl><dt>Artisanats divers</dt></dl>
            // </div>
            //_data.activities = xe.XPathValues(".//div[@class='BLOC-FICHE BLOC-ACTIVITES']//dl//text()", _trimFunc1);
            _data.activities = xe.XPathValues(".//div[@class='BLOC-FICHE BLOC-ACTIVITES']//dl//text()").Select(_trimFunc1).ToArray();
        }