public void TestSourceDataCopy()
        {
            //string dest = @"Data Source=FX026132M\SQLExpress;Initial Catalog=FGA_JMOINS1;Integrated Security=True;Connection Timeout=60";
            //string dest = @"Data Source=FX027471M\SQLExpress;Initial Catalog=FGA_JMOINS1;Integrated Security=True;Connection Timeout=60";
            //DBConnection d = new MSSQL2005_DBConnection(dest);


            //SQLCopy.SQLUtils s = new SQLCopy.SQLUtils("ConnectionAdmin", dest);
            DBConnectionDelegate s = new MSSQL2005_DBConnection("FGA_RW");
            DBConnectionDelegate d = new MSSQL2005_DBConnection("FGA_JMOINS1");
            bool bddVide           = d.isDBEmpty();

            if (bddVide)
            {
                DataSet ds = s.GetMetatDataDBScripts();

                // sauvegarde des fichiers de scripts
                TextFile.WriteTo(ds, "C:", "fga_db", "sql");

                // on execute les scripts sur la base destination
                DataTable schema = ds.Tables["SCHEMA"];
                d.ExecuteScripts(schema);
                DataTable table = ds.Tables["TABLE"];
                d.ExecuteScripts(table);
                DataTable fk = ds.Tables["FK"];
                d.ExecuteScripts(fk);
                DataTable procstock = ds.Tables["PROCSTOC"];
                d.ExecuteScripts(procstock, useDBcmd: false);
            }
            else
            {
                Console.WriteLine("La base de donnée de destinaion n'est pas vide, opération annulée");
            }
        }
        public void LumenCSVReadValuesAndInsertIntoDest()
        {
            TestContext.BeginTimer("LumenCSVReadValuesAndInsertIntoDest");

            DataSet ds = new DataSet("PTF_PROXY");
            DBConnectionDelegate dest = new MSSQL2005_DBConnection("FGA_JMOINS1");

            using (var reader = new CsvReader(new StreamReader(@"PortfolioHolding_PROXY2.csv"), true, ';'))
            {
                CsvDataAdapter adapter = new CsvDataAdapter(reader);
                adapter.Fill(dest, new DatabaseTable("dbo", "#PTF_PROXY"));

                dest.Insert(new DatabaseTable("dbo", "PTF_PROXY"), new DatabaseTable("dbo", "#PTF_PROXY"));
            }
            TestContext.EndTimer("LumenCSVReadValuesAndInsertIntoDest");
        }
        public void LumenCSVReadValuesAndDeleteIntoDest()
        {
            DBConnectionDelegate destinationConnection = new MSSQL2005_DBConnection("FGA_JMOINS1");

            DataSet       ds      = new DataSet("PTF_PROXY_4DELETE");
            List <string> columns = new List <string>();

            using (var reader = new CsvReader(new StreamReader(@"Delete_PROXY1.csv"), true, ';'))
            {
                CsvDataAdapter adapter     = new CsvDataAdapter(reader);
                int            nbReadLines = adapter.Fill(ds, "#PTF_PROXY_CLAUSE");

                DataTable dt = ds.Tables["#PTF_PROXY_CLAUSE"];

                destinationConnection.Delete(new DatabaseTable("dbo", "PTF_PROXY"), dt);
            }
        }
        public void TestBulkCopyData_4DataModel()
        {
            string source          = @"Data Source=FX026132M\SQLExpress;Initial Catalog=FGA_DATAMODEL;Integrated Security=True;Connection Timeout=60";
            DBConnectionDelegate s = new MSSQL2005_DBConnection(source);
            DBConnectionDelegate d = new MSSQL2005_DBConnection("FGA_JMOINS1");

            //DataSet ds = s.GetMetatDataDBScripts();
            //// sauvegarde des fichiers de scripts
            //TextFile.WriteTo(ds, "C:", "fgadatamodel_db", "sql");

            //// on execute les scripts sur la base destination
            //DataTable schema = ds.Tables["SCHEMA"];
            //d.ExecuteScripts(schema);
            //DataTable table = ds.Tables["TABLE"];
            //d.ExecuteScripts(table);
            //DataTable fk = ds.Tables["FK"];
            //d.ExecuteScripts(fk);
            //DataTable procstock = ds.Tables["PROCSTOC"];
            //d.ExecuteScripts(procstock, useDBcmd: false);


            //SQLCopy.SQLUtils s = new SQLCopy.SQLUtils("ConnectionAdmin", dest);
            SQLCopy.MSDBIntegration util = new SQLCopy.MSDBIntegration(s, d);


            util.bulkcopyData(ListeMode.Include, new List <DatabaseTable>()
            {
                new DatabaseTable("ASSET_HOLDING"),
                new DatabaseTable("COMPONENT"),
                new DatabaseTable("INDEX"),
                new DatabaseTable("ref_holding", "PORTFOLIO"),
                new DatabaseTable("VALUATION"),
                new DatabaseTable("ROLE"),
                new DatabaseTable("RATING"),
                new DatabaseTable("ASSET"),
                new DatabaseTable("ASSET_CLASSIFICATION"),
                new DatabaseTable("ASSET_PORTFOLIO"),
                new DatabaseTable("DEBT"),
                new DatabaseTable("EQUITY"),
                new DatabaseTable("FUND"),
                new DatabaseTable("PRICE"),
                new DatabaseTable("SECURITIES_ISSUANCE")
                //    "IDENTIFICATION"
            });
        }