@@ -1804,7 +1804,7 @@ | |||||
// | // | ||||
this.btnDmConn.Location = new System.Drawing.Point(167, 226); | this.btnDmConn.Location = new System.Drawing.Point(167, 226); | ||||
this.btnDmConn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); | this.btnDmConn.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); | ||||
this.btnDmConn.Name = "btnDmConn"; | |||||
this.btnDmConn.Name = "txtDmPort"; | |||||
this.btnDmConn.Size = new System.Drawing.Size(472, 28); | this.btnDmConn.Size = new System.Drawing.Size(472, 28); | ||||
this.btnDmConn.TabIndex = 68; | this.btnDmConn.TabIndex = 68; | ||||
// | // | ||||
@@ -1822,11 +1822,12 @@ | |||||
// | // | ||||
this.button1.Location = new System.Drawing.Point(599, 272); | this.button1.Location = new System.Drawing.Point(599, 272); | ||||
this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); | this.button1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); | ||||
this.button1.Name = "button1"; | |||||
this.button1.Name = "btnDmConn"; | |||||
this.button1.Size = new System.Drawing.Size(118, 36); | this.button1.Size = new System.Drawing.Size(118, 36); | ||||
this.button1.TabIndex = 69; | this.button1.TabIndex = 69; | ||||
this.button1.Text = "测试连接"; | this.button1.Text = "测试连接"; | ||||
this.button1.UseVisualStyleBackColor = true; | this.button1.UseVisualStyleBackColor = true; | ||||
this.button1.Click += new System.EventHandler(this.btnDmConn_Click); | |||||
// | // | ||||
// txtDmServer | // txtDmServer | ||||
// | // | ||||
@@ -591,6 +591,37 @@ namespace CNAS_DBSync | |||||
} | } | ||||
syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.Kingbase; | syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.Kingbase; | ||||
} | } | ||||
if (e.TabPage == tabDm) | |||||
{ | |||||
if (!CheckExcelControl() || !CheckAccessControl() || !CheckSQLiteControl() || | |||||
!CheckSQLServerControl() || !CheckMySqlControl() || !CheckOracleControl() || | |||||
!CheckFoxproControl() || !CheckTxtControl() || !CheckPostgreSqlControl() || | |||||
!CheckKingbaseControl()) | |||||
{ | |||||
if (MessageBox.Show("其他数据源存在已保存数据,继续将删除这些值,是否继续", "提示", | |||||
MessageBoxButtons.OKCancel) == DialogResult.OK) | |||||
{ | |||||
ClearAccessControl(); | |||||
ClearExcelControl(); | |||||
ClearSqliteControl(); | |||||
ClearSQLServerControl(); | |||||
ClearMySQLControl(); | |||||
ClearOracleControl(); | |||||
ClearFoxproControl(); | |||||
ClearTxtControl(); | |||||
ClearPostgreSqlControl(); | |||||
ClearKingbaseControl(); | |||||
ClearObjectValue(); | |||||
} | |||||
else | |||||
{ | |||||
ChangeSelectTabPageByType(); | |||||
return; | |||||
} | |||||
} | |||||
syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.Dm; | |||||
} | |||||
} | } | ||||
//根据数据源类型切换Tab页 | //根据数据源类型切换Tab页 | ||||
@@ -1266,5 +1297,48 @@ namespace CNAS_DBSync | |||||
//else | //else | ||||
// MessageBox.Show("连接失败!"); | // MessageBox.Show("连接失败!"); | ||||
} | } | ||||
private void btnDmConn_Click(object sender, EventArgs e) | |||||
{ | |||||
if (this.txtDmHost.Text.Trim() == "" || this.txtDmServer.Text.Trim() == "" || | |||||
this.txtDmUser.Text.Trim() == "" || this.btnDmConn.Text.Trim() == "") | |||||
{ | |||||
MessageBox.Show("请填写相关连接信息。"); | |||||
return; | |||||
} | |||||
InstrumentDataSourceInfo dbinfo = new InstrumentDataSourceInfo(); | |||||
dbinfo.Host = this.txtDmHost.Text.Trim(); | |||||
dbinfo.ServerName = this.txtDmServer.Text.Trim(); | |||||
dbinfo.UserId = this.txtDmUser.Text.Trim(); | |||||
dbinfo.UserPwd = this.txtDmPwd.Text.Trim(); | |||||
dbinfo.Port = this.btnDmConn.Text.Trim(); | |||||
if (new DmServerInstrumentData(dbinfo, new object[] { "", "", "" }).TestSQLServerLink()) | |||||
MessageBox.Show("连接成功!"); | |||||
else | |||||
MessageBox.Show("连接失败!"); | |||||
} | |||||
private bool CheckDmControl() | |||||
{ | |||||
if (this.txtDmHost.Text.Trim() != "" || this.txtDmServer.Text.Trim() != "" || | |||||
this.txtDmUser.Text.Trim() != "" || this.txtDmPwd.Text.Trim() != "" || | |||||
this.btnDmConn.Text.Trim() != "") | |||||
return false; | |||||
else | |||||
return true; | |||||
} | |||||
private void ClearDmControl() | |||||
{ | |||||
this.txtDmHost.Text = ""; | |||||
this.txtDmServer.Text = ""; | |||||
this.txtDmUser.Text = ""; | |||||
this.txtDmPwd.Text = ""; | |||||
this.btnDmConn.Text = ""; | |||||
} | |||||
} | } | ||||
} | } |
@@ -0,0 +1,116 @@ | |||||
using CnasSynchronousCommon; | |||||
using CnasSynchronusDAL; | |||||
using CnasSynchronusIDAL; | |||||
using CnasSynchrousModel; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Data; | |||||
using System.Linq; | |||||
using System.Text; | |||||
namespace CnasSynchronusClient | |||||
{ | |||||
public class DmServerInstrumentData : InstrumentData | |||||
{ | |||||
public string StrHost { get; set; } | |||||
public string StrServerName { get; set; } | |||||
public string StrUser { get; set; } | |||||
public string StrPwd { get; set; } | |||||
public string strTableName { get; set; } | |||||
public string strDateColumn { get; set; } | |||||
public string strDate { get; set; } | |||||
public string StrPort { get; set; } | |||||
public IDmDBService dmDataBaseService { get { return new DmDBService(); } } | |||||
public DmFormatConfig DmFormat { get; set; } | |||||
public DmServerInstrumentData(InstrumentDataSourceInfo dataSourceInfo, object[] vs) | |||||
{ | |||||
try | |||||
{ | |||||
DmFormat = FileOperation.GetFormatConfigData<DmFormatConfig>("DmFormatConfig.xml"); | |||||
this.StrHost = dataSourceInfo.Host; | |||||
this.StrServerName = dataSourceInfo.ServerName; | |||||
this.StrUser = dataSourceInfo.UserId; | |||||
this.StrPwd = dataSourceInfo.UserPwd; | |||||
this.StrPort = dataSourceInfo.Port; | |||||
this.strTableName = vs[0].ToString(); | |||||
this.strDateColumn = vs[1].ToString(); | |||||
this.strDate = vs[2].ToString(); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
AppLog.Error(ex.Message); | |||||
} | |||||
} | |||||
public override Dictionary<string, DataTable> GetInstrumentData() | |||||
{ | |||||
return dmDataBaseService.GetInstrumentData(new DmOpenParams | |||||
{ | |||||
StrHost = StrHost, | |||||
StrServer = StrServerName, | |||||
StrUser = StrUser, | |||||
StrPwd = StrPwd, | |||||
StrPort = StrPort | |||||
}); | |||||
} | |||||
public override DataTable GetInstrumentDataByDate() | |||||
{ | |||||
return dmDataBaseService.GetInstrumentDataByDate( | |||||
new DmOpenParams | |||||
{ | |||||
StrHost = StrHost, | |||||
StrServer = StrServerName, | |||||
StrUser = StrUser, | |||||
StrPwd = StrPwd, | |||||
StrPort = StrPort, | |||||
autoSql = DmFormat.AutoSql | |||||
}, | |||||
new ConditionParams | |||||
{ | |||||
TableName = strTableName, | |||||
DateColumn = strDateColumn, | |||||
DateValue = strDate | |||||
} | |||||
); | |||||
} | |||||
public override DataTable GetInstrumentDataStruct() | |||||
{ | |||||
return dmDataBaseService.GetInstrumentDataStruct( | |||||
new DmOpenParams | |||||
{ | |||||
StrHost = StrHost, | |||||
StrServer = StrServerName, | |||||
StrUser = StrUser, | |||||
StrPwd = StrPwd, | |||||
StrPort = StrPort, | |||||
autoSql = DmFormat.AutoSql | |||||
}, | |||||
new ConditionParams | |||||
{ | |||||
TableName = strTableName | |||||
} | |||||
); | |||||
} | |||||
/// <summary> | |||||
/// 测试连接 | |||||
/// </summary> | |||||
/// <returns></returns> | |||||
public bool TestSQLServerLink() | |||||
{ | |||||
return dmDataBaseService.TestConnect( | |||||
StrHost, | |||||
StrServerName, | |||||
StrUser, | |||||
StrPwd, | |||||
StrPort | |||||
); | |||||
} | |||||
} | |||||
} |
@@ -20,7 +20,8 @@ namespace CnasSynchrousModel | |||||
FoxPro, | FoxPro, | ||||
TXT, | TXT, | ||||
PostgreSQL, | PostgreSQL, | ||||
Kingbase | |||||
Kingbase, | |||||
Dm | |||||
} | } | ||||
public enum PathType | public enum PathType | ||||