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 SQLiteInstrumentData : InstrumentData { public string StrLocalPath { 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 ISqliteService sqliteDataBaseService { get { return new SqliteDBService(); } } public SqliteFormatConfig SqliteFormat { get; set; } public SQLiteInstrumentData(InstrumentDataSourceInfo dataSourceInfo, object[] vs) { SqliteFormat = FileOperation.GetFormatConfigData("SqliteFormatConfig.xml"); RemoteFileCopy remoteFileCopy = new RemoteFileCopy(dataSourceInfo); remoteFileCopy.CopyFileFromRemote(".db"); this.StrLocalPath = FileHelper.getBasePath() + "\\Cache\\" + System.Text.RegularExpressions.Regex.Replace(dataSourceInfo.Path, "[ \\[ \\] \\^ \\-_*×――(^)|'$%~!@#$…&%¥—+=<>《》!!???::•`·、。,;,.;\"‘’“”-]", "").Replace(@"\", "") + ".db"; this.StrUser = dataSourceInfo.UserId; this.StrPwd = dataSourceInfo.UserPwd; this.strTableName = vs[0].ToString(); this.strDateColumn = vs[1].ToString(); this.strDate = vs[2].ToString(); } public override Dictionary GetInstrumentData() { return sqliteDataBaseService.GetInstrumentData(new SqliteOpenParams { StrPath = StrLocalPath, StrPwd = StrPwd }); } public override DataTable GetInstrumentDataByDate() { return sqliteDataBaseService.GetInstrumentDataByDate( new SqliteOpenParams { StrPath = StrLocalPath, StrPwd = StrPwd, autoSql = SqliteFormat.AutoSql }, new ConditionParams { TableName = strTableName, DateColumn = strDateColumn, DateValue = strDate }); } public override DataTable GetInstrumentDataStruct() { return sqliteDataBaseService.GetInstrumentDataStruct( new SqliteOpenParams { StrPath = StrLocalPath, StrPwd = StrPwd, autoSql = SqliteFormat.AutoSql }, new ConditionParams { TableName = strTableName }); } } }