diff --git a/CNAS_DBSync/frmDatabaseParams.Designer.cs b/CNAS_DBSync/frmDatabaseParams.Designer.cs index 269c074..e7e8a1f 100644 --- a/CNAS_DBSync/frmDatabaseParams.Designer.cs +++ b/CNAS_DBSync/frmDatabaseParams.Designer.cs @@ -99,15 +99,10 @@ this.label13 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); this.tabMySql = new System.Windows.Forms.TabPage(); - this.txtPostgreSqlPort = new System.Windows.Forms.TextBox(); this.label17 = new System.Windows.Forms.Label(); this.btnPostgreSqlTest = new System.Windows.Forms.Button(); - this.txtPostgreSqlServer = new System.Windows.Forms.TextBox(); - this.txtPostgreSqlHost = new System.Windows.Forms.TextBox(); this.label18 = new System.Windows.Forms.Label(); this.label19 = new System.Windows.Forms.Label(); - this.txtPostgreSqlPwd = new System.Windows.Forms.TextBox(); - this.txtPostgreSqlUser = new System.Windows.Forms.TextBox(); this.label20 = new System.Windows.Forms.Label(); this.label23 = new System.Windows.Forms.Label(); this.tabOracle = new System.Windows.Forms.TabPage(); @@ -132,6 +127,18 @@ this.btnOpenFileTxt = new System.Windows.Forms.Button(); this.label36 = new System.Windows.Forms.Label(); this.txtInportTxt = new System.Windows.Forms.TextBox(); + this.tabPostgreSql = new System.Windows.Forms.TabPage(); + this.txtPostgreSqlPort = new System.Windows.Forms.TextBox(); + this.label35 = new System.Windows.Forms.Label(); + this.btnPostgreSqlConn = new System.Windows.Forms.Button(); + this.txtPostgreSqlName = new System.Windows.Forms.TextBox(); + this.txtPostgreSqlHost = new System.Windows.Forms.TextBox(); + this.label38 = new System.Windows.Forms.Label(); + this.label39 = new System.Windows.Forms.Label(); + this.txtPostgreSqlPwd = new System.Windows.Forms.TextBox(); + this.txtPostgreSqlUserId = new System.Windows.Forms.TextBox(); + this.label40 = new System.Windows.Forms.Label(); + this.label41 = new System.Windows.Forms.Label(); this.tabCnas = new System.Windows.Forms.TabPage(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.txtDBHost = new System.Windows.Forms.TextBox(); @@ -151,18 +158,11 @@ this.pnlBottom = new System.Windows.Forms.Panel(); this.btnOK = new System.Windows.Forms.Button(); this.pnlTop = new System.Windows.Forms.Panel(); - this.tabPostgreSql = new System.Windows.Forms.TabPage(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.label35 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.textBox3 = new System.Windows.Forms.TextBox(); - this.label38 = new System.Windows.Forms.Label(); - this.label39 = new System.Windows.Forms.Label(); - this.textBox4 = new System.Windows.Forms.TextBox(); - this.textBox5 = new System.Windows.Forms.TextBox(); - this.label40 = new System.Windows.Forms.Label(); - this.label41 = new System.Windows.Forms.Label(); + this.txtMySqlUser = new System.Windows.Forms.TextBox(); + this.txtMySqlPwd = new System.Windows.Forms.TextBox(); + this.txtMySqlHost = new System.Windows.Forms.TextBox(); + this.txtMySqlServer = new System.Windows.Forms.TextBox(); + this.txtMySqlPort = new System.Windows.Forms.TextBox(); this.pnlAll.SuspendLayout(); this.pnlCenter.SuspendLayout(); this.tabParamas.SuspendLayout(); @@ -176,11 +176,11 @@ this.tabMySql.SuspendLayout(); this.tabOracle.SuspendLayout(); this.tabTxt.SuspendLayout(); + this.tabPostgreSql.SuspendLayout(); this.tabCnas.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); this.pnlBottom.SuspendLayout(); - this.tabPostgreSql.SuspendLayout(); this.SuspendLayout(); // // pnlAll @@ -949,15 +949,15 @@ // // tabMySql // - this.tabMySql.Controls.Add(this.txtPostgreSqlPort); + this.tabMySql.Controls.Add(this.txtMySqlPort); this.tabMySql.Controls.Add(this.label17); this.tabMySql.Controls.Add(this.btnPostgreSqlTest); - this.tabMySql.Controls.Add(this.txtPostgreSqlServer); - this.tabMySql.Controls.Add(this.txtPostgreSqlHost); + this.tabMySql.Controls.Add(this.txtMySqlServer); + this.tabMySql.Controls.Add(this.txtMySqlHost); this.tabMySql.Controls.Add(this.label18); this.tabMySql.Controls.Add(this.label19); - this.tabMySql.Controls.Add(this.txtPostgreSqlPwd); - this.tabMySql.Controls.Add(this.txtPostgreSqlUser); + this.tabMySql.Controls.Add(this.txtMySqlPwd); + this.tabMySql.Controls.Add(this.txtMySqlUser); this.tabMySql.Controls.Add(this.label20); this.tabMySql.Controls.Add(this.label23); this.tabMySql.Location = new System.Drawing.Point(4, 28); @@ -968,14 +968,6 @@ this.tabMySql.Text = "MySql"; this.tabMySql.UseVisualStyleBackColor = true; // - // txtPostgreSqlPort - // - this.txtPostgreSqlPort.Location = new System.Drawing.Point(129, 221); - this.txtPostgreSqlPort.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.txtPostgreSqlPort.Name = "txtPostgreSqlPort"; - this.txtPostgreSqlPort.Size = new System.Drawing.Size(472, 28); - this.txtPostgreSqlPort.TabIndex = 35; - // // label17 // this.label17.AutoSize = true; @@ -997,22 +989,6 @@ this.btnPostgreSqlTest.UseVisualStyleBackColor = true; this.btnPostgreSqlTest.Click += new System.EventHandler(this.btnMySqlTest_Click); // - // txtPostgreSqlServer - // - this.txtPostgreSqlServer.Location = new System.Drawing.Point(129, 90); - this.txtPostgreSqlServer.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.txtPostgreSqlServer.Name = "txtPostgreSqlServer"; - this.txtPostgreSqlServer.Size = new System.Drawing.Size(472, 28); - this.txtPostgreSqlServer.TabIndex = 32; - // - // txtPostgreSqlHost - // - this.txtPostgreSqlHost.Location = new System.Drawing.Point(129, 47); - this.txtPostgreSqlHost.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.txtPostgreSqlHost.Name = "txtPostgreSqlHost"; - this.txtPostgreSqlHost.Size = new System.Drawing.Size(472, 28); - this.txtPostgreSqlHost.TabIndex = 31; - // // label18 // this.label18.AutoSize = true; @@ -1033,22 +1009,6 @@ this.label19.TabIndex = 29; this.label19.Text = "服务器:"; // - // txtPostgreSqlPwd - // - this.txtPostgreSqlPwd.Location = new System.Drawing.Point(129, 178); - this.txtPostgreSqlPwd.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.txtPostgreSqlPwd.Name = "txtPostgreSqlPwd"; - this.txtPostgreSqlPwd.Size = new System.Drawing.Size(472, 28); - this.txtPostgreSqlPwd.TabIndex = 34; - // - // txtPostgreSqlUser - // - this.txtPostgreSqlUser.Location = new System.Drawing.Point(129, 133); - this.txtPostgreSqlUser.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.txtPostgreSqlUser.Name = "txtPostgreSqlUser"; - this.txtPostgreSqlUser.Size = new System.Drawing.Size(472, 28); - this.txtPostgreSqlUser.TabIndex = 33; - // // label20 // this.label20.AutoSize = true; @@ -1306,6 +1266,127 @@ this.txtInportTxt.Size = new System.Drawing.Size(403, 28); this.txtInportTxt.TabIndex = 27; // + // tabPostgreSql + // + this.tabPostgreSql.Controls.Add(this.txtPostgreSqlPort); + this.tabPostgreSql.Controls.Add(this.label35); + this.tabPostgreSql.Controls.Add(this.btnPostgreSqlConn); + this.tabPostgreSql.Controls.Add(this.txtPostgreSqlName); + this.tabPostgreSql.Controls.Add(this.txtPostgreSqlHost); + this.tabPostgreSql.Controls.Add(this.label38); + this.tabPostgreSql.Controls.Add(this.label39); + this.tabPostgreSql.Controls.Add(this.txtPostgreSqlPwd); + this.tabPostgreSql.Controls.Add(this.txtPostgreSqlUserId); + this.tabPostgreSql.Controls.Add(this.label40); + this.tabPostgreSql.Controls.Add(this.label41); + this.tabPostgreSql.Location = new System.Drawing.Point(4, 28); + this.tabPostgreSql.Name = "tabPostgreSql"; + this.tabPostgreSql.Size = new System.Drawing.Size(968, 521); + this.tabPostgreSql.TabIndex = 8; + this.tabPostgreSql.Text = "PostgreSql"; + this.tabPostgreSql.UseVisualStyleBackColor = true; + // + // txtPostgreSqlPort + // + this.txtPostgreSqlPort.Location = new System.Drawing.Point(145, 221); + this.txtPostgreSqlPort.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txtPostgreSqlPort.Name = "txtPostgreSqlPort"; + this.txtPostgreSqlPort.Size = new System.Drawing.Size(472, 28); + this.txtPostgreSqlPort.TabIndex = 46; + // + // label35 + // + this.label35.AutoSize = true; + this.label35.Location = new System.Drawing.Point(78, 227); + this.label35.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label35.Name = "label35"; + this.label35.Size = new System.Drawing.Size(62, 18); + this.label35.TabIndex = 44; + this.label35.Text = "端口:"; + // + // btnPostgreSqlConn + // + this.btnPostgreSqlConn.Location = new System.Drawing.Point(577, 270); + this.btnPostgreSqlConn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.btnPostgreSqlConn.Name = "btnPostgreSqlConn"; + this.btnPostgreSqlConn.Size = new System.Drawing.Size(118, 36); + this.btnPostgreSqlConn.TabIndex = 47; + this.btnPostgreSqlConn.Text = "测试连接"; + this.btnPostgreSqlConn.UseVisualStyleBackColor = true; + this.btnPostgreSqlConn.Click += new System.EventHandler(this.button1_Click); + // + // txtPostgreSqlName + // + this.txtPostgreSqlName.Location = new System.Drawing.Point(145, 90); + this.txtPostgreSqlName.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txtPostgreSqlName.Name = "txtPostgreSqlName"; + this.txtPostgreSqlName.Size = new System.Drawing.Size(472, 28); + this.txtPostgreSqlName.TabIndex = 42; + // + // txtPostgreSqlHost + // + this.txtPostgreSqlHost.Location = new System.Drawing.Point(145, 47); + this.txtPostgreSqlHost.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txtPostgreSqlHost.Name = "txtPostgreSqlHost"; + this.txtPostgreSqlHost.Size = new System.Drawing.Size(472, 28); + this.txtPostgreSqlHost.TabIndex = 41; + // + // label38 + // + this.label38.AutoSize = true; + this.label38.Location = new System.Drawing.Point(78, 96); + this.label38.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label38.Name = "label38"; + this.label38.Size = new System.Drawing.Size(62, 18); + this.label38.TabIndex = 40; + this.label38.Text = "实例:"; + // + // label39 + // + this.label39.AutoSize = true; + this.label39.Location = new System.Drawing.Point(60, 53); + this.label39.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label39.Name = "label39"; + this.label39.Size = new System.Drawing.Size(80, 18); + this.label39.TabIndex = 39; + this.label39.Text = "服务器:"; + // + // txtPostgreSqlPwd + // + this.txtPostgreSqlPwd.Location = new System.Drawing.Point(145, 178); + this.txtPostgreSqlPwd.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txtPostgreSqlPwd.Name = "txtPostgreSqlPwd"; + this.txtPostgreSqlPwd.Size = new System.Drawing.Size(472, 28); + this.txtPostgreSqlPwd.TabIndex = 45; + // + // txtPostgreSqlUserId + // + this.txtPostgreSqlUserId.Location = new System.Drawing.Point(145, 133); + this.txtPostgreSqlUserId.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txtPostgreSqlUserId.Name = "txtPostgreSqlUserId"; + this.txtPostgreSqlUserId.Size = new System.Drawing.Size(472, 28); + this.txtPostgreSqlUserId.TabIndex = 43; + // + // label40 + // + this.label40.AutoSize = true; + this.label40.Location = new System.Drawing.Point(78, 182); + this.label40.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label40.Name = "label40"; + this.label40.Size = new System.Drawing.Size(62, 18); + this.label40.TabIndex = 38; + this.label40.Text = "密码:"; + // + // label41 + // + this.label41.AutoSize = true; + this.label41.Location = new System.Drawing.Point(60, 139); + this.label41.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label41.Name = "label41"; + this.label41.Size = new System.Drawing.Size(80, 18); + this.label41.TabIndex = 37; + this.label41.Text = "用户名:"; + // // tabCnas // this.tabCnas.Controls.Add(this.groupBox2); @@ -1510,125 +1591,45 @@ this.pnlTop.Size = new System.Drawing.Size(992, 7); this.pnlTop.TabIndex = 2; // - // tabPostgreSql - // - this.tabPostgreSql.Controls.Add(this.textBox1); - this.tabPostgreSql.Controls.Add(this.label35); - this.tabPostgreSql.Controls.Add(this.button1); - this.tabPostgreSql.Controls.Add(this.textBox2); - this.tabPostgreSql.Controls.Add(this.textBox3); - this.tabPostgreSql.Controls.Add(this.label38); - this.tabPostgreSql.Controls.Add(this.label39); - this.tabPostgreSql.Controls.Add(this.textBox4); - this.tabPostgreSql.Controls.Add(this.textBox5); - this.tabPostgreSql.Controls.Add(this.label40); - this.tabPostgreSql.Controls.Add(this.label41); - this.tabPostgreSql.Location = new System.Drawing.Point(4, 28); - this.tabPostgreSql.Name = "tabPostgreSql"; - this.tabPostgreSql.Size = new System.Drawing.Size(968, 521); - this.tabPostgreSql.TabIndex = 8; - this.tabPostgreSql.Text = "PostgreSql"; - this.tabPostgreSql.UseVisualStyleBackColor = true; - // - // textBox1 + // txtMySqlUser // - this.textBox1.Location = new System.Drawing.Point(145, 221); - this.textBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(472, 28); - this.textBox1.TabIndex = 46; + this.txtMySqlUser.Location = new System.Drawing.Point(129, 133); + this.txtMySqlUser.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txtMySqlUser.Name = "txtMySqlUser"; + this.txtMySqlUser.Size = new System.Drawing.Size(472, 28); + this.txtMySqlUser.TabIndex = 33; // - // label35 + // txtMySqlPwd // - this.label35.AutoSize = true; - this.label35.Location = new System.Drawing.Point(78, 227); - this.label35.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label35.Name = "label35"; - this.label35.Size = new System.Drawing.Size(62, 18); - this.label35.TabIndex = 44; - this.label35.Text = "端口:"; + this.txtMySqlPwd.Location = new System.Drawing.Point(129, 178); + this.txtMySqlPwd.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txtMySqlPwd.Name = "txtMySqlPwd"; + this.txtMySqlPwd.Size = new System.Drawing.Size(472, 28); + this.txtMySqlPwd.TabIndex = 34; // - // button1 + // txtMySqlHost // - this.button1.Location = new System.Drawing.Point(577, 270); - this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(118, 36); - this.button1.TabIndex = 47; - this.button1.Text = "测试连接"; - this.button1.UseVisualStyleBackColor = true; + this.txtMySqlHost.Location = new System.Drawing.Point(129, 47); + this.txtMySqlHost.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txtMySqlHost.Name = "txtMySqlHost"; + this.txtMySqlHost.Size = new System.Drawing.Size(472, 28); + this.txtMySqlHost.TabIndex = 31; // - // textBox2 + // txtMySqlServer // - this.textBox2.Location = new System.Drawing.Point(145, 90); - this.textBox2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(472, 28); - this.textBox2.TabIndex = 42; + this.txtMySqlServer.Location = new System.Drawing.Point(129, 90); + this.txtMySqlServer.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txtMySqlServer.Name = "txtMySqlServer"; + this.txtMySqlServer.Size = new System.Drawing.Size(472, 28); + this.txtMySqlServer.TabIndex = 32; // - // textBox3 + // txtMySqlPort // - this.textBox3.Location = new System.Drawing.Point(145, 47); - this.textBox3.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.textBox3.Name = "textBox3"; - this.textBox3.Size = new System.Drawing.Size(472, 28); - this.textBox3.TabIndex = 41; - // - // label38 - // - this.label38.AutoSize = true; - this.label38.Location = new System.Drawing.Point(78, 96); - this.label38.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label38.Name = "label38"; - this.label38.Size = new System.Drawing.Size(62, 18); - this.label38.TabIndex = 40; - this.label38.Text = "实例:"; - // - // label39 - // - this.label39.AutoSize = true; - this.label39.Location = new System.Drawing.Point(60, 53); - this.label39.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label39.Name = "label39"; - this.label39.Size = new System.Drawing.Size(80, 18); - this.label39.TabIndex = 39; - this.label39.Text = "服务器:"; - // - // textBox4 - // - this.textBox4.Location = new System.Drawing.Point(145, 178); - this.textBox4.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.textBox4.Name = "textBox4"; - this.textBox4.Size = new System.Drawing.Size(472, 28); - this.textBox4.TabIndex = 45; - // - // textBox5 - // - this.textBox5.Location = new System.Drawing.Point(145, 133); - this.textBox5.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.textBox5.Name = "textBox5"; - this.textBox5.Size = new System.Drawing.Size(472, 28); - this.textBox5.TabIndex = 43; - // - // label40 - // - this.label40.AutoSize = true; - this.label40.Location = new System.Drawing.Point(78, 182); - this.label40.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label40.Name = "label40"; - this.label40.Size = new System.Drawing.Size(62, 18); - this.label40.TabIndex = 38; - this.label40.Text = "密码:"; - // - // label41 - // - this.label41.AutoSize = true; - this.label41.Location = new System.Drawing.Point(60, 139); - this.label41.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label41.Name = "label41"; - this.label41.Size = new System.Drawing.Size(80, 18); - this.label41.TabIndex = 37; - this.label41.Text = "用户名:"; + this.txtMySqlPort.Location = new System.Drawing.Point(129, 221); + this.txtMySqlPort.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.txtMySqlPort.Name = "txtMySqlPort"; + this.txtMySqlPort.Size = new System.Drawing.Size(472, 28); + this.txtMySqlPort.TabIndex = 35; // // frmDatabaseParams // @@ -1665,14 +1666,14 @@ this.tabOracle.PerformLayout(); this.tabTxt.ResumeLayout(false); this.tabTxt.PerformLayout(); + this.tabPostgreSql.ResumeLayout(false); + this.tabPostgreSql.PerformLayout(); this.tabCnas.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.pnlBottom.ResumeLayout(false); - this.tabPostgreSql.ResumeLayout(false); - this.tabPostgreSql.PerformLayout(); this.ResumeLayout(false); } @@ -1748,15 +1749,10 @@ private System.Windows.Forms.Label lblSqliteRemoteUser; private System.Windows.Forms.TextBox txtSqliteRemoteUser; private System.Windows.Forms.TabPage tabMySql; - private System.Windows.Forms.TextBox txtPostgreSqlPort; private System.Windows.Forms.Label label17; private System.Windows.Forms.Button btnPostgreSqlTest; - private System.Windows.Forms.TextBox txtPostgreSqlServer; - private System.Windows.Forms.TextBox txtPostgreSqlHost; private System.Windows.Forms.Label label18; private System.Windows.Forms.Label label19; - private System.Windows.Forms.TextBox txtPostgreSqlPwd; - private System.Windows.Forms.TextBox txtPostgreSqlUser; private System.Windows.Forms.Label label20; private System.Windows.Forms.Label label23; private System.Windows.Forms.TabPage tabOracle; @@ -1802,16 +1798,21 @@ private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.TabPage tabPostgreSql; - private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox txtPostgreSqlPort; private System.Windows.Forms.Label label35; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.TextBox textBox2; - private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Button btnPostgreSqlConn; + private System.Windows.Forms.TextBox txtPostgreSqlName; + private System.Windows.Forms.TextBox txtPostgreSqlHost; private System.Windows.Forms.Label label38; private System.Windows.Forms.Label label39; - private System.Windows.Forms.TextBox textBox4; - private System.Windows.Forms.TextBox textBox5; + private System.Windows.Forms.TextBox txtPostgreSqlPwd; + private System.Windows.Forms.TextBox txtPostgreSqlUserId; private System.Windows.Forms.Label label40; private System.Windows.Forms.Label label41; + private System.Windows.Forms.TextBox txtMySqlPort; + private System.Windows.Forms.TextBox txtMySqlServer; + private System.Windows.Forms.TextBox txtMySqlHost; + private System.Windows.Forms.TextBox txtMySqlPwd; + private System.Windows.Forms.TextBox txtMySqlUser; } } \ No newline at end of file diff --git a/CNAS_DBSync/frmDatabaseParams.cs b/CNAS_DBSync/frmDatabaseParams.cs index 9873a47..23ddba7 100644 --- a/CNAS_DBSync/frmDatabaseParams.cs +++ b/CNAS_DBSync/frmDatabaseParams.cs @@ -120,11 +120,11 @@ namespace CNAS_DBSync break; case DataSourceType.MySQL: this.tabcDS.SelectedIndex = 5; - this.txtPostgreSqlHost.Text= syncInstrumentItem.SyncInstrumentDSInfo.Host; - this.txtPostgreSqlServer.Text = syncInstrumentItem.SyncInstrumentDSInfo.ServerName; - this.txtPostgreSqlUser.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserId; - this.txtPostgreSqlPwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserPwd; - this.txtPostgreSqlPort.Text = syncInstrumentItem.SyncInstrumentDSInfo.Port ; + this.txtMySqlHost.Text= syncInstrumentItem.SyncInstrumentDSInfo.Host; + this.txtMySqlServer.Text = syncInstrumentItem.SyncInstrumentDSInfo.ServerName; + this.txtMySqlUser.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserId; + this.txtMySqlPwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserPwd; + this.txtMySqlPort.Text = syncInstrumentItem.SyncInstrumentDSInfo.Port ; break; case DataSourceType.Oracle: this.tabcDS.SelectedIndex = 6; @@ -200,11 +200,11 @@ namespace CNAS_DBSync syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = this.txtSqlServerPwd.Text.Trim(); break; case DataSourceType.MySQL: - syncInstrumentItem.SyncInstrumentDSInfo.Host = this.txtPostgreSqlHost.Text.Trim(); - syncInstrumentItem.SyncInstrumentDSInfo.ServerName = this.txtPostgreSqlServer.Text.Trim(); - syncInstrumentItem.SyncInstrumentDSInfo.UserId = this.txtPostgreSqlUser.Text.Trim(); - syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = this.txtPostgreSqlPwd.Text.Trim(); - syncInstrumentItem.SyncInstrumentDSInfo.Port = this.txtPostgreSqlPort.Text.Trim(); + syncInstrumentItem.SyncInstrumentDSInfo.Host = this.txtMySqlHost.Text.Trim(); + syncInstrumentItem.SyncInstrumentDSInfo.ServerName = this.txtMySqlServer.Text.Trim(); + syncInstrumentItem.SyncInstrumentDSInfo.UserId = this.txtMySqlUser.Text.Trim(); + syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = this.txtMySqlPwd.Text.Trim(); + syncInstrumentItem.SyncInstrumentDSInfo.Port = this.txtMySqlPort.Text.Trim(); break; case DataSourceType.Oracle: syncInstrumentItem.SyncInstrumentDSInfo.Host = this.txtOracleHost.Text.Trim(); @@ -570,7 +570,7 @@ namespace CNAS_DBSync private bool CheckMySqlControl() { - if (this.txtPostgreSqlHost.Text.Trim() != "" || this.txtPostgreSqlServer.Text.Trim() != "" || this.txtPostgreSqlUser.Text.Trim() != "" || this.txtPostgreSqlPwd.Text.Trim() != ""|| this.txtPostgreSqlPort.Text.Trim()!="") + if (this.txtMySqlHost.Text.Trim() != "" || this.txtMySqlServer.Text.Trim() != "" || this.txtMySqlUser.Text.Trim() != "" || this.txtMySqlPwd.Text.Trim() != ""|| this.txtMySqlPort.Text.Trim()!="") return false; else return true; @@ -653,11 +653,11 @@ namespace CNAS_DBSync private void ClearMySQLControl() { - this.txtPostgreSqlHost.Text = ""; - this.txtPostgreSqlServer.Text = ""; - this.txtPostgreSqlUser.Text = ""; - this.txtPostgreSqlPwd.Text = ""; - this.txtPostgreSqlPort.Text = ""; + this.txtMySqlHost.Text = ""; + this.txtMySqlServer.Text = ""; + this.txtMySqlUser.Text = ""; + this.txtMySqlPwd.Text = ""; + this.txtMySqlPort.Text = ""; } private void ClearOracleControl() @@ -862,11 +862,11 @@ namespace CNAS_DBSync if (CnasDataOperationFact.CnasDataOperation().TestConnect(new DataBaseInfo() { - DBHost = this.txtPostgreSqlHost.Text.Trim(), - DBName = this.txtPostgreSqlServer.Text.Trim(), - DBUser = this.txtPostgreSqlUser.Text.Trim(), - DBPwd = this.txtPostgreSqlPwd.Text.Trim(), - DBPort = this.txtPostgreSqlPort.Text.Trim() + DBHost = this.txtMySqlHost.Text.Trim(), + DBName = this.txtMySqlServer.Text.Trim(), + DBUser = this.txtMySqlUser.Text.Trim(), + DBPwd = this.txtMySqlPwd.Text.Trim(), + DBPort = this.txtMySqlPort.Text.Trim() })) MessageBox.Show("连接成功!"); else @@ -1053,5 +1053,10 @@ namespace CNAS_DBSync } } } + + private void button1_Click(object sender, EventArgs e) + { + + } } } diff --git a/CnasSynchronusDAL/PostgreSqlDAL.cs b/CnasSynchronusDAL/PostgreSqlDAL.cs index 0519ecb..c379d5d 100644 --- a/CnasSynchronusDAL/PostgreSqlDAL.cs +++ b/CnasSynchronusDAL/PostgreSqlDAL.cs @@ -1 +1,185 @@ - \ No newline at end of file +using System; +using System.Data; +using Npgsql; +using CnasSynchrousModel; + +namespace CnasSynchronusDAL +{ + public class PostgreSqlDAL : IDAL + { + private string connectionString; + + public PostgreSqlDAL(InstrumentDataSourceInfo dataSourceInfo) + { + connectionString = $"Server={dataSourceInfo.Host};Port={dataSourceInfo.Port};Database={dataSourceInfo.ServerName};User Id={dataSourceInfo.UserId};Password={dataSourceInfo.UserPwd};"; + } + + public bool TestConnection() + { + try + { + using (NpgsqlConnection conn = new NpgsqlConnection(connectionString)) + { + conn.Open(); + return true; + } + } + catch + { + return false; + } + } + + public DataTable GetDataTable(string sql) + { + DataTable dt = new DataTable(); + try + { + using (NpgsqlConnection conn = new NpgsqlConnection(connectionString)) + { + conn.Open(); + using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) + { + using (NpgsqlDataAdapter adapter = new NpgsqlDataAdapter(cmd)) + { + adapter.Fill(dt); + } + } + } + } + catch (Exception ex) + { + throw new Exception($"获取数据失败:{ex.Message}"); + } + return dt; + } + + public DataSet GetDataSet(string sql) + { + DataSet ds = new DataSet(); + try + { + using (NpgsqlConnection conn = new NpgsqlConnection(connectionString)) + { + conn.Open(); + using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) + { + using (NpgsqlDataAdapter adapter = new NpgsqlDataAdapter(cmd)) + { + adapter.Fill(ds); + } + } + } + } + catch (Exception ex) + { + throw new Exception($"获取数据失败:{ex.Message}"); + } + return ds; + } + + public int ExecuteNonQuery(string sql) + { + try + { + using (NpgsqlConnection conn = new NpgsqlConnection(connectionString)) + { + conn.Open(); + using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) + { + return cmd.ExecuteNonQuery(); + } + } + } + catch (Exception ex) + { + throw new Exception($"执行SQL失败:{ex.Message}"); + } + } + + public object ExecuteScalar(string sql) + { + try + { + using (NpgsqlConnection conn = new NpgsqlConnection(connectionString)) + { + conn.Open(); + using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) + { + return cmd.ExecuteScalar(); + } + } + } + catch (Exception ex) + { + throw new Exception($"执行SQL失败:{ex.Message}"); + } + } + + public bool ExecuteTransaction(string[] sqlArray) + { + using (NpgsqlConnection conn = new NpgsqlConnection(connectionString)) + { + conn.Open(); + using (NpgsqlTransaction transaction = conn.BeginTransaction()) + { + try + { + foreach (string sql in sqlArray) + { + using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn, transaction)) + { + cmd.ExecuteNonQuery(); + } + } + transaction.Commit(); + return true; + } + catch (Exception ex) + { + transaction.Rollback(); + throw new Exception($"执行事务失败:{ex.Message}"); + } + } + } + } + + public void BulkCopy(DataTable sourceData, string targetTable) + { + try + { + using (NpgsqlConnection conn = new NpgsqlConnection(connectionString)) + { + conn.Open(); + + // 构建COPY命令 + using (var writer = conn.BeginBinaryImport($"COPY {targetTable} FROM STDIN (FORMAT BINARY)")) + { + foreach (DataRow row in sourceData.Rows) + { + writer.StartRow(); + for (int i = 0; i < sourceData.Columns.Count; i++) + { + if (row[i] == DBNull.Value) + writer.WriteNull(); + else + writer.Write(row[i]); + } + } + writer.Complete(); + } + } + } + catch (Exception ex) + { + throw new Exception($"批量复制数据失败:{ex.Message}"); + } + } + + public void Dispose() + { + // 清理资源 + GC.SuppressFinalize(this); + } + } +} \ No newline at end of file diff --git a/dll/CNASBalanceDBManage.exe.config b/dll/CNASBalanceDBManage.exe.config index 8b2fee3..ac31a01 100644 --- a/dll/CNASBalanceDBManage.exe.config +++ b/dll/CNASBalanceDBManage.exe.config @@ -1,49 +1,62 @@ - + -
+
- - - + + + - - + + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - + + + + + + + + + + + + + + diff --git a/dll/CNAS_BalanceClient.exe.config b/dll/CNAS_BalanceClient.exe.config index 2758824..0d52222 100644 --- a/dll/CNAS_BalanceClient.exe.config +++ b/dll/CNAS_BalanceClient.exe.config @@ -1,56 +1,64 @@ - + -
+
- - + + - - + + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - + + + + + + + + + + - + diff --git a/dll/CNAS_DBSync.exe.config b/dll/CNAS_DBSync.exe.config index 54404d6..4afd3da 100644 --- a/dll/CNAS_DBSync.exe.config +++ b/dll/CNAS_DBSync.exe.config @@ -1,87 +1,97 @@ - + -
-
- +
+
+
- + - - - - - - + + + + + + - + - - + + - - - + + + - - + + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - + + + + + + + + + + + + + diff --git a/dll/CNAS_RunSync.exe.config b/dll/CNAS_RunSync.exe.config index 4c47e64..f306c20 100644 --- a/dll/CNAS_RunSync.exe.config +++ b/dll/CNAS_RunSync.exe.config @@ -1,53 +1,66 @@ - + -
+
- - - - - - - + + + + + + + - - + + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - + + + + + + + + + + + + + + diff --git a/dll/CNAS_SerialPort.dll.config b/dll/CNAS_SerialPort.dll.config new file mode 100644 index 0000000..7afad42 --- /dev/null +++ b/dll/CNAS_SerialPort.dll.config @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dll/CNAS_SyncService.exe.config b/dll/CNAS_SyncService.exe.config index 86a9d5a..439f18b 100644 --- a/dll/CNAS_SyncService.exe.config +++ b/dll/CNAS_SyncService.exe.config @@ -1,68 +1,81 @@ - + -
+
- - - - + + + + - - + + - - + + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - - - - - + + + + + - + - - + + - + + + + + + + + + + + + + + diff --git a/dll/CnasSynchronusClient.dll.config b/dll/CnasSynchronusClient.dll.config index 150af98..ccd9fe7 100644 --- a/dll/CnasSynchronusClient.dll.config +++ b/dll/CnasSynchronusClient.dll.config @@ -1,19 +1,32 @@ - + -
+
- + - - + + - + + + + + + + + + + + + + + diff --git a/dll/WF-ChangeGUID.exe.config b/dll/WF-ChangeGUID.exe.config index 383ecdc..3886f59 100644 --- a/dll/WF-ChangeGUID.exe.config +++ b/dll/WF-ChangeGUID.exe.config @@ -1,7 +1,20 @@ - + - - + + - + + + + + + + + + + + + + +