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.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 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 } ); } /// /// 测试连接 /// /// public bool TestSQLServerLink() { return dmDataBaseService.TestConnect( StrHost, StrServerName, StrUser, StrPwd, StrPort ); } } }