|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- 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
- );
- }
- }
- }
|