public void GetTableInfo(ConnInfo connInfoA, ConnInfo connInfoB, out List<TableInfo> tableListA, out List<TableInfo> tableListB)
 {
     AnalyseTableDal analyseTableDal = new AnalyseTableDal();
     string conn = "Data Source = {0};Initial Catalog = {1};User Id = {2};Password = {3};";
     string connA = string.Format(conn, connInfoA.Ip, connInfoA.Name, connInfoA.UserId, connInfoA.Pwd);
     string connB = string.Format(conn, connInfoB.Ip, connInfoB.Name, connInfoB.UserId, connInfoB.Pwd);
     analyseTableDal.GetTableInfo(connA, connB, out tableListA, out tableListB);
     HandleData(tableListA);
     HandleData(tableListB);
 }
Esempio n. 2
0
 private void TestConn( ConnInfo connInfo )
 {
     try
     {
         ConnTestBll connTestBll = new ConnTestBll();
         connTestBll.ConnTest(connInfo);
         MessageBox.Show("连接成功!");
     }
     catch (Exception ex)
     {
         MessageBox.Show("连接失败!" + ex.Message);
     }
 }
Esempio n. 3
0
        private void btnAnalyse_Click(object sender, EventArgs e)
        {
            AnalyseTableBll analyseTableBll = new AnalyseTableBll();

            ConnInfo connInfoA = new ConnInfo();
            connInfoA.Ip = tbIPA.Text.Trim();
            connInfoA.Name = tbDBA.Text.Trim();
            connInfoA.UserId = tbUserNameA.Text.Trim();
            connInfoA.Pwd = tbPwdA.Text.Trim(); ;
            ConnInfo connInfoB = new ConnInfo();
            connInfoB.Ip = tbIPB.Text.Trim();
            connInfoB.Name = tbDBB.Text.Trim();
            connInfoB.UserId = tbUserNameB.Text.Trim();
            connInfoB.Pwd = tbPwdB.Text.Trim(); ;

            try
            {
                analyseTableBll.GetTableInfo(connInfoA, connInfoB, out _tableListA, out _tableListB);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            foreach (ListView lv in _lvArray)
            {
                UICommonHelper.ClearListView(lv);
            }

            string compareFied = "TableName";
            // 求库A多于B
            var resultA = _tableListA.Except(_tableListB, new ComparerHelper<TableInfo>(compareFied)).ToList();
            foreach (var item in resultA)
            {
                UICommonHelper.RefreshListView(listView1, item.TableName);
            }
            // 求库B多于A
            var resultB = _tableListB.Except(_tableListA, new ComparerHelper<TableInfo>(compareFied)).ToList();
            foreach (var item in resultB)
            {
                UICommonHelper.RefreshListView(listView2, item.TableName);
            }

            #region 表名相同分析差异
            var sameTableName = _tableListA.Intersect(_tableListB, new ComparerHelper<TableInfo>(compareFied)).ToList();
            var diffTable = _tableListA.Except(_tableListB, new ComparerHelper<TableInfo>()).ToList();

            // 求AB相同的表
            var resultC = sameTableName.Except(diffTable, new ComparerHelper<TableInfo>(compareFied)).ToList();
            foreach (var item in resultC)
            {
                UICommonHelper.RefreshListView(listView3, item.TableName);
            }

            // 求AB不同的表
            var resultD = sameTableName.Intersect(diffTable, new ComparerHelper<TableInfo>(compareFied)).ToList();
            foreach (var item in resultD)
            {
                UICommonHelper.RefreshListView(listView4,item.TableName);
            }
            #endregion
        }
Esempio n. 4
0
        private void btnB_Click(object sender, EventArgs e)
        {
            ConnInfo connInfo = new ConnInfo();
            connInfo.Ip = tbIPB.Text.Trim();
            connInfo.Name = tbDBB.Text.Trim();
            connInfo.UserId = tbUserNameB.Text.Trim();
            connInfo.Pwd = tbPwdB.Text.Trim(); ;

            TestConn(connInfo);
        }