Ejemplo n.º 1
0
        public string SerializeString(ExchangeExportData input)
        {
            XmlSerializer serializer = new XmlSerializer(input.GetType());

            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Encoding           = new UnicodeEncoding(false, false); // no BOM in a .NET string
            settings.Indent             = false;
            settings.OmitXmlDeclaration = false;

            using (StringWriter textWriter = new StringWriter())
            {
                using (XmlWriter xmlWriter = XmlWriter.Create(textWriter, settings))
                {
                    serializer.Serialize(xmlWriter, input);
                }
                return(textWriter.ToString());
            }
        }
Ejemplo n.º 2
0
        public void do_export(string fn)
        {
            ExchangeExportData ced = new ExchangeExportData();

            ced.from_center = 0;

            if (new utils().GetCENTER())
            {
                ced.from_center = 1;
            }

            string sql_text;

            sql_text = "select * from ORG_DOCS";

            try
            {
                ced.ORG_DOCS = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////
            sql_text = "select * from REBUILD_ORG";

            try
            {
                ced.REBUILD_ORG = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            sql_text = "select * from ORGANIZATION";

            try
            {
                ced.ORGANIZATION = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            //////////////////////////////////////\
            sql_text = "select * from COUNTRY";

            try
            {
                ced.COUNTRY = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            sql_text = "select * from DISTRICT";

            try
            {
                ced.DISTRICT = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            sql_text = "select * from KIND_DOCS";

            try
            {
                ced.KIND_DOCS = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            sql_text = "select * from PREF_TOWN";

            try
            {
                ced.PREF_TOWN = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            sql_text = "select * from REGION";

            try
            {
                ced.REGION = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            sql_text = "select * from SOURCE_ARCHIVE";

            try
            {
                ced.SOURCE_ARCHIVE = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            sql_text = "select * from STAT_ORG";

            try
            {
                ced.STAT_ORG = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            sql_text = "select * from TOWN";

            try
            {
                ced.TOWN = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            sql_text = "select * from O_USER";

            try
            {
                ced.O_USER = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            sql_text = "select * from ALL_ORG_DOCS";

            try
            {
                ced.ALL_ORG_DOCS = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            sql_text = "select * from ALL_ORGANIZATION";

            try
            {
                ced.ALL_ORGANIZATION = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            sql_text = "select * from ALL_REBUILD_ORG";

            try
            {
                ced.ALL_REBUILD_ORG = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            //////////////////////////////////////\
            sql_text = "select * from ALL_TOWN";

            try
            {
                ced.ALL_TOWN = new work_with_oledb().ExecSQL_query(sql_text);
            }
            catch (Exception ex)
            {
                new work_with_oledb().show_err_exception(ex);
            }

            string tmp = SerializeString(ced);

            File.WriteAllText(fn, tmp);
        }