private static void ExportUniqueValues(Unea_CompanyUniqueValues uniqueValues, string dir) { ExportValues(Path.Combine(dir, "Unea_activities.txt"), uniqueValues.activities.Keys); ExportValues(Path.Combine(dir, "Unea_sectors.txt"), uniqueValues.sectors.Keys); ExportValues(Path.Combine(dir, "Unea_downloadDocumentsName.txt"), uniqueValues.downloadDocumentsName.Keys); ExportValues(Path.Combine(dir, "Unea_downloadDocumentsUrl.txt"), uniqueValues.downloadDocumentsUrl.Keys); ExportValues(Path.Combine(dir, "Unea_photos.txt"), uniqueValues.photos.Keys); ExportValues(Path.Combine(dir, "Unea_unknowInfos.txt"), uniqueValues.unknowInfos.Keys); }
private static void AddUniqueValues(Unea_CompanyUniqueValues uniqueValues, Unea_Company company) { AddUniqueValues(uniqueValues.activities, company.headerActivities.Keys); AddUniqueValues(uniqueValues.activities, company.detail1Activities.Keys); AddUniqueValues(uniqueValues.activities, company.detail2Activities.Keys); AddUniqueValues(uniqueValues.sectors, company.detail1Sectors.Keys); AddUniqueValues(uniqueValues.sectors, company.detail2Sectors.Keys); AddUniqueValues(uniqueValues.downloadDocumentsName, from doc in company.detail1DownloadDocuments select doc.Value.name); AddUniqueValues(uniqueValues.downloadDocumentsUrl, from doc in company.detail1DownloadDocuments select doc.Value.url); AddUniqueValues(uniqueValues.downloadDocumentsName, from doc in company.detail2DownloadDocuments select doc.Value.name); AddUniqueValues(uniqueValues.downloadDocumentsUrl, from doc in company.detail2DownloadDocuments select doc.Value.url); AddUniqueValues(uniqueValues.photos, company.detail1Photos.Keys); AddUniqueValues(uniqueValues.photos, company.detail2Photos.Keys); AddUniqueValues(uniqueValues.unknowInfos, company.headerUnknowInfos); AddUniqueValues(uniqueValues.unknowInfos, company.detail1UnknowInfos); AddUniqueValues(uniqueValues.unknowInfos, company.detail2UnknowInfos); }
public static void ExportXmlCompanyList(int startPage = 1, int maxPage = 1, bool reload = false, bool loadImage = false) { //WriteLine("ExportXmlCompanyList : startPage {0} maxPage {1} reload {2} loadImage {3}", startPage, maxPage, reload, loadImage); Init(); //_ExportXmlCompanyList(Unea.LoadDetailCompanyList(startPage, maxPage, reload, loadImage)); //string dir = @"c:\pib\dev_data\exe\wrun\damien\export"; //string file = dir + @"\Unea.xml"; //string fileDetail = dir + @"\UneaDetail.xml"; WriteLine("export Unea"); WriteLine(" file \"{0}\"", __xmlCompanyListFile); WriteLine(" file detail \"{0}\"", __xmlDetailCompanyListFile); XmlWriterSettings settings = new XmlWriterSettings(); settings.Encoding = Encoding.UTF8; settings.Indent = true; Unea_Company_DuplicateExists duplicate = new Unea_Company_DuplicateExists(); Unea_CompanyUniqueValues uniqueValues = new Unea_CompanyUniqueValues(); using (XmlWriter xw = XmlWriter.Create(__xmlCompanyListFile, settings), xwDetail = XmlWriter.Create(__xmlDetailCompanyListFile, settings)) { xw.WriteStartElement("Unea"); xwDetail.WriteStartElement("Unea"); Unea.LoadDetailCompanyList(startPage, maxPage, reload, loadImage).zForEach(company => { ExportXml_Company(xw, company, false); ExportXml_Company(xwDetail, company, true); GetCompany_Duplicate(company, duplicate); AddUniqueValues(uniqueValues, company); }); xw.WriteEndElement(); xwDetail.WriteEndElement(); } string dir = Path.GetDirectoryName(__xmlCompanyListFile); Export_Duplicate(duplicate, dir); ExportUniqueValues(uniqueValues, dir); }