Exemple #1
0
        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);
        }
Exemple #2
0
 public static IEnumerable <Unea_Company> LoadDetailCompanyList(int startPage = 1, int maxPage = 1, bool reload = false, bool loadImage = false)
 {
     return(from header in new Unea_LoadHeaderPages(startPage, maxPage, reload, loadImage) select Unea.LoadDetailCompany(header, reload, loadImage));
 }