瀏覽代碼

20191204版本

master
LiZi 5 年之前
父節點
當前提交
c086ed0f4a
共有 97 個文件被更改,包括 169434 次插入0 次删除
  1. +31
    -0
      CNAS_DBSync.sln
  2. +58
    -0
      CNAS_DBSync/App.config
  3. +118
    -0
      CNAS_DBSync/BLL/CnasDataCheck.cs
  4. +43
    -0
      CNAS_DBSync/BLL/CnasDataOperation.cs
  5. +57
    -0
      CNAS_DBSync/BLL/InstrumentCodeOperation.cs
  6. +131
    -0
      CNAS_DBSync/BLL/InstrumentDataFact.cs
  7. +19
    -0
      CNAS_DBSync/BLL/InstrumentDataOperation.cs
  8. +154
    -0
      CNAS_DBSync/CNAS_DBSync.csproj
  9. +128
    -0
      CNAS_DBSync/Common/ExcelHelper.cs
  10. +59
    -0
      CNAS_DBSync/Common/FileHelper.cs
  11. +56
    -0
      CNAS_DBSync/Common/MdbHelper.cs
  12. +458
    -0
      CNAS_DBSync/Common/MySQLHelper.cs
  13. +137
    -0
      CNAS_DBSync/Common/SQLDB2Helper.cs
  14. +233
    -0
      CNAS_DBSync/Common/SQLiteHelper.cs
  15. +107
    -0
      CNAS_DBSync/DAL/BaseDAL.cs
  16. +124
    -0
      CNAS_DBSync/DAL/CnasDataOperationFact.cs
  17. +126
    -0
      CNAS_DBSync/DAL/MySQLBaseDAL.cs
  18. +38
    -0
      CNAS_DBSync/Model/DataBaseInfo.cs
  19. +45
    -0
      CNAS_DBSync/Model/InstrumentDataSourceInfo.cs
  20. +38
    -0
      CNAS_DBSync/Model/SyncInstrumentItemInfo.cs
  21. +21
    -0
      CNAS_DBSync/Model/SyncParamasInfo.cs
  22. +21
    -0
      CNAS_DBSync/Program.cs
  23. +38
    -0
      CNAS_DBSync/Properties/AssemblyInfo.cs
  24. +71
    -0
      CNAS_DBSync/Properties/Resources.Designer.cs
  25. +117
    -0
      CNAS_DBSync/Properties/Resources.resx
  26. +30
    -0
      CNAS_DBSync/Properties/Settings.Designer.cs
  27. +7
    -0
      CNAS_DBSync/Properties/Settings.settings
  28. 二進制
      CNAS_DBSync/dll/CNAS_DBSync.exe
  29. +58
    -0
      CNAS_DBSync/dll/CNAS_DBSync.exe.config
  30. +195
    -0
      CNAS_DBSync/dll/Data/SyncInStrumentData.xml
  31. 二進制
      CNAS_DBSync/dll/Document/AshMeltingPoint.xls
  32. 二進制
      CNAS_DBSync/dll/Document/IndustrialAnalyzer.xls
  33. 二進制
      CNAS_DBSync/dll/Document/InfraredSulfurMeter.xls
  34. 二進制
      CNAS_DBSync/dll/Document/MoistureMeter.xls
  35. 二進制
      CNAS_DBSync/dll/Document/SulphurMeter.xls
  36. 二進制
      CNAS_DBSync/dll/System.Data.SQLite.EF6.dll
  37. 二進制
      CNAS_DBSync/dll/System.Data.SQLite.Linq.dll
  38. 二進制
      CNAS_DBSync/dll/System.Data.SQLite.dll
  39. +22
    -0
      CNAS_DBSync/dll/System.Data.SQLite.dll.config
  40. +21120
    -0
      CNAS_DBSync/dll/System.Data.SQLite.xml
  41. 二進制
      CNAS_DBSync/dll/log4net.dll
  42. +32464
    -0
      CNAS_DBSync/dll/log4net.xml
  43. +577
    -0
      CNAS_DBSync/frmDatabaseParams.Designer.cs
  44. +259
    -0
      CNAS_DBSync/frmDatabaseParams.cs
  45. +120
    -0
      CNAS_DBSync/frmDatabaseParams.resx
  46. +74
    -0
      CNAS_DBSync/frmInstrumentCode.Designer.cs
  47. +75
    -0
      CNAS_DBSync/frmInstrumentCode.cs
  48. +120
    -0
      CNAS_DBSync/frmInstrumentCode.resx
  49. +203
    -0
      CNAS_DBSync/frmPrBar.Designer.cs
  50. +354
    -0
      CNAS_DBSync/frmPrBar.cs
  51. +263
    -0
      CNAS_DBSync/frmPrBar.resx
  52. +785
    -0
      CNAS_DBSync/frmSyncParams.Designer.cs
  53. +532
    -0
      CNAS_DBSync/frmSyncParams.cs
  54. +194
    -0
      CNAS_DBSync/frmSyncParams.resx
  55. +9
    -0
      CNAS_DBSync/packages.config
  56. +103
    -0
      CNAS_RunSync/CNAS_RunSync.csproj
  57. +21
    -0
      CNAS_RunSync/Program.cs
  58. +37
    -0
      CNAS_RunSync/Properties/AssemblyInfo.cs
  59. +63
    -0
      CNAS_RunSync/Properties/Resources.Designer.cs
  60. +117
    -0
      CNAS_RunSync/Properties/Resources.resx
  61. +26
    -0
      CNAS_RunSync/Properties/Settings.Designer.cs
  62. +7
    -0
      CNAS_RunSync/Properties/Settings.settings
  63. +40
    -0
      CNAS_RunSync/app.config
  64. 二進制
      CNAS_RunSync/dll/CNAS_DBSync.exe
  65. +58
    -0
      CNAS_RunSync/dll/CNAS_DBSync.exe.config
  66. 二進制
      CNAS_RunSync/dll/CNAS_RunSync.exe
  67. +3
    -0
      CNAS_RunSync/dll/CNAS_RunSync.exe.config
  68. 二進制
      CNAS_RunSync/dll/System.Data.SQLite.dll
  69. +22
    -0
      CNAS_RunSync/dll/System.Data.SQLite.dll.config
  70. +21120
    -0
      CNAS_RunSync/dll/System.Data.SQLite.xml
  71. 二進制
      CNAS_RunSync/dll/log4net.dll
  72. +32464
    -0
      CNAS_RunSync/dll/log4net.xml
  73. +160
    -0
      CNAS_RunSync/frmSyncShow.Designer.cs
  74. +53
    -0
      CNAS_RunSync/frmSyncShow.cs
  75. +163
    -0
      CNAS_RunSync/frmSyncShow.resx
  76. +416
    -0
      CNAS_RunSync/ucSyncShow.Designer.cs
  77. +522
    -0
      CNAS_RunSync/ucSyncShow.cs
  78. +120
    -0
      CNAS_RunSync/ucSyncShow.resx
  79. 二進制
      dll/CNAS_DBSync.exe
  80. +58
    -0
      dll/CNAS_DBSync.exe.config
  81. 二進制
      dll/CNAS_RunSync.exe
  82. +40
    -0
      dll/CNAS_RunSync.exe.config
  83. +326
    -0
      dll/Data/SyncInStrumentData.xml
  84. 二進制
      dll/Document/AshMeltingPoint.xls
  85. 二進制
      dll/Document/IndustrialAnalyzer.xls
  86. 二進制
      dll/Document/InfraredSulfurMeter.xls
  87. 二進制
      dll/Document/MoistureMeter.xls
  88. 二進制
      dll/Document/SulphurMeter.xls
  89. 二進制
      dll/MySql.Data.dll
  90. 二進制
      dll/Newtonsoft.Json.dll
  91. 二進制
      dll/System.Data.SQLite.EF6.dll
  92. 二進制
      dll/System.Data.SQLite.Linq.dll
  93. 二進制
      dll/System.Data.SQLite.dll
  94. +22
    -0
      dll/System.Data.SQLite.dll.config
  95. +21120
    -0
      dll/System.Data.SQLite.xml
  96. 二進制
      dll/log4net.dll
  97. +32464
    -0
      dll/log4net.xml

+ 31
- 0
CNAS_DBSync.sln 查看文件

@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.705
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNAS_DBSync", "CNAS_DBSync\CNAS_DBSync.csproj", "{0F16F166-6646-4502-B22D-5FE5BFE92326}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNAS_RunSync", "CNAS_RunSync\CNAS_RunSync.csproj", "{2F1E5C7F-BEE0-4C40-B928-917AD9A4CF46}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0F16F166-6646-4502-B22D-5FE5BFE92326}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0F16F166-6646-4502-B22D-5FE5BFE92326}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F16F166-6646-4502-B22D-5FE5BFE92326}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F16F166-6646-4502-B22D-5FE5BFE92326}.Release|Any CPU.Build.0 = Release|Any CPU
{2F1E5C7F-BEE0-4C40-B928-917AD9A4CF46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F1E5C7F-BEE0-4C40-B928-917AD9A4CF46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F1E5C7F-BEE0-4C40-B928-917AD9A4CF46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F1E5C7F-BEE0-4C40-B928-917AD9A4CF46}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CD002DA4-66BE-485C-A3D3-E1725BF3C0E9}
EndGlobalSection
EndGlobal

+ 58
- 0
CNAS_DBSync/App.config 查看文件

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<connectionStrings>
<add name="CoreDb" connectionString="Driver={IBM DB2 ODBC DRIVER};DataBase=SAMPLE; HostName=127.0.0.1; Protocol=TCPIP;Port=50000;Uid=db2admin;Pwd=123" />
</connectionStrings>
<appSettings>
<add key="TargetDBType" value="MySQL" />
</appSettings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
</system.data>
<log4net>
<!-- OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL -->
<!-- Set root logger level to ERROR and its appenders -->
<root>
<level value="ALL" />
<appender-ref ref="SysAppender" />
</root>
<!-- Print only messages of level DEBUG or above in the packages -->
<logger name="WindowsFormLogger">
<level value="DEBUG" />
</logger>
<appender name="SysAppender" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="Log/" />
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="&quot;Logs_&quot;yyyyMMdd&quot;.txt&quot;" />
<param name="StaticLogFileName" value="false" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="consoleApp" type="log4net.Appender.ConsoleAppender,log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
</log4net>
</configuration>

+ 118
- 0
CNAS_DBSync/BLL/CnasDataCheck.cs 查看文件

@@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace CNAS_DBSync
{
public class CnasDataCheck
{
public DataTable DtReadyInsert { get; set; }

public SyncInstrumentItemInfo SyncInstrumentItem { get; set; }

public string StrTableName { get; set; }

public List<IllegalCnasData> LstIllegalMsg { get; set; }

public void CheckData()
{
//1.获取数据库的字段类型和长度
DataTable dtTableType = CnasDataOperationFact.CnasDataOperation().GetCNASTableTypeLenth(StrTableName,SyncInstrumentItem);
LstIllegalMsg = new List<IllegalCnasData>();
//2.根据字段类型和长度获取检查条件
if (dtTableType != null && dtTableType.Rows.Count > 0)
{
foreach (DataColumn dc in DtReadyInsert.Columns)
{
string strColumnName = dc.ColumnName;
bool bIfNullable = true;
DataRow[] rowsType = dtTableType.Select("ColumnName='"+strColumnName+"'");
if (rowsType.Length == 1)
{
string strColumnType = rowsType[0]["DataType"].ToString();
switch (strColumnType.ToLower())
{
case "varchar":
int Maxlenth = Convert.ToInt32(rowsType[0]["CharMaxLenth"]);
int MaxByteLenth= Convert.ToInt32(rowsType[0]["CharOcterLenth"]);
bIfNullable = rowsType[0]["IsNullable"].ToString().ToLower()=="yes"?true:false;
foreach (DataRow dr in DtReadyInsert.Rows)
{
if (!CheckVarcharData(dr[strColumnName].ToString(), bIfNullable, Maxlenth, MaxByteLenth))
LstIllegalMsg.Add(new IllegalCnasData() { ColumnName = strColumnName, ColumnValue = dr[strColumnName].ToString() });
}
break;
case "bigint":
//bIfNullable = Convert.ToBoolean(rowsType[0]["IsNullable"]);
//int NumericPrecision = Convert.ToInt32(rowsType[0]["NumericPrecision"]);
//int NumericScale = Convert.ToInt32(rowsType[0]["NumericScale"]);
break;
case "decimal":
bIfNullable = rowsType[0]["IsNullable"].ToString().ToLower() == "yes" ? true : false;
int NumericPrecision = Convert.ToInt32(rowsType[0]["NumericPrecision"]);
int NumericScale = Convert.ToInt32(rowsType[0]["NumericScale"]);

foreach (DataRow dr in DtReadyInsert.Rows)
{
if (!CheckDecimalData(dr[strColumnName].ToString(), bIfNullable, NumericPrecision, NumericScale))
LstIllegalMsg.Add(new IllegalCnasData() { ColumnName = strColumnName, ColumnValue = dr[strColumnName].ToString() });
}
break;
}
}
}
}
}

private bool CheckVarcharData(string strValue, bool IfNullable, int MaxLenth,int MaxByteLenth)
{
if (strValue == null || strValue == "")
if (!IfNullable) //如果数据库不允许为空,此处需要检查是否准备插入的数据是空值
return false;
else
return true;
if (Encoding.Default.GetByteCount(strValue) > MaxByteLenth)
return false;
return true;
}

private bool CheckDecimalData(string strValue, bool IfNullable, int NumericPrecision, int NumericScale)
{
if (strValue == null || strValue == "")
if (!IfNullable) //如果数据库不允许为空,此处需要检查是否准备插入的数据是空值
return false;
else
return true;
double result=0;
if (!double.TryParse(strValue, out result))
return false;
long ValueInt = (long)(result);
int ValueDigit = (int)(result % 1);
if (ValueInt.ToString().Length > NumericPrecision- NumericScale || ValueDigit.ToString().Length > NumericScale)
return false;
return true;
}
}

public class IllegalCnasData
{
public string ColumnName { get; set; }

public object ColumnValue { get; set; }
}

public class DataFieldAndLenth
{
public string FieldName { get; set; }

public Type FieldType { get; set; }

public int FieldLenth { get; set; }

public int FieldDigits{ get; set; }
}

}

+ 43
- 0
CNAS_DBSync/BLL/CnasDataOperation.cs 查看文件

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace CNAS_DBSync
{
//public class CnasDataOperation
//{
// //获取数据库的所有表单
// public DataTable GetCnasTables(SyncInstrumentItemInfo syncInstrument)
// {
// BaseDAL baseDAL = new BaseDAL();
// baseDAL.CreateConnectString(syncInstrument.SyncTargetDBInfo.DBHost, syncInstrument.SyncTargetDBInfo.DBName, syncInstrument.SyncTargetDBInfo.DBUser, syncInstrument.SyncTargetDBInfo.DBPwd);
// return baseDAL.GetTableNames(syncInstrument.SyncTargetDBInfo.DBUser);
// }

// //获取数据表结构
// public DataTable GetCnasTableStruct(SyncInstrumentItemInfo syncInstrument)
// {
// BaseDAL baseDAL = new BaseDAL();
// baseDAL.CreateConnectString(syncInstrument.SyncTargetDBInfo.DBHost, syncInstrument.SyncTargetDBInfo.DBName, syncInstrument.SyncTargetDBInfo.DBUser, syncInstrument.SyncTargetDBInfo.DBPwd);
// return baseDAL.GetTableStruct(syncInstrument.LstSyncPramas[0].TargetTable);
// }

// //插入数据表
// public int InsertCnasTableData(DataTable dt, SyncInstrumentItemInfo syncInstrument)
// {
// BaseDAL baseDAL = new BaseDAL();
// baseDAL.CreateConnectString(syncInstrument.SyncTargetDBInfo.DBHost, syncInstrument.SyncTargetDBInfo.DBName, syncInstrument.SyncTargetDBInfo.DBUser, syncInstrument.SyncTargetDBInfo.DBPwd);
// return baseDAL.InsertCnasData(dt, syncInstrument.LstSyncPramas);
// }

// //测试数据连接
// public bool TestCnasLink(string strHost,string strName,string strUser,string strPwd)
// {
// BaseDAL basedal = new BaseDAL();
// basedal.CreateConnectString(strHost, strName, strUser, strPwd);
// return basedal.LinkCnasTest();
// }
//}
}

+ 57
- 0
CNAS_DBSync/BLL/InstrumentCodeOperation.cs 查看文件

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace CNAS_DBSync
{
public class InstrumentCodeOperation
{
//仪器编码合法性检测

public int CheckInstrumentCode(string strCode, List<SyncInstrumentItemInfo> lstSyncInstrument)
{
//为空检测
if (strCode == null || strCode.Trim() == "") return 0;

//命名不允许有特殊字符
//if (!isSpecialChar(strCode)) return -1;

//是否在库中已存在
if (!CheckCodeRepeat(strCode, lstSyncInstrument)) return -2;

return 1;
}

/// <summary>
/// 检查是否重复
/// </summary>
/// <param name="strCode"></param>
/// <param name="lstSyncInstrument"></param>
/// <returns></returns>
private bool CheckCodeRepeat(string strCode,List<SyncInstrumentItemInfo> lstSyncInstrument)
{
bool bSuccess = true;

var item = lstSyncInstrument.Where(s => s.Code == strCode).ToList<SyncInstrumentItemInfo>();
if (item != null && item.Count > 0)
{
bSuccess = false;
}

return bSuccess;
}

/// <summary>
/// 是否含有特殊字符
/// </summary>
/// <param name="strCheckString"></param>
/// <returns></returns>
public bool isSpecialChar(String strCheckString)
{
Regex regex = new Regex(@"[_.`~!@#$%^&*()+=|{}':;',\\[\\]<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]|\n|\r|\t");
return regex.IsMatch(strCheckString); ;
}
}
}

+ 131
- 0
CNAS_DBSync/BLL/InstrumentDataFact.cs 查看文件

@@ -0,0 +1,131 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace CNAS_DBSync
{
public class InstrumentDataFact
{
public static InstrumentData CreateInstrumentDataSource(DataSourceType dataSourceType,params object[] vs)
{
InstrumentData instrumentData;

switch (dataSourceType)
{
case DataSourceType.Access:
instrumentData = new AccessInstrumentData(vs);
break;
case DataSourceType.SQL:
instrumentData = new SQLInstrumentData(vs);
break;
case DataSourceType.SQLLite:
instrumentData = new SQLiteInstrumentData(vs);
break;
case DataSourceType.Excel:
default:
instrumentData = new ExcelInstrumentData(vs);
break;
}
return instrumentData;
}
}

public abstract class InstrumentData
{
/// <summary>
/// 获取数据源数据
/// </summary>
public abstract Dictionary<string,DataTable> GetInstrumentData();
}

public class ExcelInstrumentData:InstrumentData
{
public string StrLocalPath { get; set; }

public ExcelInstrumentData(params object[] vs)
{
this.StrLocalPath = vs[0].ToString();
}

public override Dictionary<string, DataTable> GetInstrumentData()
{
return ExcelHelper.ReadExcelTableNameToTable(StrLocalPath);
}
}

public class AccessInstrumentData : InstrumentData
{
public string StrLocalPath { get; set; }

public string StrUser { get; set; }

public string StrPwd { get; set; }

public AccessInstrumentData(params object[] vs)
{
this.StrLocalPath = vs[0].ToString();
if(vs[1]!=null) this.StrUser = vs[1].ToString();
this.StrPwd = vs[2].ToString();
}

public override Dictionary<string, DataTable> GetInstrumentData()
{
return MdbHelper.ReadAccessTables(StrLocalPath,StrUser,StrPwd);
}
}

public class SQLInstrumentData : InstrumentData
{
public string StrHost { get; set; }

public string StrName { get; set; }

public string StrUser { get; set; }

public string StrPwd { get; set; }

public SQLInstrumentData(params object[] vs)
{
this.StrHost = vs[0].ToString();
this.StrName = vs[1].ToString();
this.StrUser = vs[2].ToString();
this.StrPwd = vs[3].ToString();
}


public override Dictionary<string, DataTable> GetInstrumentData()
{
throw new NotImplementedException();
}

private string CreateConnectionString()
{
return string.Format("");
}
}

public class SQLiteInstrumentData : InstrumentData
{
public string StrLocalPath { get; set; }

public string StrUser { get; set; }

public string StrPwd { get; set; }

public SQLiteInstrumentData(params object[] vs)
{
this.StrLocalPath = vs[0].ToString();
if (vs[1] != null) this.StrUser = vs[1].ToString();
this.StrPwd = vs[2].ToString();
}

public override Dictionary<string, DataTable> GetInstrumentData()
{
SQLiteHelper.SetConnectionString(StrLocalPath, StrPwd);
return SQLiteHelper.ReadSQLiteTables();
}
}

}

+ 19
- 0
CNAS_DBSync/BLL/InstrumentDataOperation.cs 查看文件

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CNAS_DBSync
{
public class InstrumentDataOperation
{
//需提前制定数据源类型
protected DataSourceType dataSourceType = DataSourceType.Excel;

//获取数据
public InstrumentDataOperation(DataSourceType dataSourceType)
{
this.dataSourceType = dataSourceType;
}
}
}

+ 154
- 0
CNAS_DBSync/CNAS_DBSync.csproj 查看文件

@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0F16F166-6646-4502-B22D-5FE5BFE92326}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>CNAS_DBSync</RootNamespace>
<AssemblyName>CNAS_DBSync</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\dll\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.8\lib\net40-full\log4net.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=5.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dll\MySql.Data.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.111.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SQLite.Core.1.0.111.0\lib\net40\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite.EF6, Version=1.0.111.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SQLite.EF6.1.0.111.0\lib\net40\System.Data.SQLite.EF6.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite.Linq, Version=1.0.111.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SQLite.Linq.1.0.111.0\lib\net40\System.Data.SQLite.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BLL\CnasDataCheck.cs" />
<Compile Include="BLL\CnasDataOperation.cs" />
<Compile Include="DAL\CnasDataOperationFact.cs" />
<Compile Include="BLL\InstrumentCodeOperation.cs" />
<Compile Include="BLL\InstrumentDataFact.cs" />
<Compile Include="BLL\InstrumentDataOperation.cs" />
<Compile Include="Common\MdbHelper.cs" />
<Compile Include="Common\MySQLHelper.cs" />
<Compile Include="Common\SQLDB2Helper.cs" />
<Compile Include="Common\ExcelHelper.cs" />
<Compile Include="Common\FileHelper.cs" />
<Compile Include="Common\SQLiteHelper.cs" />
<Compile Include="DAL\BaseDAL.cs" />
<Compile Include="DAL\MySQLBaseDAL.cs" />
<Compile Include="frmDatabaseParams.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmDatabaseParams.Designer.cs">
<DependentUpon>frmDatabaseParams.cs</DependentUpon>
</Compile>
<Compile Include="frmInstrumentCode.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmInstrumentCode.Designer.cs">
<DependentUpon>frmInstrumentCode.cs</DependentUpon>
</Compile>
<Compile Include="frmPrBar.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmPrBar.Designer.cs">
<DependentUpon>frmPrBar.cs</DependentUpon>
</Compile>
<Compile Include="frmSyncParams.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmSyncParams.Designer.cs">
<DependentUpon>frmSyncParams.cs</DependentUpon>
</Compile>
<Compile Include="Model\DataBaseInfo.cs" />
<Compile Include="Model\InstrumentDataSourceInfo.cs" />
<Compile Include="Model\SyncInstrumentItemInfo.cs" />
<Compile Include="Model\SyncParamasInfo.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmDatabaseParams.resx">
<DependentUpon>frmDatabaseParams.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmInstrumentCode.resx">
<DependentUpon>frmInstrumentCode.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmPrBar.resx">
<DependentUpon>frmPrBar.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmSyncParams.resx">
<DependentUpon>frmSyncParams.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\System.Data.SQLite.Core.1.0.111.0\build\net40\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.111.0\build\net40\System.Data.SQLite.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.111.0\build\net40\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.111.0\build\net40\System.Data.SQLite.Core.targets'))" />
</Target>
</Project>

+ 128
- 0
CNAS_DBSync/Common/ExcelHelper.cs 查看文件

@@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;

namespace CNAS_DBSync
{
public static class ExcelHelper
{
private static log4net.ILog log= log4net.LogManager.GetLogger("ExcelHelper");

/// <summary>
/// 读取Excel第一个工作表的内容
/// </summary>
/// <param name="strPath"></param>
/// <returns></returns>
public static DataTable ReadExcelFirstSheetToTable(string strPath)
{
DataTable dt = new DataTable();
try
{
//连接字符串
string connstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strPath + ";Extended Properties='Excel 8.0;HDR=NO;IMEX=1';"; // Office 07及以上版本 不能出现多余的空格 而且分号注意
//string connstring = Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + path + ";Extended Properties='Excel 8.0;HDR=NO;IMEX=1';"; //Office 07以下版本
using (OleDbConnection conn = new OleDbConnection(connstring))
{
conn.Open();
DataTable sheetsName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "Table" }); //得到所有sheet的名字
string firstSheetName = sheetsName.Rows[0][2].ToString(); //得到第一个sheet的名字
string sql = string.Format("SELECT * FROM [{0}]", firstSheetName); //查询字符串
//string sql = string.Format("SELECT * FROM [{0}] WHERE [日期] is not null", firstSheetName); //查询字符串

OleDbDataAdapter ada = new OleDbDataAdapter(sql, connstring);
DataSet set = new DataSet();
ada.Fill(set);
return set.Tables[0];
}
}
catch(Exception ex)
{
//发生异常,写入日志
log.Error(ex.Message);
}
return dt;
}

/// <summary>
/// 通过表名读取Excel中数据
/// </summary>
/// <param name="strPath"></param>
/// <param name="strTableName"></param>
/// <returns></returns>
public static DataTable ReadExcelByNameToTable(string strPath,string strTableName)
{
return null;
}


/// <summary>
/// 读取Excel中所有表的表名
/// </summary>
/// <param name="strPath"></param>
/// <returns></returns>
public static Dictionary<string, DataTable> ReadExcelTableNameToTable(string strPath)
{
Dictionary<string, DataTable> dictTables = new Dictionary<string, DataTable>();
try
{
//连接字符串
string connstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strPath + ";Extended Properties='Excel 8.0;HDR=NO;IMEX=1';"; // Office 07及以上版本 不能出现多余的空格 而且分号注意
//string connstring = Provider=Microsoft.JET.OLEDB.4.0;Data Source=" + path + ";Extended Properties='Excel 8.0;HDR=NO;IMEX=1';"; //Office 07以下版本
using (OleDbConnection conn = new OleDbConnection(connstring))
{
conn.Open();
DataTable sheetsName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "Table" }); //得到所有sheet的名字

string sql = "";
OleDbDataAdapter ada = null;
foreach (DataRow dr in sheetsName.Rows)
{
string strTableName = dr[2].ToString();

sql = string.Format("SELECT * FROM [{0}]", strTableName); //查询字符串
ada = new OleDbDataAdapter(sql, connstring);
DataSet set = new DataSet();
ada.Fill(set);

DataTable dtSheetData = set.Tables[0];
DataTable dtNormal = new DataTable();
DataRow drCurrent = dtSheetData.Rows[0];
//创建标准表结构
foreach (DataColumn dc in dtSheetData.Columns)
{
DataColumn dcReady = new DataColumn
{
DataType = dc.DataType,
ColumnName = drCurrent[dc.ColumnName].ToString()
};
dtNormal.Columns.Add(dcReady);
}
//向列表中添加数据
for (int i = 1; i < dtSheetData.Rows.Count; i++)
{
DataRow drNew = dtNormal.NewRow();
for (int j = 0; j < dtSheetData.Columns.Count; j++)
{
drNew[j] = dtSheetData.Rows[i][j];
}
dtNormal.Rows.Add(drNew);
}

dictTables.Add(strTableName.Substring(0,strTableName.Length-1), dtNormal);
}
}
}
catch(Exception ex)
{
//发生异常,写入日志
log.Error(ex.Message);
}
return dictTables;
}


}
}

+ 59
- 0
CNAS_DBSync/Common/FileHelper.cs 查看文件

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace CNAS_DBSync
{
public static class FileHelper
{
///// <summary>
///// 获取本地XML文件值
///// </summary>
///// <param name="strPath"></param>
//public void GetLocalXMLFile(string strPath)
//{

//}


///// <summary>
///// 保存本地XML文件值
///// </summary>
///// <param name="strPath"></param>
//public void SaveLocalXMLFile(string strPath)
//{
//}


/// <summary>
/// 获取当前dll所在目录
/// </summary>
/// <returns></returns>
public static string getBasePath()
{
//获取当前DLL 所在路径
string dllpath = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
if (dllpath != null && dllpath.Length > 0) dllpath = dllpath.Substring(8) + @"\";
FileInfo tmpDllInfo = new FileInfo(dllpath);
dllpath = tmpDllInfo.DirectoryName;
dllpath = dllpath.Replace(tmpDllInfo.Directory.Name, "");
return dllpath;
}



public static List<T> XmlToList<T>(string xml, string rootName) where T : class
{
XmlSerializer serializer = new XmlSerializer(typeof(List<T>), new XmlRootAttribute(rootName));
using (StringReader sr = new StringReader(xml))
{
List<T> list = serializer.Deserialize(sr) as List<T>;
return list;
}
}
}
}

+ 56
- 0
CNAS_DBSync/Common/MdbHelper.cs 查看文件

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Linq;
using System.Text;
using System.Data;

namespace CNAS_DBSync
{
public static class MdbHelper
{
private static log4net.ILog log = log4net.LogManager.GetLogger("MdbHelper");
/// <summary>
/// 读取Excel第一个工作表的内容
/// </summary>
/// <param name="strPath"></param>
/// <returns></returns>
public static Dictionary<string, DataTable> ReadAccessTables(string strPath,string strUser,string strPwd)
{
Dictionary<string, DataTable> dictTables = new Dictionary<string, DataTable>();
try
{
//连接字符串
//string connstring = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strPath + ";Extended Properties='Excel 8.0;HDR=NO;IMEX=1';");
//string connstring = string.Format("Provider = Microsoft.Jet.OLEDB.4.0; Data Source={0}; User id={1};Jet OLEDB:Database Password={2}", strPath,strUser,strPwd);
string connstring = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Persist Security Info=False;Jet OLEDB:Database Password={1}",strPath,strPwd);
using (OleDbConnection conn = new OleDbConnection(connstring))
{
conn.Open();
DataTable TablesName = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "Table" }); //得到所有sheet的名字

string sql = "";
OleDbDataAdapter ada = null;
foreach (DataRow dr in TablesName.Rows)
{
string strTableName = dr[2].ToString();

sql = string.Format("SELECT * FROM [{0}]", strTableName); //查询字符串
ada = new OleDbDataAdapter(sql, connstring);
DataSet set = new DataSet();
ada.Fill(set);

dictTables.Add(strTableName, set.Tables[0]);
}
}
}
catch (Exception ex)
{
//发生异常,写入日志
log.Error(ex.Message);
}
return dictTables;
}

}
}

+ 458
- 0
CNAS_DBSync/Common/MySQLHelper.cs 查看文件

@@ -0,0 +1,458 @@
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace CNAS_DBSync
{
public static class MySQLHelper
{
private static log4net.ILog log = log4net.LogManager.GetLogger("MySQLHelper");

private static String mConnStr = null;

public static void InitConnectionString(string strServerIP,string strServerPort,string strServerHost,string strServerUser,string strServerPwd)
{
mConnStr = "server=" + strServerIP + ";port=" + strServerPort + ";user=" + strServerUser + ";password=" + strServerPwd + ";database=" + strServerHost + ";CharSet=utf8";
}

/// <summary>
/// 对SQLite数据库执行增删改操作,返回受影响的行数。
/// </summary>
/// <param name="sql">要执行的增删改的SQL语句</param>
/// <returns></returns>
public static int ExecuteNonQuery(String sql)
{
try
{
using (MySqlConnection connection = new MySqlConnection(mConnStr))
{
connection.Open();
MySqlTransaction transaction = connection.BeginTransaction();

using (MySqlCommand cmd = new MySqlCommand())
{
try
{
PrepareCommand(cmd, connection, transaction, CommandType.Text, sql, null);

int rows = cmd.ExecuteNonQuery();
transaction.Commit();

cmd.Parameters.Clear();
return rows;
}
catch (MySqlException e1)
{
try
{
transaction.Rollback();
}
catch (Exception e2)
{
log.Error(e2.Message);
throw e2;
}
log.Error(e1.Message);
throw e1;
}
}
}
}
catch (Exception e)
{
log.Error(e.Message);
throw e;
}
}

/// <summary>
/// 对数据库执行增删改操作,返回受影响的行数。
/// </summary>
/// <param name="sql">要执行的增删改的SQL语句</param>
/// <returns></returns>
public static int ExecuteNonQuery(String sql, MySqlParameter[] cmdParams)
{
try
{
using (MySqlConnection connection = new MySqlConnection(mConnStr))
{
connection.Open();
MySqlTransaction transaction = connection.BeginTransaction();

using (MySqlCommand cmd = new MySqlCommand())
{
try
{
PrepareCommand(cmd, connection, transaction, CommandType.Text, sql, cmdParams);

int rows = cmd.ExecuteNonQuery();
transaction.Commit();

cmd.Parameters.Clear();
return rows;
}
catch (MySqlException e1)
{
try
{
transaction.Rollback();
}
catch (Exception e2)
{
log.Error(e2.Message);
throw e2;
}
log.Error(e1.Message);
throw e1;
}
}
}
}
catch (Exception e)
{
log.Error(e.Message);
throw e;
}
}

/// <summary>
/// 对SQLite数据库执行操作,返回 返回第一行第一列数据
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
public static int ExecuteScalar(String sql)
{
try
{
using (MySqlConnection connection = new MySqlConnection(mConnStr))
{
connection.Open();
MySqlTransaction transaction = connection.BeginTransaction();

using (MySqlCommand cmd = new MySqlCommand())
{
try
{
int line = 0;

PrepareCommand(cmd, connection, transaction, CommandType.Text, sql, null);

String str = cmd.ExecuteScalar().ToString();
transaction.Commit();

line = Convert.ToInt32(str);
cmd.Parameters.Clear();

return line;
}
catch (MySqlException e1)
{
try
{
transaction.Rollback();
}
catch (Exception e2)
{
log.Error(e2.Message);
throw e2;
}

log.Error(e1.Message);
throw e1;
}
}
}
}
catch (Exception e)
{
log.Error(e.Message);
throw e;
}
}

/// <summary>
/// 对SQLite数据库执行操作,返回 返回第一行第一列数据
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
public static int ExecuteScalar(String sql, MySqlParameter[] cmdParams)
{
try
{
using (MySqlConnection connection = new MySqlConnection(mConnStr))
{
connection.Open();
MySqlTransaction transaction = connection.BeginTransaction();

using (MySqlCommand cmd = new MySqlCommand())
{
try
{
int line = 0;

PrepareCommand(cmd, connection, transaction, CommandType.Text, sql, cmdParams);

String str = cmd.ExecuteScalar().ToString();
transaction.Commit();

line = Convert.ToInt32(str);
cmd.Parameters.Clear();

return line;
}
catch (MySqlException e1)
{
try
{
transaction.Rollback();
}
catch (Exception e2)
{
log.Error(e2.Message);
throw e2;
}

log.Error(e1.Message);
throw e1;
}
}
}
}
catch (Exception e)
{
log.Error(e.Message);
throw e;
}
}

/// <summary>
///  用执行的数据库连接执行一个返回数据集的sql命令
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
public static MySqlDataReader ExecuteReader(String sql)
{
try
{
//创建一个MySqlConnection对象
using (MySqlConnection connection = new MySqlConnection(mConnStr))
{
connection.Open();
MySqlTransaction transaction = connection.BeginTransaction();

//创建一个MySqlCommand对象
using (MySqlCommand cmd = new MySqlCommand())
{
try
{
PrepareCommand(cmd, connection, transaction, CommandType.Text, sql, null);

MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
transaction.Commit();

cmd.Parameters.Clear();
return reader;
}
catch (MySqlException e1)
{
try
{
transaction.Rollback();
}
catch (Exception e2)
{
log.Error(e2.Message);
throw e2;
}

log.Error(e1.Message);
throw e1;
}
}
}
}
catch (Exception e)
{
log.Error(e.Message);
throw e;
}
}

/// <summary>
/// 查询返回Dtaset
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
public static DataSet ExecuteDataSet(String sql)
{
try
{
//创建一个MySqlConnection对象
using (MySqlConnection connection = new MySqlConnection(mConnStr))
{
connection.Open();
MySqlTransaction transaction = connection.BeginTransaction();

//创建一个MySqlCommand对象
using (MySqlCommand cmd = new MySqlCommand())
{
try
{
PrepareCommand(cmd, connection, transaction, CommandType.Text, sql, null);

MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.SelectCommand = cmd;
DataSet ds = new DataSet();

adapter.Fill(ds);

transaction.Commit();

//清除参数
cmd.Parameters.Clear();
return ds;

}
catch (MySqlException e1)
{
try
{
transaction.Rollback();
}
catch (Exception e2)
{
log.Error(e2.Message);
throw e2;
}

log.Error(e1.Message);
throw e1;
}
}
}
}
catch (Exception e)
{
log.Error(e.Message);
throw e;
}
}

/// <summary>
/// 查询返回Dtaset
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
public static DataSet ExecuteDataSet(String sql, MySqlParameter[] cmdParams)
{
try
{
//创建一个MySqlConnection对象
using (MySqlConnection connection = new MySqlConnection(mConnStr))
{
connection.Open();
MySqlTransaction transaction = connection.BeginTransaction();

//创建一个MySqlCommand对象
using (MySqlCommand cmd = new MySqlCommand())
{
try
{
PrepareCommand(cmd, connection, transaction, CommandType.Text, sql, cmdParams);

MySqlDataAdapter adapter = new MySqlDataAdapter();
adapter.SelectCommand = cmd;
DataSet ds = new DataSet();

adapter.Fill(ds);

transaction.Commit();

//清除参数
cmd.Parameters.Clear();
return ds;

}
catch (MySqlException e1)
{
try
{
transaction.Rollback();
}
catch (Exception e2)
{
log.Error(e2.Message);
throw e2;
}

log.Error(e1.Message);
throw e1;
}
}
}
}
catch (Exception e)
{
log.Error(e.Message);
throw e;
}
}

/// <summary>
/// 准备执行一个命令
/// </summary>
/// <param name="cmd">sql命令</param>
/// <param name="conn">OleDb连接</param>
/// <param name="trans">OleDb事务</param>
/// <param name="cmdType">命令类型例如 存储过程或者文本</param>
/// <param name="cmdText">命令文本,例如:Select * from Products</param>
/// <param name="cmdParms">执行命令的参数</param>
private static void PrepareCommand(MySqlCommand cmd, MySqlConnection conn, MySqlTransaction trans, CommandType cmdType, string cmdText, MySqlParameter[] cmdParms)
{
if (conn.State != ConnectionState.Open)
conn.Open();

cmd.Connection = conn;
cmd.CommandText = cmdText;

if (trans != null)
cmd.Transaction = trans;

cmd.CommandType = cmdType;

if (cmdParms != null)
{
foreach (MySqlParameter parm in cmdParms)
cmd.Parameters.Add(parm);
}
}


public static bool TestConnectMySql()
{
bool bIfSuccess = false;
try
{
//创建一个MySqlConnection对象
using (MySqlConnection connection = new MySqlConnection(mConnStr))
{
connection.Open();

if (connection.State == System.Data.ConnectionState.Open)
bIfSuccess = true;
}
}
catch (Exception ex)
{
log.Error(ex.Message);
bIfSuccess = false;
}

return bIfSuccess;
}
}
}

+ 137
- 0
CNAS_DBSync/Common/SQLDB2Helper.cs 查看文件

@@ -0,0 +1,137 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data;
using System.Reflection;
using System.Collections;
using System.Data.Odbc;
using System.Data.OleDb;

namespace CNAS_DBSync
{
//数据库类
public static class SQLDB2Helper
{
private static log4net.ILog log = log4net.LogManager.GetLogger("SQLDB2Helper");

private static string connectionString = "";

public static void createConnectString(string strHost,string strName,string strUser,string strPwd)
{
//connectionString = string.Format("Provider=IBMDADB2;HostName={0}; Port=50000;Data Source={1};UID={2};PWD={3};",strHost,strName,strUser,strPwd);

connectionString = string.Format("Provider = IBMDADB2; HostName = {0}; Database = {1}; uid = {2}; pwd = {3}; protocol = TCPIP; port = 50000", strHost, strName, strUser, strPwd);
}

/// <summary>
/// 执行查询语句,获取表数据
/// </summary>
/// <param name="strsql"></param>
/// <returns></returns>
public static DataTable getDB2Table(string strsql)
{
DataTable dt = new DataTable();
using (OleDbConnection conn = new OleDbConnection(connectionString))
{
OleDbCommand cmd = new OleDbCommand(strsql, conn);
try
{
conn.Open();
OleDbDataAdapter adp = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
adp.Fill(ds);
dt = ds.Tables[0];
}
catch (Exception ex)
{
//这里写日志
log.Error(ex.Message);
}
}

return dt;
}

//执行插入/更新语句,返回受影响的行数(无参数)
public static int ExequeryDB2Table(string strSql)
{
int ireturn = 0;

using (OleDbConnection conn = new OleDbConnection(connectionString))
{
OleDbCommand cmd = new OleDbCommand(strSql, conn);
try
{
conn.Open();

ireturn=cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
//这里写日志
log.Error(ex.Message);
}
}

return ireturn;
}


//执行插入/更新语句,返回受影响的行数(有参数)
public static int ExequeryDB2Table(string strSql,params OleDbParameter[] parameters)
{
int ireturn = 0;

using (OleDbConnection conn = new OleDbConnection(connectionString))
{
OleDbCommand cmd = new OleDbCommand(strSql, conn);
try
{
conn.Open();
cmd.CommandText = strSql;
if (parameters.Length != 0)
{
cmd.Parameters.AddRange(parameters);
}
ireturn = cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
//这里写日志
log.Error(ex.Message);
}
}

return ireturn;
}

/// <summary>
/// 执行插入/更新语句,返回受影响的行数(有参数)
/// </summary>
public static bool TestCnasLink()
{
bool bIfSuccess = true;

using (OleDbConnection conn = new OleDbConnection(connectionString))
{
try
{
conn.Open();
}
catch (Exception ex)
{
//这里写日志
bIfSuccess = false;
log.Error(ex.Message);
}
}

return bIfSuccess;
}

}
}

+ 233
- 0
CNAS_DBSync/Common/SQLiteHelper.cs 查看文件

@@ -0,0 +1,233 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SQLite;
using System.Data;

namespace CNAS_DBSync
{

public static class SQLiteHelper
{
private static log4net.ILog log = log4net.LogManager.GetLogger("SQLiteHelper");
private static string connectionString = string.Empty;

/// <summary>
/// 根据数据源、密码、版本号设置连接字符串。
/// </summary>
/// <param name="datasource">数据源。</param>
/// <param name="password">密码。</param>
/// <param name="version">版本号(缺省为3)。</param>
public static void SetConnectionString(string datasource, string password, int version = 3)
{
connectionString = string.Format("Data Source={0};Version={1};password={2}",
datasource, version, password);
}

/// <summary>
/// 创建一个数据库文件。如果存在同名数据库文件,则会覆盖。
/// </summary>
/// <param name="dbName">数据库文件名。为null或空串时不创建。</param>
/// <param name="password">(可选)数据库密码,默认为空。</param>
/// <exception cref="Exception"></exception>
public static void CreateDB(string dbName)
{
if (!string.IsNullOrEmpty(dbName))
{
try { SQLiteConnection.CreateFile(dbName); }
catch (Exception) { throw; }
}
}

/// <summary>
/// 对SQLite数据库执行增删改操作,返回受影响的行数。
/// </summary>
/// <param name="sql">要执行的增删改的SQL语句。</param>
/// <param name="parameters">执行增删改语句所需要的参数,参数必须以它们在SQL语句中的顺序为准。</param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public static int ExecuteNonQuery(string sql, params SQLiteParameter[] parameters)
{
int affectedRows = 0;
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
{
using (SQLiteCommand command = new SQLiteCommand(connection))
{
try
{
connection.Open();
command.CommandText = sql;
if (parameters.Length != 0)
{
command.Parameters.AddRange(parameters);
}
affectedRows = command.ExecuteNonQuery();
}
catch (Exception) { throw; }
}
}
return affectedRows;
}

/// <summary>
/// 批量处理数据操作语句。
/// </summary>
/// <param name="list">SQL语句集合。</param>
/// <exception cref="Exception"></exception>
public static void ExecuteNonQueryBatch(List<KeyValuePair<string, SQLiteParameter[]>> list)
{
using (SQLiteConnection conn = new SQLiteConnection(connectionString))
{
try { conn.Open(); }
catch { throw; }
using (SQLiteTransaction tran = conn.BeginTransaction())
{
using (SQLiteCommand cmd = new SQLiteCommand(conn))
{
try
{
foreach (var item in list)
{
cmd.CommandText = item.Key;
if (item.Value != null)
{
cmd.Parameters.AddRange(item.Value);
}
cmd.ExecuteNonQuery();
}
tran.Commit();
}
catch (Exception) { tran.Rollback(); throw; }
}
}
}
}

/// <summary>
/// 执行查询语句,并返回第一个结果。
/// </summary>
/// <param name="sql">查询语句。</param>
/// <returns>查询结果。</returns>
/// <exception cref="Exception"></exception>
public static object ExecuteScalar(string sql, params SQLiteParameter[] parameters)
{
using (SQLiteConnection conn = new SQLiteConnection(connectionString))
{
using (SQLiteCommand cmd = new SQLiteCommand(conn))
{
try
{
conn.Open();
cmd.CommandText = sql;
if (parameters.Length != 0)
{
cmd.Parameters.AddRange(parameters);
}
return cmd.ExecuteScalar();
}
catch (Exception) { throw; }
}
}
}

/// <summary>
/// 执行一个查询语句,返回一个包含查询结果的DataTable。
/// </summary>
/// <param name="sql">要执行的查询语句。</param>
/// <param name="parameters">执行SQL查询语句所需要的参数,参数必须以它们在SQL语句中的顺序为准。</param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public static DataTable ExecuteQuery(string sql, params SQLiteParameter[] parameters)
{
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
{
using (SQLiteCommand command = new SQLiteCommand(sql, connection))
{
if (parameters.Length != 0)
{
command.Parameters.AddRange(parameters);
}
SQLiteDataAdapter adapter = new SQLiteDataAdapter(command);
DataTable data = new DataTable();
try { adapter.Fill(data); }
catch (Exception) { throw; }
return data;
}
}
}

/// <summary>
/// 执行一个查询语句,返回一个关联的SQLiteDataReader实例。
/// </summary>
/// <param name="sql">要执行的查询语句。</param>
/// <param name="parameters">执行SQL查询语句所需要的参数,参数必须以它们在SQL语句中的顺序为准。</param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public static SQLiteDataReader ExecuteReader(string sql, params SQLiteParameter[] parameters)
{
SQLiteConnection connection = new SQLiteConnection(connectionString);
SQLiteCommand command = new SQLiteCommand(sql, connection);
try
{
if (parameters.Length != 0)
{
command.Parameters.AddRange(parameters);
}
connection.Open();
return command.ExecuteReader(CommandBehavior.CloseConnection);
}
catch (Exception) { throw; }
}

/// <summary>
/// 查询数据库中的所有数据类型信息。
/// </summary>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public static DataTable GetSchema()
{
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
{
try
{
connection.Open();
return connection.GetSchema("TABLES");
}
catch (Exception) { throw; }
}
}



/// <summary>
/// 读取Excel第一个工作表的内容
/// </summary>
/// <param name="strPath"></param>
/// <returns></returns>
public static Dictionary<string, DataTable> ReadSQLiteTables()
{
Dictionary<string, DataTable> dictTables = new Dictionary<string, DataTable>();
try
{
string sql = "";
DataTable TablesName = ExecuteQuery("select * from sqlite_master;", new SQLiteParameter[] { });//得到所有表
foreach (DataRow dr in TablesName.Rows)
{
string strTableName = dr[1].ToString();

sql = string.Format("SELECT * FROM [{0}]", strTableName); //查询字符串

dictTables.Add(strTableName, ExecuteQuery(sql, new SQLiteParameter[] { }));
}
}
catch (Exception ex)
{
//发生异常,写入日志
log.Error(ex.Message);
}
return dictTables;
}
}
}

+ 107
- 0
CNAS_DBSync/DAL/BaseDAL.cs 查看文件

@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;

namespace CNAS_DBSync
{
public class BaseDAL
{
private static log4net.ILog log = log4net.LogManager.GetLogger("BaseDAL");

public void CreateConnectString(string strHost, string strName, string strUser, string strPwd)
{
SQLDB2Helper.createConnectString(strHost, strName, strUser, strPwd);
}

//获取所有表单名称
public DataTable GetTableNames(string strUser)
{
DataTable dt = new DataTable();
string strSql = string.Format("SELECT TABNAME FROM SYSCAT.TABLES Where TABSCHEMA = '{0}'",strUser);
try
{
dt= SQLDB2Helper.getDB2Table(strSql);
}
catch (Exception ex)
{
log.Error(ex.Message);
}
return dt;
}

/// <summary>
/// 获取某表的表结构
/// </summary>
/// <param name="strTableName"></param>
/// <returns></returns>
public DataTable GetTableStruct(string strTableName)
{
DataTable dt = new DataTable();
string strSql = string.Format("SELECT * FROM {0} Where 1=0", strTableName);
try
{
dt = SQLDB2Helper.getDB2Table(strSql);
}
catch (Exception ex)
{
log.Error(ex.Message);
}
return dt;
}


/// <summary>
/// 逐行批量插入数据
/// </summary>
/// <param name="dt"></param>
/// <returns></returns>
public int InsertCnasData(DataTable dt, List<SyncParamasInfo> syncParamasInfos)
{
int iReturn = 0;
if (dt.Rows.Count <= 0) return 0;
try
{
//构建SQL语句
string strSql_part1 = "";
string strSql_part2 = "";
foreach (var item in syncParamasInfos)
{
strSql_part1 += item.TargetField + ",";

strSql_part2 += "?,";
}
string strSql = string.Format("insert into {0}({1}) values({2})",syncParamasInfos[0].TargetTable, strSql_part1.Substring(0, strSql_part1.Length - 1), strSql_part2.Substring(0, strSql_part2.Length - 1));

foreach (DataRow dr in dt.Rows)
{

OleDbParameter[] parameters = new OleDbParameter[syncParamasInfos.Count];
for (int i = 0; i < syncParamasInfos.Count; i++)
{
parameters[i] = new OleDbParameter(syncParamasInfos[i].TargetField, dr[syncParamasInfos[i].TargetField]);
}

//执行SQL语句
iReturn += SQLDB2Helper.ExequeryDB2Table(strSql, parameters);

}
}
catch (Exception ex)
{
//此处添加错误日志
log.Error(ex.Message);
}

return iReturn;
}

public bool LinkCnasTest()
{
return SQLDB2Helper.TestCnasLink();
}

}
}

+ 124
- 0
CNAS_DBSync/DAL/CnasDataOperationFact.cs 查看文件

@@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text;

namespace CNAS_DBSync
{
public class CnasDataOperationFact
{
//从Config中获取目标数据库的的类型
private static string strDataType = ConfigurationManager.AppSettings["TargetDBType"].ToString();

public static ICnasDataOperation CnasDataOperation()
{
ICnasDataOperation operation;

switch (strDataType)
{
case "MySQL":
operation = new MySQLCNASDataOperation();
break;
case "DB2":
default:
operation = new DB2CNASDataOperation();
break;
}
return operation;
}
}

public interface ICnasDataOperation
{
//测试连接
bool TestConnect(string strHost, string strName, string strUser, string strPwd,string strPort);

//获取所有表名称
DataTable GetAllCNASTablesName(SyncInstrumentItemInfo syncitem);

//获取第一张表的表结构
DataTable GetCNASTablesStruct(string strTableName,SyncInstrumentItemInfo syncitem);

//向第一张表的表中插入数据
int InsertDataToCNASTable(DataTable dt, SyncInstrumentItemInfo syncitem);

//获取所有表的数据类型和长度
DataTable GetCNASTableTypeLenth(string strTableName, SyncInstrumentItemInfo syncitem);
}

public class MySQLCNASDataOperation : ICnasDataOperation
{
public DataTable GetAllCNASTablesName(SyncInstrumentItemInfo syncitem)
{
MySQLBaseDAL mySQLBase = new MySQLBaseDAL();
mySQLBase.CreateConnectString(syncitem.SyncTargetDBInfo.DBHost,syncitem.SyncTargetDBInfo.DBPort,syncitem.SyncTargetDBInfo.DBName, syncitem.SyncTargetDBInfo.DBUser,syncitem.SyncTargetDBInfo.DBPwd);
return mySQLBase.GetTableNames(syncitem.SyncTargetDBInfo.DBName);
}

public DataTable GetCNASTablesStruct(string strTableName, SyncInstrumentItemInfo syncitem)
{
MySQLBaseDAL mySQLBase = new MySQLBaseDAL();
mySQLBase.CreateConnectString(syncitem.SyncTargetDBInfo.DBHost, syncitem.SyncTargetDBInfo.DBPort, syncitem.SyncTargetDBInfo.DBName, syncitem.SyncTargetDBInfo.DBUser, syncitem.SyncTargetDBInfo.DBPwd);
return mySQLBase.GetTableStruct(strTableName);
}

public DataTable GetCNASTableTypeLenth(string strTableName, SyncInstrumentItemInfo syncitem)
{
MySQLBaseDAL mySQLBase = new MySQLBaseDAL();
mySQLBase.CreateConnectString(syncitem.SyncTargetDBInfo.DBHost, syncitem.SyncTargetDBInfo.DBPort, syncitem.SyncTargetDBInfo.DBName, syncitem.SyncTargetDBInfo.DBUser, syncitem.SyncTargetDBInfo.DBPwd);
return mySQLBase.GetTableTypeAndLenth(strTableName);
}

public int InsertDataToCNASTable(DataTable dt, SyncInstrumentItemInfo syncitem)
{
MySQLBaseDAL mySQLBase = new MySQLBaseDAL();
mySQLBase.CreateConnectString(syncitem.SyncTargetDBInfo.DBHost, syncitem.SyncTargetDBInfo.DBPort, syncitem.SyncTargetDBInfo.DBName, syncitem.SyncTargetDBInfo.DBUser, syncitem.SyncTargetDBInfo.DBPwd);
return mySQLBase.InsertCnasData(dt,syncitem.LstSyncPramas);
}

public bool TestConnect(string strHost, string strName, string strUser, string strPwd, string strPort)
{
MySQLBaseDAL mySQLBase = new MySQLBaseDAL();
mySQLBase.CreateConnectString(strHost, strPort, strName, strUser, strPwd);
return mySQLBase.LinkCnasTest();
}
}

public class DB2CNASDataOperation : ICnasDataOperation
{
public DataTable GetAllCNASTablesName(SyncInstrumentItemInfo syncitem)
{
BaseDAL baseDAL = new BaseDAL();
baseDAL.CreateConnectString(syncitem.SyncTargetDBInfo.DBHost, syncitem.SyncTargetDBInfo.DBName, syncitem.SyncTargetDBInfo.DBUser, syncitem.SyncTargetDBInfo.DBPwd);
return baseDAL.GetTableNames(syncitem.SyncTargetDBInfo.DBUser);
}

public DataTable GetCNASTablesStruct(string strTableName, SyncInstrumentItemInfo syncitem)
{
BaseDAL baseDAL = new BaseDAL();
baseDAL.CreateConnectString(syncitem.SyncTargetDBInfo.DBHost, syncitem.SyncTargetDBInfo.DBName, syncitem.SyncTargetDBInfo.DBUser, syncitem.SyncTargetDBInfo.DBPwd);
return baseDAL.GetTableStruct(strTableName);
}

public DataTable GetCNASTableTypeLenth(string strTableName, SyncInstrumentItemInfo syncitem)
{
throw new NotImplementedException();
}

public int InsertDataToCNASTable(DataTable dt, SyncInstrumentItemInfo syncitem)
{
BaseDAL baseDAL = new BaseDAL();
baseDAL.CreateConnectString(syncitem.SyncTargetDBInfo.DBHost, syncitem.SyncTargetDBInfo.DBName, syncitem.SyncTargetDBInfo.DBUser, syncitem.SyncTargetDBInfo.DBPwd);
return baseDAL.InsertCnasData(dt, syncitem.LstSyncPramas);
}

public bool TestConnect(string strHost, string strName, string strUser, string strPwd, string strPort)
{
BaseDAL basedal = new BaseDAL();
basedal.CreateConnectString(strHost, strName, strUser, strPwd);
return basedal.LinkCnasTest();
}
}
}

+ 126
- 0
CNAS_DBSync/DAL/MySQLBaseDAL.cs 查看文件

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using MySql.Data.MySqlClient;

namespace CNAS_DBSync
{
public class MySQLBaseDAL
{
private static log4net.ILog log = log4net.LogManager.GetLogger("MySQLBaseDAL");

public void CreateConnectString(string strIP,string strPort,string strName, string strUser, string strPwd)
{
MySQLHelper.InitConnectionString(strIP,strPort,strName,strUser,strPwd);
}

//获取所有表单名称
public DataTable GetTableNames(string strName)
{
DataTable dt = new DataTable();
string strSql = string.Format("SELECT table_name as TABNAME FROM information_schema.TABLES WHERE table_schema='{0}'", strName);
try
{
dt = MySQLHelper.ExecuteDataSet(strSql).Tables[0];
}
catch (Exception ex)
{
log.Error(ex.Message);
}
return dt;
}

/// <summary>
/// 获取某表的表结构
/// </summary>
/// <param name="strTableName"></param>
/// <returns></returns>
public DataTable GetTableStruct(string strTableName)
{
DataTable dt = new DataTable();
string strSql = string.Format("SELECT * FROM {0} Where 1=0", strTableName);
try
{
dt = MySQLHelper.ExecuteDataSet(strSql).Tables[0];
}
catch (Exception ex)
{
log.Error(ex.Message);
}
return dt;
}

/// <summary>
/// 获取某表的表结构和类型长度
/// </summary>
/// <param name="strTableName"></param>
/// <returns></returns>
public DataTable GetTableTypeAndLenth(string strTableName)
{
DataTable dt = new DataTable();
string strSql = string.Format("select COLUMN_NAME AS 'ColumnName',IS_NULLABLE AS 'IsNullable',DATA_TYPE AS 'DataType',CHARACTER_MAXIMUM_LENGTH AS 'CharMaxLenth',CHARACTER_OCTET_LENGTH AS 'CharOcterLenth',NUMERIC_PRECISION AS 'NumericPrecision',NUMERIC_SCALE AS 'NumericScale' FROM information_schema.COLUMNS WHERE TABLE_NAME LIKE '{0}'", strTableName);
try
{
dt = MySQLHelper.ExecuteDataSet(strSql).Tables[0];
}
catch (Exception ex)
{
log.Error(ex.Message);
}
return dt;
}


/// <summary>
/// 逐行批量插入数据
/// </summary>
/// <param name="dt"></param>
/// <returns></returns>
public int InsertCnasData(DataTable dt, List<SyncParamasInfo> syncParamasInfos)
{
int iReturn = 0;
if (dt.Rows.Count <= 0) return 0;
try
{
//构建SQL语句
string strSql_part1 = "";
string strSql_part2 = "";
foreach (var item in syncParamasInfos)
{
strSql_part1 += item.TargetField + ",";

strSql_part2 += string.Format("@{0},",item.TargetField);
}
string strSql = string.Format("insert into {0}({1}) values({2})", syncParamasInfos[0].TargetTable, strSql_part1.Substring(0, strSql_part1.Length - 1), strSql_part2.Substring(0, strSql_part2.Length - 1));

foreach (DataRow dr in dt.Rows)
{

MySqlParameter[] parameters = new MySqlParameter[syncParamasInfos.Count];
for (int i = 0; i < syncParamasInfos.Count; i++)
{
parameters[i] = new MySqlParameter(syncParamasInfos[i].TargetField, dr[syncParamasInfos[i].TargetField]);
}

//执行SQL语句
iReturn += MySQLHelper.ExecuteNonQuery(strSql, parameters);

}
}
catch (Exception ex)
{
//此处添加错误日志
log.Error(ex.Message);
}

return iReturn;
}

public bool LinkCnasTest()
{
return MySQLHelper.TestConnectMySql();
}
}
}

+ 38
- 0
CNAS_DBSync/Model/DataBaseInfo.cs 查看文件

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CNAS_DBSync
{
/// <summary>
/// 本系统目标数据库信息
/// </summary>
public class DataBaseInfo
{
/// <summary>
/// 服务器
/// </summary>
public string DBHost { get; set; }

/// <summary>
/// 数据库名称
/// </summary>
public string DBName { get; set; }

/// <summary>
/// 用户名
/// </summary>
public string DBUser { get; set; }

/// <summary>
/// 密码
/// </summary>
public string DBPwd { get; set; }

/// <summary>
/// 端口
/// </summary>
public string DBPort { get; set; }
}
}

+ 45
- 0
CNAS_DBSync/Model/InstrumentDataSourceInfo.cs 查看文件

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CNAS_DBSync
{
/// <summary>
/// 数据源类型
/// </summary>
public enum DataSourceType
{
None,
Access,
Excel,
SQLLite,
SQL
}

/// <summary>
/// 仪表数据源类
/// </summary>
public class InstrumentDataSourceInfo
{
/// <summary>
/// 仪表数据源类型
/// </summary>
public DataSourceType InstrumentDataSourceType { get; set; }

/// <summary>
/// 用户名
/// </summary>
public string UserId { get; set; }

/// <summary>
/// 用户密码
/// </summary>
public string UserPwd { get; set; }

/// <summary>
/// 数据源本地路径(只有数据源是本地文件时不为空)
/// </summary>
public string LocalPath { get; set; }
}
}

+ 38
- 0
CNAS_DBSync/Model/SyncInstrumentItemInfo.cs 查看文件

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CNAS_DBSync
{
/// <summary>
/// 仪表类
/// </summary>
public class SyncInstrumentItemInfo
{
/// <summary>
/// 标识
/// </summary>
public string GUID { get; set; }

/// <summary>
/// 仪表编号(库内唯一)
/// </summary>
public string Code { get; set; }

/// <summary>
/// 仪表同步数据源
/// </summary>
public InstrumentDataSourceInfo SyncInstrumentDSInfo { get; set; }

/// <summary>
/// 仪表同步目标数据库
/// </summary>
public DataBaseInfo SyncTargetDBInfo { get; set; }

/// <summary>
/// 映射字段集合
/// </summary>
public List<SyncParamasInfo> LstSyncPramas { get; set; }
}
}

+ 21
- 0
CNAS_DBSync/Model/SyncParamasInfo.cs 查看文件

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CNAS_DBSync
{
/// <summary>
/// 同步映射字段
/// </summary>
public class SyncParamasInfo
{
public string SourceTable { get; set; }

public string SourceField { get; set; }

public string TargetTable { get; set; }

public string TargetField { get; set; }
}
}

+ 21
- 0
CNAS_DBSync/Program.cs 查看文件

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace CNAS_DBSync
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmSyncParams());
}
}
}

+ 38
- 0
CNAS_DBSync/Properties/AssemblyInfo.cs 查看文件

@@ -0,0 +1,38 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("CNAS_DBSync")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CNAS_DBSync")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("0f16f166-6646-4502-b22d-5fe5bfe92326")]

// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//log4net从配置文件中读取配置
[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension = "config", Watch = true)]

+ 71
- 0
CNAS_DBSync/Properties/Resources.Designer.cs 查看文件

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace CNAS_DBSync.Properties
{


/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{

private static global::System.Resources.ResourceManager resourceMan;

private static global::System.Globalization.CultureInfo resourceCulture;

[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}

/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CNAS_DBSync.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}

/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

+ 117
- 0
CNAS_DBSync/Properties/Resources.resx 查看文件

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

+ 30
- 0
CNAS_DBSync/Properties/Settings.Designer.cs 查看文件

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace CNAS_DBSync.Properties
{


[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{

private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

+ 7
- 0
CNAS_DBSync/Properties/Settings.settings 查看文件

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

二進制
CNAS_DBSync/dll/CNAS_DBSync.exe 查看文件


+ 58
- 0
CNAS_DBSync/dll/CNAS_DBSync.exe.config 查看文件

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<connectionStrings>
<add name="CoreDb" connectionString="Driver={IBM DB2 ODBC DRIVER};DataBase=SAMPLE; HostName=127.0.0.1; Protocol=TCPIP;Port=50000;Uid=db2admin;Pwd=123" />
</connectionStrings>
<appSettings>
<add key="CoreDb" value="Provider=IBMDADB2;Data Source=SAMPLE;UID=db2admin;PWD=123;" />
</appSettings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
</system.data>
<log4net>
<!-- OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL -->
<!-- Set root logger level to ERROR and its appenders -->
<root>
<level value="ALL" />
<appender-ref ref="SysAppender" />
</root>
<!-- Print only messages of level DEBUG or above in the packages -->
<logger name="WindowsFormLogger">
<level value="DEBUG" />
</logger>
<appender name="SysAppender" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="Log/" />
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="&quot;Logs_&quot;yyyyMMdd&quot;.txt&quot;" />
<param name="StaticLogFileName" value="false" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="consoleApp" type="log4net.Appender.ConsoleAppender,log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
</log4net>
</configuration>

+ 195
- 0
CNAS_DBSync/dll/Data/SyncInStrumentData.xml 查看文件

@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfSyncInstrumentItemInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SyncInstrumentItemInfo>
<GUID>a2065a7f-62fb-4f5d-8a94-c321b896cf53</GUID>
<Code>LDD-1</Code>
<SyncInstrumentDSInfo>
<InstrumentDataSourceType>Excel</InstrumentDataSourceType>
<LocalPath>C:\Users\Li\Desktop\水分仪模拟数据.xls</LocalPath>
</SyncInstrumentDSInfo>
<SyncTargetDBInfo>
<DBHost>127.0.0.1</DBHost>
<DBName>SAMPLE</DBName>
<DBUser>DB2ADMIN</DBUser>
<DBPwd>123</DBPwd>
</SyncTargetDBInfo>
<LstSyncPramas>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>SerialNumber</SourceField>
<TargetTable>ASHEXAMINERECORD</TargetTable>
<TargetField>PLANTCODE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>SampleID</SourceField>
<TargetTable>ASHEXAMINERECORD</TargetTable>
<TargetField>COAL_CODE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>SampleName</SourceField>
<TargetTable>ASHEXAMINERECORD</TargetTable>
<TargetField>TEST_DATE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Content</SourceField>
<TargetTable>ASHEXAMINERECORD</TargetTable>
<TargetField>STANDARD_NAME</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Method</SourceField>
<TargetTable>ASHEXAMINERECORD</TargetTable>
<TargetField>STANDARD_ID</TargetField>
</SyncParamasInfo>
</LstSyncPramas>
</SyncInstrumentItemInfo>
<SyncInstrumentItemInfo>
<GUID>f521c2d4-ab6b-450c-a2dd-ef7d4e6d9fd4</GUID>
<Code>SDD-2</Code>
<SyncInstrumentDSInfo>
<InstrumentDataSourceType>Excel</InstrumentDataSourceType>
<LocalPath>C:\Users\Li\Desktop\水分仪模拟数据.xls</LocalPath>
</SyncInstrumentDSInfo>
<SyncTargetDBInfo>
<DBHost>127.0.0.1</DBHost>
<DBName>SAMPLE</DBName>
<DBUser>DB2ADMIN</DBUser>
<DBPwd>123</DBPwd>
</SyncTargetDBInfo>
<LstSyncPramas>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>SerialNumber</SourceField>
<TargetTable>ASHEXAMINERECORD_SUB</TargetTable>
<TargetField>VESSEL_CODE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>SampleID</SourceField>
<TargetTable>ASHEXAMINERECORD_SUB</TargetTable>
<TargetField>VESSEL_MASS</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>SampleName</SourceField>
<TargetTable>ASHEXAMINERECORD_SUB</TargetTable>
<TargetField>SAMPLING_MASS</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Content</SourceField>
<TargetTable>ASHEXAMINERECORD_SUB</TargetTable>
<TargetField>MASS_AFTER_FIRING</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Method</SourceField>
<TargetTable>ASHEXAMINERECORD_SUB</TargetTable>
<TargetField>FIRST_FIRING_MASS</TargetField>
</SyncParamasInfo>
</LstSyncPramas>
</SyncInstrumentItemInfo>
<SyncInstrumentItemInfo>
<GUID>bc6bc9f0-4b2d-42d6-92dd-85a2afb2b8b8</GUID>
<Code>SDF-1</Code>
<SyncInstrumentDSInfo>
<InstrumentDataSourceType>Excel</InstrumentDataSourceType>
<LocalPath>C:\Users\Li\Desktop\水分仪模拟数据.xls</LocalPath>
</SyncInstrumentDSInfo>
<SyncTargetDBInfo>
<DBHost>127.0.0.1</DBHost>
<DBName>SAMPLE</DBName>
<DBUser>DB2ADMIN</DBUser>
<DBPwd>123</DBPwd>
</SyncTargetDBInfo>
<LstSyncPramas>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>SerialNumber</SourceField>
<TargetTable>DB2TEST</TargetTable>
<TargetField>T_DECIMAL</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>SampleID</SourceField>
<TargetTable>DB2TEST</TargetTable>
<TargetField>T_CHAR</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>SampleName</SourceField>
<TargetTable>DB2TEST</TargetTable>
<TargetField>T_VARCHAR</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Content</SourceField>
<TargetTable>DB2TEST</TargetTable>
<TargetField>T_GRAPHIC</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Method</SourceField>
<TargetTable>DB2TEST</TargetTable>
<TargetField>T_VARGRAPHIC</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Tare</SourceField>
<TargetTable>DB2TEST</TargetTable>
<TargetField>T_DATE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Sample</SourceField>
<TargetTable>DB2TEST</TargetTable>
<TargetField>T_TIMESTAMP</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Leftover</SourceField>
<TargetTable>DB2TEST</TargetTable>
<TargetField>T_TIME</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Calibration</SourceField>
<TargetTable>DB2TEST</TargetTable>
<TargetField>T_DOUBLE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Moisture</SourceField>
<TargetTable>DB2TEST</TargetTable>
<TargetField>T_BLOB</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>TypeFlag</SourceField>
<TargetTable>DB2TEST</TargetTable>
<TargetField>T_CLOB</TargetField>
</SyncParamasInfo>
</LstSyncPramas>
</SyncInstrumentItemInfo>
<SyncInstrumentItemInfo>
<GUID>20aa5cdf-ded4-4972-91ba-124300a34f63</GUID>
<Code>1</Code>
<SyncInstrumentDSInfo>
<InstrumentDataSourceType>None</InstrumentDataSourceType>
</SyncInstrumentDSInfo>
<SyncTargetDBInfo>
<DBHost />
<DBName />
<DBUser />
<DBPwd />
</SyncTargetDBInfo>
<LstSyncPramas />
</SyncInstrumentItemInfo>
<SyncInstrumentItemInfo>
<GUID>a98d236d-c067-4fa4-ac63-6b188989cd01</GUID>
<Code>2</Code>
</SyncInstrumentItemInfo>
</ArrayOfSyncInstrumentItemInfo>

二進制
CNAS_DBSync/dll/Document/AshMeltingPoint.xls 查看文件


二進制
CNAS_DBSync/dll/Document/IndustrialAnalyzer.xls 查看文件


二進制
CNAS_DBSync/dll/Document/InfraredSulfurMeter.xls 查看文件


二進制
CNAS_DBSync/dll/Document/MoistureMeter.xls 查看文件


二進制
CNAS_DBSync/dll/Document/SulphurMeter.xls 查看文件


二進制
CNAS_DBSync/dll/System.Data.SQLite.EF6.dll 查看文件


二進制
CNAS_DBSync/dll/System.Data.SQLite.Linq.dll 查看文件


二進制
CNAS_DBSync/dll/System.Data.SQLite.dll 查看文件


+ 22
- 0
CNAS_DBSync/dll/System.Data.SQLite.dll.config 查看文件

@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!--
*
* System.Data.SQLite.dll.config -
*
* WARNING: This XML configuration file is intended for use within the NuGet
* package directories only. Please do not copy this file to any of
* the build output directories because it could interfere with the
* native library pre-loading feature.
*
* Written by Joe Mistachkin.
* Released to the public domain, use at your own risk!
*
-->
<configuration>
<appSettings>
<add key="PreLoadSQLite_BaseDirectory"
value="%PreLoadSQLite_AssemblyDirectory%\..\..\build\%PreLoadSQLite_TargetFramework%" />
</appSettings>

<dllmap dll="SQLite.Interop" target="SQLite.Interop.dll" />
</configuration>

+ 21120
- 0
CNAS_DBSync/dll/System.Data.SQLite.xml
文件差異過大導致無法顯示
查看文件


二進制
CNAS_DBSync/dll/log4net.dll 查看文件


+ 32464
- 0
CNAS_DBSync/dll/log4net.xml
文件差異過大導致無法顯示
查看文件


+ 577
- 0
CNAS_DBSync/frmDatabaseParams.Designer.cs 查看文件

@@ -0,0 +1,577 @@
namespace CNAS_DBSync
{
partial class frmDatabaseParams
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pnlAll = new System.Windows.Forms.Panel();
this.pnlCenter = new System.Windows.Forms.Panel();
this.tabParamas = new System.Windows.Forms.TabControl();
this.tabInstrument = new System.Windows.Forms.TabPage();
this.label14 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.tabcDS = new System.Windows.Forms.TabControl();
this.tabExcel = new System.Windows.Forms.TabPage();
this.btnOpenFileExcel = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.txtInportExcel = new System.Windows.Forms.TextBox();
this.tabAccess = new System.Windows.Forms.TabPage();
this.txtAceessPwd = new System.Windows.Forms.TextBox();
this.txtAccessUser = new System.Windows.Forms.TextBox();
this.label15 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.btnOpenFileAccess = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.txtAccessPath = new System.Windows.Forms.TextBox();
this.tabSQLite = new System.Windows.Forms.TabPage();
this.txtSqlitePwd = new System.Windows.Forms.TextBox();
this.txtSqliteUser = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.btnOpenFileSQLite = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.txtSqlitePath = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.tabCnas = new System.Windows.Forms.TabPage();
this.btnCNASTestLink = new System.Windows.Forms.Button();
this.txtDBName = new System.Windows.Forms.TextBox();
this.txtDBHost = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.txtDBPwd = new System.Windows.Forms.TextBox();
this.txtDBUser = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.pnlBottom = new System.Windows.Forms.Panel();
this.btnOK = new System.Windows.Forms.Button();
this.pnlTop = new System.Windows.Forms.Panel();
this.txtPort = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.pnlAll.SuspendLayout();
this.pnlCenter.SuspendLayout();
this.tabParamas.SuspendLayout();
this.tabInstrument.SuspendLayout();
this.tabcDS.SuspendLayout();
this.tabExcel.SuspendLayout();
this.tabAccess.SuspendLayout();
this.tabSQLite.SuspendLayout();
this.tabCnas.SuspendLayout();
this.pnlBottom.SuspendLayout();
this.SuspendLayout();
//
// pnlAll
//
this.pnlAll.Controls.Add(this.pnlCenter);
this.pnlAll.Controls.Add(this.pnlBottom);
this.pnlAll.Controls.Add(this.pnlTop);
this.pnlAll.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlAll.Location = new System.Drawing.Point(0, 0);
this.pnlAll.Name = "pnlAll";
this.pnlAll.Size = new System.Drawing.Size(612, 426);
this.pnlAll.TabIndex = 0;
//
// pnlCenter
//
this.pnlCenter.Controls.Add(this.tabParamas);
this.pnlCenter.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlCenter.Location = new System.Drawing.Point(0, 10);
this.pnlCenter.Name = "pnlCenter";
this.pnlCenter.Size = new System.Drawing.Size(612, 374);
this.pnlCenter.TabIndex = 4;
//
// tabParamas
//
this.tabParamas.Controls.Add(this.tabInstrument);
this.tabParamas.Controls.Add(this.tabCnas);
this.tabParamas.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabParamas.Location = new System.Drawing.Point(0, 0);
this.tabParamas.Name = "tabParamas";
this.tabParamas.SelectedIndex = 0;
this.tabParamas.Size = new System.Drawing.Size(612, 374);
this.tabParamas.TabIndex = 1;
//
// tabInstrument
//
this.tabInstrument.Controls.Add(this.label14);
this.tabInstrument.Controls.Add(this.textBox2);
this.tabInstrument.Controls.Add(this.tabcDS);
this.tabInstrument.Controls.Add(this.label2);
this.tabInstrument.Location = new System.Drawing.Point(4, 22);
this.tabInstrument.Name = "tabInstrument";
this.tabInstrument.Padding = new System.Windows.Forms.Padding(3);
this.tabInstrument.Size = new System.Drawing.Size(604, 348);
this.tabInstrument.TabIndex = 0;
this.tabInstrument.Text = "仪器数据源";
this.tabInstrument.UseVisualStyleBackColor = true;
//
// label14
//
this.label14.AutoSize = true;
this.label14.ForeColor = System.Drawing.Color.Red;
this.label14.Location = new System.Drawing.Point(287, 23);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(149, 12);
this.label14.TabIndex = 8;
this.label14.Text = "(暂时自动生成,不可更改)";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(76, 20);
this.textBox2.Name = "textBox2";
this.textBox2.ReadOnly = true;
this.textBox2.Size = new System.Drawing.Size(205, 21);
this.textBox2.TabIndex = 7;
//
// tabcDS
//
this.tabcDS.Controls.Add(this.tabExcel);
this.tabcDS.Controls.Add(this.tabAccess);
this.tabcDS.Controls.Add(this.tabSQLite);
this.tabcDS.Location = new System.Drawing.Point(8, 65);
this.tabcDS.Name = "tabcDS";
this.tabcDS.SelectedIndex = 0;
this.tabcDS.Size = new System.Drawing.Size(588, 277);
this.tabcDS.TabIndex = 6;
this.tabcDS.Selected += new System.Windows.Forms.TabControlEventHandler(this.tabcDS_Selected);
//
// tabExcel
//
this.tabExcel.Controls.Add(this.btnOpenFileExcel);
this.tabExcel.Controls.Add(this.label3);
this.tabExcel.Controls.Add(this.txtInportExcel);
this.tabExcel.Location = new System.Drawing.Point(4, 22);
this.tabExcel.Name = "tabExcel";
this.tabExcel.Padding = new System.Windows.Forms.Padding(3);
this.tabExcel.Size = new System.Drawing.Size(580, 251);
this.tabExcel.TabIndex = 0;
this.tabExcel.Text = "Excel";
this.tabExcel.UseVisualStyleBackColor = true;
//
// btnOpenFileExcel
//
this.btnOpenFileExcel.Location = new System.Drawing.Point(410, 80);
this.btnOpenFileExcel.Name = "btnOpenFileExcel";
this.btnOpenFileExcel.Size = new System.Drawing.Size(60, 23);
this.btnOpenFileExcel.TabIndex = 6;
this.btnOpenFileExcel.Text = "浏览";
this.btnOpenFileExcel.UseVisualStyleBackColor = true;
this.btnOpenFileExcel.Click += new System.EventHandler(this.btnOpenFileExcel_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(14, 83);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(41, 12);
this.label3.TabIndex = 5;
this.label3.Text = "路径:";
//
// txtInportExcel
//
this.txtInportExcel.Location = new System.Drawing.Point(64, 80);
this.txtInportExcel.Name = "txtInportExcel";
this.txtInportExcel.Size = new System.Drawing.Size(329, 21);
this.txtInportExcel.TabIndex = 5;
//
// tabAccess
//
this.tabAccess.Controls.Add(this.txtAceessPwd);
this.tabAccess.Controls.Add(this.txtAccessUser);
this.tabAccess.Controls.Add(this.label15);
this.tabAccess.Controls.Add(this.label16);
this.tabAccess.Controls.Add(this.btnOpenFileAccess);
this.tabAccess.Controls.Add(this.label4);
this.tabAccess.Controls.Add(this.txtAccessPath);
this.tabAccess.Location = new System.Drawing.Point(4, 22);
this.tabAccess.Name = "tabAccess";
this.tabAccess.Padding = new System.Windows.Forms.Padding(3);
this.tabAccess.Size = new System.Drawing.Size(580, 251);
this.tabAccess.TabIndex = 1;
this.tabAccess.Text = "Access";
this.tabAccess.UseVisualStyleBackColor = true;
//
// txtAceessPwd
//
this.txtAceessPwd.Location = new System.Drawing.Point(66, 109);
this.txtAceessPwd.Name = "txtAceessPwd";
this.txtAceessPwd.PasswordChar = '*';
this.txtAceessPwd.Size = new System.Drawing.Size(329, 21);
this.txtAceessPwd.TabIndex = 17;
//
// txtAccessUser
//
this.txtAccessUser.Location = new System.Drawing.Point(66, 65);
this.txtAccessUser.Name = "txtAccessUser";
this.txtAccessUser.Size = new System.Drawing.Size(329, 21);
this.txtAccessUser.TabIndex = 16;
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(16, 109);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(41, 12);
this.label15.TabIndex = 15;
this.label15.Text = "密码:";
//
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(6, 65);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(53, 12);
this.label16.TabIndex = 14;
this.label16.Text = "用户名:";
//
// btnOpenFileAccess
//
this.btnOpenFileAccess.Location = new System.Drawing.Point(412, 21);
this.btnOpenFileAccess.Name = "btnOpenFileAccess";
this.btnOpenFileAccess.Size = new System.Drawing.Size(60, 23);
this.btnOpenFileAccess.TabIndex = 9;
this.btnOpenFileAccess.Text = "浏览";
this.btnOpenFileAccess.UseVisualStyleBackColor = true;
this.btnOpenFileAccess.Click += new System.EventHandler(this.btnOpenFileAccess_Click);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(16, 24);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(41, 12);
this.label4.TabIndex = 7;
this.label4.Text = "路径:";
//
// txtAccessPath
//
this.txtAccessPath.Location = new System.Drawing.Point(66, 21);
this.txtAccessPath.Name = "txtAccessPath";
this.txtAccessPath.Size = new System.Drawing.Size(329, 21);
this.txtAccessPath.TabIndex = 8;
//
// tabSQLite
//
this.tabSQLite.Controls.Add(this.txtSqlitePwd);
this.tabSQLite.Controls.Add(this.txtSqliteUser);
this.tabSQLite.Controls.Add(this.label7);
this.tabSQLite.Controls.Add(this.label6);
this.tabSQLite.Controls.Add(this.btnOpenFileSQLite);
this.tabSQLite.Controls.Add(this.label5);
this.tabSQLite.Controls.Add(this.txtSqlitePath);
this.tabSQLite.Location = new System.Drawing.Point(4, 22);
this.tabSQLite.Name = "tabSQLite";
this.tabSQLite.Size = new System.Drawing.Size(580, 251);
this.tabSQLite.TabIndex = 2;
this.tabSQLite.Text = "SQLLite";
this.tabSQLite.UseVisualStyleBackColor = true;
//
// txtSqlitePwd
//
this.txtSqlitePwd.Location = new System.Drawing.Point(81, 115);
this.txtSqlitePwd.Name = "txtSqlitePwd";
this.txtSqlitePwd.PasswordChar = '*';
this.txtSqlitePwd.Size = new System.Drawing.Size(316, 21);
this.txtSqlitePwd.TabIndex = 13;
//
// txtSqliteUser
//
this.txtSqliteUser.Location = new System.Drawing.Point(81, 71);
this.txtSqliteUser.Name = "txtSqliteUser";
this.txtSqliteUser.Size = new System.Drawing.Size(316, 21);
this.txtSqliteUser.TabIndex = 12;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(18, 115);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(41, 12);
this.label7.TabIndex = 11;
this.label7.Text = "密码:";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(18, 71);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(53, 12);
this.label6.TabIndex = 10;
this.label6.Text = "用户名:";
//
// btnOpenFileSQLite
//
this.btnOpenFileSQLite.Location = new System.Drawing.Point(414, 23);
this.btnOpenFileSQLite.Name = "btnOpenFileSQLite";
this.btnOpenFileSQLite.Size = new System.Drawing.Size(60, 23);
this.btnOpenFileSQLite.TabIndex = 9;
this.btnOpenFileSQLite.Text = "浏览";
this.btnOpenFileSQLite.UseVisualStyleBackColor = true;
this.btnOpenFileSQLite.Click += new System.EventHandler(this.btnOpenFileSQLite_Click);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(18, 26);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(41, 12);
this.label5.TabIndex = 7;
this.label5.Text = "路径:";
//
// txtSqlitePath
//
this.txtSqlitePath.Location = new System.Drawing.Point(81, 23);
this.txtSqlitePath.Name = "txtSqlitePath";
this.txtSqlitePath.Size = new System.Drawing.Size(316, 21);
this.txtSqlitePath.TabIndex = 8;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(14, 23);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 12);
this.label2.TabIndex = 4;
this.label2.Text = "进程名:";
//
// tabCnas
//
this.tabCnas.Controls.Add(this.txtPort);
this.tabCnas.Controls.Add(this.label1);
this.tabCnas.Controls.Add(this.btnCNASTestLink);
this.tabCnas.Controls.Add(this.txtDBName);
this.tabCnas.Controls.Add(this.txtDBHost);
this.tabCnas.Controls.Add(this.label11);
this.tabCnas.Controls.Add(this.label10);
this.tabCnas.Controls.Add(this.txtDBPwd);
this.tabCnas.Controls.Add(this.txtDBUser);
this.tabCnas.Controls.Add(this.label8);
this.tabCnas.Controls.Add(this.label9);
this.tabCnas.Location = new System.Drawing.Point(4, 22);
this.tabCnas.Name = "tabCnas";
this.tabCnas.Padding = new System.Windows.Forms.Padding(3);
this.tabCnas.Size = new System.Drawing.Size(604, 348);
this.tabCnas.TabIndex = 1;
this.tabCnas.Text = "CNAS数据库";
this.tabCnas.UseVisualStyleBackColor = true;
//
// btnCNASTestLink
//
this.btnCNASTestLink.Location = new System.Drawing.Point(444, 237);
this.btnCNASTestLink.Name = "btnCNASTestLink";
this.btnCNASTestLink.Size = new System.Drawing.Size(79, 24);
this.btnCNASTestLink.TabIndex = 22;
this.btnCNASTestLink.Text = "测试连接";
this.btnCNASTestLink.UseVisualStyleBackColor = true;
this.btnCNASTestLink.Click += new System.EventHandler(this.btnCNASTestLink_Click);
//
// txtDBName
//
this.txtDBName.Location = new System.Drawing.Point(96, 73);
this.txtDBName.Name = "txtDBName";
this.txtDBName.Size = new System.Drawing.Size(316, 21);
this.txtDBName.TabIndex = 21;
//
// txtDBHost
//
this.txtDBHost.Location = new System.Drawing.Point(96, 27);
this.txtDBHost.Name = "txtDBHost";
this.txtDBHost.Size = new System.Drawing.Size(316, 21);
this.txtDBHost.TabIndex = 20;
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(51, 77);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(41, 12);
this.label11.TabIndex = 19;
this.label11.Text = "实例:";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(40, 30);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(53, 12);
this.label10.TabIndex = 18;
this.label10.Text = "服务器:";
//
// txtDBPwd
//
this.txtDBPwd.Location = new System.Drawing.Point(96, 164);
this.txtDBPwd.Name = "txtDBPwd";
this.txtDBPwd.PasswordChar = '*';
this.txtDBPwd.Size = new System.Drawing.Size(316, 21);
this.txtDBPwd.TabIndex = 17;
//
// txtDBUser
//
this.txtDBUser.Location = new System.Drawing.Point(96, 120);
this.txtDBUser.Name = "txtDBUser";
this.txtDBUser.Size = new System.Drawing.Size(316, 21);
this.txtDBUser.TabIndex = 16;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(51, 168);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(41, 12);
this.label8.TabIndex = 15;
this.label8.Text = "密码:";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(39, 124);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(53, 12);
this.label9.TabIndex = 14;
this.label9.Text = "用户名:";
//
// pnlBottom
//
this.pnlBottom.Controls.Add(this.btnOK);
this.pnlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlBottom.Location = new System.Drawing.Point(0, 384);
this.pnlBottom.Name = "pnlBottom";
this.pnlBottom.Size = new System.Drawing.Size(612, 42);
this.pnlBottom.TabIndex = 3;
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(522, 4);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 35);
this.btnOK.TabIndex = 0;
this.btnOK.Text = "确认";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// pnlTop
//
this.pnlTop.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlTop.Location = new System.Drawing.Point(0, 0);
this.pnlTop.Name = "pnlTop";
this.pnlTop.Size = new System.Drawing.Size(612, 10);
this.pnlTop.TabIndex = 2;
//
// txtPort
//
this.txtPort.Location = new System.Drawing.Point(96, 205);
this.txtPort.Name = "txtPort";
this.txtPort.PasswordChar = '*';
this.txtPort.Size = new System.Drawing.Size(316, 21);
this.txtPort.TabIndex = 24;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(51, 209);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 23;
this.label1.Text = "端口:";
//
// frmDatabaseParams
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(612, 426);
this.Controls.Add(this.pnlAll);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmDatabaseParams";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "仪表数据库配置";
this.Load += new System.EventHandler(this.frmDatabaseParams_Load);
this.pnlAll.ResumeLayout(false);
this.pnlCenter.ResumeLayout(false);
this.tabParamas.ResumeLayout(false);
this.tabInstrument.ResumeLayout(false);
this.tabInstrument.PerformLayout();
this.tabcDS.ResumeLayout(false);
this.tabExcel.ResumeLayout(false);
this.tabExcel.PerformLayout();
this.tabAccess.ResumeLayout(false);
this.tabAccess.PerformLayout();
this.tabSQLite.ResumeLayout(false);
this.tabSQLite.PerformLayout();
this.tabCnas.ResumeLayout(false);
this.tabCnas.PerformLayout();
this.pnlBottom.ResumeLayout(false);
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Panel pnlAll;
private System.Windows.Forms.Panel pnlCenter;
private System.Windows.Forms.TabControl tabParamas;
private System.Windows.Forms.TabPage tabInstrument;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TabControl tabcDS;
private System.Windows.Forms.TabPage tabExcel;
private System.Windows.Forms.Button btnOpenFileExcel;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtInportExcel;
private System.Windows.Forms.TabPage tabAccess;
private System.Windows.Forms.TextBox txtAceessPwd;
private System.Windows.Forms.TextBox txtAccessUser;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.Button btnOpenFileAccess;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TabPage tabSQLite;
private System.Windows.Forms.TextBox txtSqlitePwd;
private System.Windows.Forms.TextBox txtSqliteUser;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button btnOpenFileSQLite;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox txtSqlitePath;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TabPage tabCnas;
private System.Windows.Forms.Button btnCNASTestLink;
private System.Windows.Forms.TextBox txtDBName;
private System.Windows.Forms.TextBox txtDBHost;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox txtDBPwd;
private System.Windows.Forms.TextBox txtDBUser;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Panel pnlBottom;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Panel pnlTop;
private System.Windows.Forms.TextBox txtAccessPath;
private System.Windows.Forms.TextBox txtPort;
private System.Windows.Forms.Label label1;
}
}

+ 259
- 0
CNAS_DBSync/frmDatabaseParams.cs 查看文件

@@ -0,0 +1,259 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Serialization;

namespace CNAS_DBSync
{
public delegate void InstrumentItemDataHanlder(Dictionary<string,DataTable> dictInstrument);

public partial class frmDatabaseParams : Form
{
public SyncInstrumentItemInfo syncInstrumentItem = new SyncInstrumentItemInfo();
public Dictionary<string, DataTable> dictInstrument = new Dictionary<string, DataTable>();
public DataBaseInfo dataBaseInfo = new DataBaseInfo();
public InstumentCodeHanlder InstrumentDelegate;
public InstrumentItemDataHanlder InstrumentItemData;

public frmDatabaseParams(SyncInstrumentItemInfo syncInstrumentItem)
{
InitializeComponent();

this.syncInstrumentItem = syncInstrumentItem;
}

private void frmDatabaseParams_Load(object sender, EventArgs e)
{
if (syncInstrumentItem.SyncInstrumentDSInfo == null)
syncInstrumentItem.SyncInstrumentDSInfo = new InstrumentDataSourceInfo();

//如果有旧值,加载旧的值
switch (syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType)
{
case DataSourceType.Access:
this.txtAccessPath.Text = syncInstrumentItem.SyncInstrumentDSInfo.LocalPath;
this.txtAccessUser.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserId;
this.txtAceessPwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserPwd;
break;
case DataSourceType.Excel:
this.txtInportExcel.Text = syncInstrumentItem.SyncInstrumentDSInfo.LocalPath;
break;
case DataSourceType.SQLLite:
this.txtSqlitePath.Text= syncInstrumentItem.SyncInstrumentDSInfo.LocalPath;
this.txtSqliteUser.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserId;
this.txtSqlitePwd.Text = syncInstrumentItem.SyncInstrumentDSInfo.UserPwd;
break;
default:
break;
}

//加载旧的CNAS数据库信息
if (syncInstrumentItem.SyncTargetDBInfo == null)
syncInstrumentItem.SyncTargetDBInfo = new DataBaseInfo();
this.txtDBHost.Text = syncInstrumentItem.SyncTargetDBInfo.DBHost;
this.txtDBName.Text = syncInstrumentItem.SyncTargetDBInfo.DBName;
this.txtDBUser.Text = syncInstrumentItem.SyncTargetDBInfo.DBUser;
this.txtDBPwd.Text = syncInstrumentItem.SyncTargetDBInfo.DBPwd;
this.txtPort.Text= syncInstrumentItem.SyncTargetDBInfo.DBPort;
}

private void btnOK_Click(object sender, EventArgs e)
{
//点击确定按钮
InstrumentData instrumentData = null;
switch (syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType)
{
case DataSourceType.Access:

syncInstrumentItem.SyncInstrumentDSInfo.LocalPath = this.txtAccessPath.Text.Trim();
syncInstrumentItem.SyncInstrumentDSInfo.UserId = this.txtAccessUser.Text.Trim();
syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = this.txtAceessPwd.Text.Trim();

instrumentData = InstrumentDataFact.CreateInstrumentDataSource(syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType, new object[] { syncInstrumentItem.SyncInstrumentDSInfo.LocalPath, syncInstrumentItem.SyncInstrumentDSInfo.UserId, syncInstrumentItem.SyncInstrumentDSInfo.UserPwd });
dictInstrument = instrumentData.GetInstrumentData();
break;
case DataSourceType.SQLLite:

syncInstrumentItem.SyncInstrumentDSInfo.LocalPath = this.txtSqlitePath.Text.Trim();
syncInstrumentItem.SyncInstrumentDSInfo.UserId = this.txtSqliteUser.Text.Trim();
syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = this.txtSqlitePwd.Text.Trim();

instrumentData = InstrumentDataFact.CreateInstrumentDataSource(syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType, new object[] { syncInstrumentItem.SyncInstrumentDSInfo.LocalPath, syncInstrumentItem.SyncInstrumentDSInfo.UserId, syncInstrumentItem.SyncInstrumentDSInfo.UserPwd });
dictInstrument = instrumentData.GetInstrumentData();
break;
case DataSourceType.Excel:
default:
instrumentData = InstrumentDataFact.CreateInstrumentDataSource(syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType, new object[] { syncInstrumentItem.SyncInstrumentDSInfo.LocalPath });
dictInstrument = instrumentData.GetInstrumentData();
break;
}

//目标库的信息
syncInstrumentItem.SyncTargetDBInfo.DBHost = this.txtDBHost.Text.Trim();
syncInstrumentItem.SyncTargetDBInfo.DBName = this.txtDBName.Text.Trim();
syncInstrumentItem.SyncTargetDBInfo.DBUser = this.txtDBUser.Text.Trim();
syncInstrumentItem.SyncTargetDBInfo.DBPwd = this.txtDBPwd.Text.Trim();
syncInstrumentItem.SyncTargetDBInfo.DBPort = this.txtPort.Text.Trim();

this.InstrumentDelegate(syncInstrumentItem);
this.InstrumentItemData(dictInstrument);

this.Close();
}

private void btnOpenFileExcel_Click(object sender, EventArgs e)
{
if (syncInstrumentItem.Code == null) return;

if (syncInstrumentItem.SyncInstrumentDSInfo == null)
syncInstrumentItem.SyncInstrumentDSInfo = new InstrumentDataSourceInfo();

syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.Excel;

OpenFileDialog openFile = new OpenFileDialog
{
Filter = "Excel(*.xlsx)|*.xlsx|Excel(*.xls)|*.xls",
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
Multiselect = false
};

if (openFile.ShowDialog() == DialogResult.Cancel) return;
this.txtInportExcel.Text = syncInstrumentItem.SyncInstrumentDSInfo.LocalPath = openFile.FileName;
string fileType = System.IO.Path.GetExtension(openFile.FileName);
if (string.IsNullOrEmpty(fileType)) return;
}

private void tabcDS_Selected(object sender, TabControlEventArgs e)
{
//切换的时候,检查其他类型数据源是否有值,如果有值,将提示删除旧值才能配置新值
if (e.TabPage == tabExcel)
{
//检查tabAccess页面是否为空 //检查tabSQLite页面是否为空
if (!CheckAccessControl() || !CheckSQLiteControl())
{
if (MessageBox.Show("其他数据源存在已保存数据,继续将删除这些值,是否继续", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
this.txtAccessPath.Text = "";
this.txtAccessUser.Text = "";
this.txtAceessPwd.Text = "";

this.txtSqliteUser.Text = "";
this.txtSqlitePath.Text = "";
this.txtSqlitePwd.Text = "";

syncInstrumentItem.SyncInstrumentDSInfo.LocalPath = "";
syncInstrumentItem.SyncInstrumentDSInfo.UserId = "";
syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = "";
}
}
syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.Excel;
}
if (e.TabPage == tabAccess)
{
//检查tabAccess页面是否为空 //检查tabSQLite页面是否为空
if (!CheckExcelControl() || !CheckSQLiteControl())
{
if (MessageBox.Show("其他数据源存在已保存数据,继续将删除这些值,是否继续", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
this.txtAccessPath.Text = "";
this.txtAccessUser.Text = "";
this.txtAceessPwd.Text = "";

this.txtSqliteUser.Text = "";
this.txtSqlitePath.Text = "";
this.txtSqlitePwd.Text = "";

syncInstrumentItem.SyncInstrumentDSInfo.LocalPath = "";
syncInstrumentItem.SyncInstrumentDSInfo.UserId = "";
syncInstrumentItem.SyncInstrumentDSInfo.UserPwd = "";
}
}
syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.Access;
}

}

private bool CheckExcelControl()
{
if (this.txtInportExcel.Text != "")
return false;
else
return true;
}

private bool CheckAccessControl()
{
if (this.txtAccessPath.Text != "" && this.txtAccessUser.Text != "" && this.txtAceessPwd.Text != "")
return false;
else
return true;
}

private bool CheckSQLiteControl()
{
if (this.txtSqlitePath.Text != "" && this.txtSqliteUser.Text != "" && this.txtSqlitePwd.Text != "")
return false;
else
return true;
}

private void btnCNASTestLink_Click(object sender, EventArgs e)
{
if(CnasDataOperationFact.CnasDataOperation().TestConnect(this.txtDBHost.Text.Trim(), this.txtDBName.Text.Trim(), this.txtDBUser.Text.Trim(), this.txtDBPwd.Text.Trim(),this.txtPort.Text.Trim()))
MessageBox.Show("连接成功!");
else
MessageBox.Show("连接失败!");
}

private void btnOpenFileAccess_Click(object sender, EventArgs e)
{
if (syncInstrumentItem.Code == null) return;

if (syncInstrumentItem.SyncInstrumentDSInfo == null)
syncInstrumentItem.SyncInstrumentDSInfo = new InstrumentDataSourceInfo();

syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.Access;

OpenFileDialog openFile = new OpenFileDialog
{
Filter = "Microsoft Access(*.mdb)|*.mdb",
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
Multiselect = false
};

if (openFile.ShowDialog() == DialogResult.Cancel) return;
this.txtAccessPath.Text = syncInstrumentItem.SyncInstrumentDSInfo.LocalPath = openFile.FileName;
string fileType = System.IO.Path.GetExtension(openFile.FileName);
if (string.IsNullOrEmpty(fileType)) return;
}

private void btnOpenFileSQLite_Click(object sender, EventArgs e)
{
if (syncInstrumentItem.Code == null) return;

if (syncInstrumentItem.SyncInstrumentDSInfo == null)
syncInstrumentItem.SyncInstrumentDSInfo = new InstrumentDataSourceInfo();

syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType = DataSourceType.SQLLite;

OpenFileDialog openFile = new OpenFileDialog
{
Filter = "SQLite(*.db)|*.db",
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
Multiselect = false
};

if (openFile.ShowDialog() == DialogResult.Cancel) return;
this.txtSqlitePath.Text = syncInstrumentItem.SyncInstrumentDSInfo.LocalPath = openFile.FileName;
string fileType = System.IO.Path.GetExtension(openFile.FileName);
if (string.IsNullOrEmpty(fileType)) return;
}
}
}

+ 120
- 0
CNAS_DBSync/frmDatabaseParams.resx 查看文件

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

+ 74
- 0
CNAS_DBSync/frmInstrumentCode.Designer.cs 查看文件

@@ -0,0 +1,74 @@
namespace CNAS_DBSync
{
partial class frmInstrumentCode
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.txtCode = new System.Windows.Forms.TextBox();
this.btnOK = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// txtCode
//
this.txtCode.Location = new System.Drawing.Point(21, 23);
this.txtCode.Name = "txtCode";
this.txtCode.Size = new System.Drawing.Size(292, 21);
this.txtCode.TabIndex = 0;
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(334, 23);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 1;
this.btnOK.Text = "确定";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// frmInstrumentCode
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(432, 66);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.txtCode);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmInstrumentCode";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "请填写仪器编号";
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.TextBox txtCode;
private System.Windows.Forms.Button btnOK;
}
}

+ 75
- 0
CNAS_DBSync/frmInstrumentCode.cs 查看文件

@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CNAS_DBSync
{
public delegate void InstumentCodeHanlder(SyncInstrumentItemInfo Instrumentitem);

public partial class frmInstrumentCode : Form
{
public List<SyncInstrumentItemInfo> lstSyncInstrument = new List<SyncInstrumentItemInfo>();
public InstumentCodeHanlder InstrumentDelegate;
public string strOldCode = "";

public frmInstrumentCode(List<SyncInstrumentItemInfo> lstSyncInstrument)
{
InitializeComponent();

this.lstSyncInstrument = lstSyncInstrument;
}

public frmInstrumentCode(List<SyncInstrumentItemInfo> lstSyncInstrument,string strOldCode=null)
{
InitializeComponent();

this.lstSyncInstrument = lstSyncInstrument;
this.strOldCode=this.txtCode.Text=strOldCode;
}

private void btnOK_Click(object sender, EventArgs e)
{
if (this.txtCode.Text.Trim() == strOldCode) //此时没有修改任何内容
{
return;
}

int iMessage = new InstrumentCodeOperation().CheckInstrumentCode(this.txtCode.Text.Trim(),lstSyncInstrument);
if (iMessage <= 0)
{
switch (iMessage)
{
case 0:
MessageBox.Show("输入不允许为空!请重新输入!");
break;
case -1:
MessageBox.Show("输入含有特殊字符!请重新输入!");
break;
case -2:
MessageBox.Show("仪器编码不允许重复!请重新输入!");
break;

}
this.txtCode.Text = "";
return;
}

//传输输入到父界面
SyncInstrumentItemInfo syncinstrument = new SyncInstrumentItemInfo();
syncinstrument.GUID = Guid.NewGuid().ToString();
syncinstrument.Code = this.txtCode.Text.Trim();

this.InstrumentDelegate(syncinstrument);


//关闭界面
this.Close();

}
}
}

+ 120
- 0
CNAS_DBSync/frmInstrumentCode.resx 查看文件

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

+ 203
- 0
CNAS_DBSync/frmPrBar.Designer.cs 查看文件

@@ -0,0 +1,203 @@
namespace CNAS_DBSync
{
partial class frmPrBar
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmPrBar));
this.panel1 = new System.Windows.Forms.Panel();
this.btnStart = new System.Windows.Forms.Button();
this.btnGoon = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
this.btnPause = new System.Windows.Forms.Button();
this.lblCount = new System.Windows.Forms.Label();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.lblMsg = new System.Windows.Forms.Label();
this.lblPercentage = new System.Windows.Forms.Label();
this.pictureBoxCancel = new System.Windows.Forms.PictureBox();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCancel)).BeginInit();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.SystemColors.Control;
this.panel1.Controls.Add(this.btnStart);
this.panel1.Controls.Add(this.btnGoon);
this.panel1.Controls.Add(this.btnStop);
this.panel1.Controls.Add(this.btnPause);
this.panel1.Controls.Add(this.lblCount);
this.panel1.Controls.Add(this.progressBar1);
this.panel1.Controls.Add(this.lblMsg);
this.panel1.Controls.Add(this.lblPercentage);
this.panel1.Controls.Add(this.pictureBoxCancel);
this.panel1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.panel1.Location = new System.Drawing.Point(1, 2);
this.panel1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(331, 96);
this.panel1.TabIndex = 2;
//
// btnStart
//
this.btnStart.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnStart.Image = ((System.Drawing.Image)(resources.GetObject("btnStart.Image")));
this.btnStart.Location = new System.Drawing.Point(4, 70);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(75, 23);
this.btnStart.TabIndex = 8;
this.btnStart.Text = "开始";
this.btnStart.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnStart.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.btnStart.UseVisualStyleBackColor = true;
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
//
// btnGoon
//
this.btnGoon.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnGoon.Image = ((System.Drawing.Image)(resources.GetObject("btnGoon.Image")));
this.btnGoon.Location = new System.Drawing.Point(169, 70);
this.btnGoon.Name = "btnGoon";
this.btnGoon.Size = new System.Drawing.Size(75, 23);
this.btnGoon.TabIndex = 7;
this.btnGoon.Text = "继续";
this.btnGoon.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnGoon.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.btnGoon.UseVisualStyleBackColor = true;
this.btnGoon.Click += new System.EventHandler(this.btnGoon_Click);
//
// btnStop
//
this.btnStop.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnStop.Image = ((System.Drawing.Image)(resources.GetObject("btnStop.Image")));
this.btnStop.Location = new System.Drawing.Point(251, 70);
this.btnStop.Name = "btnStop";
this.btnStop.Size = new System.Drawing.Size(75, 23);
this.btnStop.TabIndex = 6;
this.btnStop.Text = "停止";
this.btnStop.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnStop.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.btnStop.UseVisualStyleBackColor = true;
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
//
// btnPause
//
this.btnPause.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnPause.Image = ((System.Drawing.Image)(resources.GetObject("btnPause.Image")));
this.btnPause.Location = new System.Drawing.Point(87, 70);
this.btnPause.Name = "btnPause";
this.btnPause.Size = new System.Drawing.Size(75, 23);
this.btnPause.TabIndex = 5;
this.btnPause.Text = "暂停";
this.btnPause.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnPause.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.btnPause.UseVisualStyleBackColor = true;
this.btnPause.Click += new System.EventHandler(this.btnPause_Click);
//
// lblCount
//
this.lblCount.Location = new System.Drawing.Point(239, 17);
this.lblCount.Name = "lblCount";
this.lblCount.Size = new System.Drawing.Size(87, 21);
this.lblCount.TabIndex = 4;
this.lblCount.Text = "1/1";
this.lblCount.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(4, 41);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(322, 23);
this.progressBar1.TabIndex = 3;
//
// lblMsg
//
this.lblMsg.Location = new System.Drawing.Point(3, 17);
this.lblMsg.Name = "lblMsg";
this.lblMsg.Size = new System.Drawing.Size(230, 21);
this.lblMsg.TabIndex = 1;
this.lblMsg.Text = "准备就绪";
this.lblMsg.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblPercentage
//
this.lblPercentage.AutoSize = true;
this.lblPercentage.ForeColor = System.Drawing.Color.Black;
this.lblPercentage.Location = new System.Drawing.Point(231, 28);
this.lblPercentage.Name = "lblPercentage";
this.lblPercentage.Size = new System.Drawing.Size(12, 17);
this.lblPercentage.TabIndex = 3;
this.lblPercentage.Text = " ";
this.lblPercentage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pictureBoxCancel
//
this.pictureBoxCancel.Location = new System.Drawing.Point(308, 5);
this.pictureBoxCancel.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pictureBoxCancel.Name = "pictureBoxCancel";
this.pictureBoxCancel.Size = new System.Drawing.Size(14, 13);
this.pictureBoxCancel.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBoxCancel.TabIndex = 2;
this.pictureBoxCancel.TabStop = false;
this.pictureBoxCancel.Visible = false;
//
// frmPrBar
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(332, 100);
this.ControlBox = false;
this.Controls.Add(this.panel1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "frmPrBar";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = " ";
this.TopMost = true;
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCancel)).EndInit();
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Panel panel1;
public System.Windows.Forms.Label lblCount;
private System.Windows.Forms.ProgressBar progressBar1;
public System.Windows.Forms.Label lblMsg;
private System.Windows.Forms.Label lblPercentage;
private System.Windows.Forms.PictureBox pictureBoxCancel;
private System.Windows.Forms.Button btnPause;
private System.Windows.Forms.Button btnGoon;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button btnStart;
}
}

+ 354
- 0
CNAS_DBSync/frmPrBar.cs 查看文件

@@ -0,0 +1,354 @@
using System;
using System.Threading;
using System.Windows.Forms;

namespace CNAS_DBSync
{
public partial class frmPrBar : Form
{
/// <summary>
/// 显示百分比(例:30%)或完成数(例:138/2000)
/// </summary>
private static bool _ShowPercentage;

/// <summary>
/// 构造函数
/// </summary>
/// <param name="title">窗体标题</param>
/// <param name="customText">滚动条上方显示的文字提示</param>
/// <param name="taskCount">总任务数</param>
/// <param name="showPercentage">显示百分比(例:30%)或完成数(例:138/2000)</param>
/// <param name="showClose">是否显示关闭按钮</param>
/// <param name="showCustomButton">是否显示开始/暂停/继续/停止按钮</param>
public frmPrBar(string title, string customText, int taskCount, bool showPercentage, bool showClose, bool showCustomButton)
{
InitializeComponent();
this.Text = title;
SetText(customText);
//pictureBoxCancel.Visible = showCustomClose;
_ShowPercentage = showPercentage;
this.ControlBox = showClose;
btnStart.Visible = showCustomButton;
btnPause.Visible = showCustomButton;
btnGoon.Visible = showCustomButton;
btnStop.Visible = showCustomButton;
ProgressBarService.Status = ProgressBarRunStatus.None;

this.progressBar1.Maximum = taskCount;
this.progressBar1.Value = 0;
}

protected override void WndProc(ref Message m)
{
const int WM_SYSCOMMAND = 0x0112;
const int SC_CLOSE = 0xF060;
if (m.Msg == WM_SYSCOMMAND && (int)m.WParam == SC_CLOSE)
{
//Application.ExitThread();
//ProgressBarService.CloseBarForm();
ProgressBarService.Status = ProgressBarRunStatus.Close;
return;
}
base.WndProc(ref m);
}

/// <summary>
/// 委托修改等待窗显示的文字
/// </summary>
/// <param name="text"></param>
private delegate void SetTextHandler(string text);

public void SetText(string text)
{
if (lblMsg.InvokeRequired)
this.Invoke(new SetTextHandler(SetText), text);
else
{
if (text.ToUpper() == "CLOSE")
{
this.Close();
this.Dispose();
}
else
lblMsg.Text = text;
}
}

private delegate void UpdateUI(int step);

/// <summary>
/// 更新UI
/// </summary>
/// <param name="step"></param>
public void UpdataUIStatus(int step)
{
try
{
if (this.IsDisposed || !this.IsHandleCreated)
return;
if (InvokeRequired)
{
this.Invoke(new UpdateUI(delegate (int s)
{
this.progressBar1.Value = s;
//this.progressBar1.Value += s;
if (_ShowPercentage)
this.lblCount.Text = (this.progressBar1.Value * 100 / this.progressBar1.Maximum).ToString() + "%";
else
this.lblCount.Text = this.progressBar1.Value.ToString() + "/" + this.progressBar1.Maximum.ToString();
if (this.progressBar1.Value == this.progressBar1.Maximum)
this.Close();
}), step);
}
else
{
if (this.progressBar1.Value >= this.progressBar1.Maximum)
this.progressBar1.Value = 0;
this.progressBar1.Value = step;
//this.progressBar1.Value += step;
if (_ShowPercentage)
this.lblCount.Text = (this.progressBar1.Value * 100 / this.progressBar1.Maximum).ToString() + "%";
else
this.lblCount.Text = this.progressBar1.Value.ToString() + "/" + this.progressBar1.Maximum.ToString();
}
}
catch (Exception ex) { }
}

/// <summary>
/// 开始
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnStart_Click(object sender, EventArgs e)
{
ProgressBarService.Status = ProgressBarRunStatus.Start;
btnStart.Enabled = false;
btnPause.Enabled = true;
btnGoon.Enabled = true;
btnStop.Enabled = true;
this.ControlBox = false;
}

/// <summary>
/// 暂停
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnPause_Click(object sender, EventArgs e)
{
//ProgressBarService.PauseProgress();
ProgressBarService.Status = ProgressBarRunStatus.Pause;
btnStart.Enabled = false;
btnPause.Enabled = false;
btnGoon.Enabled = true;
btnStop.Enabled = true;
this.ControlBox = false;
}

/// <summary>
/// 继续
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnGoon_Click(object sender, EventArgs e)
{
ProgressBarService.Status = ProgressBarRunStatus.GoOn;
btnStart.Enabled = false;
btnPause.Enabled = true;
btnGoon.Enabled = false;
btnStop.Enabled = true;
this.ControlBox = false;
}

/// <summary>
/// 停止
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnStop_Click(object sender, EventArgs e)
{
ProgressBarService.Status = ProgressBarRunStatus.Stop;
btnStart.Enabled = true;
btnPause.Enabled = false;
btnGoon.Enabled = false;
btnStop.Enabled = false;
this.ControlBox = true;
}
}

public class ProgressBarService
{
private Thread thred = null;
private frmPrBar bar = null;

public ProgressBarService() { }

private static ProgressBarService _instance;
private static readonly Object syncLock = new Object();
public static ProgressBarService Instance
{
get
{
if (ProgressBarService._instance == null)
{
lock (syncLock)
{
if (ProgressBarService._instance == null)
{
ProgressBarService._instance = new ProgressBarService();
}
}
}
return ProgressBarService._instance;
}
}

#region 创建等待窗口
/// <summary>
/// 创建等待窗口并写入提示文字
/// </summary>
/// <param name="title">标题</param>
/// <param name="str">提示文字</param>
/// <param name="Count">步长</param>
/// <param name="showPercentage">显示百分比(例:30%)或完成数(例:138/2000).默认false显示完成数</param>
/// <param name="showClose">是否显示关闭窗口按钮(true显示;false隐藏),不传值默认fasle</param>
/// <param name="showCustomButton">是否显示开始/暂停/继续/停止按钮(true显示;false隐藏),不传值默认fasle</param>
public static void CreateBarForm(string title, string text, int Count, bool showPercentage = false, bool showClose = false, bool showCustomButton = false)
{
ProgressBarService.Instance.CreateForm(title, text, Count, showPercentage, showClose, showCustomButton);
}

int tid1 = 0;
private void CreateForm(string title, string text, int Count, bool showPercentage, bool showClose, bool showCustomButton)
{
int tid2 = Thread.CurrentThread.ManagedThreadId;
if (tid1 == tid2)
return;
tid1 = tid2;
if (thred != null)
{
try
{
thred = null;
bar = null;
}
catch (Exception)
{
}
}

thred = new Thread(new ThreadStart(delegate ()
{
bar = new frmPrBar(title, text, Count, showPercentage, showClose, showCustomButton);
System.Windows.Forms.Application.Run(bar);
}));
thred.Start();

}
#endregion

#region 关闭等待窗口
/// <summary>
/// 关闭窗口
/// </summary>
public static void CloseBarForm()
{
ProgressBarService.Instance.CloseForm();
}

private void CloseForm()
{
tid1 = 0;
if (thred != null)
{
try
{
bar.SetText("CLOSE");
thred = null;
bar = null;
}
catch (Exception) { }
}
}
#endregion

#region 修改等待窗体的提示文字
/// <summary>
/// 修改提示文字
/// </summary>
/// <param name="text">提示文字</param>
public static void SetBarFormCaption(string text)
{
ProgressBarService.Instance.SetFormCaption(text);
}

private void SetFormCaption(string text)
{
if (bar != null)
{
try
{
bar.SetText(text);
}
catch (Exception) { }
}
}
#endregion

#region 更新进度条
/// <summary>
/// 更新进度
/// </summary>
/// <param name="step"></param>
public static void UpdateProgress(int step)
{
ProgressBarService.Instance.SetProgress(step);
}

private void SetProgress(int step)
{
if (bar != null)
{
try
{
bar.UpdataUIStatus(step);
}
catch (Exception) { }
}
}
#endregion

#region 进度条运行状态
public static ProgressBarRunStatus Status { get; set; }
#endregion
}

public enum ProgressBarRunStatus
{
/// <summary>
/// 无操作
/// </summary>
None,
/// <summary>
/// 开始
/// </summary>
Start,
/// <summary>
/// 暂停
/// </summary>
Pause,
/// <summary>
/// 继续
/// </summary>
GoOn,
/// <summary>
/// 停止
/// </summary>
Stop,
/// <summary>
/// 关闭
/// </summary>
Close
}
}

+ 263
- 0
CNAS_DBSync/frmPrBar.resx 查看文件

@@ -0,0 +1,263 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnStart.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJ
TUUH3wIYEh0dQxlfkQAAAtRJREFUOE9lkWtIk2EUxw+kQVCBqNhmiAO7aqJiaZltXrYwEyyClAQhJIS+
ZS2xMC+BSrS5MmuyoiivUzfnbm5ZTaRc9sEp3mI6lwVaGUQf+mKeznlNsTrw33Oec/6/5znPXtgY4TdN
EFZlhMON/aAZ9gEiCuKca9xjz38hrjaBss8DSQ1OgCJdYNJdZ3L2k8GrZ1rdj1icc03okUfZNyIw61HQ
OgQZTS8hTmWT5D57rS3sHftaaH+P5xxeQZxzjXpNcWqbhL0FbUOrsKjCCPFqO+ytM0ecbnU786xTmG2b
RbltDjNtfmFVkLjGPfI8Zy8zzMKOGwaAi483y3QD2hzjOCqsPlTY/XjK5sUcqxfllPNeEPVyesZRpnNp
mRHYWJUdom9ZkzOah5cUZi8eJ6Ocbq51+9HgmcE827Sw5zqLPexlhlk40fEODtQ7rsg6POu3Z9DId0YX
ceXXMg55P2KxY0p4xtoU7GWGWZiizxStcTbK9GMot/J76QBaNSML9AVXw7fwBUterE7CHvYywyy8op99
Ksc9afsoZlp8mGn1Y7plDus3HOBZ+okXXPN0sF/wsJcZZiFZNwC7ai2XjjwdxnQTvY9gmdknTLC8soLW
Dz/wbP88plGde+xJIS8zzEJEpQHCy7sSE+67Pks7JzCtdxalvT4sd39C7cQ3zKK3y2ifTocKPfKwdycx
zELQ5TaAQm1AVI1Zc+jhGzzWOYlS4wzKCUoz0bg9sygjcY177GEvMwIbrGwHUZkeQpRtoj11lp7EpkFM
afHgUf0kpnZOY2oXiXKucY897GWGWSEiqwwgvkaFkmaRpKJbHXPbvpjwYAAP0m0szmNU9kVJpUEVXNIi
El/XC8xfkU//aLj6LUBI1NZt8vO5oXmljaKiGou4qMYcml/WsD2r+CSIY7eElXbAfuP3P9Q/ERgZy0sA
KZi0mxRPiiNFkYJIm0KqXbSsBcBvK2YMb8wajUQAAAAASUVORK5CYII=
</value>
</data>
<data name="btnGoon.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJ
TUUH3wIYEh0dQxlfkQAAAuhJREFUOE9lkWtIk3EUxg+UQVCBqNhmiIJdNVGxtEQ3L5u3BAkDRUEpPwh9
y1piUV4Ck2gmmaWse961TXdVM51Iafah5WUquk2lD96SJCkrOJ3zqmF14Nn/2TnP77z/d4Ot5XGjDdyL
NHCisgvKB+2AiILYc49nnPmvxMVtoGi3QEhFJ0C2yinkbmdo4tO+yyl1A49Y7LknzCijaP8gMH8qo64f
oqu7IUBp9E5+8aYqUzu0mGmawPSOSUHsuUez6oAyozdnM+r712FRgQYCy0xwqFTnebpuoDPVMIaJRhvK
jQ6UbYg993hGmVecZYZZ2HtdDXD+yQ6pqrcqSTOCcoMdZaZplG9oq+dZUusISlXmKmYE1l9pAt9bhtDo
msEluW4S40wOTDfSLQxTGEvQpucF/J0znGWGWUhofA9H73RckjZaUEZPiKcF6uEZfNxvxTN05ebhWXw2
YMUUw/j6bSjDWWaYhTH6m3zLOyulTUO0wIFx9L4905/x++pXNI9O4cinBfy2uoo95M+ZxjCGF1CWGWah
hz4OKzvuSRo+YozejrG0pHt6CX/9WMOh+RWcWFjBn2traJlbwZyeaYzW2ZGzzDALoape2H9Tf+Hk80GM
aptEOS0x2hZRa1vG9K4Z1NmWUG9fxrSuWYzSO4RMGGWZYRY8C9Xgca0lOOi+eV7SPIrR2inMej2D8fQq
kVo7ZnXPYgJ5KflIrQ05w9l9xDALzhfrATKrtvuU6MqPP3yLEc1WjNBMoqTVhtI2G0bQyV6imRJmnOEs
MwLromgAUX4TuCrqRQdL9a3B1X0YVmvB8CYrhreMr4s893jGGc4yw6xQXkVqEF+hRm6NyLvgZZnfbdNc
0INePEZPY7H3U5rmvAvVSpfcWpH4apPA/FVp9It6lL0DcPXZtVt2NtktNa9SlF2iF2eX6NzS8iv2xOec
ArH/Tve8Rjii+bJB/VNOXv58bCe5kA6QAkkBJB+SM2mba7GZjs0C+A0Zsg4rupc/VgAAAABJRU5ErkJg
gg==
</value>
</data>
<data name="btnStop.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJ
TUUH3wIYEh0dQxlfkQAAAn1JREFUOE9lkV1IU3EYxl9Ig6ACmWKbIQ7sUxMVS0uWS92iTJDoQkkQxIsg
6CJriUX5ESyJtiSzJiuK8nPapu7juBU5sdLWRSamhW16Yxh2EdT12/85OunYC79z/jzv89vh7NC/k3Rz
iBKbXHS4/RW1hiLEzDI4I8MOnf9G0zxEppEpym0LENXYY3PvBfJKno5fOdM9+RjgjEzeiY5p5KPsrE9l
9wQVdbymTItPW/b8ra1qeHqlSvrKZ/3zMjgjE7uOTKtPi25lz8SqrG5wUZZVor0t7uTT3ZOBcu8cl/jC
bPQtsGENnJFhJzov0YUDl3bccBKdf7JZbx+zlbpm2OiNsFFaZMMGkGFXOjjDenvQBkd2MywSpd325hV1
hn4a3fN8XBRBtTSnIJqjgy4cuHSy7wMduOu/rO+bWn86GImsKIjm6KALBy7Nic+U1hpo1zum2eDF+4qS
IPj9j4Jojg66cODSqLjss/jvF/R+4mJPhIu9izKjS78VRHN00IUDl/LsY7TrlufikWchLhwS7+dZkNn4
A9EcnXzRhQOXkhudlHR9ICf7QfBHQf9nPjYc5kJ3hC+8WVKADDt00N0pHLgUd6mHqMoWk2p2tx569I6P
9s9ygesb6wbDCpBhhw66cGRXZeoldb2D4k096j0tnsGcjnHO75pinWOWdQNfVhFnZNihgy4cuPKkNDlJ
c1UEtZ1qbcMLa/odaTn74RgfFE8DOKdbpGVto9Oiqu1Sa645ZEcxFeIfTbK+J4pP3brNUF2WUF7Xrq4x
ezQ1ZndCRX3b9hPnTpEmY0tiXR/td/1aszZMbEoGbjEClWC3IEuQKUgVxAk2xTcHxS06RH8B4+wLlXF9
8lIAAAAASUVORK5CYII=
</value>
</data>
<data name="btnPause.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAB3RJTUUH3gwKEAoh5A2BPgAAAHhJREFU
OE/tkssJgDAQRKO24N0WbcaTFQjakwetQ+fBBhZCQEnw5MCDZWY/hyRUUzefr0jkwtaR9RJZ0ItJbGIU
jUGNR0aPTTlhikEc4hKriFep8cjosSknTAt3QfMi4gJqPLJ/wRcLip6x+CNBvApZL1EMnlJJIdz2xC/o
PlMuvwAAAABJRU5ErkJggg==
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAB5yaP/ecmj/3nJo/95yaP/ecmj/3nJo/95yaP/ecmj/3nJo/95yaP/ecmj/3nJo/95yaP/ecmj/3nJ
o/95yaP/ecmj/3nJo/95yaP/ecmj/3nJo/95yaP/ecmj/3nJo/95yaP/ecmj/3nJo/95yaP/ecmj/3nJ
o/95yaP/ecmj/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/2/Fnf/T7eH/0+3h/9Pt4f/T7eH/0+3h/9Pt4f/T7eH/0+3h/9Pt
4f/T7eH/0+3h/9Pt4f/T7eH/0+3h/9Pt4f/T7eH/0+3h/9Pt4f/T7eH/0+3h/9Pt4f/T7eH/0+3h/9Pt
4f/T7eH/0+3h/9Pt4f/T7eH/asOZ/ympbf8pqW3/lNS2////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////+P0rL/Kalt/ympbf+U1Lb//////1u9j/9Ds3//Q7N//0Oz
f/9Ds3//Q7N//0Ozf/9Ds3//Q7N//0Ozf/9Ds3//Q7N//0Ozf/9Ds3//Q7N//0Ozf/9Ds3//Q7N//0Oz
f/9Ds3//Q7N//0Ozf/9Ds3//Q7N//0Ozf/9yxp///////4/Ssv8pqW3/Kalt/5TUtv//////Q7N//ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/16+kf//////j9Ky/ympbf8pqW3/lNS2////
//9Ds3//Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf/V7uL/1u7j/0u2hP8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Xr6R//////+P0rL/Kalt/ymp
bf+U1Lb//////0Ozf/8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt//3+/v//////U7qK/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf9evpH//////4/S
sv8pqW3/Kalt/5TUtv//////Q7N//ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3//f7+////
//9Tuor/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/16+
kf//////j9Ky/ympbf8pqW3/lNS2//////9Ds3//Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf/9/v7//////1O6iv8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Xr6R//////+P0rL/Kalt/ympbf+U1Lb//////0Ozf/8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt//3+/v//////U7qK/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf9evpH//////4/Ssv8pqW3/Kalt/5TUtv//////Q7N//ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3//f7+//////9Tuor/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/16+kf//////j9Ky/ympbf8pqW3/lNS2//////9Ds3//Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf/9/v7//////1i8jf8vq3H/L6tx/yqpbv8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Xr6R//////+P0rL/Kalt/ympbf+U1Lb//////0Oz
f/8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt//3+/v///////////////////////P39/9vw
5/+a1rr/O7B5/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf9evpH//////4/Ssv8pqW3/Kalt/5TU
tv//////Q7N//ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3//f7+///////5/Pv/+Pz6//n8
+v/+/v7////////////v+PT/Xb6Q/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/16+kf//////j9Ky/ymp
bf8pqW3/lNS2//////9Ds3//Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf/9/v7//////1O6
iv8pqW3/Kalt/zStdf9rw5r/2e/l///////z+vf/RrSB/ympbf8pqW3/Kalt/ympbf8pqW3/Xr6R////
//+P0rL/Kalt/ympbf+U1Lb//////0Ozf/8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt//3+
/v//////U7qK/ympbf8pqW3/Kalt/ympbf8zrXT/3/Lp//////+w38n/Kalt/ympbf8pqW3/Kalt/ymp
bf9evpH//////4/Ssv8pqW3/Kalt/5TUtv//////Q7N//ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3//f7+//////9Tuor/Kalt/ympbf8pqW3/Kalt/ympbf+CzKr///////D59f8pqW3/Kalt/ymp
bf8pqW3/Kalt/16+kf//////j9Ky/ympbf8pqW3/lNS2//////9Ds3//Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf/9/v7//////1O6iv8pqW3/Kalt/ympbf8pqW3/Kalt/1++kf///////////zSt
dP8pqW3/Kalt/ympbf8pqW3/Xr6R//////+P0rL/Kalt/ympbf+U1Lb//////0Ozf/8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt//3+/v//////U7qK/ympbf8pqW3/Kalt/ympbf8pqW3/bcSb////
///+/v7/L6tx/ympbf8pqW3/Kalt/ympbf9evpH//////4/Ssv8pqW3/Kalt/5TUtv//////Q7N//ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3//f7+//////9Tuor/Kalt/ympbf8pqW3/Kalt/ymp
bf+04cz//////+Hy6v8pqW3/Kalt/ympbf8pqW3/Kalt/16+kf//////j9Ky/ympbf8pqW3/lNS2////
//9Ds3//Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf/9/v7//////1O6iv8pqW3/Kalt/ymp
bf84r3f/nNe7//7+/v//////jtGy/ympbf8pqW3/Kalt/ympbf8pqW3/Xr6R//////+P0rL/Kalt/ymp
bf+S07X//////0Ozf/8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt//3+/v//////3PHn/9Tt
4f/U7eH/3/Lp//z9/f///////////8bo2P8uq3D/Kalt/ympbf8pqW3/Kalt/ympbf9evpH//////4/S
sv8pqW3/Kalt/3rJpP//////SraD/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3//f7+////
/////////////////////////v7+/+Pz7P+L0LD/Lapv/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/16+
kf//////j9Ky/ympbf8pqW3/QrN+//7+/v+a1rr/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf9Xu4z/WLyN/1i8jf9YvI3/WLyN/1O6iv89sXr/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Xr6R//////+P0rL/Kalt/0CyfP8pqW3/vOTR//j8+v9RuYj/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf9evpH//////4/Ssv8pqW3/mta6/ympbf9GtIH/8/r3/+r28f9RuYj/Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/16+kf//////j9Ky/ympbf/7/fz/UbmI/ympbf9lwZb/9/z6//T6
+P+Jz6//Nq52/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Xr6R//////+P0rL/Kalt///////d8ej/QLJ8/ymp
bf9TuYn/2O/k////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////4/Ssv8pqW3/////////
///d8ej/Q7N//ympbf8qqW7/acKY/6rcxf/O693/2/Dm/9zx5//c8ef/3PHn/9zx5//c8ef/3PHn/9zx
5//c8ef/3PHn/9zx5//c8ef/3PHn/9zx5//c8ef/3PHn/9zx5//c8ef/3PHn/9zx5//c8Of/bMSa/ymp
bf/////////////////4/Pr/jdGx/zmveP8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ympbf8pqW3/Kalt/ymp
bf8pqW3/Kalt////////////////////////////+Pz6/7zk0f+Q0rP/ecmj/3nJo/95yaP/ecmj/3nJ
o/95yaP/ecmj/3nJo/95yaP/ecmj/3nJo/95yaP/ecmj/3nJo/95yaP/ecmj/3nJo/95yaP/ecmj/3nJ
o/95yaP/ecmj/3nJo/95yaP/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
</value>
</data>
</root>

+ 785
- 0
CNAS_DBSync/frmSyncParams.Designer.cs 查看文件

@@ -0,0 +1,785 @@
namespace CNAS_DBSync
{
partial class frmSyncParams
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows 窗体设计器生成的代码

/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSyncParams));
this.pnlAll = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.pnlRigh = new System.Windows.Forms.Panel();
this.panel5 = new System.Windows.Forms.Panel();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tabMapping = new System.Windows.Forms.TabControl();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.dgvMapping = new System.Windows.Forms.DataGridView();
this.InstrumentField = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.CnasField = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.cmsMapping = new System.Windows.Forms.ContextMenuStrip(this.components);
this.btnDelMap = new System.Windows.Forms.ToolStripMenuItem();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage6 = new System.Windows.Forms.TabPage();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.dgvInstruDS = new System.Windows.Forms.DataGridView();
this.InstruFieldName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.InstruDataType = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.pnlleft = new System.Windows.Forms.Panel();
this.cbxInstrument = new System.Windows.Forms.ComboBox();
this.label12 = new System.Windows.Forms.Label();
this.dgvCnas = new System.Windows.Forms.DataGridView();
this.CNASFieldName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.CnasDataType = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.pnlRight = new System.Windows.Forms.Panel();
this.cbxCnas = new System.Windows.Forms.ComboBox();
this.label13 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.panel7 = new System.Windows.Forms.Panel();
this.btnLoadDBData = new System.Windows.Forms.Button();
this.btnAddMapping = new System.Windows.Forms.Button();
this.btnDatabaseConfig = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.panel10 = new System.Windows.Forms.Panel();
this.dgvInstrument = new System.Windows.Forms.DataGridView();
this.Code = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.panel9 = new System.Windows.Forms.Panel();
this.btnAdd = new System.Windows.Forms.Button();
this.btnDel = new System.Windows.Forms.Button();
this.panel8 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.btnSave = new System.Windows.Forms.Button();
this.panel11 = new System.Windows.Forms.Panel();
this.panel12 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel();
this.panel13 = new System.Windows.Forms.Panel();
this.panel6 = new System.Windows.Forms.Panel();
this.pnlAll.SuspendLayout();
this.panel3.SuspendLayout();
this.pnlRigh.SuspendLayout();
this.panel5.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.tabMapping.SuspendLayout();
this.tabPage5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvMapping)).BeginInit();
this.cmsMapping.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvInstruDS)).BeginInit();
this.pnlleft.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvCnas)).BeginInit();
this.pnlRight.SuspendLayout();
this.panel1.SuspendLayout();
this.panel7.SuspendLayout();
this.groupBox1.SuspendLayout();
this.panel10.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvInstrument)).BeginInit();
this.panel9.SuspendLayout();
this.panel8.SuspendLayout();
this.panel11.SuspendLayout();
this.panel12.SuspendLayout();
this.panel4.SuspendLayout();
this.panel13.SuspendLayout();
this.SuspendLayout();
//
// pnlAll
//
this.pnlAll.Controls.Add(this.panel3);
this.pnlAll.Controls.Add(this.panel2);
this.pnlAll.Controls.Add(this.groupBox1);
this.pnlAll.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlAll.Location = new System.Drawing.Point(0, 0);
this.pnlAll.Name = "pnlAll";
this.pnlAll.Size = new System.Drawing.Size(796, 463);
this.pnlAll.TabIndex = 0;
//
// panel3
//
this.panel3.Controls.Add(this.pnlRigh);
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(156, 0);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(640, 463);
this.panel3.TabIndex = 5;
//
// pnlRigh
//
this.pnlRigh.Controls.Add(this.panel5);
this.pnlRigh.Controls.Add(this.panel1);
this.pnlRigh.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlRigh.Location = new System.Drawing.Point(0, 0);
this.pnlRigh.Name = "pnlRigh";
this.pnlRigh.Size = new System.Drawing.Size(640, 463);
this.pnlRigh.TabIndex = 5;
//
// panel5
//
this.panel5.Controls.Add(this.groupBox2);
this.panel5.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel5.Location = new System.Drawing.Point(0, 0);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(640, 422);
this.panel5.TabIndex = 4;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.splitContainer1);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(0, 0);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(640, 422);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "详情";
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(3, 19);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.tabMapping);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.tabControl1);
this.splitContainer1.Size = new System.Drawing.Size(634, 400);
this.splitContainer1.SplitterDistance = 199;
this.splitContainer1.TabIndex = 2;
//
// tabMapping
//
this.tabMapping.Controls.Add(this.tabPage5);
this.tabMapping.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabMapping.Location = new System.Drawing.Point(0, 0);
this.tabMapping.Name = "tabMapping";
this.tabMapping.SelectedIndex = 0;
this.tabMapping.Size = new System.Drawing.Size(634, 199);
this.tabMapping.TabIndex = 0;
//
// tabPage5
//
this.tabPage5.Controls.Add(this.dgvMapping);
this.tabPage5.Location = new System.Drawing.Point(4, 26);
this.tabPage5.Name = "tabPage5";
this.tabPage5.Padding = new System.Windows.Forms.Padding(3);
this.tabPage5.Size = new System.Drawing.Size(626, 169);
this.tabPage5.TabIndex = 1;
this.tabPage5.Text = "映射表";
this.tabPage5.UseVisualStyleBackColor = true;
//
// dgvMapping
//
this.dgvMapping.AllowUserToAddRows = false;
this.dgvMapping.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvMapping.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dgvMapping.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvMapping.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.InstrumentField,
this.CnasField});
this.dgvMapping.ContextMenuStrip = this.cmsMapping;
this.dgvMapping.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvMapping.Location = new System.Drawing.Point(3, 3);
this.dgvMapping.MultiSelect = false;
this.dgvMapping.Name = "dgvMapping";
this.dgvMapping.ReadOnly = true;
this.dgvMapping.RowHeadersVisible = false;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dgvMapping.RowsDefaultCellStyle = dataGridViewCellStyle2;
this.dgvMapping.RowTemplate.Height = 23;
this.dgvMapping.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvMapping.Size = new System.Drawing.Size(620, 163);
this.dgvMapping.TabIndex = 0;
//
// InstrumentField
//
this.InstrumentField.DataPropertyName = "SourceField";
this.InstrumentField.HeaderText = "仪器数据列";
this.InstrumentField.Name = "InstrumentField";
this.InstrumentField.ReadOnly = true;
this.InstrumentField.Width = 305;
//
// CnasField
//
this.CnasField.DataPropertyName = "TargetField";
this.CnasField.HeaderText = "CNAS数据列";
this.CnasField.Name = "CnasField";
this.CnasField.ReadOnly = true;
this.CnasField.Width = 305;
//
// cmsMapping
//
this.cmsMapping.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnDelMap});
this.cmsMapping.Name = "cmsMapping";
this.cmsMapping.Size = new System.Drawing.Size(101, 26);
//
// btnDelMap
//
this.btnDelMap.Name = "btnDelMap";
this.btnDelMap.Size = new System.Drawing.Size(100, 22);
this.btnDelMap.Text = "移除";
this.btnDelMap.Click += new System.EventHandler(this.btnDelMap_Click);
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage6);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(634, 197);
this.tabControl1.TabIndex = 1;
//
// tabPage6
//
this.tabPage6.Controls.Add(this.splitContainer2);
this.tabPage6.Location = new System.Drawing.Point(4, 26);
this.tabPage6.Name = "tabPage6";
this.tabPage6.Padding = new System.Windows.Forms.Padding(3);
this.tabPage6.Size = new System.Drawing.Size(626, 167);
this.tabPage6.TabIndex = 1;
this.tabPage6.Text = "字段";
this.tabPage6.UseVisualStyleBackColor = true;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.Location = new System.Drawing.Point(3, 3);
this.splitContainer2.Name = "splitContainer2";
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.dgvInstruDS);
this.splitContainer2.Panel1.Controls.Add(this.pnlleft);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.dgvCnas);
this.splitContainer2.Panel2.Controls.Add(this.pnlRight);
this.splitContainer2.Size = new System.Drawing.Size(620, 161);
this.splitContainer2.SplitterDistance = 307;
this.splitContainer2.TabIndex = 1;
//
// dgvInstruDS
//
this.dgvInstruDS.AllowUserToAddRows = false;
this.dgvInstruDS.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvInstruDS.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3;
this.dgvInstruDS.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvInstruDS.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.InstruFieldName,
this.InstruDataType});
this.dgvInstruDS.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvInstruDS.Location = new System.Drawing.Point(0, 34);
this.dgvInstruDS.Name = "dgvInstruDS";
this.dgvInstruDS.ReadOnly = true;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dgvInstruDS.RowsDefaultCellStyle = dataGridViewCellStyle4;
this.dgvInstruDS.RowTemplate.Height = 23;
this.dgvInstruDS.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvInstruDS.Size = new System.Drawing.Size(307, 127);
this.dgvInstruDS.TabIndex = 1;
//
// InstruFieldName
//
this.InstruFieldName.DataPropertyName = "InstruFieldName";
this.InstruFieldName.HeaderText = "列名";
this.InstruFieldName.Name = "InstruFieldName";
this.InstruFieldName.ReadOnly = true;
this.InstruFieldName.Width = 150;
//
// InstruDataType
//
this.InstruDataType.DataPropertyName = "InstruDataType";
this.InstruDataType.HeaderText = "数据类型";
this.InstruDataType.Name = "InstruDataType";
this.InstruDataType.ReadOnly = true;
//
// pnlleft
//
this.pnlleft.Controls.Add(this.cbxInstrument);
this.pnlleft.Controls.Add(this.label12);
this.pnlleft.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlleft.Location = new System.Drawing.Point(0, 0);
this.pnlleft.Name = "pnlleft";
this.pnlleft.Size = new System.Drawing.Size(307, 34);
this.pnlleft.TabIndex = 0;
//
// cbxInstrument
//
this.cbxInstrument.FormattingEnabled = true;
this.cbxInstrument.Location = new System.Drawing.Point(104, 6);
this.cbxInstrument.Name = "cbxInstrument";
this.cbxInstrument.Size = new System.Drawing.Size(144, 25);
this.cbxInstrument.TabIndex = 1;
this.cbxInstrument.SelectedIndexChanged += new System.EventHandler(this.cbxInstrument_SelectedIndexChanged);
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(3, 10);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(104, 17);
this.label12.TabIndex = 0;
this.label12.Text = "仪器数据源表名:";
//
// dgvCnas
//
this.dgvCnas.AllowUserToAddRows = false;
this.dgvCnas.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvCnas.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5;
this.dgvCnas.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvCnas.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.CNASFieldName,
this.CnasDataType});
this.dgvCnas.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvCnas.Location = new System.Drawing.Point(0, 34);
this.dgvCnas.Name = "dgvCnas";
this.dgvCnas.ReadOnly = true;
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dgvCnas.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.dgvCnas.RowTemplate.Height = 23;
this.dgvCnas.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvCnas.Size = new System.Drawing.Size(309, 127);
this.dgvCnas.TabIndex = 2;
//
// CNASFieldName
//
this.CNASFieldName.DataPropertyName = "CnasFieldName";
this.CNASFieldName.HeaderText = "列名";
this.CNASFieldName.Name = "CNASFieldName";
this.CNASFieldName.ReadOnly = true;
this.CNASFieldName.Width = 150;
//
// CnasDataType
//
this.CnasDataType.DataPropertyName = "CnasDataType";
this.CnasDataType.HeaderText = "数据类型";
this.CnasDataType.Name = "CnasDataType";
this.CnasDataType.ReadOnly = true;
//
// pnlRight
//
this.pnlRight.Controls.Add(this.cbxCnas);
this.pnlRight.Controls.Add(this.label13);
this.pnlRight.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlRight.Location = new System.Drawing.Point(0, 0);
this.pnlRight.Name = "pnlRight";
this.pnlRight.Size = new System.Drawing.Size(309, 34);
this.pnlRight.TabIndex = 0;
//
// cbxCnas
//
this.cbxCnas.FormattingEnabled = true;
this.cbxCnas.Location = new System.Drawing.Point(122, 6);
this.cbxCnas.Name = "cbxCnas";
this.cbxCnas.Size = new System.Drawing.Size(149, 25);
this.cbxCnas.TabIndex = 2;
this.cbxCnas.SelectedIndexChanged += new System.EventHandler(this.cbxCnas_SelectedIndexChanged);
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(3, 10);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(113, 17);
this.label13.TabIndex = 1;
this.label13.Text = "CNAS数据库表名:";
//
// panel1
//
this.panel1.Controls.Add(this.panel7);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 422);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(640, 41);
this.panel1.TabIndex = 3;
//
// panel7
//
this.panel7.Controls.Add(this.btnLoadDBData);
this.panel7.Controls.Add(this.btnAddMapping);
this.panel7.Controls.Add(this.btnDatabaseConfig);
this.panel7.Dock = System.Windows.Forms.DockStyle.Right;
this.panel7.Location = new System.Drawing.Point(272, 0);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(368, 41);
this.panel7.TabIndex = 5;
//
// btnLoadDBData
//
this.btnLoadDBData.Location = new System.Drawing.Point(169, 3);
this.btnLoadDBData.Name = "btnLoadDBData";
this.btnLoadDBData.Size = new System.Drawing.Size(79, 23);
this.btnLoadDBData.TabIndex = 4;
this.btnLoadDBData.Text = "加载数据";
this.btnLoadDBData.UseVisualStyleBackColor = true;
this.btnLoadDBData.Click += new System.EventHandler(this.btnLoadDBData_Click);
//
// btnAddMapping
//
this.btnAddMapping.Location = new System.Drawing.Point(84, 3);
this.btnAddMapping.Name = "btnAddMapping";
this.btnAddMapping.Size = new System.Drawing.Size(79, 23);
this.btnAddMapping.TabIndex = 2;
this.btnAddMapping.Text = "新增映射";
this.btnAddMapping.UseVisualStyleBackColor = true;
this.btnAddMapping.Click += new System.EventHandler(this.btnAddMapping_Click);
//
// btnDatabaseConfig
//
this.btnDatabaseConfig.Location = new System.Drawing.Point(254, 3);
this.btnDatabaseConfig.Name = "btnDatabaseConfig";
this.btnDatabaseConfig.Size = new System.Drawing.Size(79, 23);
this.btnDatabaseConfig.TabIndex = 3;
this.btnDatabaseConfig.Text = "配置数据库";
this.btnDatabaseConfig.UseVisualStyleBackColor = true;
this.btnDatabaseConfig.Click += new System.EventHandler(this.btnDatabaseConfig_Click);
//
// panel2
//
this.panel2.Dock = System.Windows.Forms.DockStyle.Left;
this.panel2.Location = new System.Drawing.Point(146, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(10, 463);
this.panel2.TabIndex = 4;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.panel10);
this.groupBox1.Controls.Add(this.panel9);
this.groupBox1.Controls.Add(this.panel8);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Left;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(146, 463);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "仪器";
//
// panel10
//
this.panel10.Controls.Add(this.dgvInstrument);
this.panel10.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel10.Location = new System.Drawing.Point(3, 45);
this.panel10.Name = "panel10";
this.panel10.Size = new System.Drawing.Size(140, 369);
this.panel10.TabIndex = 6;
//
// dgvInstrument
//
this.dgvInstrument.AllowUserToAddRows = false;
this.dgvInstrument.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvInstrument.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
this.dgvInstrument.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvInstrument.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Code});
this.dgvInstrument.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvInstrument.Location = new System.Drawing.Point(0, 0);
this.dgvInstrument.MultiSelect = false;
this.dgvInstrument.Name = "dgvInstrument";
this.dgvInstrument.ReadOnly = true;
this.dgvInstrument.RowHeadersVisible = false;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dgvInstrument.RowsDefaultCellStyle = dataGridViewCellStyle8;
this.dgvInstrument.RowTemplate.Height = 23;
this.dgvInstrument.Size = new System.Drawing.Size(140, 369);
this.dgvInstrument.TabIndex = 0;
this.dgvInstrument.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvInstrument_CellDoubleClick);
this.dgvInstrument.SelectionChanged += new System.EventHandler(this.dgvInstrument_SelectionChanged);
//
// Code
//
this.Code.DataPropertyName = "Code";
this.Code.HeaderText = "仪器编号";
this.Code.Name = "Code";
this.Code.ReadOnly = true;
this.Code.Width = 135;
//
// panel9
//
this.panel9.Controls.Add(this.btnAdd);
this.panel9.Controls.Add(this.btnDel);
this.panel9.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel9.Location = new System.Drawing.Point(3, 414);
this.panel9.Name = "panel9";
this.panel9.Size = new System.Drawing.Size(140, 46);
this.panel9.TabIndex = 5;
//
// btnAdd
//
this.btnAdd.Location = new System.Drawing.Point(3, 11);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(58, 23);
this.btnAdd.TabIndex = 1;
this.btnAdd.Text = "新增";
this.btnAdd.UseVisualStyleBackColor = true;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnDel
//
this.btnDel.Location = new System.Drawing.Point(68, 11);
this.btnDel.Name = "btnDel";
this.btnDel.Size = new System.Drawing.Size(58, 23);
this.btnDel.TabIndex = 2;
this.btnDel.Text = "删除";
this.btnDel.UseVisualStyleBackColor = true;
this.btnDel.Click += new System.EventHandler(this.btnDel_Click);
//
// panel8
//
this.panel8.Controls.Add(this.label1);
this.panel8.Dock = System.Windows.Forms.DockStyle.Top;
this.panel8.Location = new System.Drawing.Point(3, 19);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(140, 26);
this.panel8.TabIndex = 4;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(4, 5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(68, 17);
this.label1.TabIndex = 3;
this.label1.Text = "当前选中:";
//
// btnSave
//
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(18, 4);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(82, 35);
this.btnSave.TabIndex = 3;
this.btnSave.Text = "保存";
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// panel11
//
this.panel11.Controls.Add(this.panel12);
this.panel11.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel11.Location = new System.Drawing.Point(0, 465);
this.panel11.Name = "panel11";
this.panel11.Size = new System.Drawing.Size(796, 43);
this.panel11.TabIndex = 1;
//
// panel12
//
this.panel12.Controls.Add(this.btnSave);
this.panel12.Dock = System.Windows.Forms.DockStyle.Right;
this.panel12.Location = new System.Drawing.Point(682, 0);
this.panel12.Name = "panel12";
this.panel12.Size = new System.Drawing.Size(114, 43);
this.panel12.TabIndex = 0;
//
// panel4
//
this.panel4.Controls.Add(this.panel13);
this.panel4.Controls.Add(this.panel6);
this.panel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel4.Location = new System.Drawing.Point(0, 0);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(796, 465);
this.panel4.TabIndex = 2;
//
// panel13
//
this.panel13.Controls.Add(this.pnlAll);
this.panel13.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel13.Location = new System.Drawing.Point(0, 0);
this.panel13.Name = "panel13";
this.panel13.Size = new System.Drawing.Size(796, 463);
this.panel13.TabIndex = 2;
//
// panel6
//
this.panel6.BackColor = System.Drawing.SystemColors.ControlDark;
this.panel6.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel6.Location = new System.Drawing.Point(0, 463);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(796, 2);
this.panel6.TabIndex = 1;
//
// frmSyncParams
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(796, 508);
this.Controls.Add(this.panel4);
this.Controls.Add(this.panel11);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "frmSyncParams";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "仪器数据上传工具";
this.Load += new System.EventHandler(this.frmSyncParams_Load);
this.pnlAll.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.pnlRigh.ResumeLayout(false);
this.panel5.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.tabMapping.ResumeLayout(false);
this.tabPage5.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvMapping)).EndInit();
this.cmsMapping.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPage6.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvInstruDS)).EndInit();
this.pnlleft.ResumeLayout(false);
this.pnlleft.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvCnas)).EndInit();
this.pnlRight.ResumeLayout(false);
this.pnlRight.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel7.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.panel10.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvInstrument)).EndInit();
this.panel9.ResumeLayout(false);
this.panel8.ResumeLayout(false);
this.panel8.PerformLayout();
this.panel11.ResumeLayout(false);
this.panel12.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.panel13.ResumeLayout(false);
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Panel pnlAll;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnDel;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.DataGridView dgvInstruDS;
private System.Windows.Forms.Panel pnlleft;
private System.Windows.Forms.ComboBox cbxInstrument;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.DataGridView dgvCnas;
private System.Windows.Forms.Panel pnlRight;
private System.Windows.Forms.ComboBox cbxCnas;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Button btnAddMapping;
private System.Windows.Forms.TabControl tabMapping;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.DataGridView dgvInstrument;
private System.Windows.Forms.DataGridView dgvMapping;
private System.Windows.Forms.ContextMenuStrip cmsMapping;
private System.Windows.Forms.ToolStripMenuItem btnDelMap;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage6;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnDatabaseConfig;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel pnlRigh;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.Button btnLoadDBData;
private System.Windows.Forms.Panel panel7;
private System.Windows.Forms.Panel panel10;
private System.Windows.Forms.Panel panel9;
private System.Windows.Forms.Panel panel8;
private System.Windows.Forms.Panel panel11;
private System.Windows.Forms.Panel panel12;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel panel13;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.DataGridViewTextBoxColumn Code;
private System.Windows.Forms.DataGridViewTextBoxColumn InstrumentField;
private System.Windows.Forms.DataGridViewTextBoxColumn CnasField;
private System.Windows.Forms.DataGridViewTextBoxColumn InstruFieldName;
private System.Windows.Forms.DataGridViewTextBoxColumn InstruDataType;
private System.Windows.Forms.DataGridViewTextBoxColumn CNASFieldName;
private System.Windows.Forms.DataGridViewTextBoxColumn CnasDataType;
}
}


+ 532
- 0
CNAS_DBSync/frmSyncParams.cs 查看文件

@@ -0,0 +1,532 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using System.Xml.Serialization;

namespace CNAS_DBSync
{
public delegate void ReferenceChangeSyncParamHanlder(SyncInstrumentItemInfo syncInstrumentItem);
public partial class frmSyncParams : Form
{
public List<SyncInstrumentItemInfo> lstSyncInstrument = new List<SyncInstrumentItemInfo>();
public SyncInstrumentItemInfo currentSyncItem = new SyncInstrumentItemInfo();
public Dictionary<string, DataTable> dictInstruTables = new Dictionary<string, DataTable>();
private log4net.ILog log = log4net.LogManager.GetLogger("frmSyncParams");
private SyncInstrumentItemInfo syncInstrumentItem;
private string strMode = "";
public ReferenceChangeSyncParamHanlder ParamsChangedDelegate;

//public frmSyncParams()
//{
// InitializeComponent();

// dgvInstrument.AutoGenerateColumns = false;
// dgvInstrument.RowHeadersVisible = false;

// dgvInstruDS.AutoGenerateColumns = false;
// dgvInstruDS.RowHeadersVisible = false;

// dgvCnas.AutoGenerateColumns = false;
// dgvCnas.RowHeadersVisible = false;

// dgvMapping.AutoGenerateColumns = false;
// dgvMapping.RowHeadersVisible = false;
//}

public frmSyncParams(SyncInstrumentItemInfo syncInstrumentItem=null)
{
InitializeComponent();

dgvInstrument.AutoGenerateColumns = false;
dgvInstrument.RowHeadersVisible = false;

dgvInstruDS.AutoGenerateColumns = false;
dgvInstruDS.RowHeadersVisible = false;

dgvCnas.AutoGenerateColumns = false;
dgvCnas.RowHeadersVisible = false;

dgvMapping.AutoGenerateColumns = false;
dgvMapping.RowHeadersVisible = false;
if (syncInstrumentItem != null)
{
strMode = "Reference";
this.syncInstrumentItem = syncInstrumentItem;

this.btnAdd.Visible = false;
this.btnDel.Visible = false;
}
}

private void frmSyncParams_Load(object sender, EventArgs e)
{
if (syncInstrumentItem == null)
{//读取本地文件中存储的配置信息
XmlSerializer serializer = new XmlSerializer(lstSyncInstrument.GetType());
FileStream stream = new FileStream(FileHelper.getBasePath() + "/Data/SyncInStrumentData.xml", FileMode.Open);
lstSyncInstrument = (List<SyncInstrumentItemInfo>)serializer.Deserialize(stream);
stream.Close();
}
else
{
lstSyncInstrument = new List<SyncInstrumentItemInfo>() { syncInstrumentItem };
}
//绑定数据源,填写相关内容
if(lstSyncInstrument.Count!=0)
dgvInstrument.DataSource = new BindingList<SyncInstrumentItemInfo>(lstSyncInstrument);
}

/// <summary>
/// 保存当前设置到本地
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnSave_Click(object sender, EventArgs e)
{
//将配置好的信息存储到本地文件中
try
{
if (strMode == "Reference")
{
////使用Linq To XML 直接修改存储,不能直接全部保存,会覆盖其他操作
//XDocument doc = XDocument.Load(FileHelper.getBasePath() + "/Data/SyncInStrumentData.xml");
//var query = from p in doc.Elements("SyncInstrumentItemInfo")
// where p.Element("GUID").Value == syncInstrumentItem.GUID
// select p;
//XElement item = query.SingleOrDefault();
//if (item != null)
//{

//}

//1.先加载所有数据 2.替换当前数据 3.重新保存
List<SyncInstrumentItemInfo> lstDB = new List<SyncInstrumentItemInfo>();
XmlSerializer serializer = new XmlSerializer(lstDB.GetType());
FileStream stream = new FileStream(FileHelper.getBasePath() + "/Data/SyncInStrumentData.xml", FileMode.Open);
lstDB = (List<SyncInstrumentItemInfo>)serializer.Deserialize(stream);
stream.Close();

var item = lstDB.Where(p => p.GUID == syncInstrumentItem.GUID).SingleOrDefault();
if (item != null)
{
item = syncInstrumentItem;
}
else
{
lstDB.Add(syncInstrumentItem);
}

TextWriter writer = new StreamWriter(FileHelper.getBasePath() + "/Data/SyncInStrumentData.xml");
serializer.Serialize(writer, lstDB);
writer.Close();

this.ParamsChangedDelegate(syncInstrumentItem);

}
else
{
XmlSerializer serializer = new XmlSerializer(lstSyncInstrument.GetType());
TextWriter writer = new StreamWriter(FileHelper.getBasePath() + "/Data/SyncInStrumentData.xml");
serializer.Serialize(writer, lstSyncInstrument);
writer.Close();
}
MessageBox.Show("保存成功!");
}
catch (Exception ex)
{
MessageBox.Show("保存失败!错误信息为:"+ex.Message.ToString());
}
}


/// <summary>
/// 新增仪器
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnAdd_Click(object sender, EventArgs e)
{
frmInstrumentCode frmCode = new frmInstrumentCode(lstSyncInstrument);
frmCode.InstrumentDelegate = delegate(SyncInstrumentItemInfo Instrumentitem)
{
lstSyncInstrument.Add(Instrumentitem);
};
frmCode.ShowDialog();

//绑定数据
dgvInstrument.DataSource = new BindingList<SyncInstrumentItemInfo>(lstSyncInstrument);
}


/// <summary>
/// 删除仪器
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnDel_Click(object sender, EventArgs e)
{
if (dgvInstrument.Rows.Count <= 0) return;

//当前选中行
string strInstrumentCode = this.dgvInstrument.Rows[this.dgvInstrument.CurrentRow.Index].Cells[0].Value.ToString();

//找到数据源中数据,删除
var lstitem = lstSyncInstrument.Where(s => s.Code == strInstrumentCode).ToList<SyncInstrumentItemInfo>();
if (lstitem == null)
return;
else if (lstitem.Count >= 1)
{
foreach (var item in lstitem)
{
lstSyncInstrument.Remove(item);
}
}

//绑定数据
dgvInstrument.DataSource = new BindingList<SyncInstrumentItemInfo>();
dgvInstrument.DataSource = new BindingList<SyncInstrumentItemInfo>(lstSyncInstrument);
}


//双击单元格时,触发修改
private void dgvInstrument_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (dgvInstrument.Rows.Count <= 0) return;

//当前选中单元格
string strInstrumentCode = this.dgvInstrument.Rows[this.dgvInstrument.CurrentRow.Index].Cells[0].Value.ToString();

frmInstrumentCode frmCode = new frmInstrumentCode(lstSyncInstrument, strInstrumentCode);
frmCode.InstrumentDelegate = delegate (SyncInstrumentItemInfo Instrumentitem)
{
var lstInstrument = lstSyncInstrument.Where(s => s.Code == strInstrumentCode).ToList<SyncInstrumentItemInfo>();
if (lstInstrument.Count == 1)
{
lstInstrument[0].Code = Instrumentitem.Code;
}
};
frmCode.ShowDialog();

//绑定数据
dgvInstrument.DataSource = new BindingList<SyncInstrumentItemInfo>(lstSyncInstrument);
}


private void dgvInstrument_SelectionChanged(object sender, EventArgs e)
{
if (dgvInstrument.Rows.Count <= 0) return;
if (dgvInstrument.Rows[dgvInstrument.CurrentRow.Index].Cells[0].Value == null) return;

//当前选中单元格
string strInstrumentCode = this.dgvInstrument.Rows[this.dgvInstrument.CurrentRow.Index].Cells[0].Value.ToString();
var lstInstrument = lstSyncInstrument.Where(s => s.Code == strInstrumentCode).ToList<SyncInstrumentItemInfo>();
if (lstInstrument.Count == 1)
{
currentSyncItem = lstInstrument[0];

if (currentSyncItem.SyncInstrumentDSInfo != null&& currentSyncItem.SyncInstrumentDSInfo.InstrumentDataSourceType!=DataSourceType.None)
{
dgvMapping.DataSource = new BindingList<SyncParamasInfo>(currentSyncItem.LstSyncPramas);
}
else
{
cbxCnas.DataSource = null;
cbxInstrument.DataSource = null;

dgvInstruDS.DataSource = null;
dgvCnas.DataSource = null;
dgvMapping.DataSource = new BindingList<SyncParamasInfo>();
}
}
else
{
cbxCnas.DataSource = null;
cbxInstrument.DataSource = null;

dgvInstruDS.DataSource = null;
dgvCnas.DataSource = null;
dgvMapping.DataSource =new BindingList<SyncParamasInfo>();
}
}
/// <summary>
/// 切换选中表时发生
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cbxInstrument_SelectedIndexChanged(object sender, EventArgs e)
{
if (cbxInstrument.SelectedValue == null) return;

string strTableName_Instru = cbxInstrument.SelectedValue.ToString();
if (dictInstruTables.ContainsKey(strTableName_Instru))
{
DataTable dt = dictInstruTables[strTableName_Instru];
if (dt != null && dt.Rows.Count > 0)
{
//DataRow drColumn = dt.Rows[0]; //第一行是列名

DataTable dtInstruShow = new DataTable();
dtInstruShow.Columns.Add("InstruFieldName");
dtInstruShow.Columns.Add("InstruDataType");
//foreach (DataColumn dc in dt.Columns)
//{
// dtInstruShow.Rows.Add(new object[] { drColumn[dc.ColumnName] });
//}

foreach (DataColumn dc in dt.Columns)
{
dtInstruShow.Rows.Add(new object[] { dc.ColumnName,dc.DataType});
}

dgvInstruDS.DataSource = dtInstruShow;
}
}
}

/// <summary>
/// 切换表时发生
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cbxCnas_SelectedIndexChanged(object sender, EventArgs e)
{
if (cbxCnas.Text == null) return;

string strTableName_Cnas = cbxCnas.Text.ToString();
//从数据库中加载数据表结构
//DataTable dtTableStruct = SQLDB2Helper.getDB2Table(string.Format("SELECT * FROM {0} Where 1=0", strTableName_Cnas));

DataTable dtTableStruct = CnasDataOperationFact.CnasDataOperation().GetCNASTablesStruct(strTableName_Cnas,currentSyncItem);
if (dtTableStruct != null)
{
DataTable dtCnasShow = new DataTable();
dtCnasShow.Columns.Add("CnasFieldName");
dtCnasShow.Columns.Add("CnasDataType");
foreach (DataColumn dc in dtTableStruct.Columns)
{
dtCnasShow.Rows.Add(new object[] { dc.ColumnName ,dc.DataType});
}

dgvCnas.DataSource = dtCnasShow;
}
}

//增加映射
private void btnAddMapping_Click(object sender, EventArgs e)
{
if (cbxInstrument.SelectedValue == null) return;
if (cbxCnas.SelectedValue == null) return;
if (dgvInstruDS.Rows.Count <= 0) return;
if (dgvCnas.Rows.Count <= 0) return;

SyncParamasInfo syncParamas = new SyncParamasInfo();
if (currentSyncItem.LstSyncPramas == null) currentSyncItem.LstSyncPramas = new List<SyncParamasInfo>();

//检测选中表是否跟已有映射数据一致,如果不一致,则不允许继续

var lst = currentSyncItem.LstSyncPramas.Where(s=>s.SourceTable== cbxInstrument.SelectedValue.ToString()&&s.TargetTable== cbxCnas.SelectedValue.ToString()).ToList<SyncParamasInfo>();
if (currentSyncItem.LstSyncPramas.Count > 0 && lst.Count <= 0)
{
MessageBox.Show("已存在不同表单映射数据,无法添加!");
return;
}

//检测是否已经存在这个数据(不允许存在重复数据)
lst = currentSyncItem.LstSyncPramas.Where(s => s.SourceField == dgvInstruDS.Rows[dgvInstruDS.CurrentCell.RowIndex].Cells[0].Value.ToString()&&s.SourceTable== cbxInstrument.SelectedValue.ToString()).ToList<SyncParamasInfo>();
if (lst.Count > 0)
{
MessageBox.Show("仪器数据库字段已分配,请重新选择!");
return;
}
lst = currentSyncItem.LstSyncPramas.Where(s => s.TargetTable == cbxCnas.SelectedValue.ToString() && s.TargetField == dgvCnas.Rows[dgvCnas.CurrentCell.RowIndex].Cells[0].Value.ToString()).ToList<SyncParamasInfo>();
if (lst.Count > 0)
{
MessageBox.Show("CNAS数据库字段已分配,请重新选择!");
return;
}
if (dgvCnas.Rows[dgvCnas.CurrentCell.RowIndex].Cells[0].Value.ToString().ToUpper() == "ID")
{
MessageBox.Show("该字段为CNAS数据库保留字段,不允许插入数据,请重新选择!");
return;
}

//仪器表名和选中行
syncParamas.SourceTable = cbxInstrument.SelectedValue.ToString();
syncParamas.SourceField = dgvInstruDS.Rows[dgvInstruDS.CurrentCell.RowIndex].Cells[0].Value.ToString();

//CNAS表名和选中行
syncParamas.TargetTable = cbxCnas.SelectedValue.ToString();
syncParamas.TargetField = dgvCnas.Rows[dgvCnas.CurrentCell.RowIndex].Cells[0].Value.ToString();

//绑定数据
if (currentSyncItem.LstSyncPramas == null) currentSyncItem.LstSyncPramas = new List<SyncParamasInfo>();

currentSyncItem.LstSyncPramas.Add(syncParamas);

dgvMapping.DataSource= new BindingList<SyncParamasInfo>(currentSyncItem.LstSyncPramas);
}

/// <summary>
/// 删除映射
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnDelMap_Click(object sender, EventArgs e)
{
//当前选中项
string strSourceField = dgvMapping.Rows[dgvMapping.CurrentCell.RowIndex].Cells["InstrumentField"].Value.ToString();
string strTargetField = dgvMapping.Rows[dgvMapping.CurrentCell.RowIndex].Cells["CnasField"].Value.ToString();

var lstDelItems = currentSyncItem.LstSyncPramas.Where(s => s.SourceField == strSourceField && s.TargetField == strTargetField).ToList<SyncParamasInfo>();
if (lstDelItems.Count > 0)
{
foreach (var item in lstDelItems)
{
currentSyncItem.LstSyncPramas.Remove(item);
}

dgvMapping.DataSource = new BindingList<SyncParamasInfo>(currentSyncItem.LstSyncPramas);
}
}

private void btnRun_Click(object sender, EventArgs e)
{
////根据映射字段获取准备上传的所有数据
//if (!dictInstruTables.ContainsKey(currentSyncItem.LstSyncPramas[0].SourceTable)) return;

//DataTable dtReadySource = dictInstruTables[currentSyncItem.LstSyncPramas[0].SourceTable];
//if (dtReadySource == null || dtReadySource.Rows.Count <= 0) return;

////构建准备插入的数据
//DataTable dtTarget = CnasDataOperationFact.CnasDataOperation().GetCNASTablesStruct(currentSyncItem.LstSyncPramas[0].TargetTable,currentSyncItem);

//foreach (DataRow drSource in dtReadySource.Rows)
//{
// DataRow drNewTarget = dtTarget.NewRow();

// //遍历映射表,把所有字段插入到目标表中
// foreach (var item in currentSyncItem.LstSyncPramas)
// {
// var strSourceField = item.SourceField;
// var strTargetField = item.TargetField;

// //当列名存在于数据表中时才能继续
// if (dtReadySource.Columns.Contains(strSourceField) && dtTarget.Columns.Contains(strTargetField))
// {
// drNewTarget[strTargetField] = drSource[strSourceField];
// }
// }

// dtTarget.Rows.Add(drNewTarget);
//}

////执行插入
//int iReturn = CnasDataOperationFact.CnasDataOperation().InsertDataToCNASTable(dtTarget, currentSyncItem);

//if (iReturn>0)
// MessageBox.Show("上传完成!");
//else
// MessageBox.Show("上传过程中发生异常,请联系管理员!");
}

/// <summary>
/// 配置数据库界面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnDatabaseConfig_Click(object sender, EventArgs e)
{
frmDatabaseParams frmDatabase = new frmDatabaseParams(currentSyncItem);
frmDatabase.InstrumentDelegate = delegate (SyncInstrumentItemInfo Instrumentitem)
{
this.currentSyncItem = Instrumentitem;
};
frmDatabase.InstrumentItemData = delegate (Dictionary<string, DataTable> dict)
{
this.dictInstruTables = dict;
};

frmDatabase.ShowDialog();

LoadSourceAndTargetData();
}

private void btnLoadDBData_Click(object sender, EventArgs e)
{
int iReturn=LoadSourceAndTargetData(true);
switch (iReturn)
{
case -1:
MessageBox.Show("未能成功获取仪器数据库配置信息,请配置后重试!");
break;
case -2:
MessageBox.Show("未能成功获取CNAS数据库配置信息,请配置后重试!");
break;
case -3:
MessageBox.Show("未能成功获取仪器数据信息,请配置后重试!");
break;
case -4:
MessageBox.Show("未能成功获取CNAS数据信息,请配置后重试!");
break;
default:
break;
}
}

public int LoadSourceAndTargetData(bool bIfLoading=false)
{
//检查配置信息
if (currentSyncItem.SyncInstrumentDSInfo == null || currentSyncItem.SyncInstrumentDSInfo.LocalPath ==null|| currentSyncItem.SyncInstrumentDSInfo.LocalPath == "") return -1;
if (currentSyncItem.SyncTargetDBInfo == null) return -2;

//是否需要重新加载来源库
if (bIfLoading)
{
if (currentSyncItem.SyncInstrumentDSInfo.LocalPath != null && currentSyncItem.SyncInstrumentDSInfo.LocalPath != "")
{
InstrumentData instrumentData = InstrumentDataFact.CreateInstrumentDataSource(currentSyncItem.SyncInstrumentDSInfo.InstrumentDataSourceType, new object[] { currentSyncItem.SyncInstrumentDSInfo.LocalPath, currentSyncItem.SyncInstrumentDSInfo.UserId, currentSyncItem.SyncInstrumentDSInfo.UserPwd });
dictInstruTables = instrumentData.GetInstrumentData();
}
}
if (dictInstruTables.Count <= 0) return -3;

//绑定ComboBox
List<string> lstTableName = new List<string>();
foreach (var item in dictInstruTables)
{
lstTableName.Add(item.Key);
}

cbxInstrument.DataSource = lstTableName;
cbxInstrument.ValueMember = "";

//获取CNAS配置的数据库连接信息
DataTable dtCNAS = CnasDataOperationFact.CnasDataOperation().GetAllCNASTablesName(currentSyncItem);
if (dtCNAS != null && dtCNAS.Rows.Count > 0)
{
List<string> lstCnasTables = new List<string>();
foreach (DataRow dr in dtCNAS.Rows)
{
lstCnasTables.Add(dr["TABNAME"].ToString());
}

cbxCnas.DataSource = lstCnasTables;
cbxCnas.ValueMember = "";
}
else
return -4;
return 1;
}
}
}

+ 194
- 0
CNAS_DBSync/frmSyncParams.resx 查看文件

@@ -0,0 +1,194 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="InstrumentField.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CnasField.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cmsMapping.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="InstruFieldName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="InstruDataType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CNASFieldName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CnasDataType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAGBgAAAEAIACICQAAFgAAACgAAAAYAAAAMAAAAAEAIAAAAAAAAAkAABILAAASCwAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeHh4AAAAAAI+PjwBnZ2cAISEhAA0NDQsLCwscBgYGKB8e
GzhQTEZ2Ozk0aQwMChwAAAAHAAAABwAAAAMAAAAAkZGRAP///wAAAAAAAAAAAAAAAAAAAAAAHBwcACUl
JQAlJSUAVVVVAJWVlRRWVlZPFRUVjRISErsMDAzVBgYG3yAfHeZnY138UlBL+BYWFMVbWlmfWVhWcgIC
ASYZGRkDLy8vANPT0wAAAAAAAAAAAAAAAAAAAAAALCwsACkpKQAkJCQHGhoaXGZmZseBgYH5FxcX/xgY
GP85ODb/MC8u/1NSTv+Gg37/iYaB/3x6d/+zsq//iYiG9i8uLHKKioog2traFtzc3AUAAAAAAAAAAAAA
AAAqKioAKysrACsrKw8pKSmRIiIi+GhoaP+qqqv/ICAg/ysrKv+GhID/jIqF/5aUj/+Zl5P/oZ+c/7W0
sf/Cwb//dHRy+CEgIHeQkJAx3NzcF+Pj4wIAAAAAAAAAAAAAAAArKysAIyMjAS8vL38tLS3/JSUl/3Bw
cP/R0dH/Ozs7/x4eHv97enj/q6mn/5STkf9SUVD/Ojk5/56dnf/W1tb/oKCg90JCQmOdnZ0d2dnZFuLi
4gIAAAAAAAAAAAAAAAAjIyMAIiIiDjExMcQwMDD/KCgo/3Fxcv/t7e3/bGxs/yYmJv+cnJz/ubi4/2dn
Zv8UFBT/CQkJ/0RERP/Qz83/zcvJ/7SyrsVgX11iQEBAAm1ragAAAAAAAAAAAAAAAAAUFBQAEBAQDDIy
MrUzMzP/LS0t/3Z2dv/5+fn/wMDA/5OSkv/Ly8r/qKin/0JCQv8TExP/EBAQ/ycmJv+uq6f/xMC7/7Ct
p/5iYF2dNTU2BG9ubQAAAAAAAAAAAAAAAAAICAgA////ADU1NYU2Njb/MzMz/3Jycv/m5uf/1dXW/8bE
w//IxsP/mZeU/zU0M/8YGBj/ExMT/zQzMf+mopv/m5eR/398d4ZycG0Sd2teAIqJhwAAAAAAAAAAAAAA
AAAQEBAAODg4ADk5OTo4ODjuODg4/4aGiP+urrH/tbW4/4iIiv+hn53/qqej/0RDQf8aGhr/Hx8e/2Vi
Xf+VkIj/a2di8EZEQDdZV1MAbGRbAIeGhAAAAAAAAAAAAAAAAAAAAAAAOjo6ADw8PAQ6OjqKOjo6/pKR
k/+psLz/xMzZ/9HR0v+lpKL/r6yn/5CNiP9mZGD/dnNu/4uHgP+Hg3v/WldS/SspJnIzMS0AKigmAAAA
AAAAAAAAAAAAAAAAAAAAAAAAOjo6ADo6OgA6OjoOPDw7dGBhY9xugJr/boqz/6+90f+2tbP/nZmT/5yZ
k/+UkYr/kY6G/4eDfOyPioPWfXlx70dEP2d9eG4ALy0rAAAAAAAAAAAAAAAAAAAAAAAAAAAAOzs7AEhT
YwBUaIQAYYCrKF13ncNdeJ//V3Ka/1VvlP92hp3/en2B/2BfXvSal5D3gX13/z88OJeSjocdfXhxOFhV
TQZST0kALSwpAAAAAAAAAAAAAAAAAAAAAAAAAAAAZIOvAGB+qgBgfqkLYH6qr2B/qv9gf6r/YX+q/114
n/9Qao7/Y3ud61dealino5uUeXVvwyknI0pYVlAAfnlyAE1KQwBVUkwAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAZ4e1AGOBrQBiga1GY4Gt9WOBrf9iga3/YYCr/2iFrv9he6D/TmeLxlZ6rgualIsLfnt2C///
/wAxMC8ALiwpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAodb/AFt1nQBnh7WIZ4e1/2eH
tf9kg7D/Xnyn/2SCrP9zjbP/W3Wavz5KWg5gZWoAgX55ABUUEgAxMC0AAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAOUtlADdKZApadJq5XHad/2F8pP9oepT/dIOY/1Rph/9zjbT/ZoGn+ElU
ZYwvIxMIOzs7AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdXVvAGZn
Y0aKkZTre4WO/0xabf+UoK//j5yv/z1JW/9OY4H/ZYOt/0tYavI4NTJAOjo6AAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAioqEAHV1cVKSnKPue4yh/2Z/o/9mgKf/Y4Cq/2OB
rf9JXXv/Q1Fk/0FGS/89PTxzQUFBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAXGp/AFRfbwx8mMKyhKLO/4Sj0v98nMz/cZLC/2qLuv9Zb4//OTk6/z09Pf9HR0eEUVFRAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlP//AIaauQB9nMmIfp3L/3yc
y/95mcf/cpLA/2uJtP9TYHP/Ojo5/z4+Pv9HR0d6UFBQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAPzo0AGN4lwBfcYxkX3CJ/mJyiv9mdo7/aHeO/2NreP9OT1D/QUFA/z4+
PvtBQUFVQ0NDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATk5OAKem
pQBubW1zc3Jy+29vbv9qaWj/YmJh/1hYV/9OTk7/RkZG/0BAQNU8PDwdPDw8AAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaGhoAIiIiACMjIwNgYGBZXl5echwcHDyZmZm/V1d
Xf5TU1P7SkpK40RERFxFRUUASkpKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAg4ODAIKCggCDg4MAdnZ2AICAgBZ2dnZJbW1tb2RkZHZZWVlkUVFRMVlZWQJKSkoAQ0NDAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA8AAAAPAAAADgAAAA4AAAAOAAAADgAAAA4AAAAOAA
AADgAAEA8AABAPAAAQDwAAMA8AAPAPAAHwDwAH8A8AB/APAAfwDwAH8A8AB/APAAfwDwAH8A8AB/APAA
fwA=
</value>
</data>
</root>

+ 9
- 0
CNAS_DBSync/packages.config 查看文件

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.2.0" targetFramework="net40" />
<package id="log4net" version="2.0.8" targetFramework="net40" />
<package id="System.Data.SQLite" version="1.0.111.0" targetFramework="net40" />
<package id="System.Data.SQLite.Core" version="1.0.111.0" targetFramework="net40" />
<package id="System.Data.SQLite.EF6" version="1.0.111.0" targetFramework="net40" />
<package id="System.Data.SQLite.Linq" version="1.0.111.0" targetFramework="net40" />
</packages>

+ 103
- 0
CNAS_RunSync/CNAS_RunSync.csproj 查看文件

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2F1E5C7F-BEE0-4C40-B928-917AD9A4CF46}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>CNAS_RunSync</RootNamespace>
<AssemblyName>CNAS_RunSync</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\dll\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dll\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dll\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="frmSyncShow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmSyncShow.Designer.cs">
<DependentUpon>frmSyncShow.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ucSyncShow.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ucSyncShow.Designer.cs">
<DependentUpon>ucSyncShow.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="frmSyncShow.resx">
<DependentUpon>frmSyncShow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="ucSyncShow.resx">
<DependentUpon>ucSyncShow.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CNAS_DBSync\CNAS_DBSync.csproj">
<Project>{0f16f166-6646-4502-b22d-5fe5bfe92326}</Project>
<Name>CNAS_DBSync</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

+ 21
- 0
CNAS_RunSync/Program.cs 查看文件

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace CNAS_RunSync
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmSyncShow());
}
}
}

+ 37
- 0
CNAS_RunSync/Properties/AssemblyInfo.cs 查看文件

@@ -0,0 +1,37 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("CNAS_RunSync")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CNAS_RunSync")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("2f1e5c7f-bee0-4c40-b928-917ad9a4cf46")]

// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: log4net.Config.XmlConfigurator(ConfigFileExtension = "config", Watch = true)]

+ 63
- 0
CNAS_RunSync/Properties/Resources.Designer.cs 查看文件

@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace CNAS_RunSync.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CNAS_RunSync.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

+ 117
- 0
CNAS_RunSync/Properties/Resources.resx 查看文件

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

+ 26
- 0
CNAS_RunSync/Properties/Settings.Designer.cs 查看文件

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace CNAS_RunSync.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

+ 7
- 0
CNAS_RunSync/Properties/Settings.settings 查看文件

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

+ 40
- 0
CNAS_RunSync/app.config 查看文件

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<appSettings>
<add key="TargetDBType" value="MySQL" />
</appSettings>

<log4net>
<!-- OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL -->
<!-- Set root logger level to ERROR and its appenders -->
<root>
<level value="ALL" />
<appender-ref ref="SysAppender" />
</root>
<!-- Print only messages of level DEBUG or above in the packages -->
<logger name="WindowsFormLogger">
<level value="DEBUG" />
</logger>
<appender name="SysAppender" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="Log/" />
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="&quot;Logs_&quot;yyyyMMdd&quot;.txt&quot;" />
<param name="StaticLogFileName" value="false" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="consoleApp" type="log4net.Appender.ConsoleAppender,log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

二進制
CNAS_RunSync/dll/CNAS_DBSync.exe 查看文件


+ 58
- 0
CNAS_RunSync/dll/CNAS_DBSync.exe.config 查看文件

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<connectionStrings>
<add name="CoreDb" connectionString="Driver={IBM DB2 ODBC DRIVER};DataBase=SAMPLE; HostName=127.0.0.1; Protocol=TCPIP;Port=50000;Uid=db2admin;Pwd=123" />
</connectionStrings>
<appSettings>
<add key="CoreDb" value="Provider=IBMDADB2;Data Source=SAMPLE;UID=db2admin;PWD=123;" />
</appSettings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
</system.data>
<log4net>
<!-- OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL -->
<!-- Set root logger level to ERROR and its appenders -->
<root>
<level value="ALL" />
<appender-ref ref="SysAppender" />
</root>
<!-- Print only messages of level DEBUG or above in the packages -->
<logger name="WindowsFormLogger">
<level value="DEBUG" />
</logger>
<appender name="SysAppender" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="Log/" />
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="&quot;Logs_&quot;yyyyMMdd&quot;.txt&quot;" />
<param name="StaticLogFileName" value="false" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="consoleApp" type="log4net.Appender.ConsoleAppender,log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
</log4net>
</configuration>

二進制
CNAS_RunSync/dll/CNAS_RunSync.exe 查看文件


+ 3
- 0
CNAS_RunSync/dll/CNAS_RunSync.exe.config 查看文件

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

二進制
CNAS_RunSync/dll/System.Data.SQLite.dll 查看文件


+ 22
- 0
CNAS_RunSync/dll/System.Data.SQLite.dll.config 查看文件

@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!--
*
* System.Data.SQLite.dll.config -
*
* WARNING: This XML configuration file is intended for use within the NuGet
* package directories only. Please do not copy this file to any of
* the build output directories because it could interfere with the
* native library pre-loading feature.
*
* Written by Joe Mistachkin.
* Released to the public domain, use at your own risk!
*
-->
<configuration>
<appSettings>
<add key="PreLoadSQLite_BaseDirectory"
value="%PreLoadSQLite_AssemblyDirectory%\..\..\build\%PreLoadSQLite_TargetFramework%" />
</appSettings>

<dllmap dll="SQLite.Interop" target="SQLite.Interop.dll" />
</configuration>

+ 21120
- 0
CNAS_RunSync/dll/System.Data.SQLite.xml
文件差異過大導致無法顯示
查看文件


二進制
CNAS_RunSync/dll/log4net.dll 查看文件


+ 32464
- 0
CNAS_RunSync/dll/log4net.xml
文件差異過大導致無法顯示
查看文件


+ 160
- 0
CNAS_RunSync/frmSyncShow.Designer.cs 查看文件

@@ -0,0 +1,160 @@
namespace CNAS_RunSync
{
partial class frmSyncShow
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows 窗体设计器生成的代码

/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmSyncShow));
this.pnlAll = new System.Windows.Forms.Panel();
this.pnlCenter = new System.Windows.Forms.Panel();
this.pnlCenterCenter = new System.Windows.Forms.Panel();
this.tabcSyncData = new System.Windows.Forms.TabControl();
this.pnlCenterBottom = new System.Windows.Forms.Panel();
this.pnlBottom = new System.Windows.Forms.Panel();
this.pnlTop = new System.Windows.Forms.Panel();
this.pnlRight = new System.Windows.Forms.Panel();
this.pnlLeft = new System.Windows.Forms.Panel();
this.pnlAll.SuspendLayout();
this.pnlCenter.SuspendLayout();
this.pnlCenterCenter.SuspendLayout();
this.SuspendLayout();
//
// pnlAll
//
this.pnlAll.Controls.Add(this.pnlCenter);
this.pnlAll.Controls.Add(this.pnlBottom);
this.pnlAll.Controls.Add(this.pnlTop);
this.pnlAll.Controls.Add(this.pnlRight);
this.pnlAll.Controls.Add(this.pnlLeft);
this.pnlAll.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlAll.Location = new System.Drawing.Point(0, 0);
this.pnlAll.Name = "pnlAll";
this.pnlAll.Size = new System.Drawing.Size(943, 583);
this.pnlAll.TabIndex = 0;
//
// pnlCenter
//
this.pnlCenter.Controls.Add(this.pnlCenterCenter);
this.pnlCenter.Controls.Add(this.pnlCenterBottom);
this.pnlCenter.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlCenter.Location = new System.Drawing.Point(10, 10);
this.pnlCenter.Name = "pnlCenter";
this.pnlCenter.Size = new System.Drawing.Size(923, 563);
this.pnlCenter.TabIndex = 4;
//
// pnlCenterCenter
//
this.pnlCenterCenter.Controls.Add(this.tabcSyncData);
this.pnlCenterCenter.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlCenterCenter.Location = new System.Drawing.Point(0, 0);
this.pnlCenterCenter.Name = "pnlCenterCenter";
this.pnlCenterCenter.Size = new System.Drawing.Size(923, 546);
this.pnlCenterCenter.TabIndex = 1;
//
// tabcSyncData
//
this.tabcSyncData.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabcSyncData.Location = new System.Drawing.Point(0, 0);
this.tabcSyncData.Name = "tabcSyncData";
this.tabcSyncData.SelectedIndex = 0;
this.tabcSyncData.Size = new System.Drawing.Size(923, 546);
this.tabcSyncData.TabIndex = 0;
//
// pnlCenterBottom
//
this.pnlCenterBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlCenterBottom.Location = new System.Drawing.Point(0, 546);
this.pnlCenterBottom.Name = "pnlCenterBottom";
this.pnlCenterBottom.Size = new System.Drawing.Size(923, 17);
this.pnlCenterBottom.TabIndex = 0;
//
// pnlBottom
//
this.pnlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlBottom.Location = new System.Drawing.Point(10, 573);
this.pnlBottom.Name = "pnlBottom";
this.pnlBottom.Size = new System.Drawing.Size(923, 10);
this.pnlBottom.TabIndex = 3;
//
// pnlTop
//
this.pnlTop.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlTop.Location = new System.Drawing.Point(10, 0);
this.pnlTop.Name = "pnlTop";
this.pnlTop.Size = new System.Drawing.Size(923, 10);
this.pnlTop.TabIndex = 2;
//
// pnlRight
//
this.pnlRight.Dock = System.Windows.Forms.DockStyle.Right;
this.pnlRight.Location = new System.Drawing.Point(933, 0);
this.pnlRight.Name = "pnlRight";
this.pnlRight.Size = new System.Drawing.Size(10, 583);
this.pnlRight.TabIndex = 1;
//
// pnlLeft
//
this.pnlLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.pnlLeft.Location = new System.Drawing.Point(0, 0);
this.pnlLeft.Name = "pnlLeft";
this.pnlLeft.Size = new System.Drawing.Size(10, 583);
this.pnlLeft.TabIndex = 0;
//
// frmSyncShow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(943, 583);
this.Controls.Add(this.pnlAll);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "frmSyncShow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "CNAS客户端程序";
this.Load += new System.EventHandler(this.frmSyncShow_Load);
this.pnlAll.ResumeLayout(false);
this.pnlCenter.ResumeLayout(false);
this.pnlCenterCenter.ResumeLayout(false);
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Panel pnlAll;
private System.Windows.Forms.Panel pnlRight;
private System.Windows.Forms.Panel pnlLeft;
private System.Windows.Forms.Panel pnlCenter;
private System.Windows.Forms.Panel pnlBottom;
private System.Windows.Forms.Panel pnlTop;
private System.Windows.Forms.Panel pnlCenterCenter;
private System.Windows.Forms.TabControl tabcSyncData;
private System.Windows.Forms.Panel pnlCenterBottom;
}
}


+ 53
- 0
CNAS_RunSync/frmSyncShow.cs 查看文件

@@ -0,0 +1,53 @@
using CNAS_DBSync;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Serialization;

namespace CNAS_RunSync
{
public partial class frmSyncShow : Form
{
private log4net.ILog log = log4net.LogManager.GetLogger("frmSyncShow");
public List<SyncInstrumentItemInfo> lstSyncInstrument = new List<SyncInstrumentItemInfo>();

public frmSyncShow()
{
InitializeComponent();
}

private void frmSyncShow_Load(object sender, EventArgs e)
{
//1.读取本地存储的仪器信息
//2.每一个仪器创建一个TabPage
//3.每个TabPage页内加载一个ucSyncShow,展示这个仪器的详细信息和操作

//读取本地文件中存储的配置信息
XmlSerializer serializer = new XmlSerializer(lstSyncInstrument.GetType());
FileStream stream = new FileStream(FileHelper.getBasePath() + "/Data/SyncInStrumentData.xml", FileMode.Open);
lstSyncInstrument = (List<SyncInstrumentItemInfo>)serializer.Deserialize(stream);
stream.Close();

if (lstSyncInstrument.Count > 0)
{
int index = 0;
foreach (var item in lstSyncInstrument)
{
tabcSyncData.TabPages.Add(index.ToString(), item.Code);

ucSyncShow show = new ucSyncShow(item);
tabcSyncData.TabPages[index].Controls.Add(show);
show.Dock = DockStyle.Fill;

index++;
}
}
}
}
}

+ 163
- 0
CNAS_RunSync/frmSyncShow.resx 查看文件

@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAGBYAAAEAIADACAAAFgAAACgAAAAYAAAALAAAAAEAIAAAAAAAQAgAAK8PAACvDwAAAAAAAAAA
AACJaD0AiWg9EYloPR6JaD0diWg9HYloPR2JaD0diWg9HYloPR2JaD0diWg9HYloPR2JaD0diWg9HYlo
PR2JaD0diWg9HYloPR2JaD0diWg9HYloPR2JaD0eiWg9E4loPQCJaD0OiWg9poloPdyJaD3aiWg92olo
PdqJaD3aiWg92oloPdqJaD3aiWg92oloPdqJaD3aiWg92oloPdqJaD3aiWg92oloPdqJaD3aiWg92olo
PdqJaD3ciWg9q4loPRCJaD0YiWg91oloPayJaD1jiWg9ZYloPWWJaD1liWg9ZYloPWWJaD1liWg9ZYlo
PWWJaD1liWg9ZYloPWWJaD1liWg9ZYloPWWJaD1liWg9ZYloPWOJaD2jiWg91YloPRiJaD0YiWg91Ylo
PXCJaD0AiWg9AIloPQCJaD0AiWg9AIloPQCJaD0AiWg9AIloPQCJaD0AiWg9AIloPQCJaD0AiWg9AIlo
PQCJaD0AiWg9AIloPQCJaD1giWg904loPRiJaD0YiWg91YloPXOJaD0AAAAAAAAAAACJaD0AiWg9A4lo
PSiIZz01iGc8NIhnPDSIZzw0iGc8NIhnPTWJaD0qiWg9BIloPQAAAAAAAAAAAIloPQCJaD1iiWg904lo
PRiJaD0YiWg91YloPXOJaD0AAAAAAAAAAACJaD0AiWg9IoloPdSMaz7yjWw/8I1sP/CNbD/wjWw/8Ixr
PvGJaD3biWg9KoloPQAAAAAAAAAAAIloPQCJaD1iiWg904loPRiJaD0XiWg914loPXOJaD0AAAAAAAAA
AACJaD0AiGc9K4tqPuzBnln/2rZm/9i1Zf/YtWX/2bZm/8WiW/+Maz/yiGc9NYloPQAAAAAAAAAAAIlo
PQCJaD1jiWg91oloPRiJaD0JiWg9doloPTqJaD0AAAAAAAAAAACJaD0AiGc9K4tqPurVsmP/99N1//bS
dP/20nT/99N1/9u4Zv+NbD/wiGc8NIloPQAAAAAAAAAAAIloPQCJaD0xiWg9eIloPQuJaD0AiWg9AIlo
PQCJaD0AAAAAAAAAAACJaD0AiGc9K4tqPurUsWP/9tJ0//TQc//00HP/9tJ0/9q2Zv+NbD/wiGc8NIlo
PQAAAAAAAAAAAIloPQCJaD0AiWg9AIloPQCJaD0AiWg9AIloPQCJaD0AAAAAAAAAAACJaD0AiGc9K4tq
PurUsWP/9tJ0//TQc//00HP/9tJ0/9q2Zv+NbD/wiGc8NIloPQAAAAAAAAAAAIloPQCJaD0AiWg9AIlo
PQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACJaD0AiGc9K4tqPurUsWP/9tJ0//TQc//00HP/9tJ0/9q2
Zv+NbD/wiGc8NIloPQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AACJaD0AiGc9K4tqPurUsWP/9tJ0//TQc//00HP/9tJ0/9q2Zv+NbD/wiGc8NIloPQAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAIloPQCJaD0AiWg9AIloPQCJaD0AiGc9KYtqPurUsWP/9tJ0//TQ
c//00HP/9tJ0/9q2Zv+NbD/wiGc8M4loPQCJaD0AiWg9AIloPQCJaD0AAAAAAAAAAAAAAAAAAAAAAIlo
PQCJaD0AiWg9EYloPSOJaD0giGc9SItqPu3UsWP/9tJ0//TQc//00HP/9tJ0/9q2Zv+NbD/yiGc9UIlo
PSCJaD0jiWg9EoloPQCJaD0AAAAAAAAAAAAAAAAAAAAAAIloPQCJaD0BiWg9jIloPemJaD3ki2o+6Y1s
P/3XtGT/9tJ0//TQc//00HP/9dF0/9y5Z/+Qb0D9i2k+6oppPeSJaD3piWg9mYloPQSJaD0AAAAAAAAA
AAAAAAAAAAAAAIloPQCJaD0AiWg9P4loPdGMaz7/s5FS/9SxY//uynD/9NBz//TQc//00HP/9NBz/+/M
cf/Ws2T/t5RU/41sP/+JaD3XiWg9SIloPQCJaD0AAAAAAAAAAAAAAAAAAAAAAIloPQCJaD0AiWg9AIlo
PSWJaD2ulXRD/8uoXv/yznL/9dFz//TQc//00HP/9dFz//PPc//PrGD/l3ZE/4loPbeJaD0riWg9AIlo
PQCJaD0AAAAAAAAAAAAAAAAAAAAAAAAAAACJaD0AiWg9AIloPQCJaD0Qh2Y8iY1rP/a5llX/7clv//XR
dP/10XT/7spw/72aV/+ObT/5h2Y8k4loPRWJaD0AiWg9AIloPQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAiWg9AIloPQCJaD0Aimk+BIhnPGOJaD3lqYdN/+TAa//mw2z/rYtP/4ppPeqIZzxsimk9Bolo
PQCJaD0AiWg9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIloPQCJaD0AiWg9AIhn
PQCIZz0/iGc8zZt5Rv+de0f/iGc81IhnPUiHZjwAiWg9AIloPQCJaD0AAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiWg9AIloPQCJaD0AiWg9I4hnPKeHZzyuiWg9KYlo
PQCJaD0AiWg9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAIloPQCJaD0AiWg9AIloPQqJaD0MiWg9AIloPQCJaD0AAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAwAAwAMAAMADAADAAwAAwAMAAMADAA/AA/APwA
PwDAAAMAwAADAMAAAwDAAAMAwAADAOAABwDwAA8A+AAfAP4AfwD/AP8A
</value>
</data>
</root>

+ 416
- 0
CNAS_RunSync/ucSyncShow.Designer.cs 查看文件

@@ -0,0 +1,416 @@
namespace CNAS_RunSync
{
partial class ucSyncShow
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region 组件设计器生成的代码

/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.pnlAll = new System.Windows.Forms.Panel();
this.pnlCenter = new System.Windows.Forms.Panel();
this.dgvSyncData = new System.Windows.Forms.DataGridView();
this.pnlTop = new System.Windows.Forms.Panel();
this.tableTop = new System.Windows.Forms.TableLayoutPanel();
this.pnlSelect = new System.Windows.Forms.Panel();
this.cbxAutoRun = new System.Windows.Forms.CheckBox();
this.btnConfig = new System.Windows.Forms.Button();
this.btnRunData = new System.Windows.Forms.Button();
this.lblTitle = new System.Windows.Forms.Label();
this.pnlRunData = new System.Windows.Forms.Panel();
this.pnlConfig = new System.Windows.Forms.Panel();
this.pnlText = new System.Windows.Forms.Panel();
this.label3 = new System.Windows.Forms.Label();
this.txtFind = new System.Windows.Forms.TextBox();
this.combCondition = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.pnlCheck = new System.Windows.Forms.Panel();
this.pnlDate = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.dtpSource = new System.Windows.Forms.DateTimePicker();
this.dtpTarget = new System.Windows.Forms.DateTimePicker();
this.lblColumn = new System.Windows.Forms.Label();
this.cmbColumns = new System.Windows.Forms.ComboBox();
this.btnFind = new System.Windows.Forms.Button();
this.btnCancelFind = new System.Windows.Forms.Button();
this.pnlAll.SuspendLayout();
this.pnlCenter.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvSyncData)).BeginInit();
this.pnlTop.SuspendLayout();
this.tableTop.SuspendLayout();
this.pnlSelect.SuspendLayout();
this.pnlConfig.SuspendLayout();
this.pnlText.SuspendLayout();
this.pnlDate.SuspendLayout();
this.SuspendLayout();
//
// pnlAll
//
this.pnlAll.Controls.Add(this.pnlCenter);
this.pnlAll.Controls.Add(this.pnlTop);
this.pnlAll.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlAll.Location = new System.Drawing.Point(0, 0);
this.pnlAll.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlAll.Name = "pnlAll";
this.pnlAll.Size = new System.Drawing.Size(772, 450);
this.pnlAll.TabIndex = 0;
//
// pnlCenter
//
this.pnlCenter.Controls.Add(this.dgvSyncData);
this.pnlCenter.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlCenter.Location = new System.Drawing.Point(0, 82);
this.pnlCenter.Name = "pnlCenter";
this.pnlCenter.Size = new System.Drawing.Size(772, 368);
this.pnlCenter.TabIndex = 2;
//
// dgvSyncData
//
this.dgvSyncData.AllowUserToAddRows = false;
this.dgvSyncData.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvSyncData.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dgvSyncData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvSyncData.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvSyncData.Location = new System.Drawing.Point(0, 0);
this.dgvSyncData.Name = "dgvSyncData";
this.dgvSyncData.ReadOnly = true;
this.dgvSyncData.RowTemplate.Height = 23;
this.dgvSyncData.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvSyncData.Size = new System.Drawing.Size(772, 368);
this.dgvSyncData.TabIndex = 0;
//
// pnlTop
//
this.pnlTop.Controls.Add(this.tableTop);
this.pnlTop.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlTop.Location = new System.Drawing.Point(0, 0);
this.pnlTop.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlTop.Name = "pnlTop";
this.pnlTop.Size = new System.Drawing.Size(772, 82);
this.pnlTop.TabIndex = 0;
//
// tableTop
//
this.tableTop.BackColor = System.Drawing.Color.White;
this.tableTop.ColumnCount = 3;
this.tableTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 95.77922F));
this.tableTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4.220779F));
this.tableTop.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 463F));
this.tableTop.Controls.Add(this.pnlSelect, 0, 0);
this.tableTop.Controls.Add(this.pnlRunData, 1, 0);
this.tableTop.Controls.Add(this.pnlConfig, 2, 0);
this.tableTop.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableTop.Location = new System.Drawing.Point(0, 0);
this.tableTop.Name = "tableTop";
this.tableTop.RowCount = 1;
this.tableTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableTop.Size = new System.Drawing.Size(772, 82);
this.tableTop.TabIndex = 4;
//
// pnlSelect
//
this.pnlSelect.Controls.Add(this.cbxAutoRun);
this.pnlSelect.Controls.Add(this.btnConfig);
this.pnlSelect.Controls.Add(this.btnRunData);
this.pnlSelect.Controls.Add(this.lblTitle);
this.pnlSelect.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlSelect.Location = new System.Drawing.Point(3, 3);
this.pnlSelect.Name = "pnlSelect";
this.pnlSelect.Size = new System.Drawing.Size(289, 76);
this.pnlSelect.TabIndex = 0;
//
// cbxAutoRun
//
this.cbxAutoRun.AutoSize = true;
this.cbxAutoRun.Enabled = false;
this.cbxAutoRun.Location = new System.Drawing.Point(9, 48);
this.cbxAutoRun.Name = "cbxAutoRun";
this.cbxAutoRun.Size = new System.Drawing.Size(99, 21);
this.cbxAutoRun.TabIndex = 2;
this.cbxAutoRun.Text = "启动自动执行";
this.cbxAutoRun.UseVisualStyleBackColor = true;
//
// btnConfig
//
this.btnConfig.Location = new System.Drawing.Point(130, 44);
this.btnConfig.Name = "btnConfig";
this.btnConfig.Size = new System.Drawing.Size(75, 25);
this.btnConfig.TabIndex = 1;
this.btnConfig.Text = "配置连接";
this.btnConfig.UseVisualStyleBackColor = true;
this.btnConfig.Click += new System.EventHandler(this.btnConfig_Click);
//
// btnRunData
//
this.btnRunData.Location = new System.Drawing.Point(211, 44);
this.btnRunData.Name = "btnRunData";
this.btnRunData.Size = new System.Drawing.Size(75, 25);
this.btnRunData.TabIndex = 0;
this.btnRunData.Text = "上传数据";
this.btnRunData.UseVisualStyleBackColor = true;
this.btnRunData.Click += new System.EventHandler(this.btnRunData_Click);
//
// lblTitle
//
this.lblTitle.AutoSize = true;
this.lblTitle.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Bold);
this.lblTitle.Location = new System.Drawing.Point(6, 12);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(119, 19);
this.lblTitle.TabIndex = 0;
this.lblTitle.Text = "当前仪器:XXXX";
//
// pnlRunData
//
this.pnlRunData.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlRunData.Location = new System.Drawing.Point(298, 3);
this.pnlRunData.Name = "pnlRunData";
this.pnlRunData.Size = new System.Drawing.Size(7, 76);
this.pnlRunData.TabIndex = 1;
//
// pnlConfig
//
this.pnlConfig.BackColor = System.Drawing.Color.White;
this.pnlConfig.Controls.Add(this.btnCancelFind);
this.pnlConfig.Controls.Add(this.pnlText);
this.pnlConfig.Controls.Add(this.pnlCheck);
this.pnlConfig.Controls.Add(this.pnlDate);
this.pnlConfig.Controls.Add(this.lblColumn);
this.pnlConfig.Controls.Add(this.cmbColumns);
this.pnlConfig.Controls.Add(this.btnFind);
this.pnlConfig.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlConfig.Location = new System.Drawing.Point(311, 3);
this.pnlConfig.Name = "pnlConfig";
this.pnlConfig.Size = new System.Drawing.Size(458, 76);
this.pnlConfig.TabIndex = 2;
//
// pnlText
//
this.pnlText.Controls.Add(this.label3);
this.pnlText.Controls.Add(this.txtFind);
this.pnlText.Controls.Add(this.combCondition);
this.pnlText.Controls.Add(this.label4);
this.pnlText.Location = new System.Drawing.Point(4, 124);
this.pnlText.Name = "pnlText";
this.pnlText.Size = new System.Drawing.Size(451, 31);
this.pnlText.TabIndex = 7;
this.pnlText.Visible = false;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(238, 8);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(20, 17);
this.label3.TabIndex = 9;
this.label3.Text = "值";
//
// txtFind
//
this.txtFind.Location = new System.Drawing.Point(264, 5);
this.txtFind.Name = "txtFind";
this.txtFind.Size = new System.Drawing.Size(156, 23);
this.txtFind.TabIndex = 8;
//
// combCondition
//
this.combCondition.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.combCondition.FormattingEnabled = true;
this.combCondition.Location = new System.Drawing.Point(53, 4);
this.combCondition.Name = "combCondition";
this.combCondition.Size = new System.Drawing.Size(167, 25);
this.combCondition.TabIndex = 7;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(9, 8);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(44, 17);
this.label4.TabIndex = 6;
this.label4.Text = "条件:";
//
// pnlCheck
//
this.pnlCheck.Location = new System.Drawing.Point(4, 39);
this.pnlCheck.Name = "pnlCheck";
this.pnlCheck.Size = new System.Drawing.Size(451, 34);
this.pnlCheck.TabIndex = 8;
//
// pnlDate
//
this.pnlDate.Controls.Add(this.label2);
this.pnlDate.Controls.Add(this.label1);
this.pnlDate.Controls.Add(this.dtpSource);
this.pnlDate.Controls.Add(this.dtpTarget);
this.pnlDate.Location = new System.Drawing.Point(4, 86);
this.pnlDate.Name = "pnlDate";
this.pnlDate.Size = new System.Drawing.Size(451, 32);
this.pnlDate.TabIndex = 6;
this.pnlDate.Visible = false;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(238, 9);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(20, 17);
this.label2.TabIndex = 7;
this.label2.Text = "到";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(21, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(20, 17);
this.label1.TabIndex = 6;
this.label1.Text = "从";
//
// dtpSource
//
this.dtpSource.CustomFormat = "yyyy-MM-dd HH:mm";
this.dtpSource.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpSource.Location = new System.Drawing.Point(53, 6);
this.dtpSource.Name = "dtpSource";
this.dtpSource.Size = new System.Drawing.Size(167, 23);
this.dtpSource.TabIndex = 2;
this.dtpSource.Value = new System.DateTime(2019, 6, 15, 0, 0, 0, 0);
//
// dtpTarget
//
this.dtpTarget.CustomFormat = "yyyy-MM-dd HH:mm";
this.dtpTarget.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpTarget.Location = new System.Drawing.Point(264, 6);
this.dtpTarget.Name = "dtpTarget";
this.dtpTarget.Size = new System.Drawing.Size(156, 23);
this.dtpTarget.TabIndex = 3;
this.dtpTarget.Value = new System.DateTime(2019, 6, 30, 0, 0, 0, 0);
//
// lblColumn
//
this.lblColumn.AutoSize = true;
this.lblColumn.Location = new System.Drawing.Point(24, 13);
this.lblColumn.Name = "lblColumn";
this.lblColumn.Size = new System.Drawing.Size(32, 17);
this.lblColumn.TabIndex = 5;
this.lblColumn.Text = "列:";
//
// cmbColumns
//
this.cmbColumns.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbColumns.FormattingEnabled = true;
this.cmbColumns.Location = new System.Drawing.Point(57, 9);
this.cmbColumns.Name = "cmbColumns";
this.cmbColumns.Size = new System.Drawing.Size(167, 25);
this.cmbColumns.TabIndex = 4;
this.cmbColumns.SelectedIndexChanged += new System.EventHandler(this.cmbColumns_SelectedIndexChanged);
//
// btnFind
//
this.btnFind.Location = new System.Drawing.Point(268, 9);
this.btnFind.Name = "btnFind";
this.btnFind.Size = new System.Drawing.Size(75, 25);
this.btnFind.TabIndex = 1;
this.btnFind.Text = "查询";
this.btnFind.UseVisualStyleBackColor = true;
this.btnFind.Click += new System.EventHandler(this.btnFind_Click);
//
// btnCancelFind
//
this.btnCancelFind.Location = new System.Drawing.Point(349, 9);
this.btnCancelFind.Name = "btnCancelFind";
this.btnCancelFind.Size = new System.Drawing.Size(75, 25);
this.btnCancelFind.TabIndex = 9;
this.btnCancelFind.Text = "取消查询";
this.btnCancelFind.UseVisualStyleBackColor = true;
this.btnCancelFind.Click += new System.EventHandler(this.btnCancelFind_Click);
//
// ucSyncShow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.pnlAll);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "ucSyncShow";
this.Size = new System.Drawing.Size(772, 450);
this.Load += new System.EventHandler(this.ucSyncShow_Load);
this.pnlAll.ResumeLayout(false);
this.pnlCenter.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvSyncData)).EndInit();
this.pnlTop.ResumeLayout(false);
this.tableTop.ResumeLayout(false);
this.pnlSelect.ResumeLayout(false);
this.pnlSelect.PerformLayout();
this.pnlConfig.ResumeLayout(false);
this.pnlConfig.PerformLayout();
this.pnlText.ResumeLayout(false);
this.pnlText.PerformLayout();
this.pnlDate.ResumeLayout(false);
this.pnlDate.PerformLayout();
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Panel pnlAll;
private System.Windows.Forms.Panel pnlTop;
private System.Windows.Forms.Label lblTitle;
private System.Windows.Forms.Panel pnlCenter;
private System.Windows.Forms.DataGridView dgvSyncData;
private System.Windows.Forms.TableLayoutPanel tableTop;
private System.Windows.Forms.Panel pnlSelect;
private System.Windows.Forms.Button btnFind;
private System.Windows.Forms.DateTimePicker dtpTarget;
private System.Windows.Forms.DateTimePicker dtpSource;
private System.Windows.Forms.Panel pnlRunData;
private System.Windows.Forms.Button btnRunData;
private System.Windows.Forms.Panel pnlConfig;
private System.Windows.Forms.Button btnConfig;
private System.Windows.Forms.CheckBox cbxAutoRun;
private System.Windows.Forms.Label lblColumn;
private System.Windows.Forms.ComboBox cmbColumns;
private System.Windows.Forms.Panel pnlText;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Panel pnlDate;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtFind;
private System.Windows.Forms.ComboBox combCondition;
private System.Windows.Forms.Panel pnlCheck;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnCancelFind;
}
}

+ 522
- 0
CNAS_RunSync/ucSyncShow.cs 查看文件

@@ -0,0 +1,522 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CNAS_DBSync;
using Newtonsoft.Json;

namespace CNAS_RunSync
{
public partial class ucSyncShow : UserControl
{
private log4net.ILog log = log4net.LogManager.GetLogger("ucSyncShow");
private SyncInstrumentItemInfo syncInstrumentItem = new SyncInstrumentItemInfo();
private Dictionary<string, DataTable> dictSourceTables = new Dictionary<string, DataTable>();
private Dictionary<string, DataRow> dictSource = new Dictionary<string, DataRow>();
private Dictionary<string, Type> DictComboBox = new Dictionary<string, Type>(); //ComboBox数据源
private List<string> lstIntOrDouble = new List<string>() {"等于","不等于","大于","小于","不大于","不小于" };
private List<string> lstText = new List<string>() { "等于", "不等于", "包含", "不包含"};
private Color FinedBackColor = Color.LightCyan;

//需要存在一个仪器才能正常显示数据
public ucSyncShow(SyncInstrumentItemInfo syncInstrumentItem)
{
InitializeComponent();

dgvSyncData.AutoGenerateColumns = false;
dgvSyncData.RowHeadersVisible = false;

this.syncInstrumentItem = syncInstrumentItem;
}

private void ucSyncShow_Load(object sender, EventArgs e)
{
BindData();
}

private void BindData()
{
if (this.syncInstrumentItem == null) return;
if (syncInstrumentItem.LstSyncPramas == null) return;
if (syncInstrumentItem.SyncInstrumentDSInfo == null) return;
if (syncInstrumentItem.SyncInstrumentDSInfo.LocalPath == null) return;
if (syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType == DataSourceType.None) return;

DictComboBox.Clear();
dictSource.Clear();
dictSourceTables.Clear();

//加载相关数据
//1.TableLayout中相关
this.lblTitle.Text = string.Format("当前仪器:【{0}】", syncInstrumentItem.Code);

//2.datagridview中绑定数据(绑定的是从数据源中读取的数据)
//2.1 读取所有数据【会额外读取多余的数据,但如果后面用户想要维护更多映射字段,可以方便新增】
//2.2 获取映射表中的数据

InstrumentData instrumentData = InstrumentDataFact.CreateInstrumentDataSource(syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType, new object[] { syncInstrumentItem.SyncInstrumentDSInfo.LocalPath, syncInstrumentItem.SyncInstrumentDSInfo.UserId, syncInstrumentItem.SyncInstrumentDSInfo.UserPwd });
dictSourceTables = instrumentData.GetInstrumentData();

//2.2.1 根据映射表,创建datagridviewcolumn/和绑定数据列
if (syncInstrumentItem.LstSyncPramas.Count <= 0) return;
foreach (var item in syncInstrumentItem.LstSyncPramas)
{
AddDatagridColumn(dgvSyncData, item.SourceField, item.SourceField, 100);
}
AddDatagridColumn(dgvSyncData, "GridGuid", "GridGuid", 100, false);

//2.2.2 根据数据源,构建datagridviewcell
if (!dictSourceTables.ContainsKey(syncInstrumentItem.LstSyncPramas[0].SourceTable)) return;
DataTable dtSource = dictSourceTables[syncInstrumentItem.LstSyncPramas[0].SourceTable];
foreach (DataRow dr in dtSource.Rows)
{
DataGridViewRow dataGridViewRow = new DataGridViewRow();
foreach (DataGridViewColumn dataGridViewColumn in dgvSyncData.Columns)
{
if (dtSource.Columns.Contains(dataGridViewColumn.Name))
AddDataTextCell(dataGridViewRow, dataGridViewColumn, dr);
}

//添加GUID值
string strGuid = Guid.NewGuid().ToString();
DataGridViewTextBoxCell txtCell = new DataGridViewTextBoxCell
{
Value = strGuid
};
dataGridViewRow.Cells.Add(txtCell);

dgvSyncData.Rows.Add(dataGridViewRow);

dictSource.Add(strGuid, dr);
}

//3.初始化查询相关内容
//3.1 绑定Combobox数据源
foreach (DataColumn dc in dtSource.Columns)
{
if (syncInstrumentItem.LstSyncPramas.Where(s => s.SourceField == dc.ColumnName).LongCount<SyncParamasInfo>() > 0)
DictComboBox.Add(dc.ColumnName, dc.DataType);
}
BindingSource bsComboBox = new BindingSource
{
DataSource = DictComboBox
};
cmbColumns.DataSource = bsComboBox;
cmbColumns.ValueMember = "Key";
cmbColumns.DisplayMember = "Key";
}

private void AddDatagridColumn(DataGridView dgvShow,string strColumnName,string strColumnHeaderText,int Width,bool bVisible=true)
{
DataGridViewColumn Column = new DataGridViewColumn()
{
Name = strColumnName,
HeaderText = strColumnHeaderText,
Width = Width,
Visible = bVisible,
CellTemplate = new DataGridViewTextBoxCell()
};
//设置文本对齐方式
Column.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
//设置该列背景颜色
//Column.DefaultCellStyle.BackColor = Color.Red;
dgvShow.Columns.Add(Column);
}

private void AddDataTextCell(DataGridViewRow dataGridViewRow, DataGridViewColumn dataGridViewColumn,DataRow dr)
{
DataGridViewTextBoxCell txtCell = new DataGridViewTextBoxCell();
txtCell.Value = Convert.ToString(dr[dataGridViewColumn.Name]);
dataGridViewRow.Cells.Add(txtCell);
}

private void btnRunData_Click(object sender, EventArgs e)
{
//根据映射信息上传数据到数据库中
//DataTable dtSource = dictSourceTables[syncInstrumentItem.LstSyncPramas[0].SourceTable];

//组织上传数据
if (dgvSyncData.Columns.Count <= 0) return;

DataTable dtReadySource = dictSourceTables[syncInstrumentItem.LstSyncPramas[0].SourceTable].Clone();
foreach (DataGridViewRow dgvRow in dgvSyncData.Rows)
{
if (dgvRow.DefaultCellStyle.BackColor == FinedBackColor)
{
string strGuid = dgvRow.Cells["GridGuid"].Value.ToString();
if (!dictSource.ContainsKey(strGuid)) continue;
DataRow dr = dictSource[strGuid];

DataRow drReady = dtReadySource.NewRow();
foreach (DataColumn dc in dtReadySource.Columns)
{
if (dr.Table.Columns.Contains(dc.ColumnName))
drReady[dc.ColumnName] = dr[dc.ColumnName];
}
dtReadySource.Rows.Add(drReady);
}
}
if (dtReadySource.Rows.Count <= 0)
MessageBox.Show("未能获得上传数据,请查询筛选后重试!");
RunUpLoad(dtReadySource);
}

private void RunUpLoad(DataTable dtReadySource)
{
//根据映射字段获取准备上传的所有数据
if (dtReadySource == null || dtReadySource.Rows.Count <= 0) return;

//构建准备插入的数据
DataTable dtTarget = CnasDataOperationFact.CnasDataOperation().GetCNASTablesStruct(syncInstrumentItem.LstSyncPramas[0].TargetTable, syncInstrumentItem);

if (dtTarget.Columns.Count <= 0)
{
MessageBox.Show("未能成功读取CNAS数据库列,请检查数据库配置。");
return;
}

string strErrorMsg = "";
foreach (DataRow drSource in dtReadySource.Rows)
{
DataRow drNewTarget = dtTarget.NewRow();

//遍历映射表,把所有字段插入到目标表中
foreach (var item in syncInstrumentItem.LstSyncPramas)
{
var strSourceField = item.SourceField;
var strTargetField = item.TargetField;

//当列名存在于数据表中时才能继续
if (dtReadySource.Columns.Contains(strSourceField) && dtTarget.Columns.Contains(strTargetField))
{
strErrorMsg=TestConvertValueToTarget(drNewTarget,drSource,strTargetField,strSourceField);
if (strErrorMsg != "")
{
MessageBox.Show(string.Format("发生数据转换错误,请重新配置映射字段或修改字段值。错误信息如下:{0}",strErrorMsg));
break;
}

}
}
dtTarget.Rows.Add(drNewTarget);

if (strErrorMsg != "") break;
}
if (strErrorMsg != "") return;

CnasDataCheck check = new CnasDataCheck
{
DtReadyInsert = dtTarget,
SyncInstrumentItem = syncInstrumentItem,
StrTableName = syncInstrumentItem.LstSyncPramas[0].TargetTable
};
check.CheckData();
if (check.LstIllegalMsg != null && check.LstIllegalMsg.Count > 0)
{
var item=syncInstrumentItem.LstSyncPramas.Where(s => s.TargetField == check.LstIllegalMsg[0].ColumnName).ToList<SyncParamasInfo>();
if (item.Count == 1)
{
MessageBox.Show(string.Format("数据不满足上传条件,请修改后再上传。错误数据:当前列名【{0}】,列值【{1}】", item[0].SourceField, check.LstIllegalMsg[0].ColumnValue));
}
else
{
MessageBox.Show(string.Format("数据不满足上传条件,请修改后再上传。错误数据:CNAS列名【{0}】,列值【{1}】", check.LstIllegalMsg[0].ColumnName, check.LstIllegalMsg[0].ColumnValue));
}
return;
}
//逐行执行插入
List<DataRow> lstError = new List<DataRow>();
ProgressBarService.CreateBarForm("CNAS客户端上传", "上传数据...", dtTarget.Rows.Count, false, false, false);
int SuccessCount = 0;
foreach (DataRow dr in dtTarget.Rows)
{
dr.AcceptChanges();
int iReturn = CnasDataOperationFact.CnasDataOperation().InsertDataToCNASTable(dr.Table, syncInstrumentItem);
if (iReturn > 0) //此时正常存储
{
SuccessCount++;
ProgressBarService.UpdateProgress(SuccessCount);
}
else //此时出现问题
{
lstError.Add(dr);
}
}
ProgressBarService.CloseBarForm();
if (lstError.Count <= 0)
MessageBox.Show("上传完成!");
else
{
log.ErrorFormat("未成功上传的数据如下:{0}", ListToString(lstError));
MessageBox.Show("上传过程中发生异常,存在部分数据未成功上传,请联系管理员!");
}
}

private string TestConvertValueToTarget(DataRow drTarget, DataRow drSource, string strTargetColumn,string strSourceColumn)
{
string strErrorMsg = "";
try
{
drTarget[strTargetColumn] = drSource[strSourceColumn];
}
catch (Exception ex)
{
log.Error(ex.Message);
strErrorMsg = ex.Message;
}
return strErrorMsg;
}

private string ListToString(List<DataRow> lst)
{
return JsonConvert.SerializeObject(lst);
}
private List<DataRow> StringToList(string strList)
{
return JsonConvert.DeserializeObject<List<DataRow>>(strList);
}

private void cmbColumns_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbColumns.SelectedItem == null) return;
KeyValuePair<string, Type> obj = (KeyValuePair<string, Type>)cmbColumns.SelectedItem;
if (DictComboBox.ContainsKey(obj.Key))
{
Type selectType = DictComboBox[obj.Key];

switch (selectType.ToString())
{
case "System.DateTime":
UseDateTimeControl();
break;
case "System.Double":
case "System.Int64":
case "System.Int32":
UseNormalControl();
//绑定条件ComboBox
combCondition.DataSource = lstIntOrDouble ;
break;
case "System.Byte[]":
case "System.String":
default:
UseNormalControl();
//绑定条件ComboBox
combCondition.DataSource = lstText;
break;
}
}
}

/// <summary>
/// 使用时间类型专用的查询控件组
/// </summary>
private void UseDateTimeControl()
{
if (pnlCheck.Controls.Contains(pnlText))
pnlCheck.Controls.Remove(pnlText);
if (!pnlCheck.Controls.Contains(pnlDate))
{
pnlCheck.Controls.Add(pnlDate);
pnlDate.Visible = true;
pnlDate.Dock = DockStyle.Fill;
}
}

/// <summary>
/// 使用标准的查询控件组
/// </summary>
private void UseNormalControl()
{
if (pnlCheck.Controls.Contains(pnlDate))
pnlCheck.Controls.Remove(pnlDate);
if (!pnlCheck.Controls.Contains(pnlText))
{
pnlCheck.Controls.Add(pnlText);
pnlText.Visible = true;
pnlText.Dock = DockStyle.Fill;
}
}

/// <summary>
/// 查询满足满足条件的项
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnFind_Click(object sender, EventArgs e)
{
if (cmbColumns.SelectedValue == null) return;
//1.合法性检测
if (DictComboBox[cmbColumns.SelectedValue.ToString()].ToString().Equals("System.DateTime"))
{
if (dtpTarget.Value < dtpSource.Value)
{
MessageBox.Show("查询时间需要一个有效的时间范围!");
return;
}
}
else
{
if (this.txtFind.Text.Trim() == "") //为空 认为是取消查询
{
btnCancelFind_Click(sender, e);
return;
}
}

//2.将datagridview中满足条件的项修改背景色
//2.1 判断当前显示的datagridview是否含有旧的查询数据
//2.2 将满足条件的项背景色改为特殊颜色
foreach (DataGridViewRow dgvrow in dgvSyncData.Rows)
{
dgvrow.DefaultCellStyle.BackColor = Color.White;

//查询列的当前值
string strGuid = dgvrow.Cells["GridGuid"].Value.ToString();
string strValue = dgvrow.Cells[cmbColumns.SelectedValue.ToString()].Value.ToString();

//判断是否满足条件
if (CheckMatchCondition(strValue))
{
dgvrow.DefaultCellStyle.BackColor = FinedBackColor;
}
}
}

private bool CheckMatchCondition(string strValue)
{
if (DictComboBox[cmbColumns.SelectedValue.ToString()].ToString().Equals("System.DateTime"))
{
DateTime dt= DateTime.Now;
if (!DateTime.TryParse(strValue, out dt)) return false;

DateTime dtSource = dtpSource.Value;
DateTime dtTarget = dtpTarget.Value;
DateTime dtValue = dt;
if (dt >= dtSource && dt <= dtTarget)
return true;
else
return false;
}
else
{
string strFindText = this.txtFind.Text.ToString();
bool bReturn = false;
switch (combCondition.SelectedValue.ToString())
{
case "等于":
bReturn=strValue == strFindText ? true : false;
break;
case "不等于":
bReturn = strValue != strFindText ? true: false;
break;
case "包含":
bReturn = strValue.Contains(strFindText) ? true : false;
break;
case "不包含":
bReturn = !strValue.Contains(strFindText) ? true : false;
break;
case "大于":
bReturn = Convert.ToDouble(strValue)>Convert.ToDouble(strFindText) ? true : false;
break;
case "不小于":
bReturn = Convert.ToDouble(strValue) >= Convert.ToDouble(strFindText) ? true : false;
break;
case "小于":
bReturn = Convert.ToDouble(strValue) < Convert.ToDouble(strFindText) ? true : false;
break;
case "不大于":
bReturn = Convert.ToDouble(strValue) <= Convert.ToDouble(strFindText) ? true : false;
break;
}
return bReturn;
}
}


/// <summary>
/// 获得查询语句(非日期类型)
/// </summary>
/// <param name="strColumnName"></param>
/// <param name="strColumnType"></param>
/// <param name="strCondition"></param>
/// <param name="strValue"></param>
/// <returns></returns>
private string GetSelectString(string strColumnName,string strCondition, string strValue)
{
string strCondi = "";
switch (strCondition)
{
case "等于":
strCondi = "=";
break;
case "不等于":
strCondi = "<>";
break;
case "包含":
strCondi = "like";
break;
case "不包含":
strCondi = "not like";
break;
case "大于":
strCondi = ">";
break;
case "不小于":
strCondi = ">=";
break;
case "小于":
strCondi = "<";
break;
case "不大于":
strCondi = "<=";
break;
}
if (strCondi == "like" || strCondi == "not like")
return string.Format("{0} {1} '%{2}%'", strColumnName, strCondi, strValue);
else
return string.Format("{0} {1} '{2}'",strColumnName,strCondi,strValue);
}


private string GetDateSelectString(string strColumnName, DateTime dtSource, DateTime dtTarget)
{
string strSource = dtSource.ToString();
string strTarget = dtTarget.ToString();

return string.Format("{0}>='{1}' and {0}<='{2}'",strColumnName,strSource,strTarget) ;
}

private void btnConfig_Click(object sender, EventArgs e)
{
frmSyncParams frmSyncConfig = new frmSyncParams(syncInstrumentItem);
frmSyncConfig.ParamsChangedDelegate = delegate (SyncInstrumentItemInfo instrumentItemInfo)
{
syncInstrumentItem = instrumentItemInfo;

//重新绑定数据
dgvSyncData.DataSource = null;
dgvSyncData.Rows.Clear();
dgvSyncData.Columns.Clear();
combCondition.DataSource = null;
cmbColumns.DataSource = null;

BindData();
};
frmSyncConfig.ShowDialog();
}

private void btnCancelFind_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow dgvrow in dgvSyncData.Rows)
{
if (dgvrow.DefaultCellStyle.BackColor != Color.White)
dgvrow.DefaultCellStyle.BackColor = Color.White;
}
}
}
}

+ 120
- 0
CNAS_RunSync/ucSyncShow.resx 查看文件

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

二進制
dll/CNAS_DBSync.exe 查看文件


+ 58
- 0
dll/CNAS_DBSync.exe.config 查看文件

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<connectionStrings>
<add name="CoreDb" connectionString="Driver={IBM DB2 ODBC DRIVER};DataBase=SAMPLE; HostName=127.0.0.1; Protocol=TCPIP;Port=50000;Uid=db2admin;Pwd=123" />
</connectionStrings>
<appSettings>
<add key="TargetDBType" value="MySQL" />
</appSettings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
</system.data>
<log4net>
<!-- OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL -->
<!-- Set root logger level to ERROR and its appenders -->
<root>
<level value="ALL" />
<appender-ref ref="SysAppender" />
</root>
<!-- Print only messages of level DEBUG or above in the packages -->
<logger name="WindowsFormLogger">
<level value="DEBUG" />
</logger>
<appender name="SysAppender" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="Log/" />
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="&quot;Logs_&quot;yyyyMMdd&quot;.txt&quot;" />
<param name="StaticLogFileName" value="false" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="consoleApp" type="log4net.Appender.ConsoleAppender,log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
</log4net>
</configuration>

二進制
dll/CNAS_RunSync.exe 查看文件


+ 40
- 0
dll/CNAS_RunSync.exe.config 查看文件

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<appSettings>
<add key="TargetDBType" value="MySQL" />
</appSettings>

<log4net>
<!-- OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL -->
<!-- Set root logger level to ERROR and its appenders -->
<root>
<level value="ALL" />
<appender-ref ref="SysAppender" />
</root>
<!-- Print only messages of level DEBUG or above in the packages -->
<logger name="WindowsFormLogger">
<level value="DEBUG" />
</logger>
<appender name="SysAppender" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="Log/" />
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="&quot;Logs_&quot;yyyyMMdd&quot;.txt&quot;" />
<param name="StaticLogFileName" value="false" />
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="consoleApp" type="log4net.Appender.ConsoleAppender,log4net">
<layout type="log4net.Layout.PatternLayout,log4net">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

+ 326
- 0
dll/Data/SyncInStrumentData.xml 查看文件

@@ -0,0 +1,326 @@
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfSyncInstrumentItemInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SyncInstrumentItemInfo>
<GUID>a2065a7f-62fb-4f5d-8a94-c321b896cf53</GUID>
<Code>LDD-1(Excel)</Code>
<SyncInstrumentDSInfo>
<InstrumentDataSourceType>Excel</InstrumentDataSourceType>
<LocalPath>C:\Users\Li\Desktop\水分仪模拟数据.xls</LocalPath>
</SyncInstrumentDSInfo>
<SyncTargetDBInfo>
<DBHost>192.168.1.109</DBHost>
<DBName>world</DBName>
<DBUser>Li</DBUser>
<DBPwd>123456</DBPwd>
<DBPort>3306</DBPort>
</SyncTargetDBInfo>
<LstSyncPramas>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>SerialNumber</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>PLANTCODE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>SampleID</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>COAL_CODE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>SampleName</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>TEST_DATE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Content</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>STANDARD_NAME</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Method</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>STANDARD_ID</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Tare</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>EXAMINE_METHOD</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Sample</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>EMPERATURE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Leftover</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>HUMIDITY</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Calibration</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>FACILITY_ID</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Moisture</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>FACILITY_NUMBER</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>TypeFlag</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>FACILITY_BEFORE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>BeginDate</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>FACILITY_AFTER</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Operator</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>BALANCE_NUMBER</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Memo</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>BALANCE_BEFORE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>EndDate</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>BALANCE_AFTER</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Numbering</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>AVERAGE_AAD</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Temperature</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>AVERAGE_MAD</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>KeepTime</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>AVERAGE_AD</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Precision</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>REMARKS</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>IntervalTime</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>INSPECTOR</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Times</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>AUDITOR</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>Tray</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>INSPECTORID</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>TestResult</SourceTable>
<SourceField>CountNumber</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>AUDITORID</TargetField>
</SyncParamasInfo>
</LstSyncPramas>
</SyncInstrumentItemInfo>
<SyncInstrumentItemInfo>
<GUID>0531cd1a-8d7d-491f-b086-0f3a92d91964</GUID>
<Code>SAA-2(Access)</Code>
<LstSyncPramas />
</SyncInstrumentItemInfo>
<SyncInstrumentItemInfo>
<GUID>27ec3bbc-7604-48df-974b-dac3e871b817</GUID>
<Code>SAA-3(SQLite)</Code>
<SyncInstrumentDSInfo>
<InstrumentDataSourceType>SQLLite</InstrumentDataSourceType>
<UserId />
<UserPwd />
<LocalPath>F:\软件与资料\数据库\SQLite安装\sqlite\testDB.db</LocalPath>
</SyncInstrumentDSInfo>
<SyncTargetDBInfo>
<DBHost>192.168.1.108</DBHost>
<DBName>world</DBName>
<DBUser>Li</DBUser>
<DBPwd>123456</DBPwd>
<DBPort>3306</DBPort>
</SyncTargetDBInfo>
<LstSyncPramas>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>key</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>PLANTCODE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>crucible</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>COAL_CODE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>name</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>TEST_DATE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>weight</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>STANDARD_NAME</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>mad</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>STANDARD_ID</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>kc</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>EXAMINE_METHOD</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>kca</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>EMPERATURE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>stad</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>HUMIDITY</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>std</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>FACILITY_ID</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>method</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>FACILITY_NUMBER</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>type</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>FACILITY_BEFORE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>assayer</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>FACILITY_AFTER</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>count</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>BALANCE_NUMBER</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>date1</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>BALANCE_BEFORE</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>time</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>BALANCE_AFTER</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>remark</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>AVERAGE_AAD</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>data</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>AVERAGE_MAD</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>state</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>AVERAGE_AD</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>ResultDisable</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>REMARKS</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>date</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>INSPECTOR</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>k</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>AUDITOR</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>b</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>INSPECTORID</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>AT</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>AUDITORID</TargetField>
</SyncParamasInfo>
<SyncParamasInfo>
<SourceTable>result</SourceTable>
<SourceField>RH</SourceField>
<TargetTable>ashexaminerecord</TargetTable>
<TargetField>ORGCODE</TargetField>
</SyncParamasInfo>
</LstSyncPramas>
</SyncInstrumentItemInfo>
</ArrayOfSyncInstrumentItemInfo>

二進制
dll/Document/AshMeltingPoint.xls 查看文件


二進制
dll/Document/IndustrialAnalyzer.xls 查看文件


二進制
dll/Document/InfraredSulfurMeter.xls 查看文件


二進制
dll/Document/MoistureMeter.xls 查看文件


二進制
dll/Document/SulphurMeter.xls 查看文件


二進制
dll/MySql.Data.dll 查看文件


二進制
dll/Newtonsoft.Json.dll 查看文件


二進制
dll/System.Data.SQLite.EF6.dll 查看文件


二進制
dll/System.Data.SQLite.Linq.dll 查看文件


二進制
dll/System.Data.SQLite.dll 查看文件


+ 22
- 0
dll/System.Data.SQLite.dll.config 查看文件

@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!--
*
* System.Data.SQLite.dll.config -
*
* WARNING: This XML configuration file is intended for use within the NuGet
* package directories only. Please do not copy this file to any of
* the build output directories because it could interfere with the
* native library pre-loading feature.
*
* Written by Joe Mistachkin.
* Released to the public domain, use at your own risk!
*
-->
<configuration>
<appSettings>
<add key="PreLoadSQLite_BaseDirectory"
value="%PreLoadSQLite_AssemblyDirectory%\..\..\build\%PreLoadSQLite_TargetFramework%" />
</appSettings>

<dllmap dll="SQLite.Interop" target="SQLite.Interop.dll" />
</configuration>

+ 21120
- 0
dll/System.Data.SQLite.xml
文件差異過大導致無法顯示
查看文件


二進制
dll/log4net.dll 查看文件


+ 32464
- 0
dll/log4net.xml
文件差異過大導致無法顯示
查看文件


Loading…
取消
儲存