Selaa lähdekoodia

下载激活码功能

master
OCEAN 4 kuukautta sitten
vanhempi
commit
912c439e6f
100 muutettua tiedostoa jossa 9896 lisäystä ja 2016 poistoa
  1. +26
    -25
      CNASBalanceDBManage/App.config
  2. +11
    -1
      CNASBalanceDBManage/CNASBalanceDBManage.csproj
  3. +10
    -1
      CNASBalanceDBManage/Program.cs
  4. +26
    -34
      CNASBalanceDBManage/Properties/Resources.Designer.cs
  5. +13
    -17
      CNASBalanceDBManage/Properties/Settings.Designer.cs
  6. BIN
      CNASBalanceDBManage/database_16px_1229703_easyicon.net.ico
  7. +17
    -17
      CNASBalanceDBManage/frmBalanceDB.Designer.cs
  8. +20
    -3
      CNASBalanceDBManage/frmBalanceDB.cs
  9. +11
    -0
      CNAS_Authorize/App.config
  10. +9
    -0
      CNAS_Authorize/App.xaml
  11. +17
    -0
      CNAS_Authorize/App.xaml.cs
  12. +119
    -0
      CNAS_Authorize/CNAS_Authorize.csproj
  13. +252
    -0
      CNAS_Authorize/MachineAuth.cs
  14. +130
    -0
      CNAS_Authorize/MainWindow.xaml
  15. +189
    -0
      CNAS_Authorize/MainWindow.xaml.cs
  16. +55
    -0
      CNAS_Authorize/Properties/AssemblyInfo.cs
  17. +71
    -0
      CNAS_Authorize/Properties/Resources.Designer.cs
  18. +117
    -0
      CNAS_Authorize/Properties/Resources.resx
  19. +30
    -0
      CNAS_Authorize/Properties/Settings.Designer.cs
  20. +7
    -0
      CNAS_Authorize/Properties/Settings.settings
  21. +32
    -24
      CNAS_BalanceClient/App.config
  22. +24
    -2
      CNAS_BalanceClient/CNAS_BalanceClient.csproj
  23. +0
    -12
      CNAS_BalanceClient/IBalanceReceive.cs
  24. +11
    -2
      CNAS_BalanceClient/Program.cs
  25. +26
    -34
      CNAS_BalanceClient/Properties/Resources.Designer.cs
  26. +13
    -17
      CNAS_BalanceClient/Properties/Settings.Designer.cs
  27. +2
    -2
      CNAS_BalanceClient/UIOperation/BalanceMainOperation.cs
  28. +1
    -1
      CNAS_BalanceClient/UIOperation/CrucibleUIOperation.cs
  29. +4
    -4
      CNAS_BalanceClient/UIOperation/HuiFaFenUIOperation.cs
  30. +8
    -8
      CNAS_BalanceClient/UIOperation/HuiFenUIOperation.cs
  31. +7
    -7
      CNAS_BalanceClient/UIOperation/QuanShuiFenUIOperation.cs
  32. +4
    -4
      CNAS_BalanceClient/UIOperation/ShuiFenUIOperation.cs
  33. +253
    -179
      CNAS_BalanceClient/frmBalanceField.Designer.cs
  34. +72
    -5
      CNAS_BalanceClient/frmBalanceField.cs
  35. +53
    -43
      CNAS_BalanceClient/frmBalanceMain.Designer.cs
  36. +186
    -99
      CNAS_BalanceClient/frmBalanceMain.cs
  37. +16
    -16
      CNAS_BalanceClient/frmBalanceMain.resx
  38. +257
    -0
      CNAS_BalanceClient/frmConditionMap.Designer.cs
  39. +556
    -0
      CNAS_BalanceClient/frmConditionMap.cs
  40. +182
    -0
      CNAS_BalanceClient/frmConditionMap.resx
  41. +3
    -0
      CNAS_BalanceClient/frmConfigPort.Designer.cs
  42. +8
    -3
      CNAS_BalanceClient/frmConfigPort.cs
  43. +114
    -65
      CNAS_BalanceClient/frmHistory.Designer.cs
  44. +10
    -2
      CNAS_BalanceClient/frmHistory.cs
  45. +12
    -0
      CNAS_BalanceClient/frmHistory.resx
  46. +47
    -39
      CNAS_BalanceClient/frmLoginServer.Designer.cs
  47. +14
    -5
      CNAS_BalanceClient/frmLoginServer.cs
  48. +240
    -0
      CNAS_BalanceClient/frmLoginServer.resx
  49. BIN
      CNAS_BalanceClient/scales_of_Balance_16px_1117673_easyicon.net.ico
  50. +14
    -2
      CNAS_DBSync.sln
  51. +46
    -33
      CNAS_DBSync/App.config
  52. +43
    -1
      CNAS_DBSync/CNAS_DBSync.csproj
  53. +264
    -0
      CNAS_DBSync/FormSizeHelper.cs
  54. +24
    -5
      CNAS_DBSync/Program.cs
  55. +26
    -34
      CNAS_DBSync/Properties/Resources.Designer.cs
  56. +11
    -2
      CNAS_DBSync/Properties/Settings.Designer.cs
  57. +5
    -2
      CNAS_DBSync/Properties/Settings.settings
  58. +63
    -0
      CNAS_DBSync/SourceSettingTextBoxDecrible.cs
  59. BIN
      CNAS_DBSync/drum_set_16px_1218345_easyicon.net.ico
  60. +73
    -2
      CNAS_DBSync/frmCNASValue.cs
  61. +308
    -201
      CNAS_DBSync/frmDatabaseParams.Designer.cs
  62. +101
    -15
      CNAS_DBSync/frmDatabaseParams.cs
  63. +2
    -36
      CNAS_DBSync/frmInstrumentCode.Designer.cs
  64. +16
    -9
      CNAS_DBSync/frmInstrumentCode.cs
  65. +35
    -35
      CNAS_DBSync/frmServiceConfig.Designer.cs
  66. +4
    -3
      CNAS_DBSync/frmServiceConfig.cs
  67. +27
    -17
      CNAS_DBSync/frmSourceFilter.cs
  68. +1357
    -0
      CNAS_DBSync/frmSourceSetting.Designer.cs
  69. +994
    -0
      CNAS_DBSync/frmSourceSetting.cs
  70. +167
    -0
      CNAS_DBSync/frmSourceSetting.resx
  71. +177
    -0
      CNAS_DBSync/frmStartEndSubstring.Designer.cs
  72. +64
    -0
      CNAS_DBSync/frmStartEndSubstring.cs
  73. +0
    -0
      CNAS_DBSync/frmStartEndSubstring.resx
  74. +575
    -431
      CNAS_DBSync/frmSyncParams.Designer.cs
  75. +146
    -18
      CNAS_DBSync/frmSyncParams.cs
  76. +6
    -3
      CNAS_DBSync/frmSyncParams.resx
  77. +268
    -0
      CNAS_DBSync/frmSystemSetting.Designer.cs
  78. +72
    -0
      CNAS_DBSync/frmSystemSetting.cs
  79. +167
    -0
      CNAS_DBSync/frmSystemSetting.resx
  80. +5
    -5
      CNAS_DBSync/packages.config
  81. +21
    -0
      CNAS_PortDataParsing/BalancePortParsing.cs
  82. +49
    -0
      CNAS_PortDataParsing/CNAS_PortDataParsing.csproj
  83. +25
    -0
      CNAS_PortDataParsing/IDataParsing.cs
  84. +36
    -0
      CNAS_PortDataParsing/Properties/AssemblyInfo.cs
  85. +27
    -11
      CNAS_RunSync/CNAS_RunSync.csproj
  86. +390
    -0
      CNAS_RunSync/KMenuTabControl.cs
  87. +20
    -3
      CNAS_RunSync/Program.cs
  88. +3
    -3
      CNAS_RunSync/Properties/Resources.Designer.cs
  89. +1
    -1
      CNAS_RunSync/Properties/Settings.Designer.cs
  90. BIN
      CNAS_RunSync/Synchronize_16px_1190987_easyicon.net.ico
  91. BIN
      CNAS_RunSync/Synchronize_show.ico
  92. +28
    -25
      CNAS_RunSync/app.config
  93. +0
    -192
      CNAS_RunSync/frmSyncShow.Designer.cs
  94. +0
    -64
      CNAS_RunSync/frmSyncShow.cs
  95. +218
    -0
      CNAS_RunSync/frmSynchrousMain.Designer.cs
  96. +118
    -0
      CNAS_RunSync/frmSynchrousMain.cs
  97. +1
    -18
      CNAS_RunSync/frmSynchrousMain.resx
  98. +263
    -100
      CNAS_RunSync/ucSynchrousMain.Designer.cs
  99. +218
    -74
      CNAS_RunSync/ucSynchrousMain.cs
  100. +133
    -0
      CNAS_RunSync/ucSynchrousMain.resx

+ 26
- 25
CNASBalanceDBManage/App.config Näytä tiedosto

@@ -1,48 +1,49 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<appSettings>
<add key="TargetDBType" value="Mysql" />
<add key="InitalOperationPwd" value="123456" />
<add key="TargetDBType" value="Oracle"/>
<add key="InitalOperationPwd" value="123456"/>
<add key="StartWebApiUrl" value="0"/>
</appSettings>
<log4net>
<logger name="Log">
<level value="INFO" />
<appender-ref ref="RollingLog" />
<level value="INFO"/>
<appender-ref ref="RollingLog"/>
</logger>
<logger name="Err">
<level value="ERROR" />
<appender-ref ref="RollingErr" />
<level value="ERROR"/>
<appender-ref ref="RollingErr"/>
</logger>
<appender name="RollingLog" type="log4net.Appender.RollingFileAppender">
<file value="Log\" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.txt'" />
<staticLogFileName value="false" />
<file value="Log\"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyyMMdd'.txt'"/>
<staticLogFileName value="false"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 操作信息:%m%n" />
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 操作信息:%m%n"/>
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="INFO" />
<param name="LevelMin" value="INFO"/>
<param name="LevelMax" value="INFO"/>
</filter>
</appender>
<appender name="RollingErr" type="log4net.Appender.RollingFileAppender">
<file value="ErrorLog\" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.txt'" />
<staticLogFileName value="false" />
<file value="ErrorLog\"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyyMMdd'.txt'"/>
<staticLogFileName value="false"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 错误描述:%m%n" />
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 错误描述:%m%n"/>
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="ERROR" />
<param name="LevelMax" value="ERROR" />
<param name="LevelMin" value="ERROR"/>
<param name="LevelMax" value="ERROR"/>
</filter>
</appender>
</log4net>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

+ 11
- 1
CNASBalanceDBManage/CNASBalanceDBManage.csproj Näytä tiedosto

@@ -8,9 +8,10 @@
<OutputType>WinExe</OutputType>
<RootNamespace>CNASBalanceDBManage</RootNamespace>
<AssemblyName>CNASBalanceDBManage</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
@@ -21,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -30,6 +32,10 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>database_16px_1229703_easyicon.net.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
@@ -67,6 +73,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="App.config" />
<None Include="Properties\Settings.settings">
@@ -93,5 +100,8 @@
<Name>CnasSynchrousModel</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="database_16px_1229703_easyicon.net.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

+ 10
- 1
CNASBalanceDBManage/Program.cs Näytä tiedosto

@@ -1,4 +1,6 @@
using System;
using CnasSynchronusClient;
using CnasSynchrousModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
@@ -15,6 +17,13 @@ namespace CNASBalanceDBManage
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

SystemFormatConfig systemFormat = FileOperation.GetSystemFormatConfigData();
GlobalCommonOperation.strStartGeneralVersion = systemFormat.StartGeneralVersion;
GlobalCommonOperation.strStartWebApi = systemFormat.StartWebApi;
GlobalCommonOperation.strWebApiUrl = systemFormat.WebApiUrl;
GlobalCommonOperation.strTargetDbType = systemFormat.TargetDBType;

Application.Run(new frmBalanceDB());
}
}


+ 26
- 34
CNASBalanceDBManage/Properties/Resources.Designer.cs Näytä tiedosto

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

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

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()
{
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CNASBalanceDBManage.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
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}


+ 13
- 17
CNASBalanceDBManage/Properties/Settings.Designer.cs Näytä tiedosto

@@ -1,28 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace CNASBalanceDBManage.Properties
{


namespace CNASBalanceDBManage.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
{

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.3.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
{
public static Settings Default {
get {
return defaultInstance;
}
}


BIN
CNASBalanceDBManage/database_16px_1229703_easyicon.net.ico Näytä tiedosto

Before After

+ 17
- 17
CNASBalanceDBManage/frmBalanceDB.Designer.cs Näytä tiedosto

@@ -31,7 +31,7 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmBalanceDB));
this.pnlAll = new System.Windows.Forms.Panel();
this.pnlCenter = new System.Windows.Forms.Panel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabSetting = new System.Windows.Forms.TabControl();
this.tabCNASDB = new System.Windows.Forms.TabPage();
this.btnCNASTestLink = new System.Windows.Forms.Button();
this.txtPort = new System.Windows.Forms.TextBox();
@@ -69,7 +69,7 @@
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.pnlAll.SuspendLayout();
this.pnlCenter.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabSetting.SuspendLayout();
this.tabCNASDB.SuspendLayout();
this.tabPlatForm.SuspendLayout();
this.tabPwd.SuspendLayout();
@@ -89,24 +89,24 @@
//
// pnlCenter
//
this.pnlCenter.Controls.Add(this.tabControl1);
this.pnlCenter.Controls.Add(this.tabSetting);
this.pnlCenter.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlCenter.Location = new System.Drawing.Point(0, 0);
this.pnlCenter.Name = "pnlCenter";
this.pnlCenter.Size = new System.Drawing.Size(493, 258);
this.pnlCenter.TabIndex = 1;
//
// tabControl1
// tabSetting
//
this.tabControl1.Controls.Add(this.tabCNASDB);
this.tabControl1.Controls.Add(this.tabPlatForm);
this.tabControl1.Controls.Add(this.tabPwd);
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(493, 258);
this.tabControl1.TabIndex = 36;
this.tabSetting.Controls.Add(this.tabCNASDB);
this.tabSetting.Controls.Add(this.tabPlatForm);
this.tabSetting.Controls.Add(this.tabPwd);
this.tabSetting.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabSetting.Location = new System.Drawing.Point(0, 0);
this.tabSetting.Name = "tabSetting";
this.tabSetting.SelectedIndex = 0;
this.tabSetting.Size = new System.Drawing.Size(493, 258);
this.tabSetting.TabIndex = 36;
//
// tabCNASDB
//
@@ -126,7 +126,7 @@
this.tabCNASDB.Padding = new System.Windows.Forms.Padding(3);
this.tabCNASDB.Size = new System.Drawing.Size(485, 228);
this.tabCNASDB.TabIndex = 0;
this.tabCNASDB.Text = "CNAS数据库";
this.tabCNASDB.Text = "目标数据库";
this.tabCNASDB.UseVisualStyleBackColor = true;
//
// btnCNASTestLink
@@ -238,7 +238,7 @@
this.tabPlatForm.Name = "tabPlatForm";
this.tabPlatForm.Size = new System.Drawing.Size(485, 228);
this.tabPlatForm.TabIndex = 2;
this.tabPlatForm.Text = "平台数据库";
this.tabPlatForm.Text = "目标平台数据库";
this.tabPlatForm.UseVisualStyleBackColor = true;
//
// btnPlatTest
@@ -455,7 +455,7 @@
this.Load += new System.EventHandler(this.frmBalanceDB_Load);
this.pnlAll.ResumeLayout(false);
this.pnlCenter.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabSetting.ResumeLayout(false);
this.tabCNASDB.ResumeLayout(false);
this.tabCNASDB.PerformLayout();
this.tabPlatForm.ResumeLayout(false);
@@ -487,7 +487,7 @@
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabControl tabSetting;
private System.Windows.Forms.TabPage tabCNASDB;
private System.Windows.Forms.TabPage tabPwd;
private System.Windows.Forms.TextBox txtRepeatPwd;


+ 20
- 3
CNASBalanceDBManage/frmBalanceDB.cs Näytä tiedosto

@@ -28,7 +28,15 @@ namespace CNASBalanceDBManage
return;
}

if (CnasDataOperationFact.CnasDataOperation().TestConnect(this.txtDBHost.Text.Trim(), this.txtDBName.Text.Trim(), this.txtDBUser.Text.Trim(), this.txtDBPwd.Text.Trim(), this.txtPort.Text.Trim()))
if (CnasDataOperationFact.CnasDataOperation().TestConnect(new DataBaseInfo()
{
DataBaseCode="cnas",
DBHost = this.txtDBHost.Text.Trim(),
DBName = this.txtDBName.Text.Trim(),
DBUser = this.txtDBUser.Text.Trim(),
DBPwd = this.txtDBPwd.Text.Trim(),
DBPort = this.txtPort.Text.Trim()
}))
MessageBox.Show("连接成功!");
else
MessageBox.Show("连接失败!");
@@ -55,7 +63,7 @@ namespace CNASBalanceDBManage
this.txtPlatPort.Text = PlatDataBase.DBPort;
}

strOldPwd = FileOperation.GetLocalOperationPwd();
strOldPwd = FileOperation.GetLocalOperationPwd();
}

private void btnOK_Click(object sender, EventArgs e)
@@ -196,10 +204,19 @@ namespace CNASBalanceDBManage
return;
}

if (CnasDataOperationFact.CnasDataOperation().TestConnect(this.txtPlatHost.Text.Trim(), this.txtPlatServer.Text.Trim(), this.txtPlatUser.Text.Trim(), this.txtPlatPwd.Text.Trim(), this.txtPlatPort.Text.Trim()))
//if (CnasDataOperationFact.CnasDataOperation().TestConnect(this.txtPlatHost.Text.Trim(), this.txtPlatServer.Text.Trim(), this.txtPlatUser.Text.Trim(), this.txtPlatPwd.Text.Trim(), this.txtPlatPort.Text.Trim()))
if (CnasDataOperationFact.CnasDataOperation().TestConnect(new DataBaseInfo()
{
DBHost = this.txtPlatHost.Text.Trim(),
DBName = this.txtPlatServer.Text.Trim(),
DBUser = this.txtPlatUser.Text.Trim(),
DBPwd = this.txtPlatPwd.Text.Trim(),
DBPort = this.txtPlatPort.Text.Trim()
}))
MessageBox.Show("连接成功!");
else
MessageBox.Show("连接失败!");
}
}
}

+ 11
- 0
CNAS_Authorize/App.config Näytä tiedosto

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="TargetDBType" value="Oracle"/>
<add key="InitalOperationPwd" value="123456"/>
<add key="StartWebApiUrl" value="0"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>

+ 9
- 0
CNAS_Authorize/App.xaml Näytä tiedosto

@@ -0,0 +1,9 @@
<Application x:Class="CNAS_Authorize.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CNAS_Authorize"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

+ 17
- 0
CNAS_Authorize/App.xaml.cs Näytä tiedosto

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace CNAS_Authorize
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
}
}

+ 119
- 0
CNAS_Authorize/CNAS_Authorize.csproj Näytä tiedosto

@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" 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>{9B4A6989-A7A6-41C0-ADFE-D470EB972D79}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CNAS_Authorize</RootNamespace>
<AssemblyName>CNAS_Authorize</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</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="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MachineAuth.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CnasSynchronusClient\CnasSynchronusBLL.csproj">
<Project>{CB9B6D92-3CC4-46C6-92E8-A6FD0AD48041}</Project>
<Name>CnasSynchronusBLL</Name>
</ProjectReference>
<ProjectReference Include="..\CnasSynchrousModel\CnasSynchrousModel.csproj">
<Project>{0C3243F5-729E-409C-B406-C6DE56E632E0}</Project>
<Name>CnasSynchrousModel</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

+ 252
- 0
CNAS_Authorize/MachineAuth.cs Näytä tiedosto

@@ -0,0 +1,252 @@
using CnasSynchronusClient;
using CnasSynchrousModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace CNAS_Authorize
{
public class Machine
{
public string FactoryName { get; set; }
public string MachineCode { get; set; }
public string ImportTime { get; set; }
public bool IsGenerated { get; set; }

public Machine(string name, string code, string time, bool isGen)
{
FactoryName = name;
MachineCode = code;
ImportTime = time;
IsGenerated = isGen;
}

}

class MachineAuth
{
/// <summary>
/// 所有数据行
/// </summary>
private List<Machine> m_machines;
/// <summary>
/// 编码过滤
/// </summary>
private string m_filter_code;
/// <summary>
/// 名称过滤
/// </summary>
private string m_filter_factory;
//以下都是过滤过的数据
/// <summary>
/// 过滤过的数据
/// </summary>
private List<Machine> m_rangle;
/// <summary>
/// 过滤过的当前页
/// </summary>
private List<Machine> m_page;
/// <summary>
/// 每页数量
/// </summary>
private int m_pageSize;
/// <summary>
/// 页号
/// </summary>
private int m_pageIndex;
/// <summary>
/// 总页数
/// </summary>
private int m_pageCount;


public MachineAuth()
{
m_pageSize = 10;
m_pageIndex = 1;
}
DataBaseInfo targetDataBase = new DataBaseInfo();
public void Load()
{
//加载CNAS数据库配置
targetDataBase = FileOperation.GetLocalCnasDB();
if (!CnasDataOperationFact.CnasDataOperation().TestConnect(targetDataBase))
{
MessageBox.Show("CNAS数据库无法正常连接...", "提示");
return;
}


m_machines = new List<Machine>();
////1.加载数据
DataTable dtmacaddressinfo = CnasDataOperationFact.CnasDataOperation().GetTableData(targetDataBase, "select * from macaddress");
if (dtmacaddressinfo != null && dtmacaddressinfo.Rows.Count > 0)
{
List<string> lstCnasTables = new List<string>();
foreach (DataRow dr in dtmacaddressinfo.Rows)
{
Machine m = new Machine( dr["PLANTCODE"].ToString(), dr["MAC_ADDRESS"].ToString(), dr["CREATETIME"].ToString(), true);
m_machines.Add(m);
lstCnasTables.Add(dr["MAC_ADDRESS"].ToString());
}
}

//获取Machine表的数据
//m_machines = new List<Machine>();
////TEST DATA
//for(int i = 0; i < 15; i++)
//{
// Machine m = new Machine("MACHINEE"+ (i+1), "CODE" + (i + 1), "2025-02-02", i%2==0);
// m_machines.Add(m);
//}

m_rangle = new List<Machine>();
m_rangle.AddRange(m_machines);

m_pageSize = 10;
m_pageIndex = 1;
m_pageCount = (m_rangle.Count / m_pageSize) + (m_rangle.Count % m_pageSize == 0 ? 0 : 1);

m_page = getPageData(m_pageIndex);

}

public int PageSize
{
get { return m_pageSize; }
set
{
m_pageSize = value;
updateView();
}
}

public string CurrentPage
{
get
{
return m_pageCount == 0 ? "" : string.Format("{0} / {1}", m_pageIndex, m_pageCount);
}
set
{

}
}

public int TotalCount
{
get
{
return m_machines == null ? 0 : m_machines.Count;
}
set
{

}
}

private void updateView()
{
List<Machine> view = new List<Machine>();
if (!string.IsNullOrEmpty(m_filter_code) || !string.IsNullOrEmpty(m_filter_factory))
{
foreach (Machine item in m_machines)
{
bool flag = true;
if (!string.IsNullOrEmpty(m_filter_code))
{
if (item.MachineCode.IndexOf(m_filter_code) == -1)
{
flag = false;
}
}
if (!string.IsNullOrEmpty(m_filter_factory))
{
if (item.FactoryName.IndexOf(m_filter_factory) == -1)
{
flag = false;
}
}
if (flag)
{
view.Add(item);
}
}
}
else
{
view.AddRange(m_machines);
}
m_rangle = view;
m_pageIndex = 1;
m_pageCount = (m_rangle.Count / m_pageSize) + (m_rangle.Count % m_pageSize == 0 ? 0 : 1);
m_page = getPageData(m_pageIndex);
}

public void ChangeFilter(string code, string factory)
{
this.m_filter_code = code;
this.m_filter_factory = factory;

updateView();
}

public List<Machine> Page
{
get
{
return m_page;
}
}

private List<Machine> getPageData(int pageIndex)
{
int index = (pageIndex - 1) * m_pageSize;
List<Machine> page = new List<Machine>(m_pageSize);
for (int i = 0; i < m_pageSize && index < m_rangle.Count; i++)
{
page.Add(m_rangle[index]);
index++;
}
return page;
}

public List<Machine> NextPage(out bool ok)
{
int index = m_pageIndex * m_pageSize;
if (m_rangle == null || index >= m_rangle.Count)
{
ok = false;
return null;
}

m_pageIndex++;
m_page = getPageData(m_pageIndex);

ok = true;
return m_page;
}

public List<Machine> PrevPage(out bool ok)
{
if (m_pageIndex == 1 || m_rangle == null)
{
ok = false;
return null;
}
m_pageIndex--;

m_page = getPageData(m_pageIndex);

ok = true;
return m_page;

}


}
}

+ 130
- 0
CNAS_Authorize/MainWindow.xaml Näytä tiedosto

@@ -0,0 +1,130 @@
<Window x:Class="CNAS_Authorize.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CNAS_Authorize"
mc:Ignorable="d"
Title="取数端授权程序" Height="460" Width="805" Loaded="Window_Loaded" SizeChanged="Window_SizeChanged">
<DockPanel>
<!--NORTH部分:固定高度,包含两个查询条件-->
<Grid x:Name="northPanel" Margin="10" Height="60" DockPanel.Dock="Top">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<StackPanel Grid.Row="0" Orientation="Horizontal">
<Label x:Name="lbMachine" Content="机器识别码:" Width="100" />
<TextBox x:Name="edtMachine" Width="350" >
<TextBox.Resources>
<VisualBrush x:Key="HintText" TileMode="None" Opacity="0.5" Stretch="None" AlignmentX="Left">
<VisualBrush.Visual>
<TextBlock FontStyle="Italic" Text="请输入机器识别码进行查询后在下方列表中下载对应激活码,如查询不到机器识别码则填写电厂名称后进行导入"/>
</VisualBrush.Visual>
</VisualBrush>
</TextBox.Resources>
<TextBox.Style>
<Style TargetType="TextBox">
<Style.Triggers>
<Trigger Property="Text" Value="{x:Null}">
<Setter Property="Background" Value="{StaticResource HintText}"/>
</Trigger>
<Trigger Property="Text" Value="">
<Setter Property="Background" Value="{StaticResource HintText}"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
<Button x:Name="btnQuery" Content="搜索" Width="60" Click="Query_Click" />
</StackPanel>

<StackPanel Grid.Row="1" Orientation="Horizontal">
<Label Content="授权电厂名称:" Width="100" />
<TextBox x:Name="edtFactory" Width="350" >
<TextBox.Resources>
<VisualBrush x:Key="HintText" TileMode="None" Opacity="0.5" Stretch="None" AlignmentX="Left">
<VisualBrush.Visual>
<TextBlock FontStyle="Italic" Text="请输入电厂名称,非必填"/>
</VisualBrush.Visual>
</VisualBrush>
</TextBox.Resources>
<TextBox.Style>
<Style TargetType="TextBox">
<Style.Triggers>
<Trigger Property="Text" Value="{x:Null}">
<Setter Property="Background" Value="{StaticResource HintText}"/>
</Trigger>
<Trigger Property="Text" Value="">
<Setter Property="Background" Value="{StaticResource HintText}"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
<Button x:Name="btnConfirmImport" Content="确认导入" Width="60" Click="ConfirmImport_Click" />
</StackPanel>
</Grid>
<Grid x:Name="southPanel" DockPanel.Dock="Bottom" Height="30">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center">
<Label Content="共有条数:" />
<TextBox Width="50" Text="{Binding TotalCount}" IsEnabled="False" VerticalAlignment="Center" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" />
<Button x:Name="btnPrev" Content="上一页" Margin="5" Click="PrevPage_Click" />
<Button x:Name="btnNext" Content="下一页" Margin="5" Click="NextPage_Click" />
<TextBox Width="50" Text="{Binding CurrentPage}" IsEnabled="False" VerticalAlignment="Center" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" />
</StackPanel>
</Grid>
<!--CENTER部分:表格,包含列:"电厂名称"、"机器识别码"、"导入时间"、"是否已经生成激活码"和"操作"6列-->
<ScrollViewer x:Name="centerPanel" Margin="10">
<DataGrid Name="dataGrid"
AutoGenerateColumns="False"
SelectionMode="Single"
VerticalAlignment="Stretch"
HorizontalAlignment="Left"
Width="750"
Height="300" IsReadOnly="True">
<!--列定义-->
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding FactoryName}" Header="电厂名称" Width="120" CanUserSort="False" />
<DataGridTextColumn Binding="{Binding MachineCode}" Header="机器识别码" Width="220" CanUserSort="False" />
<DataGridTextColumn Binding="{Binding ImportTime}" Header="导入时间" Width="100" CanUserSort="False" />
<DataGridCheckBoxColumn Binding="{Binding IsGenerated}"
Header="是否已经生成激活码"
Width="130"
CanUserSort="False">
<DataGridCheckBoxColumn.ElementStyle>
<Style TargetType="CheckBox">
<Setter Property="IsEnabled" Value="False"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridCheckBoxColumn.ElementStyle>
<DataGridCheckBoxColumn.HeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
</DataGridCheckBoxColumn.HeaderStyle>
</DataGridCheckBoxColumn>
<DataGridTemplateColumn Header="操作" Width="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="下载激活码"
Click="DownloadActivationCode_Click"
Margin="5"
Height="25"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</ScrollViewer>

</DockPanel>
</Window>

+ 189
- 0
CNAS_Authorize/MainWindow.xaml.cs Näytä tiedosto

@@ -0,0 +1,189 @@
using CnasSynchronusClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CNAS_Authorize
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{

private MachineAuth m_machines;

public MainWindow()
{
InitializeComponent();

}

private void Window_Loaded(object sender, RoutedEventArgs e)
{
m_machines = new MachineAuth();
m_machines.Load();
dataGrid.ItemsSource = m_machines.Page;
this.DataContext = m_machines;
}

private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
{
if (this.Width < 500) return;
dataGrid.Width = this.Width - 48;
dataGrid.Height = centerPanel.Height;

//设置列宽
double colWidth = this.Width - 60;// centerPanel.Width;
for (int i = 1; i < dataGrid.Columns.Count; i++)
{
colWidth = colWidth - dataGrid.Columns[i].Width.Value;
}
if (colWidth > 0)
dataGrid.Columns[0].Width = colWidth;

edtMachine.Width = this.Width - lbMachine.Width - btnQuery.Width - 48;
edtFactory.Width = edtMachine.Width;

}

private void refreshBind()
{
this.DataContext = null;
this.DataContext = m_machines;
}

private void PrevPage_Click(object sender, RoutedEventArgs e)
{
bool ok;
List<Machine> page = m_machines.PrevPage(out ok);
if (ok)
{
dataGrid.ItemsSource = page;
refreshBind();
}


}

private void NextPage_Click(object sender, RoutedEventArgs e)
{
bool ok;
List<Machine> page = m_machines.NextPage(out ok);
if (ok)
{
dataGrid.ItemsSource = page;
refreshBind();
}

}

private void Query_Click(object sender, RoutedEventArgs e)
{
m_machines.ChangeFilter(edtMachine.Text.Trim(), edtFactory.Text.Trim());
dataGrid.ItemsSource = m_machines.Page;
refreshBind();
}

private void ConfirmImport_Click(object sender, RoutedEventArgs e)
{
//MySQLHelper.ExecuteNonQuery(strInsertSql, parameters);
//int iReturn = CnasDataOperationFact.CnasDataOperation().InsertDataToCNASTable(ConvertDataRowToTable(drNewTarget), targetdataBase, banlanceitem.syncParamasInfos, banlanceitem.CnasInstrumentColumn, banlanceitem.lstFixedValue);
//if (iReturn <= 0) //此时出现问题
//{
// if (iReturn == -1)
// {
// AppLog.ServiceInfo("数据库连接中断,终止本次上传。");
// break; //此时数据库连接中断,直接跳出循环,结束本次数据同步传输
// }
// else if (iReturn == -2) //等于-2表示插入准备更新时发现数据一致,不再执行
// {
// OtherCount++;
// }
// else
// {
// ErrorCount++;
// /*需要转换一下,否则会将整个dt全部写入日志*/
// lstError.Add(GlobalCommonOperation.ConvertDataRowToTable(drNewTarget).Rows[0]);
// }

// bSuccess = false;
//}
}

private void DownloadActivationCode_Click(object sender, RoutedEventArgs e)
{
var button = sender as Button;
var machine = button.DataContext as Machine;
if (machine != null)
{
try
{
// 生成激活码
string activationCode = GenerateActivationCode(machine.MachineCode);
// 创建保存文件对话框
var saveFileDialog = new Microsoft.Win32.SaveFileDialog
{
FileName = $"激活码_{machine.MachineCode}_{DateTime.Now:yyyyMMdd}",
DefaultExt = ".txt",
Filter = "文本文件|*.txt"
};

if (saveFileDialog.ShowDialog() == true)
{
// 将激活码写入文件
System.IO.File.WriteAllText(saveFileDialog.FileName, activationCode);
MessageBox.Show("激活码已成功保存!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
// 更新状态
machine.IsGenerated = true;
refreshBind();
}
}
catch (Exception ex)
{
MessageBox.Show($"下载激活码失败: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}

private string GenerateActivationCode(string machineCode)
{
// 这里实现激活码生成算法
// 示例:简单的加密算法,实际应用中应该使用更安全的加密方式
using (var md5 = System.Security.Cryptography.MD5.Create())
{
// 加入时间戳使得生成的激活码具有时效性
string input = machineCode + DateTime.Now.ToString("yyyyMMdd");
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
byte[] hashBytes = md5.ComputeHash(inputBytes);
// 转换为16进制字符串
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
sb.Append(hashBytes[i].ToString("X2"));
// 每4个字符添加一个分隔符,提高可读性
if ((i + 1) % 4 == 0 && i != hashBytes.Length - 1)
{
sb.Append("-");
}
}
return sb.ToString();
}
}
}
}

+ 55
- 0
CNAS_Authorize/Properties/AssemblyInfo.cs Näytä tiedosto

@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;

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

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

//若要开始生成可本地化的应用程序,请
//<PropertyGroup> 中的 .csproj 文件中
//例如,如果您在源文件中使用的是美国英语,
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
//对以下 NeutralResourceLanguage 特性的注释。 更新
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。

//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]


[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //主题特定资源词典所处位置
//(当资源未在页面
//或应用程序资源字典中找到时使用)
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
//(当资源未在页面
//、应用程序或任何主题专用资源字典中找到时使用)
)]


// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

+ 71
- 0
CNAS_Authorize/Properties/Resources.Designer.cs Näytä tiedosto

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

namespace CNAS_Authorize.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_Authorize.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_Authorize/Properties/Resources.resx Näytä tiedosto

@@ -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_Authorize/Properties/Settings.Designer.cs Näytä tiedosto

@@ -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_Authorize.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_Authorize/Properties/Settings.settings Näytä tiedosto

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

+ 32
- 24
CNAS_BalanceClient/App.config Näytä tiedosto

@@ -1,48 +1,56 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="System.Configuration.IgnoreSectionHandler"/>
</configSections>
<appSettings>
<add key="TargetDBType" value="Mysql" />
<add key="InitalOperationPwd" value="123456" />
<add key="TargetDBType" value="Mysql"/>
<add key="InitalOperationPwd" value="123456"/>
</appSettings>
<log4net>
<logger name="Log">
<level value="INFO" />
<appender-ref ref="RollingLog" />
<level value="INFO"/>
<appender-ref ref="RollingLog"/>
</logger>
<logger name="Err">
<level value="ERROR" />
<appender-ref ref="RollingErr" />
<level value="ERROR"/>
<appender-ref ref="RollingErr"/>
</logger>
<appender name="RollingLog" type="log4net.Appender.RollingFileAppender">
<file value="Log\" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.txt'" />
<staticLogFileName value="false" />
<file value="Log\"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyyMMdd'.txt'"/>
<staticLogFileName value="false"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 操作信息:%m%n" />
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 操作信息:%m%n"/>
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="INFO" />
<param name="LevelMin" value="INFO"/>
<param name="LevelMax" value="INFO"/>
</filter>
</appender>
<appender name="RollingErr" type="log4net.Appender.RollingFileAppender">
<file value="ErrorLog\" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.txt'" />
<staticLogFileName value="false" />
<file value="ErrorLog\"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyyMMdd'.txt'"/>
<staticLogFileName value="false"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 错误描述:%m%n" />
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 错误描述:%m%n"/>
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="ERROR" />
<param name="LevelMax" value="ERROR" />
<param name="LevelMin" value="ERROR"/>
<param name="LevelMax" value="ERROR"/>
</filter>
</appender>
</log4net>
</configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Devart.Data" publicKeyToken="09af7300eec23701" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.0.2194.0" newVersion="5.0.2194.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

+ 24
- 2
CNAS_BalanceClient/CNAS_BalanceClient.csproj Näytä tiedosto

@@ -8,9 +8,10 @@
<OutputType>WinExe</OutputType>
<RootNamespace>CNAS_BalanceClient</RootNamespace>
<AssemblyName>CNAS_BalanceClient</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
@@ -21,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -30,6 +32,10 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>scales_of_Balance_16px_1117673_easyicon.net.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Devart.Data, Version=5.0.2194.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL" />
@@ -49,7 +55,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="IBalanceReceive.cs" />
<Compile Include="frmConditionMap.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmConditionMap.Designer.cs">
<DependentUpon>frmConditionMap.cs</DependentUpon>
</Compile>
<Compile Include="UIOperation\BalanceMainOperation.cs" />
<Compile Include="UIOperation\CrucibleUIOperation.cs" />
<Compile Include="frmBalanceField.cs">
@@ -95,6 +106,9 @@
<EmbeddedResource Include="frmBalanceMain.resx">
<DependentUpon>frmBalanceMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmConditionMap.resx">
<DependentUpon>frmConditionMap.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmConfigPort.resx">
<DependentUpon>frmConfigPort.cs</DependentUpon>
</EmbeddedResource>
@@ -112,6 +126,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="App.config" />
<None Include="Properties\Settings.settings">
@@ -137,6 +152,13 @@
<Project>{0c3243f5-729e-409c-b406-c6de56e632e0}</Project>
<Name>CnasSynchrousModel</Name>
</ProjectReference>
<ProjectReference Include="..\CNAS_SerialPort\CNAS_SerialPort.csproj">
<Project>{abb56058-b6fd-4747-a4e9-9c9361d6d993}</Project>
<Name>CNAS_SerialPort</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="scales_of_Balance_16px_1117673_easyicon.net.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

+ 0
- 12
CNAS_BalanceClient/IBalanceReceive.cs Näytä tiedosto

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

namespace CNAS_BalanceClient
{
public interface IBalanceReceive
{
}
}

+ 11
- 2
CNAS_BalanceClient/Program.cs Näytä tiedosto

@@ -1,4 +1,6 @@
using System;
using CnasSynchronusClient;
using CnasSynchrousModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
@@ -15,7 +17,14 @@ namespace CNAS_BalanceClient
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if(new frmLoginServer().ShowDialog()==DialogResult.OK)

SystemFormatConfig systemFormat = FileOperation.GetSystemFormatConfigData();
GlobalCommonOperation.strStartGeneralVersion = systemFormat.StartGeneralVersion;
GlobalCommonOperation.strStartWebApi = systemFormat.StartWebApi;
GlobalCommonOperation.strWebApiUrl = systemFormat.WebApiUrl;
GlobalCommonOperation.strTargetDbType = systemFormat.TargetDBType;

if (new frmLoginServer().ShowDialog()==DialogResult.OK)
Application.Run(new frmBalanceMain());
}
}


+ 26
- 34
CNAS_BalanceClient/Properties/Resources.Designer.cs Näytä tiedosto

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

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

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()
{
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CNAS_BalanceClient.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
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}


+ 13
- 17
CNAS_BalanceClient/Properties/Settings.Designer.cs Näytä tiedosto

@@ -1,28 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// 此代码由工具生成。
// 运行时版本: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_BalanceClient.Properties
{


namespace CNAS_BalanceClient.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
{

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.3.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
{
public static Settings Default {
get {
return defaultInstance;
}
}


+ 2
- 2
CNAS_BalanceClient/UIOperation/BalanceMainOperation.cs Näytä tiedosto

@@ -335,13 +335,13 @@ namespace CNAS_BalanceClient
{
if (value < 0 || value > 100)
{
MessageBox.Show("输入值范围为0~100");
MessageBox.Show("输入值范围为0~100", "提示");
bIfSuccess = false;
}
}
else
{
MessageBox.Show("输入值范围为0~100的数字");
MessageBox.Show("输入值范围为0~100的数字", "提示");
bIfSuccess = false;
}
return bIfSuccess;


+ 1
- 1
CNAS_BalanceClient/UIOperation/CrucibleUIOperation.cs Näytä tiedosto

@@ -44,7 +44,7 @@ namespace CNAS_BalanceClient
}
if (defaultdouble > MaxValue || defaultdouble < MinValue)
{
MessageBox.Show($"称重范围是{MinValue}g~{MaxValue}g.");
MessageBox.Show($"称重范围是{MinValue}g~{MaxValue}g.", "提示");
return;
}



+ 4
- 4
CNAS_BalanceClient/UIOperation/HuiFaFenUIOperation.cs Näytä tiedosto

@@ -30,7 +30,7 @@ namespace CNAS_BalanceClient
case "4": //空坩埚重
if (balanceWeight < 15 || balanceWeight > 20)
{
MessageBox.Show("样重范围是15g~20g");
MessageBox.Show("样重范围是15g~20g", "提示");
bIfUpdate = false;
}
else
@@ -59,7 +59,7 @@ namespace CNAS_BalanceClient

if (query[0].AddSample_Weight != 0 && balanceWeight > query[0].AddSample_Weight)
{
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。");
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。", "提示");
bIfUpdate = false;
}
else
@@ -109,7 +109,7 @@ namespace CNAS_BalanceClient
percentdouble = CalculateOperation.CalculateVr(query[0].AddSample_Weight, query[0].Sample_Weight, new double[3] { query[0].BurningResidue_Weight, query[0].SecondBurningResidue_Weight, query[0].ThirdBurningResidue_Weight }, ref strMsg);
if (percentdouble > 100 || percentdouble < 0)
{
MessageBox.Show("百分比计算结果出错,请调整数据。");
MessageBox.Show("百分比计算结果出错,请调整数据。", "提示");
return false;
}
dgvHuiFaFen.Rows[currentRowIndex].Cells["Vr"].Value = percentdouble;
@@ -117,7 +117,7 @@ namespace CNAS_BalanceClient
percentdouble = CalculateOperation.CalculateVad(CalculateOperation.CalculateVr(query[0].AddSample_Weight, query[0].Sample_Weight, new double[3] { query[0].BurningResidue_Weight, query[0].SecondBurningResidue_Weight, query[0].ThirdBurningResidue_Weight }, ref strMsg), Convert.ToDouble(dgvHuiFaFen.Rows[currentRowIndex].Cells["MAD2"].Value));
if (percentdouble > 100 || percentdouble < 0)
{
MessageBox.Show("百分比计算结果出错,请调整数据。");
MessageBox.Show("百分比计算结果出错,请调整数据。", "提示");
return false;
}
dgvHuiFaFen.Rows[currentRowIndex].Cells["VAD"].Value = percentdouble;


+ 8
- 8
CNAS_BalanceClient/UIOperation/HuiFenUIOperation.cs Näytä tiedosto

@@ -33,7 +33,7 @@ namespace CNAS_BalanceClient
case "5": //样重
if (balanceWeight < 0.9 || balanceWeight > 1.1)
{
MessageBox.Show("样重范围是0.9g~1.1g");
MessageBox.Show("样重范围是0.9g~1.1g", "提示");
bIfUpdate = false;
}
else
@@ -48,7 +48,7 @@ namespace CNAS_BalanceClient
case "7"://烘干重
if (query[0].AddSample_Weight != 0 && balanceWeight > query[0].AddSample_Weight)
{
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。");
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。", "提示");
bIfUpdate = false;
}
else
@@ -65,7 +65,7 @@ namespace CNAS_BalanceClient
case "8"://二次烘干重
if (query[0].AddSample_Weight != 0 && balanceWeight > query[0].AddSample_Weight)
{
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。");
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。", "提示");
bIfUpdate = false;
}
else
@@ -82,7 +82,7 @@ namespace CNAS_BalanceClient
case "9"://三次烘干重
if (query[0].AddSample_Weight != 0 && balanceWeight > query[0].AddSample_Weight)
{
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。");
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。", "提示");
bIfUpdate = false;
}
else
@@ -131,7 +131,7 @@ namespace CNAS_BalanceClient
percentdouble = CalculateOperation.CalculateDecrement(query[0].AddSample_Weight, new double[1] { query[0].BurningResidue_Weight });
if (percentdouble > 100 || percentdouble < 0)
{
MessageBox.Show("百分比计算结果出错,请调整数据。");
MessageBox.Show("百分比计算结果出错,请调整数据。", "提示");
return false;
}
dgvHuiFen.Rows[CurrentRowIndex].Cells["DecrementValue2"].Value = percentdouble;
@@ -141,7 +141,7 @@ namespace CNAS_BalanceClient
percentdouble = CalculateOperation.CalculateDecrement(query[0].AddSample_Weight, new double[2] { query[0].BurningResidue_Weight, query[0].SecondBurningResidue_Weight });
if (percentdouble > 100 || percentdouble < 0)
{
MessageBox.Show("百分比计算结果出错,请调整数据。");
MessageBox.Show("百分比计算结果出错,请调整数据。", "提示");
return false;
}
dgvHuiFen.Rows[CurrentRowIndex].Cells["DecrementValue2"].Value = percentdouble;
@@ -151,7 +151,7 @@ namespace CNAS_BalanceClient
percentdouble = CalculateOperation.CalculateDecrement(query[0].AddSample_Weight, new double[3] { query[0].BurningResidue_Weight, query[0].SecondBurningResidue_Weight, query[0].ThirdBurningResidue_Weight });
if (percentdouble > 100 || percentdouble < 0)
{
MessageBox.Show("百分比计算结果出错,请调整数据。");
MessageBox.Show("百分比计算结果出错,请调整数据。", "提示");
return false;
}
dgvHuiFen.Rows[CurrentRowIndex].Cells["DecrementValue2"].Value = percentdouble;
@@ -160,7 +160,7 @@ namespace CNAS_BalanceClient
percentdouble = CalculateOperation.CalculateAad(query[0].AddSample_Weight, query[0].Sample_Weight, new double[3] { query[0].BurningResidue_Weight, query[0].SecondBurningResidue_Weight, query[0].ThirdBurningResidue_Weight }, ref strMsg);
if (percentdouble > 100 || percentdouble < 0)
{
MessageBox.Show("百分比计算结果出错,请调整数据。");
MessageBox.Show("百分比计算结果出错,请调整数据。", "提示");
return false;
}
dgvHuiFen.Rows[CurrentRowIndex].Cells["AAD"].Value = percentdouble;


+ 7
- 7
CNAS_BalanceClient/UIOperation/QuanShuiFenUIOperation.cs Näytä tiedosto

@@ -45,7 +45,7 @@ namespace CNAS_BalanceClient
}
if (balanceWeight < MinValue || balanceWeight > MaxValue)
{
MessageBox.Show($"样重范围是{MinValue}g~{MaxValue}g");
MessageBox.Show($"样重范围是{MinValue}g~{MaxValue}g.", "提示");
bIfUpdate = false;
}
else
@@ -60,7 +60,7 @@ namespace CNAS_BalanceClient
case "7"://烘干重
if (query[0].AddSample_Weight != 0 && balanceWeight > query[0].AddSample_Weight)
{
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。");
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。", "提示");
bIfUpdate = false;
}
else
@@ -77,7 +77,7 @@ namespace CNAS_BalanceClient
case "8"://二次烘干重
if (query[0].AddSample_Weight != 0 && balanceWeight > query[0].AddSample_Weight)
{
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。");
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。", "提示");
bIfUpdate = false;
}
else
@@ -94,7 +94,7 @@ namespace CNAS_BalanceClient
case "9"://三次烘干重
if (query[0].AddSample_Weight != 0 && balanceWeight > query[0].AddSample_Weight)
{
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。");
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。", "提示");
bIfUpdate = false;
}
else
@@ -146,7 +146,7 @@ namespace CNAS_BalanceClient
percentdouble = CalculateOperation.CalculateMt(query[0].AddSample_Weight, query[0].Sample_Weight, new double[1] { query[0].Drying_Weight }, ref strMsg);
if (percentdouble > 100 || percentdouble < 0)
{
MessageBox.Show("百分比计算结果出错,请调整数据。");
MessageBox.Show("百分比计算结果出错,请调整数据。", "提示");
return false;
}
dgv.Rows[CurrentRowIndex].Cells["Mt"].Value = percentdouble;
@@ -157,7 +157,7 @@ namespace CNAS_BalanceClient
percentdouble = CalculateOperation.CalculateMt(query[0].AddSample_Weight, query[0].Sample_Weight, new double[2] { query[0].Drying_Weight, query[0].SecondDrying_Weight }, ref strMsg);
if (percentdouble > 100 || percentdouble < 0)
{
MessageBox.Show("百分比计算结果出错,请调整数据。");
MessageBox.Show("百分比计算结果出错,请调整数据。", "提示");
return false;
}
dgv.Rows[CurrentRowIndex].Cells["Mt"].Value = percentdouble;
@@ -167,7 +167,7 @@ namespace CNAS_BalanceClient
percentdouble = CalculateOperation.CalculateMt(query[0].AddSample_Weight, query[0].Sample_Weight, new double[3] { query[0].Drying_Weight, query[0].SecondDrying_Weight, query[0].ThirdDrying_Weight }, ref strMsg);
if (percentdouble > 100 || percentdouble < 0)
{
MessageBox.Show("百分比计算结果出错,请调整数据。");
MessageBox.Show("百分比计算结果出错,请调整数据。", "提示");
return false;
}
dgv.Rows[CurrentRowIndex].Cells["Mt"].Value = percentdouble;


+ 4
- 4
CNAS_BalanceClient/UIOperation/ShuiFenUIOperation.cs Näytä tiedosto

@@ -33,7 +33,7 @@ namespace CNAS_BalanceClient
case "5": //样重
if (balanceWeight < 0.9 || balanceWeight > 1.1)
{
MessageBox.Show("样重范围是0.9g~1.1g");
MessageBox.Show("样重范围是0.9g~1.1g", "提示");
bIfUpdate = false;
}
else
@@ -48,7 +48,7 @@ namespace CNAS_BalanceClient
case "7"://烘干重
if (query[0].AddSample_Weight != 0 && balanceWeight > query[0].AddSample_Weight)
{
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。");
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。", "提示");
bIfUpdate = false;
}
else
@@ -65,7 +65,7 @@ namespace CNAS_BalanceClient
case "8"://二次烘干重
if (query[0].AddSample_Weight != 0 && balanceWeight > query[0].AddSample_Weight)
{
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。");
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。", "提示");
bIfUpdate = false;
}
else
@@ -82,7 +82,7 @@ namespace CNAS_BalanceClient
case "9"://三次烘干重
if (query[0].AddSample_Weight != 0 && balanceWeight > query[0].AddSample_Weight)
{
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。");
MessageBox.Show("烘干重不能大于加样重,请调整后再传入。", "提示");
bIfUpdate = false;
}
else


+ 253
- 179
CNAS_BalanceClient/frmBalanceField.Designer.cs Näytä tiedosto

@@ -28,57 +28,63 @@
/// </summary>
private void InitializeComponent()
{
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 dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmBalanceField));
this.pnlAll = new System.Windows.Forms.Panel();
this.pnlCenter = new System.Windows.Forms.Panel();
this.pnlbalanceRight = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
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.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage6 = new System.Windows.Forms.TabPage();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.dgvbalancefield = new System.Windows.Forms.DataGridView();
this.InstruFieldName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.InstruDataType = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.panel4 = new System.Windows.Forms.Panel();
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.panel5 = new System.Windows.Forms.Panel();
this.cbxCnas = new System.Windows.Forms.ComboBox();
this.label13 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel();
this.panel10 = new System.Windows.Forms.Panel();
this.btnDeleteMapping = new System.Windows.Forms.Button();
this.btnAddMapping = new System.Windows.Forms.Button();
this.pnlbalanceLeft = new System.Windows.Forms.Panel();
this.panel9 = new System.Windows.Forms.Panel();
this.panel7 = new System.Windows.Forms.Panel();
this.lstBalance = new System.Windows.Forms.ListBox();
this.panel6 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.pnlBottom = new System.Windows.Forms.Panel();
this.panel8 = new System.Windows.Forms.Panel();
this.btnOK = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.pnlTop = new System.Windows.Forms.Panel();
this.pnlRight = new System.Windows.Forms.Panel();
this.pnlLeft = new System.Windows.Forms.Panel();
this.panel6 = new System.Windows.Forms.Panel();
this.panel7 = new System.Windows.Forms.Panel();
this.panel11 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.panel12 = new System.Windows.Forms.Panel();
this.txtInstrumentColumn = new System.Windows.Forms.TextBox();
this.cbxCNASColumn = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.panel13 = new System.Windows.Forms.Panel();
this.dgvMapping = new System.Windows.Forms.DataGridView();
this.InstrumentField = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.CnasField = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.PrimaryKey = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.DateKey = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.panel8 = new System.Windows.Forms.Panel();
this.panel9 = new System.Windows.Forms.Panel();
this.panel10 = new System.Windows.Forms.Panel();
this.InstruFieldName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.InstruDataType = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.CNASFieldName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.CnasDataType = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.btnConditionMap = new System.Windows.Forms.Button();
this.pnlAll.SuspendLayout();
this.pnlCenter.SuspendLayout();
this.pnlbalanceRight.SuspendLayout();
@@ -87,9 +93,6 @@
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.tabMapping.SuspendLayout();
this.tabPage5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvMapping)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
@@ -101,12 +104,16 @@
((System.ComponentModel.ISupportInitialize)(this.dgvCnas)).BeginInit();
this.panel5.SuspendLayout();
this.panel1.SuspendLayout();
this.panel10.SuspendLayout();
this.pnlbalanceLeft.SuspendLayout();
this.pnlBottom.SuspendLayout();
this.panel6.SuspendLayout();
this.panel7.SuspendLayout();
this.panel6.SuspendLayout();
this.pnlBottom.SuspendLayout();
this.panel8.SuspendLayout();
this.panel10.SuspendLayout();
this.panel11.SuspendLayout();
this.panel12.SuspendLayout();
this.panel13.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvMapping)).BeginInit();
this.SuspendLayout();
//
// pnlAll
@@ -161,7 +168,8 @@
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.tabMapping);
this.splitContainer1.Panel1.Controls.Add(this.panel13);
this.splitContainer1.Panel1.Controls.Add(this.panel11);
//
// splitContainer1.Panel2
//
@@ -170,59 +178,6 @@
this.splitContainer1.SplitterDistance = 202;
this.splitContainer1.TabIndex = 0;
//
// 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(703, 202);
this.tabMapping.TabIndex = 1;
//
// 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(695, 172);
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.PrimaryKey,
this.DateKey});
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.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(689, 166);
this.dgvMapping.TabIndex = 0;
this.dgvMapping.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvMapping_CellValueChanged);
this.dgvMapping.CurrentCellDirtyStateChanged += new System.EventHandler(this.dgvMapping_CurrentCellDirtyStateChanged);
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage6);
@@ -291,6 +246,22 @@
this.dgvbalancefield.Size = new System.Drawing.Size(342, 186);
this.dgvbalancefield.TabIndex = 1;
//
// InstruFieldName
//
this.InstruFieldName.DataPropertyName = "FieldName";
this.InstruFieldName.HeaderText = "列名";
this.InstruFieldName.Name = "InstruFieldName";
this.InstruFieldName.ReadOnly = true;
this.InstruFieldName.Width = 155;
//
// InstruDataType
//
this.InstruDataType.DataPropertyName = "FieldType";
this.InstruDataType.HeaderText = "数据类型";
this.InstruDataType.Name = "InstruDataType";
this.InstruDataType.ReadOnly = true;
this.InstruDataType.Width = 130;
//
// panel4
//
this.panel4.Controls.Add(this.label12);
@@ -337,6 +308,22 @@
this.dgvCnas.Size = new System.Drawing.Size(343, 186);
this.dgvCnas.TabIndex = 2;
//
// CNASFieldName
//
this.CNASFieldName.DataPropertyName = "CnasFieldName";
this.CNASFieldName.HeaderText = "列名";
this.CNASFieldName.Name = "CNASFieldName";
this.CNASFieldName.ReadOnly = true;
this.CNASFieldName.Width = 155;
//
// CnasDataType
//
this.CnasDataType.DataPropertyName = "CnasDataType";
this.CnasDataType.HeaderText = "数据类型";
this.CnasDataType.Name = "CnasDataType";
this.CnasDataType.ReadOnly = true;
this.CnasDataType.Width = 130;
//
// panel5
//
this.panel5.Controls.Add(this.cbxCnas);
@@ -383,6 +370,17 @@
this.panel1.Size = new System.Drawing.Size(708, 31);
this.panel1.TabIndex = 0;
//
// panel10
//
this.panel10.Controls.Add(this.btnConditionMap);
this.panel10.Controls.Add(this.btnDeleteMapping);
this.panel10.Controls.Add(this.btnAddMapping);
this.panel10.Dock = System.Windows.Forms.DockStyle.Right;
this.panel10.Location = new System.Drawing.Point(444, 0);
this.panel10.Name = "panel10";
this.panel10.Size = new System.Drawing.Size(264, 31);
this.panel10.TabIndex = 5;
//
// btnDeleteMapping
//
this.btnDeleteMapping.Location = new System.Drawing.Point(93, 2);
@@ -414,6 +412,23 @@
this.pnlbalanceLeft.Size = new System.Drawing.Size(121, 493);
this.pnlbalanceLeft.TabIndex = 0;
//
// panel9
//
this.panel9.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel9.Location = new System.Drawing.Point(0, 462);
this.panel9.Name = "panel9";
this.panel9.Size = new System.Drawing.Size(121, 31);
this.panel9.TabIndex = 3;
//
// panel7
//
this.panel7.Controls.Add(this.lstBalance);
this.panel7.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel7.Location = new System.Drawing.Point(0, 29);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(121, 464);
this.panel7.TabIndex = 2;
//
// lstBalance
//
this.lstBalance.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -432,6 +447,24 @@
this.lstBalance.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lstBalance_DrawItem);
this.lstBalance.SelectedIndexChanged += new System.EventHandler(this.lstBalance_SelectedIndexChanged);
//
// panel6
//
this.panel6.Controls.Add(this.label1);
this.panel6.Dock = System.Windows.Forms.DockStyle.Top;
this.panel6.Location = new System.Drawing.Point(0, 0);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(121, 29);
this.panel6.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(-1, 5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 17);
this.label1.TabIndex = 0;
this.label1.Text = "化验类型";
//
// pnlBottom
//
this.pnlBottom.Controls.Add(this.panel8);
@@ -442,6 +475,15 @@
this.pnlBottom.Size = new System.Drawing.Size(829, 56);
this.pnlBottom.TabIndex = 3;
//
// panel8
//
this.panel8.Controls.Add(this.btnOK);
this.panel8.Dock = System.Windows.Forms.DockStyle.Right;
this.panel8.Location = new System.Drawing.Point(732, 13);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(97, 43);
this.panel8.TabIndex = 2;
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(4, 6);
@@ -452,6 +494,15 @@
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// groupBox1
//
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(829, 13);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
//
// pnlTop
//
this.pnlTop.Dock = System.Windows.Forms.DockStyle.Top;
@@ -476,23 +527,104 @@
this.pnlLeft.Size = new System.Drawing.Size(10, 554);
this.pnlLeft.TabIndex = 0;
//
// panel6
// panel11
//
this.panel11.Controls.Add(this.panel12);
this.panel11.Controls.Add(this.label2);
this.panel11.Dock = System.Windows.Forms.DockStyle.Top;
this.panel11.Location = new System.Drawing.Point(0, 0);
this.panel11.Name = "panel11";
this.panel11.Size = new System.Drawing.Size(703, 29);
this.panel11.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(10, 5);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
this.label2.TabIndex = 1;
this.label2.Text = "映射表";
//
// panel12
//
this.panel12.Controls.Add(this.txtInstrumentColumn);
this.panel12.Controls.Add(this.cbxCNASColumn);
this.panel12.Controls.Add(this.label3);
this.panel12.Dock = System.Windows.Forms.DockStyle.Right;
this.panel12.Location = new System.Drawing.Point(394, 0);
this.panel12.Name = "panel12";
this.panel12.Size = new System.Drawing.Size(309, 29);
this.panel12.TabIndex = 3;
//
// txtInstrumentColumn
//
this.txtInstrumentColumn.Location = new System.Drawing.Point(111, 3);
this.txtInstrumentColumn.Name = "txtInstrumentColumn";
this.txtInstrumentColumn.ReadOnly = true;
this.txtInstrumentColumn.Size = new System.Drawing.Size(190, 23);
this.txtInstrumentColumn.TabIndex = 10;
this.txtInstrumentColumn.DoubleClick += new System.EventHandler(this.txtInstrumentColumn_DoubleClick);
//
// cbxCNASColumn
//
this.cbxCNASColumn.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbxCNASColumn.FormattingEnabled = true;
this.cbxCNASColumn.Location = new System.Drawing.Point(111, 7);
this.cbxCNASColumn.Name = "cbxCNASColumn";
this.cbxCNASColumn.Size = new System.Drawing.Size(179, 25);
this.cbxCNASColumn.TabIndex = 9;
this.cbxCNASColumn.Visible = false;
this.cbxCNASColumn.SelectedIndexChanged += new System.EventHandler(this.cbxCNASColumn_SelectedIndexChanged);
this.cbxCNASColumn.Leave += new System.EventHandler(this.cbxCNASColumn_Leave);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 7);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(113, 17);
this.label3.TabIndex = 8;
this.label3.Text = "CNAS仪器信息列:";
//
// panel13
//
this.panel13.Controls.Add(this.dgvMapping);
this.panel13.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel13.Location = new System.Drawing.Point(0, 29);
this.panel13.Name = "panel13";
this.panel13.Size = new System.Drawing.Size(703, 173);
this.panel13.TabIndex = 3;
//
this.panel6.Controls.Add(this.label1);
this.panel6.Dock = System.Windows.Forms.DockStyle.Top;
this.panel6.Location = new System.Drawing.Point(0, 0);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(121, 29);
this.panel6.TabIndex = 1;
//
// panel7
// dgvMapping
//
this.panel7.Controls.Add(this.lstBalance);
this.panel7.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel7.Location = new System.Drawing.Point(0, 29);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(121, 464);
this.panel7.TabIndex = 2;
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.PrimaryKey,
this.DateKey});
this.dgvMapping.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvMapping.Location = new System.Drawing.Point(0, 0);
this.dgvMapping.MultiSelect = false;
this.dgvMapping.Name = "dgvMapping";
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(703, 173);
this.dgvMapping.TabIndex = 1;
//
// InstrumentField
//
@@ -521,82 +653,15 @@
this.DateKey.HeaderText = "日期字段";
this.DateKey.Name = "DateKey";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(-1, 5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 17);
this.label1.TabIndex = 0;
this.label1.Text = "化验类型";
//
// groupBox1
//
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(829, 13);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
// btnConditionMap
//
// panel8
//
this.panel8.Controls.Add(this.btnOK);
this.panel8.Dock = System.Windows.Forms.DockStyle.Right;
this.panel8.Location = new System.Drawing.Point(732, 13);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(97, 43);
this.panel8.TabIndex = 2;
//
// panel9
//
this.panel9.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel9.Location = new System.Drawing.Point(0, 462);
this.panel9.Name = "panel9";
this.panel9.Size = new System.Drawing.Size(121, 31);
this.panel9.TabIndex = 3;
//
// panel10
//
this.panel10.Controls.Add(this.btnDeleteMapping);
this.panel10.Controls.Add(this.btnAddMapping);
this.panel10.Dock = System.Windows.Forms.DockStyle.Right;
this.panel10.Location = new System.Drawing.Point(528, 0);
this.panel10.Name = "panel10";
this.panel10.Size = new System.Drawing.Size(180, 31);
this.panel10.TabIndex = 5;
//
// InstruFieldName
//
this.InstruFieldName.DataPropertyName = "FieldName";
this.InstruFieldName.HeaderText = "列名";
this.InstruFieldName.Name = "InstruFieldName";
this.InstruFieldName.ReadOnly = true;
this.InstruFieldName.Width = 155;
//
// InstruDataType
//
this.InstruDataType.DataPropertyName = "FieldType";
this.InstruDataType.HeaderText = "数据类型";
this.InstruDataType.Name = "InstruDataType";
this.InstruDataType.ReadOnly = true;
this.InstruDataType.Width = 130;
//
// CNASFieldName
//
this.CNASFieldName.DataPropertyName = "CnasFieldName";
this.CNASFieldName.HeaderText = "列名";
this.CNASFieldName.Name = "CNASFieldName";
this.CNASFieldName.ReadOnly = true;
this.CNASFieldName.Width = 155;
//
// CnasDataType
//
this.CnasDataType.DataPropertyName = "CnasDataType";
this.CnasDataType.HeaderText = "数据类型";
this.CnasDataType.Name = "CnasDataType";
this.CnasDataType.ReadOnly = true;
this.CnasDataType.Width = 130;
this.btnConditionMap.Location = new System.Drawing.Point(178, 2);
this.btnConditionMap.Name = "btnConditionMap";
this.btnConditionMap.Size = new System.Drawing.Size(79, 23);
this.btnConditionMap.TabIndex = 5;
this.btnConditionMap.Text = "条件映射";
this.btnConditionMap.UseVisualStyleBackColor = true;
this.btnConditionMap.Click += new System.EventHandler(this.btnConditionMap_Click);
//
// frmBalanceField
//
@@ -619,9 +684,6 @@
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.tabControl1.ResumeLayout(false);
this.tabPage6.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
@@ -635,13 +697,19 @@
this.panel5.ResumeLayout(false);
this.panel5.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel10.ResumeLayout(false);
this.pnlbalanceLeft.ResumeLayout(false);
this.pnlBottom.ResumeLayout(false);
this.panel7.ResumeLayout(false);
this.panel6.ResumeLayout(false);
this.panel6.PerformLayout();
this.panel7.ResumeLayout(false);
this.pnlBottom.ResumeLayout(false);
this.panel8.ResumeLayout(false);
this.panel10.ResumeLayout(false);
this.panel11.ResumeLayout(false);
this.panel11.PerformLayout();
this.panel12.ResumeLayout(false);
this.panel12.PerformLayout();
this.panel13.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvMapping)).EndInit();
this.ResumeLayout(false);

}
@@ -664,9 +732,6 @@
private System.Windows.Forms.Button btnAddMapping;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TabControl tabMapping;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.DataGridView dgvMapping;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage6;
private System.Windows.Forms.SplitContainer splitContainer2;
@@ -679,10 +744,6 @@
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Panel panel7;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.DataGridViewTextBoxColumn InstrumentField;
private System.Windows.Forms.DataGridViewTextBoxColumn CnasField;
private System.Windows.Forms.DataGridViewCheckBoxColumn PrimaryKey;
private System.Windows.Forms.DataGridViewCheckBoxColumn DateKey;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Panel panel8;
@@ -692,5 +753,18 @@
private System.Windows.Forms.DataGridViewTextBoxColumn InstruDataType;
private System.Windows.Forms.DataGridViewTextBoxColumn CNASFieldName;
private System.Windows.Forms.DataGridViewTextBoxColumn CnasDataType;
private System.Windows.Forms.Panel panel11;
private System.Windows.Forms.Panel panel12;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Panel panel13;
private System.Windows.Forms.DataGridView dgvMapping;
private System.Windows.Forms.DataGridViewTextBoxColumn InstrumentField;
private System.Windows.Forms.DataGridViewTextBoxColumn CnasField;
private System.Windows.Forms.DataGridViewCheckBoxColumn PrimaryKey;
private System.Windows.Forms.DataGridViewCheckBoxColumn DateKey;
private System.Windows.Forms.TextBox txtInstrumentColumn;
private System.Windows.Forms.ComboBox cbxCNASColumn;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnConditionMap;
}
}

+ 72
- 5
CNAS_BalanceClient/frmBalanceField.cs Näytä tiedosto

@@ -46,12 +46,20 @@ namespace CNAS_BalanceClient
//根据选中项加载数据
dgvbalancefield.DataSource = new BindingList<BalanceField>(BindBalanceField(strCurrentSelect));


//绑定映射数据
var syncItems = syncBalanceItems.Where(s => s.Type == strCurrentSelect).ToList<SyncBalanceItem>();
if (syncItems != null && syncItems.Count >= 1)
{
currentBalanceItem = syncItems[0];
if(syncItems[0].syncParamasInfos!=null)

if (!string.IsNullOrWhiteSpace(currentBalanceItem.CnasInstrumentColumn))
txtInstrumentColumn.Text = currentBalanceItem.CnasInstrumentColumn;
else
txtInstrumentColumn.Text = "";

if (syncItems[0].syncParamasInfos!=null)
dgvMapping.DataSource = new BindingList<SyncParamasInfo>(syncItems[0].syncParamasInfos);
else
dgvMapping.DataSource = new BindingList<SyncParamasInfo>();
@@ -60,6 +68,7 @@ namespace CNAS_BalanceClient
{
currentBalanceItem = new SyncBalanceItem()
{
GUID=Guid.NewGuid().ToString(),
Type = strCurrentSelect
};
syncBalanceItems.Add(currentBalanceItem);
@@ -161,6 +170,23 @@ namespace CNAS_BalanceClient
}

dgvCnas.DataSource = dtCnasShow;

//绑定数据
cbxCNASColumn.DataSource = dtCnasShow.Copy();
cbxCNASColumn.DisplayMember = "CnasFieldName";
cbxCNASColumn.ValueMember = "CnasFieldName";

if (dtTableStruct.Columns.Count > 0)
{
if (!string.IsNullOrWhiteSpace(currentSyncItem.CnasInstrumentColumn) && dtTableStruct.Columns.Contains(currentSyncItem.CnasInstrumentColumn))
{
cbxCNASColumn.Text = this.txtInstrumentColumn.Text = currentSyncItem.CnasInstrumentColumn;
}
else
{
cbxCNASColumn.Text = this.txtInstrumentColumn.Text = "";
}
}
}
}

@@ -181,7 +207,7 @@ namespace CNAS_BalanceClient
SyncParamsOperation paramsOperation = new SyncParamsOperation();
if (paramsOperation.CheckTableIfRepeat(currentBalanceItem.syncParamasInfos, syncParamas.SourceTable, syncParamas.TargetTable))
{
MessageBox.Show("已存在不同表单映射数据,无法添加!");
MessageBox.Show("已存在不同表单映射数据,无法添加!", "提示");
return;
}
//if (paramsOperation.CheckSourceFieldRepeat(currentBalanceItem.syncParamasInfos, syncParamas.SourceTable, syncParamas.SourceField))
@@ -191,12 +217,12 @@ namespace CNAS_BalanceClient
//}
if (paramsOperation.CheckTargetFieldRepeat(currentBalanceItem.syncParamasInfos, syncParamas.TargetTable, syncParamas.TargetField))
{
MessageBox.Show("CNAS端数据字段已分配,请重新选择!");
MessageBox.Show("CNAS端数据字段已分配,请重新选择!", "提示");
return;
}
if (paramsOperation.CheckTargetKeepField(syncParamas.TargetField))
{
MessageBox.Show("CNAS端数据字段为保留字段,请重新选择!");
MessageBox.Show("CNAS端数据字段为保留字段,请重新选择!", "提示");
return;
}

@@ -241,7 +267,7 @@ namespace CNAS_BalanceClient
}
else
{
MessageBox.Show("保存配置失败!");
MessageBox.Show("保存配置失败!", "提示");
}
}

@@ -338,5 +364,46 @@ namespace CNAS_BalanceClient
}
return bIfHave;
}

private void txtInstrumentColumn_DoubleClick(object sender, EventArgs e)
{
txtInstrumentColumn.Visible = false;

cbxCNASColumn.Top = txtInstrumentColumn.Top;
cbxCNASColumn.Height = txtInstrumentColumn.Height;
cbxCNASColumn.Width = txtInstrumentColumn.Width;
cbxCNASColumn.Location = txtInstrumentColumn.Location;

cbxCNASColumn.Visible = true;
}

private void cbxCNASColumn_Leave(object sender, EventArgs e)
{
if (cbxCNASColumn.Visible)
{
txtInstrumentColumn.Visible = true;
cbxCNASColumn.Visible = false;
}
}

private void cbxCNASColumn_SelectedIndexChanged(object sender, EventArgs e)
{
if (cbxCNASColumn.Visible)
{
cbxCNASColumn.Visible = false;
txtInstrumentColumn.Visible = true;

currentBalanceItem.CnasInstrumentColumn = txtInstrumentColumn.Text = cbxCNASColumn.Text;
}
}

private void btnConditionMap_Click(object sender, EventArgs e)
{
frmConditionMap frmCNAS = new frmConditionMap(currentBalanceItem, targetDataBase);
if (frmCNAS.ShowDialog() == DialogResult.OK)
{
this.currentBalanceItem = frmCNAS.currentBalanceItem;
}
}
}
}

+ 53
- 43
CNAS_BalanceClient/frmBalanceMain.Designer.cs Näytä tiedosto

@@ -170,20 +170,20 @@
this.txtCode = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.tsbOpenPort = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.tsbSave = new System.Windows.Forms.ToolStripButton();
this.tsbAllSave = new System.Windows.Forms.ToolStripButton();
this.tsbDelete = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.tsbUpload = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.tsbOpenPort = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.tsbHistory = new System.Windows.Forms.ToolStripButton();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.数据ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tsmMapping = new System.Windows.Forms.ToolStripMenuItem();
this.tsmPortConfig = new System.Windows.Forms.ToolStripMenuItem();
this.帮助ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tsmHelper = new System.Windows.Forms.ToolStripMenuItem();
this.pnlBottom = new System.Windows.Forms.Panel();
this.panel11 = new System.Windows.Forms.Panel();
this.lblCNASDb = new System.Windows.Forms.Label();
@@ -987,6 +987,7 @@
this.Shelf_SampleNumber.HeaderText = "样品编码";
this.Shelf_SampleNumber.Name = "Shelf_SampleNumber";
this.Shelf_SampleNumber.ReadOnly = true;
this.Shelf_SampleNumber.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Shelf_SampleNumber.Width = 150;
//
// Shelf_WeighingType
@@ -995,6 +996,7 @@
this.Shelf_WeighingType.HeaderText = "称量类型";
this.Shelf_WeighingType.Name = "Shelf_WeighingType";
this.Shelf_WeighingType.ReadOnly = true;
this.Shelf_WeighingType.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Shelf_WeighingType.Width = 120;
//
// Shelf_SampleWeight
@@ -1003,6 +1005,7 @@
this.Shelf_SampleWeight.HeaderText = "重量(g)";
this.Shelf_SampleWeight.Name = "Shelf_SampleWeight";
this.Shelf_SampleWeight.ReadOnly = true;
this.Shelf_SampleWeight.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Shelf_SampleWeight.Width = 120;
//
// Shelf_Operator
@@ -1011,6 +1014,7 @@
this.Shelf_Operator.HeaderText = "创建人";
this.Shelf_Operator.Name = "Shelf_Operator";
this.Shelf_Operator.ReadOnly = true;
this.Shelf_Operator.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Shelf_Operator.Width = 120;
//
// Shelf_CrucibleNumber
@@ -1019,6 +1023,7 @@
this.Shelf_CrucibleNumber.HeaderText = "坩埚号";
this.Shelf_CrucibleNumber.Name = "Shelf_CrucibleNumber";
this.Shelf_CrucibleNumber.ReadOnly = true;
this.Shelf_CrucibleNumber.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Shelf_CrucibleNumber.Width = 120;
//
// cmsShelf
@@ -1212,7 +1217,7 @@
//
// btnFind
//
this.btnFind.Location = new System.Drawing.Point(583, 11);
this.btnFind.Location = new System.Drawing.Point(646, 11);
this.btnFind.Name = "btnFind";
this.btnFind.Size = new System.Drawing.Size(75, 25);
this.btnFind.TabIndex = 10;
@@ -1222,7 +1227,7 @@
//
// txtShelfFind
//
this.txtShelfFind.Location = new System.Drawing.Point(380, 12);
this.txtShelfFind.Location = new System.Drawing.Point(429, 13);
this.txtShelfFind.Name = "txtShelfFind";
this.txtShelfFind.Size = new System.Drawing.Size(173, 23);
this.txtShelfFind.TabIndex = 6;
@@ -1230,7 +1235,7 @@
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(317, 14);
this.label9.Location = new System.Drawing.Point(366, 15);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(56, 17);
this.label9.TabIndex = 5;
@@ -1238,16 +1243,20 @@
//
// dtpEndDate
//
this.dtpEndDate.Location = new System.Drawing.Point(189, 11);
this.dtpEndDate.CustomFormat = "yyyy-MM-dd HH:mm";
this.dtpEndDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpEndDate.Location = new System.Drawing.Point(214, 11);
this.dtpEndDate.Name = "dtpEndDate";
this.dtpEndDate.Size = new System.Drawing.Size(111, 23);
this.dtpEndDate.Size = new System.Drawing.Size(139, 23);
this.dtpEndDate.TabIndex = 2;
//
// dtpStartTime
//
this.dtpStartTime.CustomFormat = "yyyy-MM-dd HH:mm";
this.dtpStartTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpStartTime.Location = new System.Drawing.Point(69, 11);
this.dtpStartTime.Name = "dtpStartTime";
this.dtpStartTime.Size = new System.Drawing.Size(111, 23);
this.dtpStartTime.Size = new System.Drawing.Size(139, 23);
this.dtpStartTime.TabIndex = 1;
//
// label11
@@ -1359,7 +1368,7 @@
this.tabSulfurValue.Location = new System.Drawing.Point(4, 26);
this.tabSulfurValue.Name = "tabSulfurValue";
this.tabSulfurValue.Padding = new System.Windows.Forms.Padding(3);
this.tabSulfurValue.Size = new System.Drawing.Size(273, 370);
this.tabSulfurValue.Size = new System.Drawing.Size(273, 372);
this.tabSulfurValue.TabIndex = 1;
this.tabSulfurValue.Text = "硫分";
this.tabSulfurValue.UseVisualStyleBackColor = true;
@@ -1377,7 +1386,7 @@
this.dgvCrucibleSulfur.Location = new System.Drawing.Point(3, 3);
this.dgvCrucibleSulfur.Name = "dgvCrucibleSulfur";
this.dgvCrucibleSulfur.RowTemplate.Height = 23;
this.dgvCrucibleSulfur.Size = new System.Drawing.Size(267, 364);
this.dgvCrucibleSulfur.Size = new System.Drawing.Size(267, 366);
this.dgvCrucibleSulfur.TabIndex = 1;
this.dgvCrucibleSulfur.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dgvCrucibleSulfur_RowPostPaint);
//
@@ -1407,7 +1416,7 @@
this.tabElementAynic.Controls.Add(this.dgvCrucibleElement);
this.tabElementAynic.Location = new System.Drawing.Point(4, 26);
this.tabElementAynic.Name = "tabElementAynic";
this.tabElementAynic.Size = new System.Drawing.Size(273, 370);
this.tabElementAynic.Size = new System.Drawing.Size(273, 372);
this.tabElementAynic.TabIndex = 2;
this.tabElementAynic.Text = "元素分析";
this.tabElementAynic.UseVisualStyleBackColor = true;
@@ -1425,7 +1434,7 @@
this.dgvCrucibleElement.Location = new System.Drawing.Point(0, 0);
this.dgvCrucibleElement.Name = "dgvCrucibleElement";
this.dgvCrucibleElement.RowTemplate.Height = 23;
this.dgvCrucibleElement.Size = new System.Drawing.Size(273, 370);
this.dgvCrucibleElement.Size = new System.Drawing.Size(273, 372);
this.dgvCrucibleElement.TabIndex = 1;
this.dgvCrucibleElement.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dgvCrucibleElement_RowPostPaint);
//
@@ -1528,13 +1537,13 @@
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbOpenPort,
this.toolStripSeparator2,
this.tsbSave,
this.tsbAllSave,
this.tsbDelete,
this.toolStripSeparator1,
this.tsbUpload,
this.toolStripSeparator2,
this.tsbOpenPort,
this.toolStripSeparator3,
this.tsbHistory});
this.toolStrip1.Location = new System.Drawing.Point(0, 25);
@@ -1543,6 +1552,20 @@
this.toolStrip1.TabIndex = 1;
this.toolStrip1.Text = "toolStrip1";
//
// tsbOpenPort
//
this.tsbOpenPort.Image = ((System.Drawing.Image)(resources.GetObject("tsbOpenPort.Image")));
this.tsbOpenPort.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbOpenPort.Name = "tsbOpenPort";
this.tsbOpenPort.Size = new System.Drawing.Size(76, 22);
this.tsbOpenPort.Text = "打开串口";
this.tsbOpenPort.Click += new System.EventHandler(this.tsbOpenPort_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
//
// tsbSave
//
this.tsbSave.Image = ((System.Drawing.Image)(resources.GetObject("tsbSave.Image")));
@@ -1584,20 +1607,6 @@
this.tsbUpload.Text = "上传数据";
this.tsbUpload.Click += new System.EventHandler(this.tsbUpload_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
//
// tsbOpenPort
//
this.tsbOpenPort.Image = ((System.Drawing.Image)(resources.GetObject("tsbOpenPort.Image")));
this.tsbOpenPort.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbOpenPort.Name = "tsbOpenPort";
this.tsbOpenPort.Size = new System.Drawing.Size(76, 22);
this.tsbOpenPort.Text = "打开串口";
this.tsbOpenPort.Click += new System.EventHandler(this.tsbOpenPort_Click);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
@@ -1616,7 +1625,7 @@
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.数据ToolStripMenuItem,
this.帮助ToolStripMenuItem});
this.tsmHelper});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1134, 25);
@@ -1629,8 +1638,8 @@
this.tsmMapping,
this.tsmPortConfig});
this.数据ToolStripMenuItem.Name = "数据ToolStripMenuItem";
this.数据ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
this.数据ToolStripMenuItem.Text = "数据";
this.数据ToolStripMenuItem.Size = new System.Drawing.Size(61, 21);
this.数据ToolStripMenuItem.Text = "数据(&D)";
//
// tsmMapping
//
@@ -1648,11 +1657,12 @@
this.tsmPortConfig.Text = "串口设置";
this.tsmPortConfig.Click += new System.EventHandler(this.tsmPortConfig_Click);
//
// 帮助ToolStripMenuItem
// tsmHelper
//
this.帮助ToolStripMenuItem.Name = "帮助ToolStripMenuItem";
this.帮助ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
this.帮助ToolStripMenuItem.Text = "帮助";
this.tsmHelper.Name = "tsmHelper";
this.tsmHelper.Size = new System.Drawing.Size(61, 21);
this.tsmHelper.Text = "帮助(&H)";
this.tsmHelper.Click += new System.EventHandler(this.tsmHelper_Click);
//
// pnlBottom
//
@@ -1825,7 +1835,7 @@
private System.Windows.Forms.ToolStripButton tsbOpenPort;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem 数据ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 帮助ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem tsmHelper;
private System.Windows.Forms.Panel pnlBalance;
private System.Windows.Forms.TabControl tabBalance;
private System.Windows.Forms.TabPage tabpAllWater;
@@ -1949,12 +1959,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn VAD;
private System.Windows.Forms.DataGridViewTextBoxColumn Column13;
private System.Windows.Forms.DataGridViewTextBoxColumn Column14;
private System.Windows.Forms.DataGridViewTextBoxColumn Shelf_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn Shelf_SampleNumber;
private System.Windows.Forms.DataGridViewTextBoxColumn Shelf_WeighingType;
private System.Windows.Forms.DataGridViewTextBoxColumn Shelf_SampleWeight;
private System.Windows.Forms.DataGridViewTextBoxColumn Shelf_Operator;
private System.Windows.Forms.DataGridViewTextBoxColumn Shelf_CrucibleNumber;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn11;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn54;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn55;
@@ -1965,6 +1969,12 @@
private System.Windows.Forms.DataGridViewTextBoxColumn SampleCode;
private System.Windows.Forms.DataGridViewTextBoxColumn Count;
private System.Windows.Forms.ToolStripMenuItem tsmPortConfig;
private System.Windows.Forms.DataGridViewTextBoxColumn Shelf_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn Shelf_SampleNumber;
private System.Windows.Forms.DataGridViewTextBoxColumn Shelf_WeighingType;
private System.Windows.Forms.DataGridViewTextBoxColumn Shelf_SampleWeight;
private System.Windows.Forms.DataGridViewTextBoxColumn Shelf_Operator;
private System.Windows.Forms.DataGridViewTextBoxColumn Shelf_CrucibleNumber;
}
}


+ 186
- 99
CNAS_BalanceClient/frmBalanceMain.cs Näytä tiedosto

@@ -1,4 +1,5 @@
using CnasSynchronousCommon;
using CNAS_SerialPort;
using CnasSynchronousCommon;
using CnasSynchronusClient;
using CnasSynchrousModel;
using System;
@@ -69,7 +70,7 @@ namespace CNAS_BalanceClient

//加载CNAS数据库配置
targetdataBase = FileOperation.GetLocalPlatFormDB();
if (!CnasDataOperationFact.CnasDataOperation().TestConnect(targetdataBase.DBHost, targetdataBase.DBName, targetdataBase.DBUser, targetdataBase.DBPwd, targetdataBase.DBPort))
if (!CnasDataOperationFact.CnasDataOperation().TestConnect(targetdataBase))
{
this.lblCNASDb.Visible = true;
this.lblCNASDb.Text = "CNAS数据库无法正常连接...";
@@ -104,6 +105,7 @@ namespace CNAS_BalanceClient

//从本地数据库中读取串口配置信息
serialPortConfig = new SericalPortConfigBLL().GetSerialPortConfigInfo();

//从本地数据库中读取所有数据
laboratoryTests = laboratoryTestBLL.GetLaboratoryTestDataByNoUpLoad();
@@ -146,11 +148,11 @@ namespace CNAS_BalanceClient
if (returnValue.StrErrorMsg!=null&&returnValue.StrErrorMsg != "")
{
AppLog.Error($"未保存成功:{returnValue.StrErrorMsg}");
MessageBox.Show(returnValue.StrErrorMsg);
MessageBox.Show(returnValue.StrErrorMsg, "提示");
}
else if (returnValue.StrMsg!=null&&returnValue.StrMsg != "")
{
MessageBox.Show(returnValue.StrMsg);
MessageBox.Show(returnValue.StrMsg, "提示");
//清空操作列的所有内容,避免重复操作
//int deletecount=currentquery.RemoveAll(s => (s.OperationType != null && s.OperationType.ToLower() == "delete"));
//foreach (var item in currentquery)
@@ -181,12 +183,12 @@ namespace CNAS_BalanceClient

if (returnValue.StrErrorMsg != null && returnValue.StrErrorMsg != "")
{
MessageBox.Show(returnValue.StrErrorMsg);
MessageBox.Show(returnValue.StrErrorMsg, "提示");
AppLog.Error($"未保存成功:{returnValue.StrErrorMsg}");
}
else if (returnValue.StrMsg != null && returnValue.StrMsg != "")
{
MessageBox.Show(returnValue.StrMsg);
MessageBox.Show(returnValue.StrMsg, "提示");
//清空操作列的所有内容,避免重复操作
//int deletecount = currentquery.RemoveAll(s => (s.OperationType != null && s.OperationType.ToLower() == "delete"));
//foreach (var item in currentquery)
@@ -288,33 +290,37 @@ namespace CNAS_BalanceClient

tsbOpenPort.Text = "打开串口";
lblPort.Text = "串口已关闭...";
MessageBox.Show(ex.Message);
MessageBox.Show(ex.Message, "提示");
AppLog.Error($"打开串口失败:{ex.Message}");
}
}

private void sPortBalance_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{

//读取缓冲区三次数据,类似{N +} {0.0000}{ g},这里只要第二部分的内容
try
{
//读取数据
this.Invoke((EventHandler)(delegate
{
string strReadTxt = sPortBalance.ReadExisting();
if (strReadTxt.StartsWith("N"))
{
lstReadTxt.Clear();
}
lstReadTxt.Add(strReadTxt);
if (lstReadTxt.Count == 3)
{
UpdateBalanceValue(lstReadTxt[1]);
}
//UpdateBalanceValue(strReadTxt);
}
)
);
//Invoke((EventHandler)(delegate
//{
// string strReadTxt = sPortBalance.ReadExisting();
// //if (strReadTxt.StartsWith("N"))
// //{
// // lstReadTxt.Clear();
// //}
// //lstReadTxt.Add(strReadTxt);
// //if (lstReadTxt.Count == 3)
// //{
// // UpdateBalanceValue(lstReadTxt[1]);
// //}
// UpdateBalanceValue(strReadTxt);
//}
// )
// );
string strReceiveData = SerialPortDataReceive.ReceivePortData(this, sPortBalance, lstReadTxt);
if(strReceiveData!="")
UpdateBalanceValue(strReceiveData);
}
catch (Exception ex)
{
@@ -460,78 +466,152 @@ namespace CNAS_BalanceClient
if (lstSelectID.Count <= 0)
{
AppLog.Info("未选中任何一条化验数据。上传结束。");
MessageBox.Show("请至少选择一条化验数据进行上传。");
MessageBox.Show("请至少选择一条化验数据进行上传。", "提示");
return;
}
//找到当前上传的是对应化验项目的字段配置
var currentbalanceconfig = lstBalanceData.Where(x => GetLaboratoryValue(x.Type) == currentDataType).ToList<SyncBalanceItem>();
if (currentbalanceconfig.Count <= 0)
{
MessageBox.Show("请先配置上传映射字段。");
MessageBox.Show("请先配置上传映射字段。", "提示");
return;
}
List<DataRow> lstError = new List<DataRow>();
foreach (var banlanceitem in currentbalanceconfig)
else
{
if (currentDataType != GetLaboratoryValue(banlanceitem.Type)) continue;
//2.获取准备上传到数据库表结构
AppLog.Info("获取准备上传到数据库表结构");
DataTable dtTarget = CnasDataOperationFact.CnasDataOperation().GetCNASTablesStruct(banlanceitem.syncParamasInfos[0].TargetTable, targetdataBase);

//3.将上传数据转换为上传数据的形式
AppLog.Info("将上传数据转换为上传数据的形式");
string strErrorMsg = "";
var query = laboratoryTests.Where(s => s.DataType == GetLaboratoryValue(banlanceitem.Type)).ToList<LaboratoryTest>();
foreach (var laboratoryitem in query)
//检查配置的字段映射是否满足条件
if (currentbalanceconfig[0].syncParamasInfos.Count <= 0)
{
if (!lstSelectID.Contains(laboratoryitem.GUID)) continue;
MessageBox.Show("请先配置上传映射字段。", "提示");
return;
}
}

List<DataRow> lstError = new List<DataRow>();
int ErrorCount = 0;
int SuccessCount = 0;
int OtherCount = 0;
//foreach (var banlanceitem in currentbalanceconfig)
SyncBalanceItem banlanceitem = currentbalanceconfig[0];

//如果字段配置项目不跟当前界面展示的化验项目一致,跳过
if (currentDataType != GetLaboratoryValue(banlanceitem.Type)) return;

//获取准备上传到数据库表结构
AppLog.Info("获取准备上传到数据库表结构");
DataTable dtTarget = CnasDataOperationFact.CnasDataOperation().GetCNASTablesStruct(banlanceitem.syncParamasInfos[0].TargetTable, targetdataBase);

//将上传数据转换为上传数据的形式
AppLog.Info("将上传数据转换为上传数据格式");
string strErrorMsg = "";
bool bSuccess = true;
List<string> lstSuccessID = new List<string>();
CnasInsertOperation insertOperation = new CnasInsertOperation();
var query = laboratoryTests.Where(s => s.DataType == GetLaboratoryValue(banlanceitem.Type)).ToList<LaboratoryTest>();
foreach (var laboratoryitem in query)
{
if (!lstSelectID.Contains(laboratoryitem.GUID)) continue;

DataRow drNewTarget = dtTarget.NewRow();
bSuccess = true;
DataRow drNewTarget = dtTarget.NewRow();

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

//当列名存在于数据表中时才能继续
int i = laboratoryitem.GetType().GetProperties().Where(sb => sb.Name== strSourceField).Count();
if (laboratoryitem.GetType().GetProperties().Where(sb => sb.Name== strSourceField).Count() > 0 && dtTarget.Columns.Contains(strTargetField))
{
var strSourceField = item.SourceField;
var strTargetField = item.TargetField;
strErrorMsg = TestConvertValueToTarget(drNewTarget, laboratoryitem, strTargetField, strSourceField);
if (strErrorMsg != "")
{
MessageBox.Show(string.Format("发生数据转换错误,请重新配置映射字段或修改字段值。错误信息如下:列【{0}】,值【{1}】,详情【{2}】", strSourceField, laboratoryitem.GetType().GetProperty(strSourceField).GetValue(laboratoryitem, null), strErrorMsg), "提示");
break;
}
}
}
if (strErrorMsg != "")
{
bSuccess = false;
break;
}

//字段长度约束检测
AppLog.Info("检查上传数据合法性");
if (!CheckInputDatallegal(ConvertDataRowToTable(drNewTarget), banlanceitem))
{
bSuccess = false;
break;
}

//检查仪器标识列信息
if (dtTarget.Columns.Contains(banlanceitem.CnasInstrumentColumn))
drNewTarget[banlanceitem.CnasInstrumentColumn] = banlanceitem.GUID;
else
{
MessageBox.Show("设置的CNAS仪器信息列没有在库中找到。","提示" );
bSuccess = false;
break;
}

//当列名存在于数据表中时才能继续
int i = laboratoryitem.GetType().GetProperties().Where(sb => sb.Name== strSourceField).Count();
if (laboratoryitem.GetType().GetProperties().Where(sb => sb.Name== strSourceField).Count() > 0 && dtTarget.Columns.Contains(strTargetField))
//根据固定值字段塞入数据到数据行
AppLog.Info("条件映射数据更改");
foreach (var item in banlanceitem.lstFixedValue)
{
if (dtTarget.Columns.Contains(item.ColumnName))
{
switch (item.Condition)
{
strErrorMsg = TestConvertValueToTarget(drNewTarget, laboratoryitem, strTargetField, strSourceField);
if (strErrorMsg != "")
{
MessageBox.Show(string.Format("发生数据转换错误,请重新配置映射字段或修改字段值。错误信息如下:列【{0}】,值【{1}】,详情【{2}】", strSourceField, laboratoryitem.GetType().GetProperty(strSourceField).GetValue(laboratoryitem, null), strErrorMsg));
case MapCondition.Equal:
drNewTarget[item.ColumnName] = item.Value;
break;
}
}
}
//dtTarget.Rows.Add(drNewTarget);
AppLog.Info("检查上传数据合法性");
if (strErrorMsg != "") break;
if (!CheckInputDatallegal(ConvertDataRowToTable(drNewTarget), banlanceitem)) break;

AppLog.Info("执行上传单条数据");
int iReturn = CnasDataOperationFact.CnasDataOperation().InsertDataToCNASTable(ConvertDataRowToTable(drNewTarget), targetdataBase, banlanceitem.syncParamasInfos,"");
if (iReturn <= 0) //此时出现问题
}

//执行插入一条数据
AppLog.Info("执行上传单条数据");
int iReturn = CnasDataOperationFact.CnasDataOperation().InsertDataToCNASTable(ConvertDataRowToTable(drNewTarget), targetdataBase, banlanceitem.syncParamasInfos, banlanceitem.CnasInstrumentColumn,banlanceitem.lstFixedValue);
if (iReturn <= 0) //此时出现问题
{
if (iReturn == -1)
{
AppLog.ServiceInfo("数据库连接中断,终止本次上传。");
break; //此时数据库连接中断,直接跳出循环,结束本次数据同步传输
}
else if (iReturn == -2) //等于-2表示插入准备更新时发现数据一致,不再执行
{
OtherCount++;
}
else
{
AppLog.Error("上传插入操作未能正常完成:" + TransConvert.DataTableToJSON(ConvertDataRowToTable(drNewTarget)));
lstError.Add(drNewTarget);
ErrorCount++;
/*需要转换一下,否则会将整个dt全部写入日志*/
lstError.Add(GlobalCommonOperation.ConvertDataRowToTable(drNewTarget).Rows[0]);
}
else //此时没有出现问题,1.如果本条数据未保存,将本条数据保存;2.向上传数据记录表中插入一条数据

bSuccess = false;
}
else //此时没有出现问题,1.如果本条数据未保存,将本条数据保存;2.向上传数据记录表中插入一条数据
{
SuccessCount++;

//存储化验数据到本地
if (!string.IsNullOrEmpty(laboratoryitem.OperationType))
{
if (!string.IsNullOrEmpty(laboratoryitem.OperationType))
ReturnValue<LaboratoryTest> returnValue = laboratoryTestBLL.SaveLaboratoryData(laboratoryitem);
if (!string.IsNullOrEmpty(returnValue.StrErrorMsg))
{
ReturnValue<LaboratoryTest> returnValue = laboratoryTestBLL.SaveLaboratoryData(laboratoryitem);
if (!string.IsNullOrEmpty(returnValue.StrErrorMsg))
{
//写入日志
AppLog.Error("上传完成后,没能正常存储数据到本地:" + returnValue.StrErrorMsg);
}
//写入日志
AppLog.Error("上传完成后,没能正常存储数据到本地:" + returnValue.StrErrorMsg);
}
}

UpLoadRecordBLL upLoadRecord = new UpLoadRecordBLL();
int ireturn=upLoadRecord.AddRecordToDatabase(
//存储化验数据到化验记录表
UpLoadRecordBLL upLoadRecord = new UpLoadRecordBLL();
int ireturn=upLoadRecord.AddRecordToDatabase(
new UpLoadRecord()
{
GUID = Guid.NewGuid().ToString(),
@@ -539,31 +619,32 @@ namespace CNAS_BalanceClient
UpLoadUser = GlobalCommonOperation.strUserName,
UpLoadTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm"))
}
);
if (ireturn <= 0)
{
//写入日志
AppLog.Error($"上传完成后,没能正常存储上传记录数据到本地:LaboratoryTestGUID={laboratoryitem.GUID},UpLoadUser={GlobalCommonOperation.strUserName},UpLoadTime={Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm"))}");
}

AppLog.Info("执行上传单条数据完成");
);
if (ireturn <= 0)
{
//写入日志
AppLog.Error($"上传完成后,没能正常存储上传记录数据到本地:LaboratoryTestGUID={laboratoryitem.GUID},UpLoadUser={GlobalCommonOperation.strUserName},UpLoadTime={Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm"))}");
}
}
}
if (lstError.Count <= 0)
{
MessageBox.Show("上传完成!");
//数据源中清空已经上传的项
foreach (var item in lstSelectID)

AppLog.Info("执行上传单条数据完成");
}

if (bSuccess) //说明在整个上传过程中没有发生错误
{
if(!lstSuccessID.Contains(laboratoryitem.GUID)) lstSuccessID.Add(laboratoryitem.GUID);
}
}
MessageBox.Show($"上传操作完成!其中成功{SuccessCount}条,失败{ErrorCount}条,其他{OtherCount}条。");

//数据源中清空已经上传的项
if (lstSuccessID.Count >= 0)
{
foreach (var item in lstSuccessID)
{
laboratoryTests.RemoveAll(s => s.GUID == item);
}
BindData();
}
else
{
MessageBox.Show("上传过程中发生异常,存在部分数据未成功上传,请联系管理员!");
}
}

public bool CheckInputDatallegal(DataTable dtTarget,SyncBalanceItem banlanceitem)
@@ -581,12 +662,12 @@ namespace CNAS_BalanceClient
var item = banlanceitem.syncParamasInfos.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));
MessageBox.Show(string.Format("数据不满足上传条件,请修改后再上传。错误数据:当前列名【{0}】,列值【{1}】", item[0].SourceField, check.LstIllegalMsg[0].ColumnValue), "提示");
bIfSuccess = false;
}
else
{
MessageBox.Show(string.Format("数据不满足上传条件,请修改后再上传。错误数据:CNAS列名【{0}】,列值【{1}】", check.LstIllegalMsg[0].ColumnName, check.LstIllegalMsg[0].ColumnValue));
MessageBox.Show(string.Format("数据不满足上传条件,请修改后再上传。错误数据:CNAS列名【{0}】,列值【{1}】", check.LstIllegalMsg[0].ColumnName, check.LstIllegalMsg[0].ColumnValue), "提示");
bIfSuccess = false;
}
}
@@ -648,7 +729,7 @@ namespace CNAS_BalanceClient
//判断化验编号是否合法
if (this.txtCode.Text.Trim().Length <= 0)
{
MessageBox.Show("当条码为空时不能新增化验记录");
MessageBox.Show("当条码为空时不能新增化验记录", "提示");
return;
}

@@ -667,7 +748,7 @@ namespace CNAS_BalanceClient
}
else
{
MessageBox.Show("新增数据时出错:"+returnValue.StrErrorMsg);
MessageBox.Show("新增数据时出错:"+returnValue.StrErrorMsg, "提示");
AppLog.Error("新增数据时出错:" + returnValue.StrErrorMsg);
}
}
@@ -710,7 +791,7 @@ namespace CNAS_BalanceClient
}
catch (Exception ex)
{
MessageBox.Show("无法正常插入天平值," + ex.Message);
MessageBox.Show("无法正常插入天平值," + ex.Message, "提示");
AppLog.Error("无法正常插入天平值," + ex.Message);
}
}
@@ -851,7 +932,7 @@ namespace CNAS_BalanceClient
string strSampleCode = this.txtSampleCode.Text.Trim();
if (this.txtSampleCode.Text.Trim().Length <= 0)
{
MessageBox.Show("样品编码不能为空!");
MessageBox.Show("样品编码不能为空!", "提示");
return;
}

@@ -961,7 +1042,7 @@ namespace CNAS_BalanceClient
}
catch (Exception ex)
{
MessageBox.Show("查找时发生错误:" + ex.Message);
MessageBox.Show("查找时发生错误:" + ex.Message, "提示");
AppLog.Error("查找时发生错误:" + ex.Message);
}
}
@@ -1045,7 +1126,7 @@ namespace CNAS_BalanceClient
if (e.KeyChar != 8 && !Char.IsDigit(e.KeyChar) && e.KeyChar != '.')
{
e.Handled = true;
MessageBox.Show("请输入数字与小数点");
MessageBox.Show("请输入数字与小数点", "提示");
}
}
//用户catch发生的错误
@@ -1109,5 +1190,11 @@ namespace CNAS_BalanceClient
}
}
}

private void tsmHelper_Click(object sender, EventArgs e)
{
string strHelpFilePath = FileHelper.getBasePath() + @"\BalanceHelper.CHM";
System.Diagnostics.Process.Start(strHelpFilePath);
}
}
}

+ 16
- 16
CNAS_BalanceClient/frmBalanceMain.resx Näytä tiedosto

@@ -340,6 +340,22 @@
<value>137, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="tsbOpenPort.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAI/SURBVEhLrZbJaxRBFIdHIXhwhZCIRIngRRNyEIIe1EDQ
GBURl6t4yzW5uCHixQU3ooEY4oLigiIkoJdAEBfwH/P7mqrw0t2ZBicPvpmat/xedU1VzbRKtgN2l+iG
DdDOtkG5rgc2woodgu8wB88T8+nzZljLBmABXkGuewFvwSaFKf4NfsA+6IWdaWyD7VBng/AV/sIQ5Dqf
wCa+F8vizJdhFsZhOnEenFFdg03wCX7BaxiDJ2D+JXgGRQNfnOVFuAZTcCtxCmagroG+WDcJ1tyG07Cq
gR+c+U24AdcTJ6FdA2PmWJNRQ61KgwvgIz4KnIOmBubEGjXUqjQw8T7cC5yFpgbmxBo11Ko08FFdy6sB
v7imBubEGjXUqm0Q119yg62guXNE05cbxBo1Kg3ewTAcCOyHo/Amjd1RHjxxbI4xc4zHWrXULBr4qHfg
MTwsoc+t+B6+wOWEY33G1qpTs1ha7wuPdB/YcU9gF1yBl+CVYJE41mfMnFijhlord5HH28dZgg/gCXb9
fPdk/wRn7e7IT5DHxsyJNWqopabaxQwW4Q8YvAt5u1rwG0ZBgWMJx/qMmZO3p7VqqKWm2q0uOAi5eCRw
BNx6rvVhcLbiWJ8xc2JN1lFT7UbzlvwID8ArQBzrM7Yu9hRcls8Jx/rWxbzOXRbX090hjvUZ69hcSy+x
sukz1rG51ydgL/QnHOsz1pH5Y+9MT8AZOJ5wrM9Y0x+CtrYFvG/8SfSLjegzZs5/W75GPP51VP6arLZW
6x+FhpAmxTjzIAAAAABJRU5ErkJggg==
</value>
</data>
<data name="tsbSave.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@@ -399,22 +415,6 @@
qBNUApOwCG6MuJbis3Hz1iWy3zmPDv0MrlE/DAQ7DKMwGHzz1iV6dmgzuE7KDdGfAGMdoHw2niijLz0F
v06G4Ce4uz9CzPyzX5q+x16EcfD8TcNMsAnGzad/Yuy/HdoIHhXPobfCK6j1zRZq/yeJp+vtd47zonxw
R7fAN70W+53jvFietzqofwP2MyeKrgFQ2m6IcGPD9gAAAABJRU5ErkJggg==
</value>
</data>
<data name="tsbOpenPort.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAI/SURBVEhLrZbJaxRBFIdHIXhwhZCIRIngRRNyEIIe1EDQ
GBURl6t4yzW5uCHixQU3ooEY4oLigiIkoJdAEBfwH/P7mqrw0t2ZBicPvpmat/xedU1VzbRKtgN2l+iG
DdDOtkG5rgc2woodgu8wB88T8+nzZljLBmABXkGuewFvwSaFKf4NfsA+6IWdaWyD7VBng/AV/sIQ5Dqf
wCa+F8vizJdhFsZhOnEenFFdg03wCX7BaxiDJ2D+JXgGRQNfnOVFuAZTcCtxCmagroG+WDcJ1tyG07Cq
gR+c+U24AdcTJ6FdA2PmWJNRQ61KgwvgIz4KnIOmBubEGjXUqjQw8T7cC5yFpgbmxBo11Ko08FFdy6sB
v7imBubEGjXUqm0Q119yg62guXNE05cbxBo1Kg3ewTAcCOyHo/Amjd1RHjxxbI4xc4zHWrXULBr4qHfg
MTwsoc+t+B6+wOWEY33G1qpTs1ha7wuPdB/YcU9gF1yBl+CVYJE41mfMnFijhlord5HH28dZgg/gCXb9
fPdk/wRn7e7IT5DHxsyJNWqopabaxQwW4Q8YvAt5u1rwG0ZBgWMJx/qMmZO3p7VqqKWm2q0uOAi5eCRw
BNx6rvVhcLbiWJ8xc2JN1lFT7UbzlvwID8ArQBzrM7Yu9hRcls8Jx/rWxbzOXRbX090hjvUZ69hcSy+x
sukz1rG51ydgL/QnHOsz1pH5Y+9MT8AZOJ5wrM9Y0x+CtrYFvG/8SfSLjegzZs5/W75GPP51VP6arLZW
6x+FhpAmxTjzIAAAAABJRU5ErkJggg==
</value>
</data>
<data name="tsbHistory.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">


+ 257
- 0
CNAS_BalanceClient/frmConditionMap.Designer.cs Näytä tiedosto

@@ -0,0 +1,257 @@
namespace CNAS_BalanceClient
{
partial class frmConditionMap
{
/// <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(frmConditionMap));
this.pnlCenter = new System.Windows.Forms.Panel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.dgvCnas = new System.Windows.Forms.DataGridView();
this.TableName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.TableColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.DataType = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.condition = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Value = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.pnlCenterBottom = new System.Windows.Forms.Panel();
this.btnDelete = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.pnlRight = new System.Windows.Forms.Panel();
this.pnlBottom = new System.Windows.Forms.Panel();
this.pnlTop = new System.Windows.Forms.Panel();
this.pnlLeft = new System.Windows.Forms.Panel();
this.pnlCenter.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvCnas)).BeginInit();
this.pnlCenterBottom.SuspendLayout();
this.SuspendLayout();
//
// pnlCenter
//
this.pnlCenter.Controls.Add(this.groupBox1);
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.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.pnlCenter.Name = "pnlCenter";
this.pnlCenter.Size = new System.Drawing.Size(574, 396);
this.pnlCenter.TabIndex = 7;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.dgvCnas);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.groupBox1.Size = new System.Drawing.Size(574, 353);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "CNAS列";
//
// dgvCnas
//
this.dgvCnas.AllowUserToAddRows = false;
this.dgvCnas.BackgroundColor = System.Drawing.Color.White;
this.dgvCnas.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvCnas.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.TableName,
this.TableColumn,
this.DataType,
this.condition,
this.Value});
this.dgvCnas.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvCnas.Location = new System.Drawing.Point(3, 22);
this.dgvCnas.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.dgvCnas.Name = "dgvCnas";
this.dgvCnas.RowTemplate.Height = 23;
this.dgvCnas.Size = new System.Drawing.Size(568, 325);
this.dgvCnas.TabIndex = 0;
this.dgvCnas.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvCnas_CellClick);
this.dgvCnas.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvCnas_CellDoubleClick);
this.dgvCnas.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvCnas_CellEndEdit);
this.dgvCnas.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvCnas_CellValueChanged);
this.dgvCnas.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dgvCnas_RowPostPaint);
//
// TableName
//
this.TableName.DataPropertyName = "CnasTableName";
this.TableName.HeaderText = "表名";
this.TableName.Name = "TableName";
this.TableName.Visible = false;
this.TableName.Width = 120;
//
// TableColumn
//
this.TableColumn.DataPropertyName = "CnasFieldName";
this.TableColumn.HeaderText = "列名";
this.TableColumn.Name = "TableColumn";
this.TableColumn.ReadOnly = true;
this.TableColumn.Width = 170;
//
// DataType
//
this.DataType.DataPropertyName = "CnasDataType";
this.DataType.HeaderText = "类型";
this.DataType.Name = "DataType";
this.DataType.ReadOnly = true;
this.DataType.Visible = false;
this.DataType.Width = 120;
//
// condition
//
this.condition.HeaderText = "条件";
this.condition.Name = "condition";
this.condition.ReadOnly = true;
this.condition.Resizable = System.Windows.Forms.DataGridViewTriState.True;
this.condition.Width = 110;
//
// Value
//
this.Value.HeaderText = "值";
this.Value.Name = "Value";
this.Value.Width = 200;
//
// pnlCenterBottom
//
this.pnlCenterBottom.Controls.Add(this.btnDelete);
this.pnlCenterBottom.Controls.Add(this.btnOK);
this.pnlCenterBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlCenterBottom.Location = new System.Drawing.Point(0, 353);
this.pnlCenterBottom.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.pnlCenterBottom.Name = "pnlCenterBottom";
this.pnlCenterBottom.Size = new System.Drawing.Size(574, 43);
this.pnlCenterBottom.TabIndex = 0;
//
// btnDelete
//
this.btnDelete.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnDelete.Location = new System.Drawing.Point(401, 11);
this.btnDelete.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(70, 25);
this.btnDelete.TabIndex = 1;
this.btnDelete.Text = "全部清除";
this.btnDelete.UseVisualStyleBackColor = true;
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// btnOK
//
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOK.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnOK.Location = new System.Drawing.Point(477, 6);
this.btnOK.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(90, 30);
this.btnOK.TabIndex = 0;
this.btnOK.Text = "确定";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// pnlRight
//
this.pnlRight.Dock = System.Windows.Forms.DockStyle.Right;
this.pnlRight.Location = new System.Drawing.Point(584, 10);
this.pnlRight.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.pnlRight.Name = "pnlRight";
this.pnlRight.Size = new System.Drawing.Size(10, 396);
this.pnlRight.TabIndex = 4;
//
// pnlBottom
//
this.pnlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlBottom.Location = new System.Drawing.Point(10, 406);
this.pnlBottom.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.pnlBottom.Name = "pnlBottom";
this.pnlBottom.Size = new System.Drawing.Size(584, 10);
this.pnlBottom.TabIndex = 5;
//
// pnlTop
//
this.pnlTop.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlTop.Location = new System.Drawing.Point(10, 0);
this.pnlTop.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.pnlTop.Name = "pnlTop";
this.pnlTop.Size = new System.Drawing.Size(584, 10);
this.pnlTop.TabIndex = 6;
//
// pnlLeft
//
this.pnlLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.pnlLeft.Location = new System.Drawing.Point(0, 0);
this.pnlLeft.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.pnlLeft.Name = "pnlLeft";
this.pnlLeft.Size = new System.Drawing.Size(10, 416);
this.pnlLeft.TabIndex = 3;
//
// frmConditionMap
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(594, 416);
this.Controls.Add(this.pnlCenter);
this.Controls.Add(this.pnlRight);
this.Controls.Add(this.pnlBottom);
this.Controls.Add(this.pnlTop);
this.Controls.Add(this.pnlLeft);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximizeBox = false;
this.Name = "frmConditionMap";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "条件映射";
this.Load += new System.EventHandler(this.frmConditionMap_Load);
this.pnlCenter.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvCnas)).EndInit();
this.pnlCenterBottom.ResumeLayout(false);
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Panel pnlCenter;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.DataGridView dgvCnas;
private System.Windows.Forms.Panel pnlCenterBottom;
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Panel pnlRight;
private System.Windows.Forms.Panel pnlBottom;
private System.Windows.Forms.Panel pnlTop;
private System.Windows.Forms.Panel pnlLeft;
private System.Windows.Forms.DataGridViewTextBoxColumn TableName;
private System.Windows.Forms.DataGridViewTextBoxColumn TableColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn DataType;
private System.Windows.Forms.DataGridViewTextBoxColumn condition;
private System.Windows.Forms.DataGridViewTextBoxColumn Value;
}
}

+ 556
- 0
CNAS_BalanceClient/frmConditionMap.cs Näytä tiedosto

@@ -0,0 +1,556 @@
using CnasSynchronusClient;
using CnasSynchrousModel;
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_BalanceClient
{
public partial class frmConditionMap : Form
{
DataBaseInfo targetDataBase;
public SyncBalanceItem currentBalanceItem;
private ComboBox cbxConditionValue;
//private List<string> lstConditionValueType = new List<string>() { "等于", "连接", "若...则...", "截取", "除以", "乘以", "小数位数", "数值相加(减)", "截断开头(结尾)" };
private List<string> lstConditionValueType = new List<string>() { "等于" };

public frmConditionMap(SyncBalanceItem currentBalanceItem, DataBaseInfo targetDataBase)
{
InitializeComponent();

this.currentBalanceItem = currentBalanceItem;
this.targetDataBase = targetDataBase;
}

private void frmConditionMap_Load(object sender, EventArgs e)
{
if (currentBalanceItem == null || currentBalanceItem.syncParamasInfos == null || currentBalanceItem.syncParamasInfos.Count == 0)
{
MessageBox.Show("请先指定至少一个映射字段。");
return;
}
//初始化ComBobox
InnitalComboBox();

//加载数据
LoadShowData();
}

/// <summary>
/// 初始化控件combobox
/// </summary>
private void InnitalComboBox()
{
cbxConditionValue = new ComboBox();
cbxConditionValue.SelectedIndexChanged += new EventHandler(cbxConditionValue_SelectedIndexChanged);
cbxConditionValue.SelectionChangeCommitted += new EventHandler(cbxConditionValue_SelectionChangedCommitted);

cbxConditionValue.Visible = false;

cbxConditionValue.DataSource = lstConditionValueType;
}
private void cbxConditionValue_SelectionChangedCommitted(object sender, EventArgs e)
{
cbxConditionValue.Visible = false;
}

private void cbxConditionValue_SelectedIndexChanged(object sender, EventArgs e)
{
//当前选中单元格的值将随之发生更改
if (dgvCnas.CurrentCell == null) return;
dgvCnas.Rows[dgvCnas.CurrentCell.RowIndex].Cells["condition"].Value = cbxConditionValue.Text;
}
/// <summary>
/// 加载数据
/// </summary>
private void LoadShowData()
{
//1.根据映射表中的表名,获取该表所有字段,全部显示
string strTableName = currentBalanceItem.syncParamasInfos[0].TargetTable;
DataTable dtTableStruct = CnasDataOperationFact.CnasDataOperation().GetCNASTablesStruct(strTableName, targetDataBase);
if (dtTableStruct != null)
{
DataTable dtCnasShow = new DataTable();
dtCnasShow.Columns.Add("CnasTableName");
dtCnasShow.Columns.Add("CnasFieldName");
dtCnasShow.Columns.Add("CnasDataType");
foreach (DataColumn dc in dtTableStruct.Columns)
{
if (dc.ColumnName.ToUpper() == "ID") continue;
dtCnasShow.Rows.Add(new object[] { strTableName, dc.ColumnName, dc.DataType });
}

dgvCnas.DataSource = dtCnasShow;
}
//2.根据已存储数据,匹配后填充到datagridview中
if (currentBalanceItem.lstFixedValue == null)
currentBalanceItem.lstFixedValue = new List<CnasConditionMapValue>();
if (currentBalanceItem.lstFixedValue.Count == 0) return;
foreach (DataGridViewRow dgvRow in dgvCnas.Rows)
{
string strCurrentTable = dgvRow.Cells["TableName"].Value.ToString();
string strCurrentColumn = dgvRow.Cells["TableColumn"].Value.ToString();

if (strCurrentTable == "" || strCurrentColumn == "") continue;
var query = currentBalanceItem.lstFixedValue.Where(s => s.TableName == strCurrentTable && s.ColumnName == strCurrentColumn).ToList<CnasConditionMapValue>();
if (query.Count == 1)
{
dgvRow.Cells["Value"].Value = query[0].Value;
dgvRow.Cells["Condition"].Value = GiveShowByCondition(query[0]);
}
}
}

public string GiveShowByCondition(CnasConditionMapValue cnasFixed)
{
string strCurrentCondition = "";
switch (cnasFixed.Condition)
{
case MapCondition.Equal:
strCurrentCondition = "等于";
break;
case MapCondition.Sub:
strCurrentCondition = "连接";
break;
case MapCondition.IFThen:
strCurrentCondition = "若...则...";
break;
case MapCondition.Divided:
strCurrentCondition = "除以";
break;
case MapCondition.Multiplied:
strCurrentCondition = "乘以";
break;
case MapCondition.SubString:
strCurrentCondition = "截取";
break;
case MapCondition.DecimalDigits:
strCurrentCondition = "小数位数";
break;
case MapCondition.AddSubtract:
strCurrentCondition = "数值相加(减)";
break;
case MapCondition.SubstringStartEnd:
strCurrentCondition = "截断开头(结尾)";
break;
}
return strCurrentCondition;
}

private void btnOK_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Close();
}

private void dgvCnas_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 1) //此时是“值”列
{
//如果没有指定条件,无法存储结果
if (dgvCnas.Rows[e.RowIndex].Cells["condition"].Value == null) return;

//当前列名
string strCurrentTable = dgvCnas.Rows[e.RowIndex].Cells["TableName"].Value.ToString();
string strCurrentColumn = dgvCnas.Rows[e.RowIndex].Cells["TableColumn"].Value.ToString();
string strCurrentType = dgvCnas.Rows[e.RowIndex].Cells["DataType"].Value.ToString();
string strCurrentCondition = dgvCnas.Rows[e.RowIndex].Cells["condition"].Value.ToString();

if (dgvCnas.CurrentCell.Value == null)
{
currentBalanceItem.lstFixedValue.RemoveAll(s => s.TableName == strCurrentTable && s.ColumnName == strCurrentColumn);
return;
}
string strInputValue = dgvCnas.CurrentCell.Value.ToString();

//检查合法性
if (strCurrentColumn == "ID")
{
MessageBox.Show("该列不能指定固定值。");
return;
}
bool bIfSuccess = true;
switch (strCurrentType)
{
case "System.Decimal":
decimal defaultdecimal = 0;
if (!decimal.TryParse(strInputValue, out defaultdecimal))
bIfSuccess = false;
break;
case "System.Int":
int defaultint = 0;
if (!int.TryParse(strInputValue, out defaultint))
bIfSuccess = false;
break;
case "System.String":
default:
break;
}
if (!bIfSuccess)
{
MessageBox.Show("输入格式不正确,请重新输入。");
return;
}

if (GetBytesOfString(strInputValue) > 20)
{
MessageBox.Show("输入内容超出限制,请重新输入。");
dgvCnas.CurrentCell.Value = "";
return;
}

//将数据插入到数据源中
var query = currentBalanceItem.lstFixedValue.Where(s => s.TableName == strCurrentTable && s.ColumnName == strCurrentColumn).ToList<CnasConditionMapValue>();
if (query.Count >= 1)
{
GiveConditionByShow(query[0], strCurrentCondition);
//query[0].Condition = strCurrentCondition == "Sub" ? MapCondition.Sub : (strCurrentCondition == "IFThen" ? MapCondition.IFThen: MapCondition.Equal);
query[0].Value = strInputValue;
}
else
{
CnasConditionMapValue cnasFixed = new CnasConditionMapValue();
cnasFixed.TableName = strCurrentTable;
cnasFixed.ColumnName = strCurrentColumn;
cnasFixed.Value = strInputValue;
//cnasFixed.Condition= strCurrentCondition == "Sub" ? MapCondition.Sub : (strCurrentCondition == "IFThen" ? MapCondition.IFThen : MapCondition.Equal);
GiveConditionByShow(cnasFixed, strCurrentCondition);

currentBalanceItem.lstFixedValue.Add(cnasFixed);
}
}
}

public int GetBytesOfString(string Text)
{
int nByte = 0;
byte[] bytes = Encoding.Unicode.GetBytes(Text);
for (int i = 0; i < bytes.GetLength(0); i++)
{
// 偶数位置,如0、2、4等,为UCS2编码中两个字节的第一个字节
if (i % 2 == 0)
{
nByte++; // 在UCS2第一个字节时n加1
}
else
{
// 当UCS2编码的第二个字节大于0时,该UCS2字符为汉字,一个汉字算两个字节
if (bytes[i] > 0)
{
nByte++;
}
}
}

return nByte;
}

public void GiveConditionByShow(CnasConditionMapValue cnasFixed, string strCurrentCondition)
{
switch (strCurrentCondition)
{
case "连接":
cnasFixed.Condition = MapCondition.Sub;
break;
case "若...则...":
cnasFixed.Condition = MapCondition.IFThen;
break;
case "截取":
cnasFixed.Condition = MapCondition.SubString;
break;
case "除以":
cnasFixed.Condition = MapCondition.Divided;
break;
case "乘以":
cnasFixed.Condition = MapCondition.Multiplied;
break;
case "小数位数":
cnasFixed.Condition = MapCondition.DecimalDigits;
break;
case "等于":
cnasFixed.Condition = MapCondition.Equal;
break;
case "数值相加(减)":
cnasFixed.Condition = MapCondition.AddSubtract;
break;
case "截断开头(结尾)":
cnasFixed.Condition = MapCondition.SubstringStartEnd;
break;
default:
break;
}
}

private void dgvCnas_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
dgvCnas.RowHeadersWidth - 4,
e.RowBounds.Height);

TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
dgvCnas.RowHeadersDefaultCellStyle.Font,
rectangle,
dgvCnas.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}

private void dgvCnas_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 0) //如果此时是“条件”列
{
ShowConditionValue();
}
#region
//if (e.ColumnIndex == 1)//如果此时是“值”列
//{
// if (dgvCnas.Rows[e.RowIndex].Cells["condition"].Value == null) return;
// if (dgvCnas.Rows[e.RowIndex].Cells["condition"].Value.ToString() == "连接")
// {
// CnasConditionMapValue cnasFixed = new CnasConditionMapValue
// {
// TableName = dgvCnas.Rows[e.RowIndex].Cells["TableName"].Value.ToString(),
// ColumnName = dgvCnas.Rows[e.RowIndex].Cells["TableColumn"].Value.ToString(),
// Condition = MapCondition.Sub
// };
// if (dgvCnas.Rows[e.RowIndex].Cells["Value"].Value != null)
// cnasFixed.Value = dgvCnas.Rows[e.RowIndex].Cells["Value"].Value.ToString();

// frmConditionParam frmCondition = new frmConditionParam(syncInstrument, cnasFixed);
// if (frmCondition.ShowDialog() == DialogResult.OK)
// {
// if (frmCondition.conditionvalue.Value != null && frmCondition.conditionvalue.Value.ToString() != "")
// {
// dgvCnas.Rows[e.RowIndex].Cells["Value"].Value = frmCondition.conditionvalue.Value;

// //将数据插入到数据源中
// var query = syncInstrument.lstFixedValue.Where(s => s.TableName == cnasFixed.TableName && s.ColumnName == cnasFixed.ColumnName).ToList<CnasConditionMapValue>();
// if (query.Count >= 1)
// {
// query[0].Condition = cnasFixed.Condition;
// query[0].Value = frmCondition.conditionvalue.Value;
// }
// else
// {
// cnasFixed.Value = frmCondition.conditionvalue.Value;
// syncInstrument.lstFixedValue.Add(cnasFixed);
// }
// }
// }
// }
// if (dgvCnas.Rows[e.RowIndex].Cells["condition"].Value.ToString() == "若...则...")
// {
// CnasConditionMapValue cnasFixed = new CnasConditionMapValue
// {
// TableName = dgvCnas.Rows[e.RowIndex].Cells["TableName"].Value.ToString(),
// ColumnName = dgvCnas.Rows[e.RowIndex].Cells["TableColumn"].Value.ToString(),
// Condition = MapCondition.IFThen
// };
// if (dgvCnas.Rows[e.RowIndex].Cells["Value"].Value != null)
// cnasFixed.Value = dgvCnas.Rows[e.RowIndex].Cells["Value"].Value.ToString();

// frmIfThenParams frmIfThen = new frmIfThenParams(syncInstrument, cnasFixed);
// if (frmIfThen.ShowDialog() == DialogResult.OK)
// {
// if (frmIfThen.conditionvalue.Value != null && frmIfThen.conditionvalue.Value.ToString() != "")
// {
// dgvCnas.Rows[e.RowIndex].Cells["Value"].Value = frmIfThen.conditionvalue.Value;

// //将数据插入到数据源中
// var query = syncInstrument.lstFixedValue.Where(s => s.TableName == cnasFixed.TableName && s.ColumnName == cnasFixed.ColumnName).ToList<CnasConditionMapValue>();
// if (query.Count >= 1)
// {
// query[0].Condition = cnasFixed.Condition;
// query[0].Value = frmIfThen.conditionvalue.Value;
// }
// else
// {
// cnasFixed.Value = frmIfThen.conditionvalue.Value;
// syncInstrument.lstFixedValue.Add(cnasFixed);
// }
// }
// }
// }
// if (dgvCnas.Rows[e.RowIndex].Cells["condition"].Value.ToString() == "截取")
// {
// CnasConditionMapValue cnasFixed = new CnasConditionMapValue
// {
// TableName = dgvCnas.Rows[e.RowIndex].Cells["TableName"].Value.ToString(),
// ColumnName = dgvCnas.Rows[e.RowIndex].Cells["TableColumn"].Value.ToString(),
// Condition = MapCondition.SubString
// };
// if (dgvCnas.Rows[e.RowIndex].Cells["Value"].Value != null)
// cnasFixed.Value = dgvCnas.Rows[e.RowIndex].Cells["Value"].Value.ToString();

// frmSplitParam frmSplitParam = new frmSplitParam(cnasFixed);
// if (frmSplitParam.ShowDialog() == DialogResult.OK)
// {
// if (frmSplitParam.conditionvalue.Value != null && frmSplitParam.conditionvalue.Value.ToString() != "")
// {
// dgvCnas.Rows[e.RowIndex].Cells["Value"].Value = frmSplitParam.conditionvalue.Value;

// //将数据插入到数据源中
// var query = syncInstrument.lstFixedValue.Where(s => s.TableName == cnasFixed.TableName && s.ColumnName == cnasFixed.ColumnName).ToList<CnasConditionMapValue>();
// if (query.Count >= 1)
// {
// query[0].Condition = cnasFixed.Condition;
// query[0].Value = frmSplitParam.conditionvalue.Value;
// }
// else
// {
// cnasFixed.Value = frmSplitParam.conditionvalue.Value;
// syncInstrument.lstFixedValue.Add(cnasFixed);
// }
// }
// }
// }

// if (dgvCnas.Rows[e.RowIndex].Cells["condition"].Value.ToString() == "截断开头(结尾)")
// {
// CnasConditionMapValue cnasFixed = new CnasConditionMapValue
// {
// TableName = dgvCnas.Rows[e.RowIndex].Cells["TableName"].Value.ToString(),
// ColumnName = dgvCnas.Rows[e.RowIndex].Cells["TableColumn"].Value.ToString(),
// Condition = MapCondition.SubstringStartEnd
// };
// if (dgvCnas.Rows[e.RowIndex].Cells["Value"].Value != null)
// cnasFixed.Value = dgvCnas.Rows[e.RowIndex].Cells["Value"].Value.ToString();

// frmStartEndSubstring frmStartEnd = new frmStartEndSubstring(cnasFixed);
// if (frmStartEnd.ShowDialog() == DialogResult.OK)
// {
// if (frmStartEnd.conditionvalue.Value != null && frmStartEnd.conditionvalue.Value.ToString() != "")
// {
// dgvCnas.Rows[e.RowIndex].Cells["Value"].Value = frmStartEnd.conditionvalue.Value;

// //将数据插入到数据源中
// var query = syncInstrument.lstFixedValue.Where(s => s.TableName == cnasFixed.TableName && s.ColumnName == cnasFixed.ColumnName).ToList<CnasConditionMapValue>();
// if (query.Count >= 1)
// {
// query[0].Condition = cnasFixed.Condition;
// query[0].Value = frmStartEnd.conditionvalue.Value;
// }
// else
// {
// cnasFixed.Value = frmStartEnd.conditionvalue.Value;
// syncInstrument.lstFixedValue.Add(cnasFixed);
// }
// }
// }
// }

// if (dgvCnas.Rows[e.RowIndex].Cells["condition"].Value.ToString() == "数值相加(减)")
// {
// CnasConditionMapValue cnasFixed = new CnasConditionMapValue
// {
// TableName = dgvCnas.Rows[e.RowIndex].Cells["TableName"].Value.ToString(),
// ColumnName = dgvCnas.Rows[e.RowIndex].Cells["TableColumn"].Value.ToString(),
// Condition = MapCondition.AddSubtract
// };
// if (dgvCnas.Rows[e.RowIndex].Cells["Value"].Value != null)
// cnasFixed.Value = dgvCnas.Rows[e.RowIndex].Cells["Value"].Value.ToString();

// frmAddSubtract frmAddSubtract = new frmAddSubtract(syncInstrument, cnasFixed);
// if (frmAddSubtract.ShowDialog() == DialogResult.OK)
// {
// if (frmAddSubtract.conditionvalue.Value != null && frmAddSubtract.conditionvalue.Value.ToString() != "")
// {
// dgvCnas.Rows[e.RowIndex].Cells["Value"].Value = frmAddSubtract.conditionvalue.Value;

// //将数据插入到数据源中
// var query = syncInstrument.lstFixedValue.Where(s => s.TableName == cnasFixed.TableName && s.ColumnName == cnasFixed.ColumnName).ToList<CnasConditionMapValue>();
// if (query.Count >= 1)
// {
// query[0].Condition = cnasFixed.Condition;
// query[0].Value = frmAddSubtract.conditionvalue.Value;
// }
// else
// {
// cnasFixed.Value = frmAddSubtract.conditionvalue.Value;
// syncInstrument.lstFixedValue.Add(cnasFixed);
// }
// }
// }
// }

// dgvCnas.EndEdit();
//}
#endregion
}
private void ShowConditionValue()
{
Rectangle TmpRect = dgvCnas.GetCellDisplayRectangle(dgvCnas.CurrentCell.ColumnIndex, dgvCnas.CurrentCell.RowIndex, true);
cbxConditionValue.Size = TmpRect.Size;
cbxConditionValue.Top = TmpRect.Top;
cbxConditionValue.Left = TmpRect.Left;
cbxConditionValue.DropDownStyle = ComboBoxStyle.DropDownList;
cbxConditionValue.FormattingEnabled = true;
cbxConditionValue.Visible = true;

if (!this.dgvCnas.Controls.Contains(cbxConditionValue))
this.dgvCnas.Controls.Add(cbxConditionValue);
}

private void btnDelete_Click(object sender, EventArgs e)
{
if (currentBalanceItem == null) return;
if (currentBalanceItem.lstFixedValue == null) return;
if (dgvCnas == null) return;
if (dgvCnas.Rows.Count <= 0) return;

foreach (DataGridViewRow dr in dgvCnas.Rows)
{
dr.Cells["condition"].Value = "";
dr.Cells["Value"].Value = "";
}
currentBalanceItem.lstFixedValue.Clear();
}

private void dgvCnas_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex <= 0) return;
if (e.ColumnIndex == 0) //此时是“条件”列
{
if (dgvCnas.Rows[e.RowIndex].Cells["TableName"].Value == null) return;
if (dgvCnas.Rows[e.RowIndex].Cells["TableColumn"].Value == null) return;
if (dgvCnas.Rows[e.RowIndex].Cells["DataType"].Value == null) return;
if (dgvCnas.Rows[e.RowIndex].Cells["Condition"].Value == null) return;

//当前列名
string strCurrentTable = dgvCnas.Rows[e.RowIndex].Cells["TableName"].Value.ToString();
string strCurrentColumn = dgvCnas.Rows[e.RowIndex].Cells["TableColumn"].Value.ToString();
string strCurrentType = dgvCnas.Rows[e.RowIndex].Cells["DataType"].Value.ToString();
string strCurrentCondition = dgvCnas.Rows[e.RowIndex].Cells["Condition"].Value.ToString();
string strCurrentValue = dgvCnas.Rows[e.RowIndex].Cells["Value"].Value == null ? "" : dgvCnas.Rows[e.RowIndex].Cells["Value"].Value.ToString();

//将数据插入到数据源中
var query = currentBalanceItem.lstFixedValue.Where(s => s.TableName == strCurrentTable && s.ColumnName == strCurrentColumn).ToList<CnasConditionMapValue>();
if (query.Count >= 1)
{
GiveConditionByShow(query[0], strCurrentCondition);
}
else
{
CnasConditionMapValue cnasFixed = new CnasConditionMapValue();
cnasFixed.TableName = strCurrentTable;
cnasFixed.ColumnName = strCurrentColumn;
cnasFixed.Value = strCurrentValue;
GiveConditionByShow(cnasFixed, strCurrentCondition);

currentBalanceItem.lstFixedValue.Add(cnasFixed);
}
}
}

private void dgvCnas_CellClick(object sender, DataGridViewCellEventArgs e)
{
cbxConditionValue.Visible = false;
}
}
}

+ 182
- 0
CNAS_BalanceClient/frmConditionMap.resx Näytä tiedosto

@@ -0,0 +1,182 @@
<?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="TableName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="TableColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="DataType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="condition.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Value.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</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>
AAABAAEAGBgAAAEAIACICQAAFgAAACgAAAAYAAAAMA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAA=
</value>
</data>
</root>

+ 3
- 0
CNAS_BalanceClient/frmConfigPort.Designer.cs Näytä tiedosto

@@ -274,13 +274,16 @@
this.ClientSize = new System.Drawing.Size(509, 275);
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.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmConfigPort";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "天平设置";
this.Load += new System.EventHandler(this.frmConfigPort_Load);
this.Shown += new System.EventHandler(this.frmConfigPort_Shown);
this.panel1.ResumeLayout(false);
this.pnlCenter.ResumeLayout(false);
this.pnlCenter.PerformLayout();


+ 8
- 3
CNAS_BalanceClient/frmConfigPort.cs Näytä tiedosto

@@ -1,4 +1,5 @@
using CnasSynchronusClient;
using CNAS_SerialPort;
using CnasSynchronusClient;
using CnasSynchrousModel;
using System;
using System.Windows.Forms;
@@ -36,7 +37,6 @@ namespace CNAS_BalanceClient
}

//cbxPortName.Items.AddRange(System.IO.Ports.SerialPort.GetPortNames());

}

private void btnOK_Click(object sender, EventArgs e)
@@ -66,7 +66,7 @@ namespace CNAS_BalanceClient
}
else
{
MessageBox.Show("保存时发生异常,无法正常保存!");
MessageBox.Show("保存时发生异常,无法正常保存!", "提示");
}
}

@@ -74,5 +74,10 @@ namespace CNAS_BalanceClient
{
this.Close();
}

private void frmConfigPort_Shown(object sender, EventArgs e)
{
this.cbxPortName.Select(0, 0);
}
}
}

+ 114
- 65
CNAS_BalanceClient/frmHistory.Designer.cs Näytä tiedosto

@@ -50,6 +50,7 @@
this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Mad = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dgvHuiFen = new System.Windows.Forms.DataGridView();
this.ID3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn14 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -64,6 +65,7 @@
this.DecrementValue2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.AAD = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column17 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dgvHuiFaFen = new System.Windows.Forms.DataGridView();
this.ID4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn24 = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -78,6 +80,7 @@
this.VAD = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column13 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column14 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn13 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dgvQuanShuiFen = new System.Windows.Forms.DataGridView();
this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Sample_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -91,6 +94,7 @@
this.ThirdDrying_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Mt = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Auto_Code = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.pnlCenterTop = new System.Windows.Forms.Panel();
this.btnFind = new System.Windows.Forms.Button();
this.txtCode = new System.Windows.Forms.TextBox();
@@ -125,7 +129,7 @@
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(869, 540);
this.pnlAll.Size = new System.Drawing.Size(919, 558);
this.pnlAll.TabIndex = 0;
//
// pnlCenter
@@ -135,7 +139,7 @@
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(849, 520);
this.pnlCenter.Size = new System.Drawing.Size(899, 538);
this.pnlCenter.TabIndex = 4;
//
// pnlCenterBody
@@ -147,7 +151,7 @@
this.pnlCenterBody.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlCenterBody.Location = new System.Drawing.Point(0, 48);
this.pnlCenterBody.Name = "pnlCenterBody";
this.pnlCenterBody.Size = new System.Drawing.Size(849, 472);
this.pnlCenterBody.Size = new System.Drawing.Size(899, 490);
this.pnlCenterBody.TabIndex = 1;
//
// dgvShuiFen
@@ -168,7 +172,8 @@
this.dataGridViewTextBoxColumn10,
this.Column9,
this.Mad,
this.dataGridViewTextBoxColumn12});
this.dataGridViewTextBoxColumn12,
this.Column1});
this.dgvShuiFen.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvShuiFen.Location = new System.Drawing.Point(0, 0);
this.dgvShuiFen.Name = "dgvShuiFen";
@@ -177,7 +182,7 @@
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.Black;
this.dgvShuiFen.RowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvShuiFen.RowTemplate.Height = 23;
this.dgvShuiFen.Size = new System.Drawing.Size(849, 472);
this.dgvShuiFen.Size = new System.Drawing.Size(899, 490);
this.dgvShuiFen.TabIndex = 5;
//
// dataGridViewTextBoxColumn1
@@ -279,6 +284,14 @@
this.dataGridViewTextBoxColumn12.Name = "dataGridViewTextBoxColumn12";
this.dataGridViewTextBoxColumn12.ReadOnly = true;
//
// Column1
//
this.Column1.DataPropertyName = "OperaDateTime";
this.Column1.HeaderText = "称量日期";
this.Column1.Name = "Column1";
this.Column1.ReadOnly = true;
this.Column1.Width = 150;
//
// dgvHuiFen
//
this.dgvHuiFen.AllowUserToAddRows = false;
@@ -297,7 +310,8 @@
this.dataGridViewTextBoxColumn22,
this.DecrementValue2,
this.AAD,
this.Column17});
this.Column17,
this.dataGridViewTextBoxColumn11});
this.dgvHuiFen.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvHuiFen.Location = new System.Drawing.Point(0, 0);
this.dgvHuiFen.Name = "dgvHuiFen";
@@ -306,7 +320,7 @@
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.Black;
this.dgvHuiFen.RowsDefaultCellStyle = dataGridViewCellStyle2;
this.dgvHuiFen.RowTemplate.Height = 23;
this.dgvHuiFen.Size = new System.Drawing.Size(849, 472);
this.dgvHuiFen.Size = new System.Drawing.Size(899, 490);
this.dgvHuiFen.TabIndex = 4;
//
// ID3
@@ -407,6 +421,14 @@
this.Column17.Name = "Column17";
this.Column17.ReadOnly = true;
//
// dataGridViewTextBoxColumn11
//
this.dataGridViewTextBoxColumn11.DataPropertyName = "OperaDateTime";
this.dataGridViewTextBoxColumn11.HeaderText = "称量日期";
this.dataGridViewTextBoxColumn11.Name = "dataGridViewTextBoxColumn11";
this.dataGridViewTextBoxColumn11.ReadOnly = true;
this.dataGridViewTextBoxColumn11.Width = 150;
//
// dgvHuiFaFen
//
this.dgvHuiFaFen.AllowUserToAddRows = false;
@@ -425,7 +447,8 @@
this.MAD2,
this.VAD,
this.Column13,
this.Column14});
this.Column14,
this.dataGridViewTextBoxColumn13});
this.dgvHuiFaFen.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvHuiFaFen.Location = new System.Drawing.Point(0, 0);
this.dgvHuiFaFen.Name = "dgvHuiFaFen";
@@ -434,7 +457,7 @@
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.Black;
this.dgvHuiFaFen.RowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvHuiFaFen.RowTemplate.Height = 23;
this.dgvHuiFaFen.Size = new System.Drawing.Size(849, 472);
this.dgvHuiFaFen.Size = new System.Drawing.Size(899, 490);
this.dgvHuiFaFen.TabIndex = 3;
//
// ID4
@@ -533,6 +556,14 @@
this.Column14.Name = "Column14";
this.Column14.ReadOnly = true;
//
// dataGridViewTextBoxColumn13
//
this.dataGridViewTextBoxColumn13.DataPropertyName = "OperaDateTime";
this.dataGridViewTextBoxColumn13.HeaderText = "称量日期";
this.dataGridViewTextBoxColumn13.Name = "dataGridViewTextBoxColumn13";
this.dataGridViewTextBoxColumn13.ReadOnly = true;
this.dataGridViewTextBoxColumn13.Width = 150;
//
// dgvQuanShuiFen
//
this.dgvQuanShuiFen.AllowUserToAddRows = false;
@@ -550,7 +581,8 @@
this.SecondDrying_Weight,
this.ThirdDrying_Weight,
this.Mt,
this.Auto_Code});
this.Auto_Code,
this.Column2});
this.dgvQuanShuiFen.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvQuanShuiFen.Location = new System.Drawing.Point(0, 0);
this.dgvQuanShuiFen.Name = "dgvQuanShuiFen";
@@ -559,7 +591,7 @@
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.Black;
this.dgvQuanShuiFen.RowsDefaultCellStyle = dataGridViewCellStyle4;
this.dgvQuanShuiFen.RowTemplate.Height = 23;
this.dgvQuanShuiFen.Size = new System.Drawing.Size(849, 472);
this.dgvQuanShuiFen.Size = new System.Drawing.Size(899, 490);
this.dgvQuanShuiFen.TabIndex = 1;
//
// ID
@@ -654,6 +686,14 @@
this.Auto_Code.Name = "Auto_Code";
this.Auto_Code.ReadOnly = true;
//
// Column2
//
this.Column2.DataPropertyName = "OperaDateTime";
this.Column2.HeaderText = "称量日期";
this.Column2.Name = "Column2";
this.Column2.ReadOnly = true;
this.Column2.Width = 150;
//
// pnlCenterTop
//
this.pnlCenterTop.Controls.Add(this.btnFind);
@@ -667,12 +707,12 @@
this.pnlCenterTop.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlCenterTop.Location = new System.Drawing.Point(0, 0);
this.pnlCenterTop.Name = "pnlCenterTop";
this.pnlCenterTop.Size = new System.Drawing.Size(849, 48);
this.pnlCenterTop.Size = new System.Drawing.Size(899, 48);
this.pnlCenterTop.TabIndex = 0;
//
// btnFind
//
this.btnFind.Location = new System.Drawing.Point(749, 12);
this.btnFind.Location = new System.Drawing.Point(808, 12);
this.btnFind.Name = "btnFind";
this.btnFind.Size = new System.Drawing.Size(75, 25);
this.btnFind.TabIndex = 10;
@@ -682,7 +722,7 @@
//
// txtCode
//
this.txtCode.Location = new System.Drawing.Point(546, 13);
this.txtCode.Location = new System.Drawing.Point(593, 13);
this.txtCode.Name = "txtCode";
this.txtCode.Size = new System.Drawing.Size(173, 23);
this.txtCode.TabIndex = 6;
@@ -690,7 +730,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(483, 16);
this.label3.Location = new System.Drawing.Point(530, 16);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 17);
this.label3.TabIndex = 5;
@@ -704,7 +744,7 @@
"水分",
"灰分",
"挥发分"});
this.comType.Location = new System.Drawing.Point(351, 11);
this.comType.Location = new System.Drawing.Point(398, 11);
this.comType.Name = "comType";
this.comType.Size = new System.Drawing.Size(121, 25);
this.comType.TabIndex = 4;
@@ -713,7 +753,7 @@
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(312, 15);
this.label2.Location = new System.Drawing.Point(359, 15);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 17);
this.label2.TabIndex = 3;
@@ -721,16 +761,20 @@
//
// dtpEndDate
//
this.dtpEndDate.Location = new System.Drawing.Point(189, 11);
this.dtpEndDate.CustomFormat = "yyyy-MM-dd HH:mm";
this.dtpEndDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpEndDate.Location = new System.Drawing.Point(212, 11);
this.dtpEndDate.Name = "dtpEndDate";
this.dtpEndDate.Size = new System.Drawing.Size(111, 23);
this.dtpEndDate.Size = new System.Drawing.Size(139, 23);
this.dtpEndDate.TabIndex = 2;
//
// dtpStartTime
//
this.dtpStartTime.CustomFormat = "yyyy-MM-dd HH:mm";
this.dtpStartTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpStartTime.Location = new System.Drawing.Point(69, 11);
this.dtpStartTime.Name = "dtpStartTime";
this.dtpStartTime.Size = new System.Drawing.Size(111, 23);
this.dtpStartTime.Size = new System.Drawing.Size(139, 23);
this.dtpStartTime.TabIndex = 1;
//
// label1
@@ -745,17 +789,17 @@
// pnlBottom
//
this.pnlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlBottom.Location = new System.Drawing.Point(10, 530);
this.pnlBottom.Location = new System.Drawing.Point(10, 548);
this.pnlBottom.Name = "pnlBottom";
this.pnlBottom.Size = new System.Drawing.Size(849, 10);
this.pnlBottom.Size = new System.Drawing.Size(899, 10);
this.pnlBottom.TabIndex = 3;
//
// pnlRight
//
this.pnlRight.Dock = System.Windows.Forms.DockStyle.Right;
this.pnlRight.Location = new System.Drawing.Point(859, 10);
this.pnlRight.Location = new System.Drawing.Point(909, 10);
this.pnlRight.Name = "pnlRight";
this.pnlRight.Size = new System.Drawing.Size(10, 530);
this.pnlRight.Size = new System.Drawing.Size(10, 548);
this.pnlRight.TabIndex = 2;
//
// pnlLeft
@@ -763,7 +807,7 @@
this.pnlLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.pnlLeft.Location = new System.Drawing.Point(0, 10);
this.pnlLeft.Name = "pnlLeft";
this.pnlLeft.Size = new System.Drawing.Size(10, 530);
this.pnlLeft.Size = new System.Drawing.Size(10, 548);
this.pnlLeft.TabIndex = 1;
//
// pnlTop
@@ -771,14 +815,14 @@
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(869, 10);
this.pnlTop.Size = new System.Drawing.Size(919, 10);
this.pnlTop.TabIndex = 0;
//
// frmHistory
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(869, 540);
this.ClientSize = new System.Drawing.Size(919, 558);
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")));
@@ -787,6 +831,7 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "查询";
this.Load += new System.EventHandler(this.frmHistory_Load);
this.Shown += new System.EventHandler(this.frmHistory_Shown);
this.pnlAll.ResumeLayout(false);
this.pnlCenter.ResumeLayout(false);
this.pnlCenterBody.ResumeLayout(false);
@@ -819,46 +864,8 @@
private System.Windows.Forms.Panel pnlTop;
private System.Windows.Forms.Button btnFind;
private System.Windows.Forms.DataGridView dgvQuanShuiFen;
private System.Windows.Forms.DataGridViewTextBoxColumn ID;
private System.Windows.Forms.DataGridViewTextBoxColumn Sample_Number;
private System.Windows.Forms.DataGridViewTextBoxColumn Instrument_Number;
private System.Windows.Forms.DataGridViewTextBoxColumn Crucible_Number;
private System.Windows.Forms.DataGridViewTextBoxColumn Empty_Crucible_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn Sample_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn AddSample_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn Drying_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn SecondDrying_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn ThirdDrying_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn Mt;
private System.Windows.Forms.DataGridViewTextBoxColumn Auto_Code;
private System.Windows.Forms.DataGridView dgvHuiFaFen;
private System.Windows.Forms.DataGridViewTextBoxColumn ID4;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn24;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn25;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn26;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn27;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn28;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn29;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn30;
private System.Windows.Forms.DataGridViewTextBoxColumn VR;
private System.Windows.Forms.DataGridViewTextBoxColumn MAD2;
private System.Windows.Forms.DataGridViewTextBoxColumn VAD;
private System.Windows.Forms.DataGridViewTextBoxColumn Column13;
private System.Windows.Forms.DataGridViewTextBoxColumn Column14;
private System.Windows.Forms.DataGridView dgvHuiFen;
private System.Windows.Forms.DataGridViewTextBoxColumn ID3;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn14;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn15;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn16;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn17;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn18;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn19;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn20;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn21;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn22;
private System.Windows.Forms.DataGridViewTextBoxColumn DecrementValue2;
private System.Windows.Forms.DataGridViewTextBoxColumn AAD;
private System.Windows.Forms.DataGridViewTextBoxColumn Column17;
private System.Windows.Forms.DataGridView dgvShuiFen;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
@@ -873,5 +880,47 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Column9;
private System.Windows.Forms.DataGridViewTextBoxColumn Mad;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn12;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn ID3;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn14;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn15;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn16;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn17;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn18;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn19;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn20;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn21;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn22;
private System.Windows.Forms.DataGridViewTextBoxColumn DecrementValue2;
private System.Windows.Forms.DataGridViewTextBoxColumn AAD;
private System.Windows.Forms.DataGridViewTextBoxColumn Column17;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn11;
private System.Windows.Forms.DataGridViewTextBoxColumn ID4;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn24;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn25;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn26;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn27;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn28;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn29;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn30;
private System.Windows.Forms.DataGridViewTextBoxColumn VR;
private System.Windows.Forms.DataGridViewTextBoxColumn MAD2;
private System.Windows.Forms.DataGridViewTextBoxColumn VAD;
private System.Windows.Forms.DataGridViewTextBoxColumn Column13;
private System.Windows.Forms.DataGridViewTextBoxColumn Column14;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn13;
private System.Windows.Forms.DataGridViewTextBoxColumn ID;
private System.Windows.Forms.DataGridViewTextBoxColumn Sample_Number;
private System.Windows.Forms.DataGridViewTextBoxColumn Instrument_Number;
private System.Windows.Forms.DataGridViewTextBoxColumn Crucible_Number;
private System.Windows.Forms.DataGridViewTextBoxColumn Empty_Crucible_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn Sample_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn AddSample_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn Drying_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn SecondDrying_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn ThirdDrying_Weight;
private System.Windows.Forms.DataGridViewTextBoxColumn Mt;
private System.Windows.Forms.DataGridViewTextBoxColumn Auto_Code;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
}
}

+ 10
- 2
CNAS_BalanceClient/frmHistory.cs Näytä tiedosto

@@ -30,7 +30,8 @@ namespace CNAS_BalanceClient

private void comType_SelectedValueChanged(object sender, EventArgs e)
{
switch (comType.SelectedItem)
string selectedItem = comType.SelectedItem == null ? "" : comType.SelectedItem.ToString();
switch (selectedItem)
{
case "全水分":
dgvQuanShuiFen.Visible = true;
@@ -71,7 +72,8 @@ namespace CNAS_BalanceClient
if (this.txtCode.Text.Trim() != "")
lstFilterData = lstFilterData.Where(s => s.Sample_Number == this.txtCode.Text.Trim()).ToList<LaboratoryTest>();
//筛选类型
switch (comType.SelectedItem)
string selectedIteem = comType.SelectedItem == null ? "" : comType.SelectedItem.ToString();
switch (selectedIteem)
{
case "全水分":
lstFilterData = lstFilterData.Where(s => s.DataType == "ARB").ToList<LaboratoryTest>();
@@ -99,5 +101,11 @@ namespace CNAS_BalanceClient
break;
}
}

private void frmHistory_Shown(object sender, EventArgs e)
{
txtCode.Focus();
txtCode.Select(0, 0);
}
}
}

+ 12
- 0
CNAS_BalanceClient/frmHistory.resx Näytä tiedosto

@@ -153,6 +153,9 @@
<metadata name="dataGridViewTextBoxColumn12.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ID3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -192,6 +195,9 @@
<metadata name="Column17.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn11.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ID4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -231,6 +237,9 @@
<metadata name="Column14.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn13.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ID.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -267,6 +276,9 @@
<metadata name="Auto_Code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</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>


+ 47
- 39
CNAS_BalanceClient/frmLoginServer.Designer.cs Näytä tiedosto

@@ -30,26 +30,27 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmLoginServer));
this.pnlCenter = new System.Windows.Forms.Panel();
this.label6 = new System.Windows.Forms.Label();
this.lblTitle = new System.Windows.Forms.Label();
this.Btn_Logout = new System.Windows.Forms.Button();
this.Btn_Login = new System.Windows.Forms.Button();
this.txtPwd = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.lblPwd = new System.Windows.Forms.Label();
this.txtUserName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.lblUser = new System.Windows.Forms.Label();
this.pnlCenter.SuspendLayout();
this.SuspendLayout();
//
// pnlCenter
//
this.pnlCenter.BackColor = System.Drawing.Color.White;
this.pnlCenter.Controls.Add(this.label6);
this.pnlCenter.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pnlCenter.BackgroundImage")));
this.pnlCenter.Controls.Add(this.lblTitle);
this.pnlCenter.Controls.Add(this.Btn_Logout);
this.pnlCenter.Controls.Add(this.Btn_Login);
this.pnlCenter.Controls.Add(this.txtPwd);
this.pnlCenter.Controls.Add(this.label4);
this.pnlCenter.Controls.Add(this.lblPwd);
this.pnlCenter.Controls.Add(this.txtUserName);
this.pnlCenter.Controls.Add(this.label1);
this.pnlCenter.Controls.Add(this.lblUser);
this.pnlCenter.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlCenter.Location = new System.Drawing.Point(0, 0);
this.pnlCenter.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
@@ -58,43 +59,49 @@
this.pnlCenter.TabIndex = 3;
this.pnlCenter.MouseDown += new System.Windows.Forms.MouseEventHandler(this.frmLoginServer_MouseDown);
//
// label6
// lblTitle
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("华文新魏", 21.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
this.label6.Location = new System.Drawing.Point(176, 22);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(129, 30);
this.label6.TabIndex = 12;
this.label6.Text = "用户登录";
this.lblTitle.AutoSize = true;
this.lblTitle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
this.lblTitle.Font = new System.Drawing.Font("华文新魏", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTitle.ForeColor = System.Drawing.Color.White;
this.lblTitle.Location = new System.Drawing.Point(176, 22);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(133, 30);
this.lblTitle.TabIndex = 12;
this.lblTitle.Text = "用户登录";
//
// Btn_Logout
//
this.Btn_Logout.BackColor = System.Drawing.SystemColors.HotTrack;
this.Btn_Logout.FlatAppearance.BorderColor = System.Drawing.Color.DarkGray;
this.Btn_Logout.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.Btn_Logout.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Btn_Logout.Font = new System.Drawing.Font("微软雅黑", 9.5F);
this.Btn_Logout.ForeColor = System.Drawing.Color.White;
this.Btn_Logout.Location = new System.Drawing.Point(268, 177);
this.Btn_Logout.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Btn_Logout.Name = "Btn_Logout";
this.Btn_Logout.Size = new System.Drawing.Size(90, 30);
this.Btn_Logout.TabIndex = 6;
this.Btn_Logout.Text = "取 消";
this.Btn_Logout.UseVisualStyleBackColor = true;
this.Btn_Logout.UseVisualStyleBackColor = false;
this.Btn_Logout.Click += new System.EventHandler(this.Btn_Logout_Click);
//
// Btn_Login
//
this.Btn_Login.BackColor = System.Drawing.SystemColors.HotTrack;
this.Btn_Login.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.Btn_Login.FlatAppearance.BorderColor = System.Drawing.Color.DarkGray;
this.Btn_Login.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.Btn_Login.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Btn_Login.Location = new System.Drawing.Point(127, 177);
this.Btn_Login.Font = new System.Drawing.Font("微软雅黑", 9.5F);
this.Btn_Login.ForeColor = System.Drawing.Color.White;
this.Btn_Login.Location = new System.Drawing.Point(134, 176);
this.Btn_Login.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Btn_Login.Name = "Btn_Login";
this.Btn_Login.Size = new System.Drawing.Size(90, 30);
this.Btn_Login.TabIndex = 5;
this.Btn_Login.Text = "登 录";
this.Btn_Login.UseVisualStyleBackColor = true;
this.Btn_Login.UseVisualStyleBackColor = false;
this.Btn_Login.Click += new System.EventHandler(this.Btn_Login_Click);
//
// txtPwd
@@ -108,15 +115,15 @@
this.txtPwd.TabIndex = 2;
this.txtPwd.KeyDown += new System.Windows.Forms.KeyEventHandler(this.frmLoginServer_KeyDown);
//
// label4
// lblPwd
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.Location = new System.Drawing.Point(112, 126);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(36, 17);
this.label4.TabIndex = 6;
this.label4.Text = "密 码";
this.lblPwd.AutoSize = true;
this.lblPwd.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblPwd.Location = new System.Drawing.Point(122, 126);
this.lblPwd.Name = "lblPwd";
this.lblPwd.Size = new System.Drawing.Size(39, 17);
this.lblPwd.TabIndex = 6;
this.lblPwd.Text = "密 码:";
//
// txtUserName
//
@@ -129,15 +136,15 @@
this.txtUserName.Text = "admin";
this.txtUserName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.frmLoginServer_KeyDown);
//
// label1
// lblUser
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(112, 88);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(44, 17);
this.label1.TabIndex = 0;
this.label1.Text = "用户名";
this.lblUser.AutoSize = true;
this.lblUser.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblUser.Location = new System.Drawing.Point(117, 88);
this.lblUser.Name = "lblUser";
this.lblUser.Size = new System.Drawing.Size(47, 17);
this.lblUser.TabIndex = 0;
this.lblUser.Text = "用户名:";
//
// frmLoginServer
//
@@ -152,6 +159,7 @@
this.Name = "frmLoginServer";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "登录";
this.Shown += new System.EventHandler(this.frmLoginServer_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.frmLoginServer_KeyDown);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.frmLoginServer_MouseDown);
this.pnlCenter.ResumeLayout(false);
@@ -163,13 +171,13 @@
#endregion

private System.Windows.Forms.Panel pnlCenter;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label lblTitle;
private System.Windows.Forms.Button Btn_Logout;
private System.Windows.Forms.Button Btn_Login;
private System.Windows.Forms.TextBox txtPwd;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label lblPwd;
private System.Windows.Forms.TextBox txtUserName;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lblUser;
}
}


+ 14
- 5
CNAS_BalanceClient/frmLoginServer.cs Näytä tiedosto

@@ -26,6 +26,10 @@ namespace CNAS_BalanceClient
public frmLoginServer()
{
InitializeComponent();

lblTitle.BackColor = Color.Transparent;
lblUser.BackColor = Color.Transparent;
lblPwd.BackColor = Color.Transparent;
}

private void Btn_Login_Click(object sender, EventArgs e)
@@ -37,7 +41,7 @@ namespace CNAS_BalanceClient
//合法行判断
if (this.txtUserName.Text.Trim() == "" || this.txtPwd.Text.Trim() == "")
{
MessageBox.Show("用户名,密码不能为空。");
MessageBox.Show("用户名,密码不能为空。", "提示");
return;
}

@@ -48,9 +52,9 @@ namespace CNAS_BalanceClient
//加载CNAS数据库信息
targetdataBase = FileOperation.GetLocalPlatFormDB();

if (!CnasDataOperationFact.CnasDataOperation().TestConnect(targetdataBase.DBHost, targetdataBase.DBName, targetdataBase.DBUser, targetdataBase.DBPwd, targetdataBase.DBPort))
if (!CnasDataOperationFact.CnasDataOperation().TestConnect(targetdataBase))
{
MessageBox.Show("无法连接数据,请联系管理员。");
MessageBox.Show("无法连接数据,请联系管理员。", "提示");
return;
}
}
@@ -64,13 +68,13 @@ namespace CNAS_BalanceClient
{
GlobalCommonOperation.strLoginName = dtLogin.Rows[0]["username"].ToString();
GlobalCommonOperation.strUserName = this.txtUserName.Text.Trim();
AppLog.Info($"{this.txtUserName.Text.Trim()}登录成功");
AppLog.Info($"{this.txtUserName.Text.Trim()}登录成功");
this.DialogResult = DialogResult.OK;
this.Close();
}
else
{
MessageBox.Show("用户名,密码登录失败,请重新输入。");
MessageBox.Show("用户名,密码登录失败,请重新输入。", "提示");
AppLog.Error($"{this.txtUserName.Text.Trim()}尝试登录失败");
return;
}
@@ -117,5 +121,10 @@ namespace CNAS_BalanceClient
AppLog.Error(ex.Message.ToString());
}
}

private void frmLoginServer_Shown(object sender, EventArgs e)
{
txtUserName.Select(txtUserName.Text.Length, 0);
}
}
}

+ 240
- 0
CNAS_BalanceClient/frmLoginServer.resx Näytä tiedosto

@@ -118,6 +118,246 @@
<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="pnlCenter.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
/9j/4AAQSkZJRgABAQEBLAEsAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwg
JC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIy
MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAFVAfQDAREAAhEBAxEB/8QA
GwAAAwEBAQEBAAAAAAAAAAAAAQIDAAQFBgf/xAA8EAACAQMCBAMFBQcEAgMAAAAAAQIDERIEIQUxQVET
YXEiMkJSkQYUgaGxIzNDU3KC0RVikuFUwUTw8f/EABoBAQEBAQEBAQAAAAAAAAAAAAEAAgMEBQb/xAAq
EQEBAQEAAg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6cTaA4RoFhHEjhHEjgYgcDEjjYgcMroidWfPYDD4AcbEjg4EcFRBGUSRlEiZRBGUSJlEiZIE6aFV
x9mXu/oDUrrsDbnNOTCGJMQYkAhiQkmIMSAk1iQ2JNYk1gQ2I41iQ2AjYjhrAcYmsEjjEmIsAAUxJrki
3JNcg1yTEgENYhYVizgMmbCtCzStCzgNCMI0LNickaGJyRHCNAcI4kcK4gsBxI4XEljYhpxsSONiSxsS
OGjdAVY2fkwJsC0mUQQ4kRUSRlECKiSMkRFIkdIirGrKMbXDDoiyxBiTCAJMSYQxBiQkmAMSEi1iQkhA
tyIiBEmmIiSYixJgQCGJASBsgBJiTEmJMSAQDIMxZoMmaVizSsQVjAmxBGiJGiRWiJWgRbEQsBxrEmsi
I2JDigIpEhsSPFtAVLKxNDYENiQ2IikSMkSNYCJIxJ//2Q==
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAGBgAAAEAIACICQAAFgAAACgAAAAYAAAAMAAAAAEAIAAAAAAAAAkAABAnAAAQJwAAAAAAAAAA


BIN
CNAS_BalanceClient/scales_of_Balance_16px_1117673_easyicon.net.ico Näytä tiedosto

Before After

+ 14
- 2
CNAS_DBSync.sln Näytä tiedosto

@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.705
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CnasSynchronusDAL", "CnasSynchronusDAL\CnasSynchronusDAL.csproj", "{F4EC1B78-EFF4-4D04-AE79-631D220187AF}"
EndProject
@@ -29,6 +29,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNAS_BalanceClient", "CNAS_
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WF-ChangeGUID", "WF-ChangeGUID\WF-ChangeGUID.csproj", "{E20B8662-89F1-42D9-8DC5-0E30E1AADCD6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNAS_SerialPort", "CNAS_SerialPort\CNAS_SerialPort.csproj", "{ABB56058-B6FD-4747-A4E9-9C9361D6D993}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNAS_Authorize", "CNAS_Authorize\CNAS_Authorize.csproj", "{9B4A6989-A7A6-41C0-ADFE-D470EB972D79}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -87,6 +91,14 @@ Global
{E20B8662-89F1-42D9-8DC5-0E30E1AADCD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E20B8662-89F1-42D9-8DC5-0E30E1AADCD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E20B8662-89F1-42D9-8DC5-0E30E1AADCD6}.Release|Any CPU.Build.0 = Release|Any CPU
{ABB56058-B6FD-4747-A4E9-9C9361D6D993}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ABB56058-B6FD-4747-A4E9-9C9361D6D993}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ABB56058-B6FD-4747-A4E9-9C9361D6D993}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ABB56058-B6FD-4747-A4E9-9C9361D6D993}.Release|Any CPU.Build.0 = Release|Any CPU
{9B4A6989-A7A6-41C0-ADFE-D470EB972D79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B4A6989-A7A6-41C0-ADFE-D470EB972D79}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B4A6989-A7A6-41C0-ADFE-D470EB972D79}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B4A6989-A7A6-41C0-ADFE-D470EB972D79}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE


+ 46
- 33
CNAS_DBSync/App.config Näytä tiedosto

@@ -1,74 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<?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" />
<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"/>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="CNAS_DBSync.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</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" />
<add name="CNAS_DBSync.Properties.Settings.ConnectionString"
connectionString="Data Source=E:\JXD\CNASClient\CNAS_DBSync\dll\database.db"
connectionString="Data Source=C:\DEV\CNAS\CNASClient\CNAS_DBSync\dll\database.db"
providerName="Devart.Data.SQLite" />
</connectionStrings>
<appSettings>
<add key="TargetDBType" value="MYSQL" />
<add key="InitalOperationPwd" value="123456" />
<add key="TargetDBType" value="Mysql"/>
<add key="InitalOperationPwd" value="123456"/>
<add key="GetMacMethod" value="1"/>
<add key="StartGeneralVersion" value="1"/>
<add key="StartWebApiUrl" value="1"/>
<add key="WebApiUrl" value="http://localhost:60101/api"/>
</appSettings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
<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" />
<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>
<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>
<logger name="Log">
<level value="INFO" />
<appender-ref ref="RollingLog" />
<level value="INFO"/>
<appender-ref ref="RollingLog"/>
</logger>
<logger name="Err">
<level value="ERROR" />
<appender-ref ref="RollingErr" />
<level value="ERROR"/>
<appender-ref ref="RollingErr"/>
</logger>
<appender name="RollingLog" type="log4net.Appender.RollingFileAppender">
<file value="Log\" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.txt'" />
<staticLogFileName value="false" />
<file value="Log\"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyyMMdd'.txt'"/>
<staticLogFileName value="false"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 操作信息:%m%n" />
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 操作信息:%m%n"/>
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="INFO" />
<param name="LevelMin" value="INFO"/>
<param name="LevelMax" value="INFO"/>
</filter>
</appender>
<appender name="RollingErr" type="log4net.Appender.RollingFileAppender">
<file value="ErrorLog\" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.txt'" />
<staticLogFileName value="false" />
<file value="ErrorLog\"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyyMMdd'.txt'"/>
<staticLogFileName value="false"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 错误描述:%m%n" />
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 错误描述:%m%n"/>
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="ERROR" />
<param name="LevelMax" value="ERROR" />
<param name="LevelMin" value="ERROR"/>
<param name="LevelMax" value="ERROR"/>
</filter>
</appender>
</log4net>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup><applicationSettings>
<CNAS_DBSync.Properties.Settings>
<setting name="SyncParamSize" serializeAs="String">
<value />
</setting>
</CNAS_DBSync.Properties.Settings>
</applicationSettings>
</configuration>

+ 43
- 1
CNAS_DBSync/CNAS_DBSync.csproj Näytä tiedosto

@@ -8,11 +8,12 @@
<OutputType>WinExe</OutputType>
<RootNamespace>CNAS_DBSync</RootNamespace>
<AssemblyName>CNAS_DBSync</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
@@ -23,6 +24,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -32,6 +34,13 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>drum_set_16px_1218345_easyicon.net.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
@@ -54,6 +63,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FormSizeHelper.cs" />
<Compile Include="SourceSettingTextBoxDecrible.cs" />
<Compile Include="frmAddSubtract.cs">
<SubType>Form</SubType>
</Compile>
@@ -114,18 +125,36 @@
<Compile Include="frmSourceFilter.Designer.cs">
<DependentUpon>frmSourceFilter.cs</DependentUpon>
</Compile>
<Compile Include="frmSourceSetting.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmSourceSetting.Designer.cs">
<DependentUpon>frmSourceSetting.cs</DependentUpon>
</Compile>
<Compile Include="frmSplitParam.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmSplitParam.Designer.cs">
<DependentUpon>frmSplitParam.cs</DependentUpon>
</Compile>
<Compile Include="frmStartEndSubstring.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmStartEndSubstring.Designer.cs">
<DependentUpon>frmStartEndSubstring.cs</DependentUpon>
</Compile>
<Compile Include="frmSyncParams.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmSyncParams.Designer.cs">
<DependentUpon>frmSyncParams.cs</DependentUpon>
</Compile>
<Compile Include="frmSystemSetting.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmSystemSetting.Designer.cs">
<DependentUpon>frmSystemSetting.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="frmAddSubtract.resx">
@@ -158,12 +187,21 @@
<EmbeddedResource Include="frmSourceFilter.resx">
<DependentUpon>frmSourceFilter.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmSourceSetting.resx">
<DependentUpon>frmSourceSetting.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmSplitParam.resx">
<DependentUpon>frmSplitParam.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmStartEndSubstring.resx">
<DependentUpon>frmStartEndSubstring.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmSyncParams.resx">
<DependentUpon>frmSyncParams.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmSystemSetting.resx">
<DependentUpon>frmSystemSetting.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -172,6 +210,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="App.config" />
<None Include="packages.config" />
@@ -199,6 +238,9 @@
<Name>CnasSynchrousModel</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="drum_set_16px_1218345_easyicon.net.ico" />
</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">


+ 264
- 0
CNAS_DBSync/FormSizeHelper.cs Näytä tiedosto

@@ -0,0 +1,264 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Windows.Forms;
using System.Configuration;
using System.Collections;
using System.Drawing;
using System.IO;

using CnasSynchronousCommon;
using System.Xml;

namespace CNAS_DBSync
{

struct FieldLine
{
Label label;
Control editor;
Button button;
int size;

public FieldLine(Label label, Control editor, Button button = null)
{
this.label = label;
this.editor = editor;
this.button = button;
int count = 0;
if (label != null) count++;
if (editor != null) count++;
if (button != null) count++;
size = count;
}

public Label Label
{
get
{
return label;
}
}
public Control Editor
{
get
{
return editor;
}
}

public Button Button
{
get
{
return button;
}
}

}

/// <summary>
/// 设置容器内编辑字段位置的公共算法
/// </summary>
class FormSizeHelper
{
private static readonly string strLocalConfigPath = FileHelper.getBasePath() + @"\Data\";
private static readonly string FormSizeXml = "FormSize.xml";
private static readonly FormSizeHelper instance;
private Hashtable formSizes;

// 静态构造函数确保线程安全且延迟加载。
static FormSizeHelper() {
instance = new FormSizeHelper();
}

// 防止外部实例化。
private FormSizeHelper() {
Init();
}
public static FormSizeHelper Instance => instance; // 提供全局访问点。

public static void Arrange(Panel container, FieldLine[] fields, int span1 = 1, int span2 = 1)
{
int colLabel = 0;
int colEditor = 0;
int colButton = 0;
int lbLeft = -1;
for (int i = 0; i < fields.Length; i++)
{
if (lbLeft == -1)
{
if (fields[i].Label != null)
lbLeft = fields[i].Label.Left;
}
else if (fields[i].Label != null && fields[i].Label.Left >= 0 && fields[i].Label.Left < lbLeft)
{
lbLeft = fields[i].Label.Left;
}
}

int width = lbLeft < 0 ? (container.Width * 80 / 100) : (container.Width-lbLeft*2);
int marginLeft = (container.Width - width) / 2;
for (int i=0;i< fields.Length; i++)
{
if(fields[i].Label != null && fields[i].Label.Width > colLabel)
{
colLabel = fields[i].Label.Width;
}
if (fields[i].Button != null && fields[i].Button.Width > colButton)
{
colButton = fields[i].Button.Width;
}
}

colEditor = width - (colLabel + span1 + span2 + colButton);

for (int i = 0; i < fields.Length; i++)
{
//Label不动

//改变Editor
if (fields[i].Editor != null)
{
if(fields[i].Editor is TextBox)
{
TextBox tb = (TextBox)fields[i].Editor;
//tb.Left = marginLeft + colLabel + span1;
tb.Width = colEditor;
if(fields[i].Button != null)
{
fields[i].Button.Left = tb.Left + colEditor + span2;
}
}


if(fields[i].Editor is CheckBox)
{
//不动
}

if(fields[i].Editor is ComboBox)
{
ComboBox tb = (ComboBox)fields[i].Editor;
//tb.Left = marginLeft + colLabel + span1;
tb.Width = colEditor;
if (fields[i].Button != null)
{
fields[i].Button.Left = tb.Left + colEditor + span2;
}
}

}

}


}

private static bool ValidBound(Form form, int x, int y, int w, int h)
{
if (x>=0 && y >= 0 && w>0 && h > 0)
{
Screen screen = Screen.FromControl(form);
Rectangle r = screen.Bounds;
return (x + w < r.Width && y + h < r.Height);
}
return false;
}

private void Init()
{
formSizes = new Hashtable(10);
string strUrl = strLocalConfigPath + FormSizeXml;
try
{
if (!File.Exists(strUrl)) return;

XmlDocument doc = new XmlDocument();
doc.Load(strUrl);
XmlNode root = doc.DocumentElement;
foreach (XmlNode node in root.ChildNodes)
{
string formname = node.Name;
string value = node.InnerText;
formSizes.Add(formname, value);
}
}
catch (Exception ex)
{
AppLog.Error(ex.Message);
}
}

public List<string> LoadDefaultSize(Form form, string key, out bool changed)
{
changed = false;
if (formSizes.ContainsKey(key))
{
string value = formSizes[key] as string;
string[] values = value.Split(',');
if (values.Length >= 4)
{
int x, y, w, h;
if (int.TryParse(values[0], out x) && int.TryParse(values[1], out y) &&
int.TryParse(values[2], out w) && int.TryParse(values[3], out h))
{
if (ValidBound(form, x, y, w, h))
{
form.Left = x;
form.Top = y;
form.Width = w;
form.Height = h;
changed = true;
}
}

if (changed && values.Length > 4)
{
List<string> list = new List<string>(values.Length - 4);
for (int i = 4; i < values.Length; i++)
{
list.Add(values[i]);
}
return list;
}
}
}
return null;
}

public bool SaveDefaultSize(string key, string value)
{
if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value))
{
formSizes[key] = value;
StringBuilder sb = new StringBuilder();
sb.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Forms>\n");
foreach(object k in formSizes.Keys)
{
string line = string.Format("<{0}>{1}</{0}>", k, formSizes[k]);
sb.Append(line).Append("\n");
}
sb.Append("</Forms>");
try
{
bool bIfSuccess = FileHelper.SaveLocalFile(strLocalConfigPath, FormSizeXml, sb.ToString());
return bIfSuccess;
}
catch (Exception ex)
{
AppLog.Error(ex.Message);
}
}
return true;
}

}
}

+ 24
- 5
CNAS_DBSync/Program.cs Näytä tiedosto

@@ -3,6 +3,7 @@ using CnasSynchronusClient;
using CnasSynchrousModel;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Windows.Forms;

@@ -19,7 +20,7 @@ namespace CNAS_DBSync
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
string strMsg = "";
CheckAvailability(ref strMsg);
/*CheckAvailability(ref strMsg);*/
if (strMsg == "")
{
if (new frmOperationPwd().ShowDialog() == DialogResult.OK)
@@ -29,12 +30,30 @@ namespace CNAS_DBSync
MessageBox.Show(strMsg);
}

//检查当前电脑是否可以启动程序
///检查当前电脑是否可以启动程序
public static void CheckAvailability(ref string strErrorMsg)
{
//1.读取本地CNAS数据库配置信息
DataBaseInfo Cnasdb = FileOperation.GetLocalCnasDB();
if (!CnasDataOperationFact.CnasDataOperation().TestConnect(Cnasdb.DBHost, Cnasdb.DBName, Cnasdb.DBUser, Cnasdb.DBPwd, Cnasdb.DBPort))
//0.读取本地系统配置文件
SystemFormatConfig systemFormat = FileOperation.GetSystemFormatConfigData();
GlobalCommonOperation.strStartGeneralVersion = systemFormat.StartGeneralVersion;
GlobalCommonOperation.strStartWebApi = systemFormat.StartWebApi;
GlobalCommonOperation.strWebApiUrl = systemFormat.WebApiUrl;
GlobalCommonOperation.strTargetDbType = systemFormat.TargetDBType;
if (GlobalCommonOperation.strStartGeneralVersion == "1") //此时启动的时通用版本,不需检查Mac地址
{
return;
}

//1.读取本地CNAS数据库配置信息
DataBaseInfo Cnasdb = null;
if (GlobalCommonOperation.strStartWebApi != "1")
Cnasdb = FileOperation.GetLocalCnasDB();
else
Cnasdb = new DataBaseInfo()
{
DataBaseCode = "cnas"
};
if (!CnasDataOperationFact.CnasDataOperation().TestConnect(Cnasdb))
{
strErrorMsg = "无法正常连接CNAS库,请先配置数据库连接。";
return;


+ 26
- 34
CNAS_DBSync/Properties/Resources.Designer.cs Näytä tiedosto

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

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

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()
{
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(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 属性
/// 使用此强类型资源类的资源查找。
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}


+ 11
- 2
CNAS_DBSync/Properties/Settings.Designer.cs Näytä tiedosto

@@ -12,7 +12,7 @@ namespace CNAS_DBSync.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -26,11 +26,20 @@ namespace CNAS_DBSync.Properties {
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=E:\\JXD\\CNASClient\\CNAS_DBSync\\dll\\database.db")]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=C:\\DEV\\CNAS\\CNASClient\\CNAS_DBSync\\dll\\database.db")]
public string ConnectionString {
get {
return ((string)(this["ConnectionString"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string SyncParamSize {
get {
return ((string)(this["SyncParamSize"]));
}
}
}
}

+ 5
- 2
CNAS_DBSync/Properties/Settings.settings Näytä tiedosto

@@ -5,10 +5,13 @@
<Setting Name="ConnectionString" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;ConnectionString&gt;Data Source=E:\JXD\CNASClient\CNAS_DBSync\dll\database.db&lt;/ConnectionString&gt;
&lt;ConnectionString&gt;Data Source=C:\DEV\CNAS\CNASClient\CNAS_DBSync\dll\database.db&lt;/ConnectionString&gt;
&lt;ProviderName&gt;Devart.Data.SQLite&lt;/ProviderName&gt;
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Data Source=E:\JXD\CNASClient\CNAS_DBSync\dll\database.db</Value>
<Value Profile="(Default)">Data Source=C:\DEV\CNAS\CNASClient\CNAS_DBSync\dll\database.db</Value>
</Setting>
<Setting Name="SyncParamSize" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

+ 63
- 0
CNAS_DBSync/SourceSettingTextBoxDecrible.cs Näytä tiedosto

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

namespace CNAS_DBSync
{
/// <summary>
/// 来源设置界面中提示语言类
/// </summary>
public class SourceSettingTextBoxDecrible
{
/*Excel配置界面中参数*/
public static string txtExcelSpecialDateColumnFormat_Decrible = "请输入类似于yyyyMMdd样式内容";
public static string txtExcelFileNameFormat_Decrible = "请输入类似于yyyyMMdd样式内容";
public static string txtExcelAutoSqlName_Decrible = "请定义一个自定义查询的名称或描述";
public static string txtExcelAutoSql_Decrible = "请输入自定义查询的sql语句";

/*Access配置界面中参数*/
public static string txtAccessSuffix_Decrible = "请输入文件后缀名";
public static string txtAccessSpecialDateColumnFormat_Decrible = "请输入类似于yyyyMMdd样式内容";
public static string txtAccessFileName_Decrible = "请输入类似于yyyyMMdd样式内容";
public static string txtAccessAutoSqlName_Decrible = "请定义一个自定义查询的名称或描述";
public static string txtAccessAutoSql_Decrible = "请输入自定义查询的sql语句";

/*FoxPro配置界面中参数*/
public static string txtFoxProSpecialDateColumnFormat_Decrible = "请输入类似于yyyyMMdd样式内容";
public static string txtFoxProFileNameFormat_Decrible = "请输入类似于yyyyMMdd样式内容";
public static string txtFoxProAutoSqlName_Decrible = "请定义一个自定义查询的名称或描述";
public static string txtFoxProAutoSql_Decrible = "请输入自定义查询的sql语句";
public static string txtFoxProSpecialMethodName_Decrible = "请输入特殊方法的名称(比如comcat)";
public static string txtFoxProSpecialMethod_Decrible = "请输入特殊方法的参数列,用英文逗号隔开";

/*Sqlite配置界面中参数*/
public static string txtSqliteSpecialDateColumnFormat_Decrible = "请输入类似于yyyyMMdd样式内容";
public static string txtSqliteFileNameFormat_Decrible = "请输入类似于yyyyMMdd样式内容";
public static string txtSqliteAutoSqlName_Decrible = "请定义一个自定义查询的名称或描述";
public static string txtSqliteAutoSql_Decrible = "请输入自定义查询的sql语句";

/*Sqlserver配置界面中参数*/
public static string txtSqlServerSpecialDateColumnFormat_Decrible = "请输入类似于yyyyMMdd样式内容";
public static string txtSqlServerConnection_Decrible = "请输入连接字符串";
public static string txtSqlServerAutoSqlName_Decrible = "请定义一个自定义查询的名称或描述";
public static string txtSqlServerAutoSql_Decrible = "请输入自定义查询的sql语句";

/*MySql配置界面中参数*/
public static string txtMySqlSpecialDateColumnFormat_Decrible = "请输入类似于yyyyMMdd样式内容";
public static string txtMySqlAutoSqlName_Decrible = "请定义一个自定义查询的名称或描述";
public static string txtMySqlAutoSql_Decrible = "请输入自定义查询的sql语句";

/*Oracle配置界面中参数*/
public static string txtOracleSpecialDateColumnFormat_Decrible = "请输入类似于yyyyMMdd样式内容";
public static string txtOracleAutoSqlName_Decrible = "请定义一个自定义查询的名称或描述";
public static string txtOracleAutoSql_Decrible = "请输入自定义查询的sql语句";

/*TXT配置界面中参数*/
public static string txtNormalFileSpecialDateColumnFormat_Decrible = "请输入类似于yyyyMMdd样式内容";
public static string txtNormalFileNameFormat_Decrible = "请输入类似于yyyyMMdd样式内容";
public static string txtNormalFileReadDataMode_Decrible = "请输入读取规则选型";
public static string txtNormalFileSuffix_Decrible = "请输入文件后缀名";
public static string txtNormalFileReadSplitMode_Decrible = "请输入文件分割每个数据行的依据。0代表“ ”,1代表“\t”,2代表0和1的集合";
}
}

BIN
CNAS_DBSync/drum_set_16px_1218345_easyicon.net.ico Näytä tiedosto

Before After

+ 73
- 2
CNAS_DBSync/frmCNASValue.cs Näytä tiedosto

@@ -15,7 +15,7 @@ namespace CNAS_DBSync
{
public SyncInstrumentItemInfo syncInstrument;
private ComboBox cbxConditionValue;
private List<string> lstConditionValueType = new List<string>() { "等于", "连接", "若...则...", "截取", "除以", "乘以", "小数位数","数值相加(减)" };
private List<string> lstConditionValueType = new List<string>() { "等于", "连接", "若...则...", "截取", "除以", "乘以", "小数位数","数值相加(减)","截断开头(结尾)" };

public frmCNASValue(SyncInstrumentItemInfo syncInstrument)
{
@@ -154,6 +154,13 @@ namespace CNAS_DBSync
return;
}

if (GetBytesOfString(strInputValue) > 20)
{
MessageBox.Show("输入内容超出限制,请重新输入。");
dgvCnas.CurrentCell.Value = "";
return;
}

//将数据插入到数据源中
var query = syncInstrument.lstFixedValue.Where(s => s.TableName == strCurrentTable && s.ColumnName == strCurrentColumn).ToList<CnasConditionMapValue>();
if (query.Count >= 1)
@@ -176,6 +183,30 @@ namespace CNAS_DBSync
}
}

public int GetBytesOfString(string Text)
{
int nByte = 0;
byte[] bytes = Encoding.Unicode.GetBytes(Text);
for (int i = 0; i < bytes.GetLength(0); i++)
{
// 偶数位置,如0、2、4等,为UCS2编码中两个字节的第一个字节
if (i % 2 == 0)
{
nByte++; // 在UCS2第一个字节时n加1
}
else
{
// 当UCS2编码的第二个字节大于0时,该UCS2字符为汉字,一个汉字算两个字节
if (bytes[i] > 0)
{
nByte++;
}
}
}

return nByte;
}

public void GiveConditionByShow(CnasConditionMapValue cnasFixed,string strCurrentCondition)
{
switch (strCurrentCondition)
@@ -204,7 +235,10 @@ namespace CNAS_DBSync
case "数值相加(减)":
cnasFixed.Condition = MapCondition.AddSubtract;
break;
default:
case "截断开头(结尾)":
cnasFixed.Condition = MapCondition.SubstringStartEnd;
break;
default:
break;
}
}
@@ -237,6 +271,9 @@ namespace CNAS_DBSync
case MapCondition.AddSubtract:
strCurrentCondition = "数值相加(减)";
break;
case MapCondition.SubstringStartEnd:
strCurrentCondition = "截断开头(结尾)";
break;
}
return strCurrentCondition;
}
@@ -364,6 +401,40 @@ namespace CNAS_DBSync
}
}

if (dgvCnas.Rows[e.RowIndex].Cells["condition"].Value.ToString() == "截断开头(结尾)")
{
CnasConditionMapValue cnasFixed = new CnasConditionMapValue
{
TableName = dgvCnas.Rows[e.RowIndex].Cells["TableName"].Value.ToString(),
ColumnName = dgvCnas.Rows[e.RowIndex].Cells["TableColumn"].Value.ToString(),
Condition = MapCondition.SubstringStartEnd
};
if (dgvCnas.Rows[e.RowIndex].Cells["Value"].Value != null)
cnasFixed.Value = dgvCnas.Rows[e.RowIndex].Cells["Value"].Value.ToString();

frmStartEndSubstring frmStartEnd = new frmStartEndSubstring(cnasFixed);
if (frmStartEnd.ShowDialog() == DialogResult.OK)
{
if (frmStartEnd.conditionvalue.Value != null && frmStartEnd.conditionvalue.Value.ToString() != "")
{
dgvCnas.Rows[e.RowIndex].Cells["Value"].Value = frmStartEnd.conditionvalue.Value;

//将数据插入到数据源中
var query = syncInstrument.lstFixedValue.Where(s => s.TableName == cnasFixed.TableName && s.ColumnName == cnasFixed.ColumnName).ToList<CnasConditionMapValue>();
if (query.Count >= 1)
{
query[0].Condition = cnasFixed.Condition;
query[0].Value = frmStartEnd.conditionvalue.Value;
}
else
{
cnasFixed.Value = frmStartEnd.conditionvalue.Value;
syncInstrument.lstFixedValue.Add(cnasFixed);
}
}
}
}

if (dgvCnas.Rows[e.RowIndex].Cells["condition"].Value.ToString() == "数值相加(减)")
{
CnasConditionMapValue cnasFixed = new CnasConditionMapValue


+ 308
- 201
CNAS_DBSync/frmDatabaseParams.Designer.cs
File diff suppressed because it is too large
Näytä tiedosto


+ 101
- 15
CNAS_DBSync/frmDatabaseParams.cs Näytä tiedosto

@@ -18,8 +18,7 @@ namespace CNAS_DBSync
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 Dictionary<string, DataTable> dictInstrument = new Dictionary<string, DataTable>();
public InstumentCodeHanlder InstrumentDelegate; //传递仪器编码委托
public InstrumentItemDataHanlder InstrumentItemData; //传递仪器项委托
private string strReadExcelMode = ""; //读取Excel数据模式
@@ -27,6 +26,7 @@ namespace CNAS_DBSync
private string strReadTxtMode = "";//读取Txt数据模式
private string strReadSqliteMode = ""; //读取sqlite数据模式
private string strReadAccessMode = ""; //读取Access数据模式
public DataBaseInfo targetDataBaseInfo = new DataBaseInfo(); //数据库

public SqlServerFormatConfig sqlServerFormat { get; set; }

@@ -43,6 +43,16 @@ namespace CNAS_DBSync
strReadAccessMode = FileOperation.GetFormatConfigData<AccessFormatConfig>("AccessFormatConfig.xml").ReadAccessFileMode;

sqlServerFormat = FileOperation.GetFormatConfigData<SqlServerFormatConfig>("SqlServerFormatConfig.xml");

if (GlobalCommonOperation.strStartWebApi == "1")
{
this.txtDBHost.Enabled = false;
this.txtDBName.Enabled = false;
this.txtDBUser.Enabled = false;
this.txtDBPwd.Enabled = false;
this.txtPort.Enabled = false;
btnCNASTestLink.Enabled = false;
}
}

private void frmDatabaseParams_Load(object sender, EventArgs e)
@@ -138,13 +148,20 @@ namespace CNAS_DBSync
}

//加载旧的CNAS数据库信息
if (syncInstrumentItem.SyncTargetDBInfo == null)
if (syncInstrumentItem.SyncTargetDBInfo != null)
{
targetDataBaseInfo = syncInstrumentItem.SyncTargetDBInfo;
}
else
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;

this.txtDBHost.Text = targetDataBaseInfo.DBHost;
this.txtDBName.Text = targetDataBaseInfo.DBName;
this.txtDBUser.Text = targetDataBaseInfo.DBUser;
this.txtDBPwd.Text = targetDataBaseInfo.DBPwd;
this.txtPort.Text= targetDataBaseInfo.DBPort;


}

private void btnOK_Click(object sender, EventArgs e)
@@ -236,11 +253,16 @@ namespace CNAS_DBSync
//dictInstrument = instrumentData.GetInstrumentData();

//目标库的信息
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();
if (GlobalCommonOperation.strStartWebApi != "1")
{
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();
}
else
syncInstrumentItem.SyncTargetDBInfo = targetDataBaseInfo;

this.InstrumentDelegate(syncInstrumentItem);
//this.InstrumentItemData(dictInstrument);
@@ -582,7 +604,15 @@ namespace CNAS_DBSync

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()))
//this.txtDBHost.Text.Trim(), this.txtDBName.Text.Trim(), this.txtDBUser.Text.Trim(), this.txtDBPwd.Text.Trim(),this.txtPort.Text.Trim()
if (CnasDataOperationFact.CnasDataOperation().TestConnect(new DataBaseInfo()
{
DBHost= this.txtDBHost.Text.Trim(),
DBName= this.txtDBName.Text.Trim(),
DBUser= this.txtDBUser.Text.Trim(),
DBPwd= this.txtDBPwd.Text.Trim(),
DBPort= this.txtPort.Text.Trim()
}))
MessageBox.Show("连接成功!");
else
MessageBox.Show("连接失败!");
@@ -750,6 +780,7 @@ namespace CNAS_DBSync
dbinfo.ServerName = this.txtSqlServerName.Text.Trim();
dbinfo.UserId = this.txtSqlServerUser.Text.Trim();
dbinfo.UserPwd = this.txtSqlServerPwd.Text.Trim();
dbinfo.Port = this.txtSqlServerPort.Text.Trim();
if (new SQLServerInstrumentData(dbinfo, new object[] {
"",
"",
@@ -828,7 +859,15 @@ namespace CNAS_DBSync

private void btnMySqlTest_Click(object sender, EventArgs e)
{
if (CnasDataOperationFact.CnasDataOperation().TestConnect(this.txtMySqlHost.Text.Trim(), this.txtMySqlServer.Text.Trim(), this.txtMySqlUser.Text.Trim(), this.txtMySqlPwd.Text.Trim(), this.txtMySqlPort.Text.Trim()))
if (CnasDataOperationFact.CnasDataOperation().TestConnect(new DataBaseInfo()
{
DBHost = this.txtMySqlHost.Text.Trim(),
DBName = this.txtMySqlServer.Text.Trim(),
DBUser = this.txtMySqlUser.Text.Trim(),
DBPwd = this.txtMySqlPwd.Text.Trim(),
DBPort = this.txtMySqlPort.Text.Trim()
}))
MessageBox.Show("连接成功!");
else
MessageBox.Show("连接失败!");
@@ -967,5 +1006,52 @@ namespace CNAS_DBSync
txtRemoteTxtPwd.Visible = true;
}
}

private void cbxTargetDBSelect_SelectedIndexChanged(object sender, EventArgs e)
{
if (cbxTargetDBSelect.SelectedIndex == 0)
{
if (GlobalCommonOperation.strStartWebApi == "1")
{
targetDataBaseInfo = new DataBaseInfo() {
DataBaseCode = "cnas"
};
}
else
{
DataBaseInfo CNASDataBase = FileOperation.GetLocalCnasDB();
if (CNASDataBase != null)
{
this.txtDBHost.Text = CNASDataBase.DBHost;
this.txtDBName.Text = CNASDataBase.DBName;
this.txtDBUser.Text = CNASDataBase.DBUser;
this.txtDBPwd.Text = CNASDataBase.DBPwd;
this.txtPort.Text = CNASDataBase.DBPort;
}
}
}
else if (cbxTargetDBSelect.SelectedIndex == 1)
{
if (GlobalCommonOperation.strStartWebApi == "1")
{
targetDataBaseInfo = new DataBaseInfo()
{
DataBaseCode = "platform"
};
}
else
{
DataBaseInfo PlatDataBase = FileOperation.GetLocalPlatFormDB();
if (PlatDataBase != null)
{
this.txtDBHost.Text = PlatDataBase.DBHost;
this.txtDBName.Text = PlatDataBase.DBName;
this.txtDBUser.Text = PlatDataBase.DBUser;
this.txtDBPwd.Text = PlatDataBase.DBPwd;
this.txtPort.Text = PlatDataBase.DBPort;
}
}
}
}
}
}

+ 2
- 36
CNAS_DBSync/frmInstrumentCode.Designer.cs Näytä tiedosto

@@ -32,8 +32,6 @@
this.txtCode = new System.Windows.Forms.TextBox();
this.btnOK = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.cbxInstruType = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// txtCode
@@ -46,7 +44,7 @@
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(289, 89);
this.btnOK.Location = new System.Drawing.Point(293, 66);
this.btnOK.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(90, 30);
@@ -64,41 +62,11 @@
this.label1.TabIndex = 2;
this.label1.Text = "仪器编号:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(35, 60);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(44, 17);
this.label2.TabIndex = 3;
this.label2.Text = "类型:";
//
// cbxInstruType
//
this.cbxInstruType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbxInstruType.FormattingEnabled = true;
this.cbxInstruType.Items.AddRange(new object[] {
"水分仪",
"测硫仪",
"工业分析仪",
"灰熔点",
"红外测硫仪",
"元素分析仪",
"量热仪",
"其它"});
this.cbxInstruType.Location = new System.Drawing.Point(82, 56);
this.cbxInstruType.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.cbxInstruType.Name = "cbxInstruType";
this.cbxInstruType.Size = new System.Drawing.Size(276, 25);
this.cbxInstruType.TabIndex = 4;
//
// frmInstrumentCode
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(395, 130);
this.Controls.Add(this.cbxInstruType);
this.Controls.Add(this.label2);
this.ClientSize = new System.Drawing.Size(395, 101);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.txtCode);
@@ -120,7 +88,5 @@
private System.Windows.Forms.TextBox txtCode;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox cbxInstruType;
}
}

+ 16
- 9
CNAS_DBSync/frmInstrumentCode.cs Näytä tiedosto

@@ -25,6 +25,7 @@ namespace CNAS_DBSync
InitializeComponent();

this.lstSyncInstrument = lstSyncInstrument;
this.DialogResult = DialogResult.None;
}

public frmInstrumentCode(List<SyncInstrumentItemInfo> lstSyncInstrument,string strOldCode=null)
@@ -38,14 +39,17 @@ namespace CNAS_DBSync
if (lstInstrument.Count == 1)
{
type = lstInstrument[0].InstruType;
this.cbxInstruType.Text =GlobalCommonOperation.GetTitleByInstruType(type); }
//this.cbxInstruType.Text =GlobalCommonOperation.GetTitleByInstruType(type);
}
}

private void btnOK_Click(object sender, EventArgs e)
{
if (this.txtCode.Text.Trim() == strOldCode&& GlobalCommonOperation.GetInstruTypeBySelectedItem(this.cbxInstruType.Text)==type) //此时没有修改任何内容
//if (this.txtCode.Text.Trim() == strOldCode&& GlobalCommonOperation.GetInstruTypeBySelectedItem(this.cbxInstruType.Text)==type) //此时没有修改任何内容
if (this.txtCode.Text.Trim() == strOldCode) //此时没有修改任何内容,直接关闭界面
{
//return;
this.Close();
return;
}

@@ -72,11 +76,11 @@ namespace CNAS_DBSync
}
}

if (this.cbxInstruType.Text == "")
{
MessageBox.Show("类型不允许为空!请重新选择!");
return;
}
//if (this.cbxInstruType.Text == "")
//{
// MessageBox.Show("类型不允许为空!请重新选择!");
// return;
//}


//传输输入到父界面
@@ -84,11 +88,14 @@ namespace CNAS_DBSync
{
GUID = Guid.NewGuid().ToString(),
Code = this.txtCode.Text.Trim(),
InstruType = GlobalCommonOperation.GetInstruTypeBySelectedItem(this.cbxInstruType.Text)
//InstruType = GlobalCommonOperation.GetInstruTypeBySelectedItem(this.cbxInstruType.Text)
InstruType = InstrumentType.None
};

this.InstrumentDelegate(syncinstrument);

this.DialogResult = DialogResult.OK;

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


+ 35
- 35
CNAS_DBSync/frmServiceConfig.Designer.cs Näytä tiedosto

@@ -42,12 +42,12 @@
this.panel1 = new System.Windows.Forms.Panel();
this.cbxAutoStart = new System.Windows.Forms.CheckBox();
this.panel2 = new System.Windows.Forms.Panel();
this.btnInstallService = new System.Windows.Forms.Button();
this.btnRun = new System.Windows.Forms.Button();
this.pnlRight = new System.Windows.Forms.Panel();
this.pnlLeft = new System.Windows.Forms.Panel();
this.pnlBottom = new System.Windows.Forms.Panel();
this.pnlTop = new System.Windows.Forms.Panel();
this.btnInstallService = new System.Windows.Forms.Button();
this.pnlAll.SuspendLayout();
this.pnlCenter.SuspendLayout();
this.panel3.SuspendLayout();
@@ -68,7 +68,7 @@
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(450, 163);
this.pnlAll.Size = new System.Drawing.Size(435, 183);
this.pnlAll.TabIndex = 0;
//
// pnlCenter
@@ -79,7 +79,7 @@
this.pnlCenter.Location = new System.Drawing.Point(12, 14);
this.pnlCenter.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlCenter.Name = "pnlCenter";
this.pnlCenter.Size = new System.Drawing.Size(426, 139);
this.pnlCenter.Size = new System.Drawing.Size(411, 159);
this.pnlCenter.TabIndex = 4;
//
// panel3
@@ -89,7 +89,7 @@
this.panel3.Location = new System.Drawing.Point(0, 0);
this.panel3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(426, 104);
this.panel3.Size = new System.Drawing.Size(411, 115);
this.panel3.TabIndex = 1;
//
// groupBox1
@@ -105,7 +105,7 @@
this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.groupBox1.Size = new System.Drawing.Size(426, 104);
this.groupBox1.Size = new System.Drawing.Size(411, 115);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "设置";
@@ -114,7 +114,7 @@
//
this.dtpSource.CustomFormat = "yyyy-MM-dd HH:mm";
this.dtpSource.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpSource.Location = new System.Drawing.Point(145, 61);
this.dtpSource.Location = new System.Drawing.Point(159, 68);
this.dtpSource.Name = "dtpSource";
this.dtpSource.Size = new System.Drawing.Size(179, 23);
this.dtpSource.TabIndex = 5;
@@ -123,7 +123,7 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(26, 64);
this.label4.Location = new System.Drawing.Point(40, 71);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(116, 17);
this.label4.TabIndex = 4;
@@ -132,7 +132,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(335, 33);
this.label3.Location = new System.Drawing.Point(342, 39);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(32, 17);
this.label3.TabIndex = 3;
@@ -140,7 +140,7 @@
//
// numService
//
this.numService.Location = new System.Drawing.Point(184, 29);
this.numService.Location = new System.Drawing.Point(196, 35);
this.numService.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.numService.Name = "numService";
this.numService.Size = new System.Drawing.Size(140, 23);
@@ -149,7 +149,7 @@
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(142, 32);
this.label2.Location = new System.Drawing.Point(156, 38);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 17);
this.label2.TabIndex = 1;
@@ -158,7 +158,7 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(26, 32);
this.label1.Location = new System.Drawing.Point(40, 38);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(116, 17);
this.label1.TabIndex = 0;
@@ -169,10 +169,10 @@
this.panel1.Controls.Add(this.cbxAutoStart);
this.panel1.Controls.Add(this.panel2);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 104);
this.panel1.Location = new System.Drawing.Point(0, 115);
this.panel1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(426, 35);
this.panel1.Size = new System.Drawing.Size(411, 44);
this.panel1.TabIndex = 0;
//
// cbxAutoStart
@@ -190,18 +190,29 @@
this.panel2.Controls.Add(this.btnInstallService);
this.panel2.Controls.Add(this.btnRun);
this.panel2.Dock = System.Windows.Forms.DockStyle.Right;
this.panel2.Location = new System.Drawing.Point(243, 0);
this.panel2.Location = new System.Drawing.Point(205, 0);
this.panel2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(183, 35);
this.panel2.Size = new System.Drawing.Size(206, 44);
this.panel2.TabIndex = 0;
//
// btnInstallService
//
this.btnInstallService.Location = new System.Drawing.Point(3, 4);
this.btnInstallService.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btnInstallService.Name = "btnInstallService";
this.btnInstallService.Size = new System.Drawing.Size(90, 30);
this.btnInstallService.TabIndex = 1;
this.btnInstallService.Text = "安装服务";
this.btnInstallService.UseVisualStyleBackColor = true;
this.btnInstallService.Click += new System.EventHandler(this.btnInstallService_Click);
//
// btnRun
//
this.btnRun.Location = new System.Drawing.Point(90, 4);
this.btnRun.Location = new System.Drawing.Point(109, 4);
this.btnRun.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(80, 25);
this.btnRun.Size = new System.Drawing.Size(90, 30);
this.btnRun.TabIndex = 0;
this.btnRun.Text = "启动服务";
this.btnRun.UseVisualStyleBackColor = true;
@@ -210,10 +221,10 @@
// pnlRight
//
this.pnlRight.Dock = System.Windows.Forms.DockStyle.Right;
this.pnlRight.Location = new System.Drawing.Point(438, 14);
this.pnlRight.Location = new System.Drawing.Point(423, 14);
this.pnlRight.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlRight.Name = "pnlRight";
this.pnlRight.Size = new System.Drawing.Size(12, 139);
this.pnlRight.Size = new System.Drawing.Size(12, 159);
this.pnlRight.TabIndex = 3;
//
// pnlLeft
@@ -222,16 +233,16 @@
this.pnlLeft.Location = new System.Drawing.Point(0, 14);
this.pnlLeft.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlLeft.Name = "pnlLeft";
this.pnlLeft.Size = new System.Drawing.Size(12, 139);
this.pnlLeft.Size = new System.Drawing.Size(12, 159);
this.pnlLeft.TabIndex = 2;
//
// pnlBottom
//
this.pnlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlBottom.Location = new System.Drawing.Point(0, 153);
this.pnlBottom.Location = new System.Drawing.Point(0, 173);
this.pnlBottom.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlBottom.Name = "pnlBottom";
this.pnlBottom.Size = new System.Drawing.Size(450, 10);
this.pnlBottom.Size = new System.Drawing.Size(435, 10);
this.pnlBottom.TabIndex = 1;
//
// pnlTop
@@ -240,25 +251,14 @@
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(450, 14);
this.pnlTop.Size = new System.Drawing.Size(435, 14);
this.pnlTop.TabIndex = 0;
//
// btnInstallService
//
this.btnInstallService.Location = new System.Drawing.Point(3, 4);
this.btnInstallService.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.btnInstallService.Name = "btnInstallService";
this.btnInstallService.Size = new System.Drawing.Size(80, 25);
this.btnInstallService.TabIndex = 1;
this.btnInstallService.Text = "安装服务";
this.btnInstallService.UseVisualStyleBackColor = true;
this.btnInstallService.Click += new System.EventHandler(this.btnInstallService_Click);
//
// frmServiceConfig
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(450, 163);
this.ClientSize = new System.Drawing.Size(435, 183);
this.Controls.Add(this.pnlAll);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;


+ 4
- 3
CNAS_DBSync/frmServiceConfig.cs Näytä tiedosto

@@ -32,7 +32,7 @@ namespace CNAS_DBSync
try
{
XmlSerializer serializer = new XmlSerializer(serviceConfig.GetType());
FileStream stream = new FileStream(FileHelper.getBasePath() + "/Data/SyncServiceData.xml", FileMode.Open);
FileStream stream = new FileStream(FileHelper.getBasePath() + "/DataConfig/SyncServiceData.xml", FileMode.Open);
serviceConfig = (ServiceConfig)serializer.Deserialize(stream);
stream.Close();

@@ -168,7 +168,7 @@ namespace CNAS_DBSync
try
{
XmlSerializer serializer = new XmlSerializer(config.GetType());
TextWriter writer = new StreamWriter(FileHelper.getBasePath() + "/Data/SyncServiceData.xml");
TextWriter writer = new StreamWriter(FileHelper.getBasePath() + "/DataConfig/SyncServiceData.xml");
serializer.Serialize(writer, config);
writer.Close();
}
@@ -218,7 +218,8 @@ namespace CNAS_DBSync
RegistryKey currentControlSet = sysReg.OpenSubKey("CurrentControlSet");
RegistryKey services = currentControlSet.OpenSubKey("Services");
RegistryKey servicesName = services.OpenSubKey(serviceName, true);
startType=(int)servicesName.GetValue("Start");
if(servicesName != null)
startType=(int)servicesName.GetValue("Start");
}
catch (Exception ex)
{


+ 27
- 17
CNAS_DBSync/frmSourceFilter.cs Näytä tiedosto

@@ -25,12 +25,14 @@ namespace CNAS_DBSync
private List<string> lstText = new List<string>() { "等于", "不等于", "包含", "不包含" };
private List<string> lstConditionValueType = new List<string>() { "{自定义...}","RegEx:{全数字}", "RegEx:{英文+数字}","RegEx:{中文+数字}" };

public string strTableInfoMode { get; set; }
public List<FilterCondition> lstFilterConditions { get; set; } //临时过滤条件

public frmSourceFilter(SyncInstrumentItemInfo syncInstrumentItem)
public frmSourceFilter(SyncInstrumentItemInfo syncInstrumentItem,string strTableInfoMode)
{
InitializeComponent();
this.syncInstrumentItem = syncInstrumentItem;
this.strTableInfoMode = strTableInfoMode;
if (syncInstrumentItem.SourceFilter == null || syncInstrumentItem.SourceFilter.lstFilterConditions == null)
this.lstFilterConditions = new List<FilterCondition>();
else
@@ -49,11 +51,19 @@ namespace CNAS_DBSync
this.txtCurrentTableName.Text = syncInstrumentItem.LstSyncPramas[0].SourceTable;

//加载表结构(需要重新加载,因为父窗口可能没有数据或数据已经过时)
InstrumentData instrumentData = InstrumentDataFact.CreateInstrumentDataSource(syncInstrumentItem.SyncInstrumentDSInfo, new object[] { "", "", "" });
Dictionary<string,DataTable> dictInstruTables = instrumentData.GetInstrumentData();
if (dictInstruTables.ContainsKey(this.txtCurrentTableName.Text))
dtCurrentTableStruct = dictInstruTables[this.txtCurrentTableName.Text];

if (strTableInfoMode == "0")
{
InstrumentData instrumentData = InstrumentDataFact.CreateInstrumentDataSource(syncInstrumentItem.SyncInstrumentDSInfo, new object[] { "", "", "" });
Dictionary<string, DataTable> dictInstruTables = instrumentData.GetInstrumentData();
if (dictInstruTables.ContainsKey(this.txtCurrentTableName.Text))
dtCurrentTableStruct = dictInstruTables[this.txtCurrentTableName.Text];
}
else
{
InstrumentData instrumentData = InstrumentDataFact.CreateInstrumentDataSource(syncInstrumentItem.SyncInstrumentDSInfo, new object[] { this.txtCurrentTableName.Text, "", "" });
dtCurrentTableStruct = instrumentData.GetInstrumentDataStruct();
}
//根据表结构手动构建ComboBox,用于用户选择增加列
InitalColumnComboBox(dtCurrentTableStruct);
InitalAlgorithmComboBox();
@@ -133,17 +143,17 @@ namespace CNAS_DBSync
switch (cbxConditionValue.Text)
{
case "RegEx:{全数字}":
strConditionValue = @"RegEx:{^[1-9]\d*$}";
strConditionValue = @"RegEx:^[1-9]\d*$";
dgvConditions.Rows[dgvConditions.CurrentCell.RowIndex].Cells["ConditionValue"].Value = strConditionValue;
dgvConditions.Rows[dgvConditions.CurrentCell.RowIndex].Cells["Algorithm"].Value = "等于";
break;
case "RegEx:{英文+数字}":
strConditionValue = @"RegEx:{[a-zA-Z][0-9]}";
strConditionValue = @"RegEx:[a-zA-Z][0-9]";
dgvConditions.Rows[dgvConditions.CurrentCell.RowIndex].Cells["ConditionValue"].Value = strConditionValue;
dgvConditions.Rows[dgvConditions.CurrentCell.RowIndex].Cells["Algorithm"].Value = "等于";
break;
case "RegEx:{中文+数字}":
strConditionValue = @"RegEx:{[\u4e00-\u9fa5][0-9]}";
strConditionValue = @"RegEx:[\u4e00-\u9fa5][0-9]";
dgvConditions.Rows[dgvConditions.CurrentCell.RowIndex].Cells["ConditionValue"].Value = strConditionValue;
dgvConditions.Rows[dgvConditions.CurrentCell.RowIndex].Cells["Algorithm"].Value = "等于";
break;
@@ -479,10 +489,10 @@ namespace CNAS_DBSync

private void dgvConditions_CellClick(object sender, DataGridViewCellEventArgs e)
{
cbxTableColumns.Visible = false;
cbxAlgorithm.Visible = false;
cbxConditionValue.Visible = false;
txtConditionValue.Visible = false;
if (cbxTableColumns != null) cbxTableColumns.Visible = false;
if (cbxAlgorithm != null) cbxAlgorithm.Visible = false;
if (cbxConditionValue != null) cbxConditionValue.Visible = false;
if (txtConditionValue != null) txtConditionValue.Visible = false;
}

private void dgvConditions_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
@@ -530,10 +540,10 @@ namespace CNAS_DBSync
if (GetRowIndexAt(e.Y, dgvConditions) == -1)
{
dgvConditions.EndEdit();
cbxTableColumns.Visible = false;
cbxAlgorithm.Visible = false;
cbxConditionValue.Visible = false;
txtConditionValue.Visible = false;
if(cbxTableColumns!=null) cbxTableColumns.Visible = false;
if (cbxAlgorithm != null) cbxAlgorithm.Visible = false;
if (cbxConditionValue != null) cbxConditionValue.Visible = false;
if (txtConditionValue != null) txtConditionValue.Visible = false;
}
}
}


+ 1357
- 0
CNAS_DBSync/frmSourceSetting.Designer.cs
File diff suppressed because it is too large
Näytä tiedosto


+ 994
- 0
CNAS_DBSync/frmSourceSetting.cs Näytä tiedosto

@@ -0,0 +1,994 @@
using CnasSynchronusClient;
using CnasSynchrousModel;
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 partial class frmSourceSetting : Form
{
public AccessFormatConfig AccessFormat { get; set; }
public ExcelFormatConfig ExcelFormat { get; set; }
public FoxProFormatConfig FoxProFormat { get; set; }
public SqliteFormatConfig SqliteFormat { get; set; }
public SqlServerFormatConfig SqlServerFormat { get; set; }
public OracleFormatConfig OracleFormat { get; set; }
public MySqlFormatConfig MySqlFormat { get; set; }
public NormalFileFormatConfig NormalFileFormat { get; set; }

//用来记录tablepage是否加载过,如果没有加载过,存储时不做处理
private List<string> lstLoadingSource = new List<string>();

public frmSourceSetting()
{
InitializeComponent();
}

private void frmSourceSetting_Load(object sender, EventArgs e)
{
//获取已经存储的数据,初始化各种类型的参数类

ExcelFormat= FileOperation.GetFormatConfigData<ExcelFormatConfig>("ExcelFormatConfig.xml");
AccessFormat = FileOperation.GetFormatConfigData<AccessFormatConfig>("AccessFormatConfig.xml");
FoxProFormat= FileOperation.GetFormatConfigData<FoxProFormatConfig>("FoxProFormatConfig.xml");
SqliteFormat= FileOperation.GetFormatConfigData<SqliteFormatConfig>("SqliteFormatConfig.xml");

SqlServerFormat= FileOperation.GetFormatConfigData<SqlServerFormatConfig>("SqlServerFormatConfig.xml");
OracleFormat = FileOperation.GetFormatConfigData<OracleFormatConfig>("OracleFormatConfig.xml");
MySqlFormat = FileOperation.GetFormatConfigData<MySqlFormatConfig>("MySqlFormatConfig.xml");
NormalFileFormat = FileOperation.GetFormatConfigData<NormalFileFormatConfig>("NormalFileFormatConfig.xml");

//默认加载第一个tablepage
LoadExcelControlData();
}

private void tabcDS_Selected(object sender, TabControlEventArgs e)
{
switch (e.TabPageIndex)
{
case 0:
//切换到Excel时的操作
LoadExcelControlData();
break;
case 1:
//切换到FoxPro时的操作
LoadFoxProControlData();
break;
case 2:
//切换到Access时的操作
LoadAccessControlData();
break;
case 3:
//切换到Sqlite时的操作
LoadSqliteControlData();
break;
case 4:
//切换到SQLServer时的操作
LoadSqlServerData();
break;
case 5:
//切换到MySQL时的操作
LoadMySqlControlData();
break;
case 6:
//切换到Oracle时的操作
LoadOracleControlData();
break;
case 7:
//切换到Txt时的操作
LoadNormalFileControlData();
break;
}
}

private void LoadNormalFileControlData()
{
this.cbxNormalFileReadFile.Checked = NormalFileFormat.ReadNormalFileMode == "0" ? true : false;
this.cbxNormalFileReadFolder.Checked = !this.cbxNormalFileReadFile.Checked;

this.txtNormalFileSpecialDateColumnFormat.Text = NormalFileFormat.NormalFileDateColumnFormat ?? "";
this.txtNormalFileNameFormat.Text = NormalFileFormat.NormalFileNameFormat ?? "";

this.txtNormalFileReadDataMode.Text = NormalFileFormat.NormalFileDataMode ?? "";
this.txtNormalFileSuffix.Text = NormalFileFormat.NormalFileSuffix ?? "";

this.txtNormalFileReadSplitMode.Text = NormalFileFormat.NormalFileSplitType ?? "";

//显示数字
int showValue = 1;
if (NormalFileFormat.NormalFileStartLineIndex != null)
{
Int32.TryParse(NormalFileFormat.NormalFileStartLineIndex, out showValue);
}
this.numNormalFileStartIndex.Value = showValue;

this.cbxNormalFileCustomDate.Checked = NormalFileFormat.IfCustomCreateDateColumn == "0" ? true : false;
this.cbxNormalFileNoCustomDate.Checked = !this.cbxNormalFileCustomDate.Checked;

DefaultTextBoxShowLeaveValue(txtNormalFileSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtNormalFileSpecialDateColumnFormat_Decrible);
DefaultTextBoxShowLeaveValue(txtNormalFileNameFormat, SourceSettingTextBoxDecrible.txtNormalFileNameFormat_Decrible);
DefaultTextBoxShowLeaveValue(txtNormalFileReadDataMode, SourceSettingTextBoxDecrible.txtNormalFileReadDataMode_Decrible);
DefaultTextBoxShowLeaveValue(txtNormalFileSuffix, SourceSettingTextBoxDecrible.txtNormalFileSuffix_Decrible);
DefaultTextBoxShowLeaveValue(txtNormalFileReadSplitMode, SourceSettingTextBoxDecrible.txtNormalFileReadSplitMode_Decrible);

if (!lstLoadingSource.Contains("NormalFileFormat")) lstLoadingSource.Add("NormalFileFormat");
}

private void LoadOracleControlData()
{
this.txtOracleSpecialDateColumnFormat.Text = OracleFormat.OracleFileDateColumnFormat ?? "";

this.txtOracleAutoSqlName.Text = OracleFormat.AutoSql != null ? OracleFormat.AutoSql.OracleViewName : "";
this.txtOracleAutoSql.Text = OracleFormat.AutoSql != null ? OracleFormat.AutoSql.OracleViewSql : "";

DefaultTextBoxShowLeaveValue(txtOracleSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtOracleSpecialDateColumnFormat_Decrible);
DefaultTextBoxShowLeaveValue(txtOracleAutoSqlName, SourceSettingTextBoxDecrible.txtOracleAutoSqlName_Decrible);
DefaultTextBoxShowLeaveValue(txtOracleAutoSql, SourceSettingTextBoxDecrible.txtOracleAutoSql_Decrible);

if (!lstLoadingSource.Contains("OracleFormat")) lstLoadingSource.Add("OracleFormat");
}

private void LoadMySqlControlData()
{
this.txtMySqlSpecialDateColumnFormat.Text = MySqlFormat.MySqlFileDateColumnFormat ?? "";

this.txtMySqlAutoSqlName.Text = MySqlFormat.AutoSql != null ? MySqlFormat.AutoSql.MySqlViewName : "";
this.txtMySqlAutoSql.Text = MySqlFormat.AutoSql != null ? MySqlFormat.AutoSql.MySqlViewSql : "";

DefaultTextBoxShowLeaveValue(txtMySqlSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtMySqlSpecialDateColumnFormat_Decrible);
DefaultTextBoxShowLeaveValue(txtMySqlAutoSqlName, SourceSettingTextBoxDecrible.txtMySqlAutoSqlName_Decrible);
DefaultTextBoxShowLeaveValue(txtMySqlAutoSql, SourceSettingTextBoxDecrible.txtMySqlAutoSql_Decrible);

if (!lstLoadingSource.Contains("MySqlFormat")) lstLoadingSource.Add("MySqlFormat");
}

private void LoadSqlServerData()
{
this.txtSqlServerSpecialDateColumnFormat.Text = SqlServerFormat.SqlServerFileDateColumnFormat ??"";
this.txtSqlServerConnection.Text = SqlServerFormat.SqlServerConnection ?? "";

this.txtSqlServerAutoSqlName.Text = SqlServerFormat.AutoSql != null ? SqlServerFormat.AutoSql.SqlServerViewName : "";
this.txtSqlServerAutoSql.Text = SqlServerFormat.AutoSql != null ? SqlServerFormat.AutoSql.SqlServerViewSql : "";

DefaultTextBoxShowLeaveValue(txtSqlServerSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtSqlServerSpecialDateColumnFormat_Decrible);
DefaultTextBoxShowLeaveValue(txtSqlServerConnection, SourceSettingTextBoxDecrible.txtSqlServerConnection_Decrible);
DefaultTextBoxShowLeaveValue(txtSqlServerAutoSqlName, SourceSettingTextBoxDecrible.txtSqlServerAutoSqlName_Decrible);
DefaultTextBoxShowLeaveValue(txtSqlServerAutoSql, SourceSettingTextBoxDecrible.txtSqlServerAutoSql_Decrible);

if (!lstLoadingSource.Contains("SqlServerFormat")) lstLoadingSource.Add("SqlServerFormat");
}

private void LoadSqliteControlData()
{
this.cbxSqliteReadFile.Checked = SqliteFormat.ReadSqliteFileMode == "0" ? true : false;
this.cbxSqliteReadFolder.Checked = !this.cbxSqliteReadFile.Checked;

this.txtSqliteSpecialDateColumnFormat.Text = SqliteFormat.SqliteFileDateColumnFormat ?? "";
this.txtSqliteFileNameFormat.Text = SqliteFormat.SqliteFileNameFormat ?? "";

this.txtSqliteAutoSqlName.Text = SqliteFormat.AutoSql != null ? SqliteFormat.AutoSql.SqliteViewName : "";
this.txtSqliteAutoSql.Text = SqliteFormat.AutoSql != null ? SqliteFormat.AutoSql.SqliteViewSql : "";

DefaultTextBoxShowLeaveValue(txtSqliteSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtSqliteSpecialDateColumnFormat_Decrible);
DefaultTextBoxShowLeaveValue(txtSqliteFileNameFormat, SourceSettingTextBoxDecrible.txtSqliteFileNameFormat_Decrible);
DefaultTextBoxShowLeaveValue(txtSqliteAutoSqlName, SourceSettingTextBoxDecrible.txtSqliteAutoSqlName_Decrible);
DefaultTextBoxShowLeaveValue(txtSqliteAutoSql, SourceSettingTextBoxDecrible.txtSqliteAutoSql_Decrible);

if (!lstLoadingSource.Contains("SqliteFormat")) lstLoadingSource.Add("SqliteFormat");
}

private void LoadAccessControlData()
{
this.cbxAccessOldVersion.Checked = AccessFormat.AccessFileVersion == "0" ? true : false;
this.cbxAccessNewVersion.Checked = !this.cbxAccessOldVersion.Checked;

this.txtAccessSuffix.Text = this.AccessFormat.AccessSuffix ?? "";
this.txtAccessSpecialDateColumnFormat.Text = this.AccessFormat.AccessFileDateColumnFormat ?? "";
this.txtAccessFileName.Text = this.AccessFormat.AccessFileNameFormat ?? "";

this.cbxAccessReadFile.Checked=AccessFormat.ReadAccessFileMode=="0"?true:false;
this.cbxAccessReadFolder.Checked = !cbxAccessReadFile.Checked;

this.txtAccessAutoSqlName.Text = AccessFormat.AutoSql != null ? AccessFormat.AutoSql.AccessViewName : "";
this.txtAccessAutoSql.Text = AccessFormat.AutoSql != null ? AccessFormat.AutoSql.AccessViewSql : "";

DefaultTextBoxShowLeaveValue(txtAccessSuffix, SourceSettingTextBoxDecrible.txtAccessSuffix_Decrible);
DefaultTextBoxShowLeaveValue(txtAccessSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtAccessSpecialDateColumnFormat_Decrible);
DefaultTextBoxShowLeaveValue(txtAccessFileName, SourceSettingTextBoxDecrible.txtAccessFileName_Decrible);
DefaultTextBoxShowLeaveValue(txtAccessAutoSqlName, SourceSettingTextBoxDecrible.txtAccessAutoSqlName_Decrible);
DefaultTextBoxShowLeaveValue(txtAccessAutoSql, SourceSettingTextBoxDecrible.txtAccessAutoSql_Decrible);

if (!lstLoadingSource.Contains("AccessFormat")) lstLoadingSource.Add("AccessFormat");
}

private void LoadFoxProControlData()
{
this.cbxFoxProReadFile.Checked = FoxProFormat.ReadFoxProFileMode == "0" ? true : false;
this.cbxFoxProReadFolder.Checked = !cbxFoxProReadFile.Checked;

this.txtFoxProSpecialDateColumnFormat.Text = FoxProFormat.FoxProFileDateColumnFormat ?? "";
this.txtFoxProFileNameFormat.Text = FoxProFormat.FoxProFileNameFormat ?? "";

this.txtFoxProAutoSqlName.Text = FoxProFormat.AutoSql != null ? FoxProFormat.AutoSql.FoxProViewName : "";
this.txtFoxProAutoSql.Text = FoxProFormat.AutoSql != null ? FoxProFormat.AutoSql.FoxProViewSql : "";

this.txtFoxProSpecialMethodName.Text = FoxProFormat.SpecialDtOpera != null ? FoxProFormat.SpecialDtOpera.Method : "";
this.txtFoxProSpecialMethod.Text= FoxProFormat.SpecialDtOpera != null ? FoxProFormat.SpecialDtOpera.Value : "";

DefaultTextBoxShowLeaveValue(txtFoxProSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtFoxProSpecialDateColumnFormat_Decrible);
DefaultTextBoxShowLeaveValue(txtFoxProFileNameFormat, SourceSettingTextBoxDecrible.txtFoxProFileNameFormat_Decrible);
DefaultTextBoxShowLeaveValue(txtFoxProAutoSqlName, SourceSettingTextBoxDecrible.txtFoxProAutoSqlName_Decrible);
DefaultTextBoxShowLeaveValue(txtFoxProAutoSql, SourceSettingTextBoxDecrible.txtFoxProAutoSql_Decrible);
DefaultTextBoxShowLeaveValue(txtFoxProSpecialMethodName, SourceSettingTextBoxDecrible.txtFoxProSpecialMethodName_Decrible);
DefaultTextBoxShowLeaveValue(txtFoxProSpecialMethod, SourceSettingTextBoxDecrible.txtFoxProSpecialMethod_Decrible);

if (!lstLoadingSource.Contains("FoxProFormat")) lstLoadingSource.Add("FoxProFormat");
}

private void LoadExcelControlData()
{
this.cbxExcelOldVersion.Checked = ExcelFormat.ExcelFileVersion == "0" ? true : false;
this.cbxExcelNewVersion.Checked = !cbxExcelOldVersion.Checked;

this.txtExcelSpecialDateColumnFormat.Text = ExcelFormat.ExcelFileDateColumnFormat ?? "";
this.txtExcelFileNameFormat.Text = ExcelFormat.ExcelFileNameFormat ?? "";

this.cbxExcelReadFile.Checked = ExcelFormat.ReadExcelFileMode == "0" ? true : false;
this.cbxExcelReadFolder.Checked = !cbxExcelReadFile.Checked;

this.txtExcelAutoSqlName.Text = ExcelFormat.AutoSql != null ? ExcelFormat.AutoSql.ExcelViewName:"";
this.txtExcelAutoSql.Text= ExcelFormat.AutoSql != null ? ExcelFormat.AutoSql.ExcelViewSql : "";

DefaultTextBoxShowLeaveValue(txtExcelSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtExcelSpecialDateColumnFormat_Decrible);
DefaultTextBoxShowLeaveValue(txtExcelFileNameFormat, SourceSettingTextBoxDecrible.txtExcelFileNameFormat_Decrible);
DefaultTextBoxShowLeaveValue(txtExcelAutoSqlName, SourceSettingTextBoxDecrible.txtExcelAutoSqlName_Decrible);
DefaultTextBoxShowLeaveValue(txtExcelAutoSql, SourceSettingTextBoxDecrible.txtExcelAutoSql_Decrible);

if (!lstLoadingSource.Contains("ExcelFormat")) lstLoadingSource.Add("ExcelFormat");
}

private void DefaultTextBoxShowLeaveValue(TextBox textBox, string strValue)
{
if (textBox.Text.Length == 0)
{
textBox.Text = strValue;
textBox.ForeColor = Color.Gray;
}
}

private void DefaultTextBoxShowEnterValue(TextBox textBox, string strValue)
{
if (textBox.Text == strValue)
{
textBox.Text = "";
textBox.ForeColor = Color.Black;
}
}

private void btnOK_Click(object sender, EventArgs e)
{
bool bSaveSuccess = true;
int count = 0;
//判断类型内容是否发生了修改,如果发生了修改,进行存储
if (ExcelFormatChanged())
{
bSaveSuccess = FileOperation.SaveFormatConfigData(ExcelFormat, "ExcelFormatConfig.xml");
count = bSaveSuccess ? count : count + 1;
}
if (FoxProFormatChanged())
{
bSaveSuccess = FileOperation.SaveFormatConfigData(FoxProFormat, "FoxProFormatConfig.xml");
count = bSaveSuccess ? count : count + 1;
}
if (AccessFormatChanged())
{
bSaveSuccess = FileOperation.SaveFormatConfigData(AccessFormat, "AccessFormatConfig.xml");
count = bSaveSuccess ? count : count + 1;
}
if (SqliteFormatChanged())
{
bSaveSuccess = FileOperation.SaveFormatConfigData(SqliteFormat, "SqliteFormatConfig.xml");
count = bSaveSuccess ? count : count + 1;
}
if (SqlServerFormatChanged())
{
bSaveSuccess = FileOperation.SaveFormatConfigData(SqlServerFormat, "SqlServerFormatConfig.xml");
count = bSaveSuccess ? count : count + 1;
}
if (MySqlFormatChanged())
{
bSaveSuccess = FileOperation.SaveFormatConfigData(MySqlFormat, "MySqlFormatConfig.xml");
count = bSaveSuccess ? count : count + 1;
}
if (OracleFormatChanged())
{
bSaveSuccess = FileOperation.SaveFormatConfigData(OracleFormat, "OracleFormatConfig.xml");
count = bSaveSuccess ? count : count + 1;
}
if (NormalFileFormatChanged())
{
bSaveSuccess = FileOperation.SaveFormatConfigData(NormalFileFormat, "NormalFileFormatConfig.xml");
count = bSaveSuccess ? count : count + 1;
}

MessageBox.Show(count == 0 ? "保存成功" : "保存失败!");
}

private bool NormalFileFormatChanged()
{
bool bIfChanged = false;

if (!lstLoadingSource.Contains("NormalFileFormat")) return bIfChanged;

if (this.cbxNormalFileReadFile.Checked != (NormalFileFormat.ReadNormalFileMode == "0" ? true : false))
{
NormalFileFormat.ReadNormalFileMode = this.cbxNormalFileReadFile.Checked ? "0" : "1";
bIfChanged = true;
}

if (NormalFileFormat.IfCustomCreateDateColumn==null||(this.cbxNormalFileCustomDate.Checked != (NormalFileFormat.IfCustomCreateDateColumn == "0" ? true : false)))
{
NormalFileFormat.IfCustomCreateDateColumn= this.cbxNormalFileCustomDate.Checked ? "0" : "1";
bIfChanged = true;
}

//数字
int oldValue = 0;
if (NormalFileFormat.NormalFileStartLineIndex != null)
{
Int32.TryParse(NormalFileFormat.NormalFileStartLineIndex, out oldValue);
}
if (this.numNormalFileStartIndex.Value != oldValue)
{
NormalFileFormat.NormalFileStartLineIndex = this.numNormalFileStartIndex.Value.ToString();
bIfChanged = true;
}

NormalFileFormat.NormalFileDateColumnFormat=TextBoxChangedValue(NormalFileFormat.NormalFileDateColumnFormat, txtNormalFileSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtNormalFileSpecialDateColumnFormat_Decrible,ref bIfChanged);
NormalFileFormat.NormalFileNameFormat=TextBoxChangedValue(NormalFileFormat.NormalFileNameFormat, txtNormalFileNameFormat, SourceSettingTextBoxDecrible.txtNormalFileNameFormat_Decrible,ref bIfChanged);
NormalFileFormat.NormalFileDataMode=TextBoxChangedValue(NormalFileFormat.NormalFileDataMode, txtNormalFileReadDataMode, SourceSettingTextBoxDecrible.txtNormalFileReadDataMode_Decrible,ref bIfChanged);
NormalFileFormat.NormalFileSuffix=TextBoxChangedValue(NormalFileFormat.NormalFileSuffix, txtNormalFileSuffix, SourceSettingTextBoxDecrible.txtNormalFileSuffix_Decrible,ref bIfChanged);
NormalFileFormat.NormalFileSplitType = TextBoxChangedValue(NormalFileFormat.NormalFileSplitType,txtNormalFileReadSplitMode, SourceSettingTextBoxDecrible.txtNormalFileReadSplitMode_Decrible, ref bIfChanged);

return bIfChanged;
}

private bool OracleFormatChanged()
{
bool bIfChanged = false;

if (!lstLoadingSource.Contains("OracleFormat")) return bIfChanged;

OracleFormat.OracleFileDateColumnFormat=TextBoxChangedValue(OracleFormat.OracleFileDateColumnFormat, txtOracleSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtOracleSpecialDateColumnFormat_Decrible,ref bIfChanged);
OracleFormat.AutoSql.OracleViewName=TextBoxChangedValue(OracleFormat.AutoSql.OracleViewName, txtOracleAutoSqlName, SourceSettingTextBoxDecrible.txtOracleAutoSqlName_Decrible,ref bIfChanged);
OracleFormat.AutoSql.OracleViewSql=TextBoxChangedValue(OracleFormat.AutoSql.OracleViewSql, txtOracleAutoSql, SourceSettingTextBoxDecrible.txtOracleAutoSql_Decrible,ref bIfChanged);

return bIfChanged;
}

private bool MySqlFormatChanged()
{
bool bIfChanged = false;

if (!lstLoadingSource.Contains("MySqlFormat")) return bIfChanged;

MySqlFormat.MySqlFileDateColumnFormat=TextBoxChangedValue(MySqlFormat.MySqlFileDateColumnFormat, txtMySqlSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtMySqlSpecialDateColumnFormat_Decrible,ref bIfChanged);
MySqlFormat.AutoSql.MySqlViewName=TextBoxChangedValue(MySqlFormat.AutoSql.MySqlViewName, txtMySqlAutoSqlName, SourceSettingTextBoxDecrible.txtMySqlAutoSqlName_Decrible,ref bIfChanged);
MySqlFormat.AutoSql.MySqlViewSql=TextBoxChangedValue(MySqlFormat.AutoSql.MySqlViewSql, txtMySqlAutoSql, SourceSettingTextBoxDecrible.txtMySqlAutoSql_Decrible,ref bIfChanged);

return bIfChanged;
}

private bool SqlServerFormatChanged()
{
bool bIfChanged = false;

if (!lstLoadingSource.Contains("SqlServerFormat")) return bIfChanged;

SqlServerFormat.SqlServerFileDateColumnFormat=TextBoxChangedValue(SqlServerFormat.SqlServerFileDateColumnFormat, txtSqlServerSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtSqlServerSpecialDateColumnFormat_Decrible,ref bIfChanged);
SqlServerFormat.SqlServerConnection=TextBoxChangedValue(SqlServerFormat.SqlServerConnection, txtSqlServerConnection, SourceSettingTextBoxDecrible.txtSqlServerConnection_Decrible,ref bIfChanged);
SqlServerFormat.AutoSql.SqlServerViewName=TextBoxChangedValue(SqlServerFormat.AutoSql.SqlServerViewName, txtSqlServerAutoSqlName, SourceSettingTextBoxDecrible.txtSqlServerAutoSqlName_Decrible,ref bIfChanged);
SqlServerFormat.AutoSql.SqlServerViewSql=TextBoxChangedValue(SqlServerFormat.AutoSql.SqlServerViewSql, txtSqlServerAutoSql, SourceSettingTextBoxDecrible.txtSqlServerAutoSql_Decrible,ref bIfChanged);

return bIfChanged;
}

private bool SqliteFormatChanged()
{
bool bIfChanged = false;

if (!lstLoadingSource.Contains("SqliteFormat")) return bIfChanged;

if (this.cbxSqliteReadFile.Checked != (SqliteFormat.ReadSqliteFileMode == "0" ? true : false))
{
SqliteFormat.ReadSqliteFileMode = this.cbxSqliteReadFile.Checked ? "0" : "1";
bIfChanged = true;
}
SqliteFormat.SqliteFileDateColumnFormat=TextBoxChangedValue(SqliteFormat.SqliteFileDateColumnFormat, txtSqliteSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtSqliteSpecialDateColumnFormat_Decrible,ref bIfChanged);
SqliteFormat.SqliteFileNameFormat=TextBoxChangedValue(SqliteFormat.SqliteFileNameFormat, txtSqliteFileNameFormat, SourceSettingTextBoxDecrible.txtSqliteFileNameFormat_Decrible, ref bIfChanged);
SqliteFormat.AutoSql.SqliteViewName=TextBoxChangedValue(SqliteFormat.AutoSql.SqliteViewName, txtSqliteAutoSqlName, SourceSettingTextBoxDecrible.txtSqliteAutoSqlName_Decrible, ref bIfChanged);
SqliteFormat.AutoSql.SqliteViewSql=TextBoxChangedValue(SqliteFormat.AutoSql.SqliteViewSql, txtSqliteAutoSql, SourceSettingTextBoxDecrible.txtSqliteAutoSql_Decrible,ref bIfChanged);

return bIfChanged;
}

private bool AccessFormatChanged()
{
bool bIfChanged = false;

if (!lstLoadingSource.Contains("AccessFormat")) return bIfChanged;

if (this.cbxAccessOldVersion.Checked != (AccessFormat.AccessFileVersion == "0" ? true : false))
{
AccessFormat.AccessFileVersion = this.cbxAccessOldVersion.Checked ? "0" : "1";
bIfChanged = true;
}
this.AccessFormat.AccessSuffix=TextBoxChangedValue(this.AccessFormat.AccessSuffix, txtAccessSuffix, SourceSettingTextBoxDecrible.txtAccessSuffix_Decrible,ref bIfChanged);
this.AccessFormat.AccessFileDateColumnFormat=TextBoxChangedValue(AccessFormat.AccessFileDateColumnFormat, txtAccessSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtAccessSpecialDateColumnFormat_Decrible,ref bIfChanged);
this.AccessFormat.AccessFileNameFormat=TextBoxChangedValue(this.AccessFormat.AccessFileNameFormat, txtAccessFileName, SourceSettingTextBoxDecrible.txtAccessFileName_Decrible, ref bIfChanged);
if (this.cbxAccessReadFile.Checked != (AccessFormat.ReadAccessFileMode == "0" ? true : false))
{
AccessFormat.ReadAccessFileMode = this.cbxAccessReadFile.Checked ? "0" : "1";
bIfChanged = true;
}
AccessFormat.AutoSql.AccessViewName=TextBoxChangedValue(AccessFormat.AutoSql.AccessViewName, txtAccessAutoSqlName, SourceSettingTextBoxDecrible.txtAccessAutoSqlName_Decrible,ref bIfChanged);
AccessFormat.AutoSql.AccessViewSql=TextBoxChangedValue(AccessFormat.AutoSql.AccessViewSql, txtAccessAutoSql, SourceSettingTextBoxDecrible.txtAccessAutoSql_Decrible,ref bIfChanged);

return bIfChanged;
}

private bool FoxProFormatChanged()
{
bool bIfChanged = false;

if (!lstLoadingSource.Contains("FoxProFormat")) return bIfChanged;

if (this.cbxFoxProReadFile.Checked != (FoxProFormat.ReadFoxProFileMode == "0" ? true : false))
{
FoxProFormat.ReadFoxProFileMode = this.cbxFoxProReadFile.Checked ? "0" : "1";
bIfChanged = true;
}

FoxProFormat.FoxProFileDateColumnFormat = TextBoxChangedValue(FoxProFormat.FoxProFileDateColumnFormat,txtFoxProSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtFoxProSpecialDateColumnFormat_Decrible, ref bIfChanged);
FoxProFormat.FoxProFileNameFormat=TextBoxChangedValue(FoxProFormat.FoxProFileNameFormat, txtFoxProFileNameFormat, SourceSettingTextBoxDecrible.txtFoxProFileNameFormat_Decrible, ref bIfChanged);
FoxProFormat.AutoSql.FoxProViewName=TextBoxChangedValue(FoxProFormat.AutoSql.FoxProViewName, txtFoxProAutoSqlName, SourceSettingTextBoxDecrible.txtFoxProAutoSqlName_Decrible, ref bIfChanged);
FoxProFormat.AutoSql.FoxProViewSql=TextBoxChangedValue(FoxProFormat.AutoSql.FoxProViewSql, txtFoxProAutoSql, SourceSettingTextBoxDecrible.txtFoxProAutoSql_Decrible, ref bIfChanged);
FoxProFormat.SpecialDtOpera.Method=TextBoxChangedValue(FoxProFormat.SpecialDtOpera.Method, txtFoxProSpecialMethodName, SourceSettingTextBoxDecrible.txtFoxProSpecialMethodName_Decrible, ref bIfChanged);
FoxProFormat.SpecialDtOpera.Value=TextBoxChangedValue(FoxProFormat.SpecialDtOpera.Value, txtFoxProSpecialMethod, SourceSettingTextBoxDecrible.txtFoxProSpecialMethod_Decrible, ref bIfChanged);

return bIfChanged;
}

private string TextBoxChangedValue(string strClassValue,TextBox textBox,string strDetailValue,ref bool bIfChanged)
{
string strNewValue = "";

if (textBox.Text != "" && textBox.Text != strDetailValue)
strNewValue = textBox.Text;

if (strNewValue != strClassValue)
{
strClassValue = strNewValue;
bIfChanged = true;
}
return strClassValue;
}

//private void bTextBoxChanged(string strClassValue, TextBox textBox, string strDetailValue, ref bool bIfChanged)
//{
// string strNewValue = "";

// if (textBox.Text != "" && textBox.Text != strDetailValue)
// strNewValue = textBox.Text;

// if (strNewValue != strClassValue)
// {
// strClassValue = strNewValue;
// bIfChanged = true;
// }
//}

private bool ExcelFormatChanged()
{
bool bIfChanged = false;

if (!lstLoadingSource.Contains("ExcelFormat")) return bIfChanged;

if (this.cbxExcelOldVersion.Checked != (ExcelFormat.ExcelFileVersion == "0" ? true : false))
{
ExcelFormat.ExcelFileVersion = this.cbxExcelOldVersion.Checked ? "0" : "1";
bIfChanged = true;
}

ExcelFormat.ExcelFileDateColumnFormat=TextBoxChangedValue(ExcelFormat.ExcelFileDateColumnFormat, txtExcelSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtExcelSpecialDateColumnFormat_Decrible,ref bIfChanged);
ExcelFormat.ExcelFileNameFormat=TextBoxChangedValue(ExcelFormat.ExcelFileNameFormat, txtExcelFileNameFormat, SourceSettingTextBoxDecrible.txtExcelFileNameFormat_Decrible, ref bIfChanged);
if (cbxExcelReadFile.Checked != (ExcelFormat.ReadExcelFileMode == "0" ? true : false))
{
ExcelFormat.ReadExcelFileMode = cbxExcelReadFile.Checked ? "0" : "1";
bIfChanged = true;
}
ExcelFormat.AutoSql.ExcelViewName=TextBoxChangedValue(ExcelFormat.AutoSql.ExcelViewName, txtExcelAutoSqlName, SourceSettingTextBoxDecrible.txtExcelAutoSqlName_Decrible,ref bIfChanged);
ExcelFormat.AutoSql.ExcelViewSql=TextBoxChangedValue(ExcelFormat.AutoSql.ExcelViewSql, txtExcelAutoSql, SourceSettingTextBoxDecrible.txtExcelAutoSql_Decrible, ref bIfChanged);

return bIfChanged;
}


#region Excel界面事件
private void txtExcelSpecialDateColumnFormat_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtExcelSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtExcelSpecialDateColumnFormat_Decrible);
}

private void txtExcelSpecialDateColumnFormat_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtExcelSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtExcelSpecialDateColumnFormat_Decrible);
}

private void txtExcelFileNameFormat_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtExcelFileNameFormat, SourceSettingTextBoxDecrible.txtExcelFileNameFormat_Decrible);
}

private void txtExcelFileNameFormat_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtExcelFileNameFormat, SourceSettingTextBoxDecrible.txtExcelFileNameFormat_Decrible);
}

private void txtExcelAutoSqlName_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtExcelAutoSqlName, SourceSettingTextBoxDecrible.txtExcelAutoSqlName_Decrible);
}

private void txtExcelAutoSqlName_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtExcelAutoSqlName, SourceSettingTextBoxDecrible.txtExcelAutoSqlName_Decrible);
}

private void txtExcelAutoSql_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtExcelAutoSql, SourceSettingTextBoxDecrible.txtExcelAutoSql_Decrible);
}

private void txtExcelAutoSql_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtExcelAutoSql, SourceSettingTextBoxDecrible.txtExcelAutoSql_Decrible);
}


private void cbxExcelOldVersion_CheckedChanged(object sender, EventArgs e)
{
cbxExcelNewVersion.Checked = !cbxExcelOldVersion.Checked;
}

private void cbxExcelNewVersion_CheckedChanged(object sender, EventArgs e)
{
cbxExcelOldVersion.Checked = !cbxExcelNewVersion.Checked;
}

private void cbxExcelReadFile_CheckedChanged(object sender, EventArgs e)
{
cbxExcelReadFolder.Checked = !cbxExcelReadFile.Checked;
}

private void cbxExcelReadFolder_CheckedChanged(object sender, EventArgs e)
{
cbxExcelReadFile.Checked = !cbxExcelReadFolder.Checked;
}

#endregion

#region FoxPro界面事件

private void cbxFoxProReadFile_CheckedChanged(object sender, EventArgs e)
{
cbxFoxProReadFolder.Checked = !cbxFoxProReadFile.Checked;
}

private void cbxFoxProReadFolder_CheckedChanged(object sender, EventArgs e)
{
cbxFoxProReadFile.Checked = !cbxFoxProReadFolder.Checked;
}

private void txtFoxProSpecialDateColumnFormat_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtFoxProSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtFoxProSpecialDateColumnFormat_Decrible);
}

private void txtFoxProSpecialDateColumnFormat_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtFoxProSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtFoxProSpecialDateColumnFormat_Decrible);
}

private void txtFoxProFileNameFormat_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtFoxProFileNameFormat, SourceSettingTextBoxDecrible.txtFoxProFileNameFormat_Decrible);
}

private void txtFoxProFileNameFormat_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtFoxProFileNameFormat, SourceSettingTextBoxDecrible.txtFoxProFileNameFormat_Decrible);
}

private void txtFoxProAutoSqlName_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtFoxProAutoSqlName, SourceSettingTextBoxDecrible.txtFoxProAutoSqlName_Decrible);
}

private void txtFoxProAutoSqlName_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtFoxProAutoSqlName, SourceSettingTextBoxDecrible.txtFoxProAutoSqlName_Decrible);
}

private void txtFoxProAutoSql_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtFoxProAutoSql, SourceSettingTextBoxDecrible.txtFoxProAutoSql_Decrible);
}

private void txtFoxProAutoSql_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtFoxProAutoSql, SourceSettingTextBoxDecrible.txtFoxProAutoSql_Decrible);
}

private void txtFoxProSpecialMethodName_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtFoxProSpecialMethodName, SourceSettingTextBoxDecrible.txtFoxProSpecialMethodName_Decrible);
}

private void txtFoxProSpecialMethodName_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtFoxProSpecialMethodName, SourceSettingTextBoxDecrible.txtFoxProSpecialMethodName_Decrible);
}

private void txtFoxProSpecialMethod_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtFoxProSpecialMethod, SourceSettingTextBoxDecrible.txtFoxProSpecialMethod_Decrible);
}

private void txtFoxProSpecialMethod_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtFoxProSpecialMethod, SourceSettingTextBoxDecrible.txtFoxProSpecialMethod_Decrible);
}

#endregion

#region Access界面事件
private void cbxAccessOldVersion_CheckedChanged(object sender, EventArgs e)
{
cbxAccessNewVersion.Checked = !cbxAccessOldVersion.Checked;
}

private void cbxAccessNewVersion_CheckedChanged(object sender, EventArgs e)
{
cbxAccessOldVersion.Checked = !cbxAccessNewVersion.Checked;
}

private void cbxAccessReadFile_CheckedChanged(object sender, EventArgs e)
{
cbxAccessReadFolder.Checked = !cbxAccessReadFile.Checked;
}

private void cbxAccessReadFolder_CheckedChanged(object sender, EventArgs e)
{
cbxAccessReadFile.Checked = !cbxAccessReadFolder.Checked;
}
private void txtAccessSuffix_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtAccessSuffix, SourceSettingTextBoxDecrible.txtAccessSuffix_Decrible);
}

private void txtAccessSuffix_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtAccessSuffix, SourceSettingTextBoxDecrible.txtAccessSuffix_Decrible);
}

private void txtAccessSpecialDateColumnFormat_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtAccessSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtAccessSpecialDateColumnFormat_Decrible);
}

private void txtAccessSpecialDateColumnFormat_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtAccessSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtAccessSpecialDateColumnFormat_Decrible);
}

private void txtAccessFileName_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtAccessFileName, SourceSettingTextBoxDecrible.txtAccessFileName_Decrible);
}

private void txtAccessFileName_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtAccessFileName, SourceSettingTextBoxDecrible.txtAccessFileName_Decrible);
}

private void txtAccessAutoSqlName_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtAccessAutoSqlName, SourceSettingTextBoxDecrible.txtAccessAutoSqlName_Decrible);
}

private void txtAccessAutoSqlName_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtAccessAutoSqlName, SourceSettingTextBoxDecrible.txtAccessAutoSqlName_Decrible);
}

private void txtAccessAutoSql_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtAccessAutoSql, SourceSettingTextBoxDecrible.txtAccessAutoSql_Decrible);
}

private void txtAccessAutoSql_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtAccessAutoSql, SourceSettingTextBoxDecrible.txtAccessAutoSql_Decrible);
}
#endregion

#region Sqlite界面事件
private void cbxSqliteReadFile_CheckedChanged(object sender, EventArgs e)
{
cbxSqliteReadFolder.Checked = !cbxSqliteReadFile.Checked;
}

private void cbxSqliteReadFolder_CheckedChanged(object sender, EventArgs e)
{
cbxSqliteReadFile.Checked = !cbxSqliteReadFolder.Checked;
}

private void txtSqliteSpecialDateColumnFormat_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtSqliteSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtSqliteSpecialDateColumnFormat_Decrible);
}

private void txtSqliteSpecialDateColumnFormat_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtSqliteSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtSqliteSpecialDateColumnFormat_Decrible);
}

private void txtSqliteFileNameFormat_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtSqliteFileNameFormat, SourceSettingTextBoxDecrible.txtSqliteFileNameFormat_Decrible);
}

private void txtSqliteFileNameFormat_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtSqliteFileNameFormat, SourceSettingTextBoxDecrible.txtSqliteFileNameFormat_Decrible);
}

private void txtSqliteAutoSqlName_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtSqliteAutoSqlName, SourceSettingTextBoxDecrible.txtSqliteAutoSqlName_Decrible);
}

private void txtSqliteAutoSqlName_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtSqliteAutoSqlName, SourceSettingTextBoxDecrible.txtSqliteAutoSqlName_Decrible);
}

private void txtSqliteAutoSql_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtSqliteAutoSql, SourceSettingTextBoxDecrible.txtSqliteAutoSql_Decrible);
}

private void txtSqliteAutoSql_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtSqliteAutoSql, SourceSettingTextBoxDecrible.txtSqliteAutoSql_Decrible);
}
#endregion

#region SqlServer界面事件
private void txtSqlServerSpecialDateColumnFormat_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtSqlServerSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtSqlServerSpecialDateColumnFormat_Decrible);
}

private void txtSqlServerSpecialDateColumnFormat_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtSqlServerSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtSqlServerSpecialDateColumnFormat_Decrible);
}

private void txtSqlServerConnection_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtSqlServerConnection, SourceSettingTextBoxDecrible.txtSqlServerConnection_Decrible);
}

private void txtSqlServerConnection_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtSqlServerConnection, SourceSettingTextBoxDecrible.txtSqlServerConnection_Decrible);
}

private void txtSqlServerAutoSqlName_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtSqlServerAutoSqlName, SourceSettingTextBoxDecrible.txtSqlServerAutoSqlName_Decrible);
}

private void txtSqlServerAutoSqlName_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtSqlServerAutoSqlName, SourceSettingTextBoxDecrible.txtSqlServerAutoSqlName_Decrible);
}

private void txtSqlServerAutoSql_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtSqlServerAutoSql, SourceSettingTextBoxDecrible.txtSqlServerAutoSql_Decrible);
}

private void txtSqlServerAutoSql_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtSqlServerAutoSql, SourceSettingTextBoxDecrible.txtSqlServerAutoSql_Decrible);
}
#endregion

#region MySql界面事件

private void txtMySqlSpecialDateColumnFormat_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtMySqlSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtMySqlSpecialDateColumnFormat_Decrible);
}

private void txtMySqlSpecialDateColumnFormat_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtMySqlSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtMySqlSpecialDateColumnFormat_Decrible);
}

private void txtMySqlAutoSqlName_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtMySqlAutoSqlName, SourceSettingTextBoxDecrible.txtMySqlAutoSqlName_Decrible);
}

private void txtMySqlAutoSqlName_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtMySqlAutoSqlName, SourceSettingTextBoxDecrible.txtMySqlAutoSqlName_Decrible);
}

private void txtMySqlAutoSql_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtMySqlAutoSql, SourceSettingTextBoxDecrible.txtMySqlAutoSql_Decrible);
}

private void txtMySqlAutoSql_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtMySqlAutoSql, SourceSettingTextBoxDecrible.txtMySqlAutoSql_Decrible);
}
#endregion

#region Oracle界面事件

private void txtOracleSpecialDateColumnFormat_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtOracleSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtOracleSpecialDateColumnFormat_Decrible);
}

private void txtOracleSpecialDateColumnFormat_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtOracleSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtOracleSpecialDateColumnFormat_Decrible);
}

private void txtOracleAutoSqlName_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtOracleAutoSqlName, SourceSettingTextBoxDecrible.txtOracleAutoSqlName_Decrible);
}

private void txtOracleAutoSqlName_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtOracleAutoSqlName, SourceSettingTextBoxDecrible.txtOracleAutoSqlName_Decrible);
}

private void txtOracleAutoSql_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtOracleAutoSql, SourceSettingTextBoxDecrible.txtOracleAutoSql_Decrible);
}

private void txtOracleAutoSql_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtOracleAutoSql, SourceSettingTextBoxDecrible.txtOracleAutoSql_Decrible);
}
#endregion

#region Txt界面事件
private void cbxNormalFileReadFile_CheckedChanged(object sender, EventArgs e)
{
cbxNormalFileReadFolder.Checked = !cbxNormalFileReadFile.Checked;
}

private void cbxNormalFileReadFolder_CheckedChanged(object sender, EventArgs e)
{
cbxNormalFileReadFile.Checked = !cbxNormalFileReadFolder.Checked;
}

private void txtNormalFileSpecialDateColumnFormat_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtNormalFileSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtNormalFileSpecialDateColumnFormat_Decrible);
}

private void txtNormalFileSpecialDateColumnFormat_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtNormalFileSpecialDateColumnFormat, SourceSettingTextBoxDecrible.txtNormalFileSpecialDateColumnFormat_Decrible);
}

private void txtNormalFileNameFormat_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtNormalFileNameFormat, SourceSettingTextBoxDecrible.txtNormalFileNameFormat_Decrible);
}

private void txtNormalFileNameFormat_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtNormalFileNameFormat, SourceSettingTextBoxDecrible.txtNormalFileNameFormat_Decrible);
}

private void txtNormalFileSuffix_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtNormalFileSuffix, SourceSettingTextBoxDecrible.txtNormalFileSuffix_Decrible);
}

private void txtNormalFileSuffix_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtNormalFileSuffix, SourceSettingTextBoxDecrible.txtNormalFileSuffix_Decrible);
}

private void txtNormalFileReadDataMode_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtNormalFileReadDataMode, SourceSettingTextBoxDecrible.txtNormalFileReadDataMode_Decrible);
}

private void txtNormalFileReadDataMode_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtNormalFileReadDataMode, SourceSettingTextBoxDecrible.txtNormalFileReadDataMode_Decrible);
}
private void txtNormalFileReadSplitMode_Leave(object sender, EventArgs e)
{
DefaultTextBoxShowLeaveValue(txtNormalFileReadSplitMode, SourceSettingTextBoxDecrible.txtNormalFileReadSplitMode_Decrible);
}

private void txtNormalFileReadSplitMode_Enter(object sender, EventArgs e)
{
DefaultTextBoxShowEnterValue(txtNormalFileReadSplitMode, SourceSettingTextBoxDecrible.txtNormalFileReadSplitMode_Decrible);
}

private void cbxNormalFileCustomDate_CheckedChanged(object sender, EventArgs e)
{
cbxNormalFileNoCustomDate.Checked = !cbxNormalFileCustomDate.Checked;
}

private void cbxNormalFileNoCustomDate_CheckedChanged(object sender, EventArgs e)
{
cbxNormalFileCustomDate.Checked = !cbxNormalFileNoCustomDate.Checked;
}

#endregion

private void frmSourceSetting_Resize(object sender, EventArgs e)
{
arrayFields();
btnOK.Left = (this.Width - btnOK.Width) / 2;
}

private void frmSourceSetting_Shown(object sender, EventArgs e)
{
arrayFields();
btnOK.Left = (this.Width - btnOK.Width) / 2;
}

private void arrayFields() {
switch (tabcDS.SelectedIndex)
{
case 0:
FieldLine[] fields = {
new FieldLine(lbExcelDateFormat,txtExcelSpecialDateColumnFormat),
new FieldLine(lblExcelRemoteUser,txtExcelFileNameFormat),
new FieldLine(lbExcelDynQuery,txtExcelAutoSqlName)
};
FormSizeHelper.Arrange(tabExcel, fields);
txtExcelAutoSql.Width = txtExcelAutoSqlName.Width;
txtExcelAutoSql.Height = tabExcel.Height - txtExcelAutoSql.Top - 24;
break;
}
}

}
}

+ 167
- 0
CNAS_DBSync/frmSourceSetting.resx Näytä tiedosto

@@ -0,0 +1,167 @@
<?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>
AAABAAEAGBgAAAEAIACICQAAFgAAACgAAAAYAAAAMAAAAAEAIAAAAAAAAAkAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAkAAAAHAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAKAAAAbAAAAIgAAACGAAAALAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7AAAAbAAA
AAoAAAA9AAAAbgAAAAIAAAAAAAAAAAAAAAAAAAAAAAA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AAwAAAB3AAAAQgAAABwAAABWAAAAdwAA
AE0AAAAcAAAAAQAAAAAAAAAAAAAADAAAADcAAABtAAAAbAAAADAAAAAeAAAAeQAAADQAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAfAAAAegAAAH4AAABXAAAALwAAAF0AAACAAAAAHwAAAAAAAAACAAAAYwAA
AHMAAAA7AAAAPgAAAHMAAACCAAAARwAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAA
ABEAAAAAAAAAAAAAAAAAAABdAAAATQAAAAAAAAAVAAAAgQAAAA0AAAAAAAAAAAAAAAkAAAATAAAAAQAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAmAAAAfQAA
AEEAAABpAAAAWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAARAAAAG8AAABhAAAAFAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/Af8A/gD/AMAABwCAAAMAgAADAIAAAwCAAAMAgAADAIAA
AQAAAAAAAAAAAAAYAAAAGAAAABAAAAAAAAAAAAAAgAABAIIAAwCAAAMAgAADAIAAAwCAAAMAwAAHAP8B
/wA=
</value>
</data>
</root>

+ 177
- 0
CNAS_DBSync/frmStartEndSubstring.Designer.cs Näytä tiedosto

@@ -0,0 +1,177 @@
namespace CNAS_DBSync
{
partial class frmStartEndSubstring
{
/// <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.btnOK = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.cbxPrama2 = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.txtPrama1 = new System.Windows.Forms.TextBox();
this.pnlAll.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// pnlAll
//
this.pnlAll.Controls.Add(this.btnOK);
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.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlAll.Name = "pnlAll";
this.pnlAll.Size = new System.Drawing.Size(436, 188);
this.pnlAll.TabIndex = 2;
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(336, 149);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(90, 30);
this.btnOK.TabIndex = 1;
this.btnOK.Text = "确定";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// groupBox1
//
this.groupBox1.BackColor = System.Drawing.SystemColors.Control;
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.cbxPrama2);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.txtPrama1);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(414, 131);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "截断开头/结尾字符参数";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(15, 96);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(401, 12);
this.label3.TabIndex = 10;
this.label3.Text = "(说明:若操作字符串中不存在或存在多个截断字符,则直接返回初始字符串)";
//
// cbxPrama2
//
this.cbxPrama2.FormattingEnabled = true;
this.cbxPrama2.Items.AddRange(new object[] {
"S",
"E"});
this.cbxPrama2.Location = new System.Drawing.Point(75, 59);
this.cbxPrama2.Name = "cbxPrama2";
this.cbxPrama2.Size = new System.Drawing.Size(121, 20);
this.cbxPrama2.TabIndex = 9;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(199, 64);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(107, 12);
this.label5.TabIndex = 7;
this.label5.Text = "(开头(S)/结尾(E))";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(200, 35);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(65, 12);
this.label4.TabIndex = 6;
this.label4.Text = "(截断字符)";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(18, 63);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(47, 12);
this.label2.TabIndex = 3;
this.label2.Text = "参数2:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(18, 34);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(47, 12);
this.label1.TabIndex = 1;
this.label1.Text = "参数1:";
//
// txtPrama1
//
this.txtPrama1.Location = new System.Drawing.Point(75, 31);
this.txtPrama1.Name = "txtPrama1";
this.txtPrama1.Size = new System.Drawing.Size(121, 21);
this.txtPrama1.TabIndex = 0;
//
// frmStartEndSubstring
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(436, 188);
this.Controls.Add(this.pnlAll);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "frmStartEndSubstring";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "截断开头/结尾";
this.Load += new System.EventHandler(this.frmStartEndSubstring_Load);
this.pnlAll.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Panel pnlAll;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox cbxPrama2;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtPrama1;
}
}

+ 64
- 0
CNAS_DBSync/frmStartEndSubstring.cs Näytä tiedosto

@@ -0,0 +1,64 @@
using CnasSynchrousModel;
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 partial class frmStartEndSubstring : Form
{
public CnasConditionMapValue conditionvalue { get; set; }
public frmStartEndSubstring(CnasConditionMapValue conditionvalue)
{
InitializeComponent();

this.conditionvalue = conditionvalue;
}

private void frmStartEndSubstring_Load(object sender, EventArgs e)
{
if (this.conditionvalue == null) return;
if (this.conditionvalue.Value == null) return;
if (this.conditionvalue.Condition != MapCondition.SubstringStartEnd) return;

//根据旧值显示控件默认值
if (this.conditionvalue.Value.ToString() != "")
{
string[] strConditionValues = this.conditionvalue.Value.ToString().Split(new string[] { "{", ",", "}" }, StringSplitOptions.RemoveEmptyEntries);
if (strConditionValues.Length == 2)
{
this.txtPrama1.Text = strConditionValues[0];
this.cbxPrama2.Text = strConditionValues[1];
}
}
}

private void btnOK_Click(object sender, EventArgs e)
{
if (this.txtPrama1.Text == "")
{
MessageBox.Show("参数1不能为空。");
return;
}
if (this.cbxPrama2.Text == "")
{
MessageBox.Show("参数2不能为空。");
return;
}
if (this.cbxPrama2.Text != "S" && this.cbxPrama2.Text != "E")
{
MessageBox.Show("参数2不符合规则,请重新选择。");
return;
}

this.conditionvalue.Value = "{" + this.txtPrama1.Text + "," + this.cbxPrama2.Text + "}";
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}

CNAS_RunSync/ucSyncShow.resx → CNAS_DBSync/frmStartEndSubstring.resx Näytä tiedosto


+ 575
- 431
CNAS_DBSync/frmSyncParams.Designer.cs
File diff suppressed because it is too large
Näytä tiedosto


+ 146
- 18
CNAS_DBSync/frmSyncParams.cs Näytä tiedosto

@@ -12,6 +12,7 @@ using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using System.Xml.Serialization;
using System.Configuration;

namespace CNAS_DBSync
{
@@ -27,6 +28,8 @@ namespace CNAS_DBSync
private string strMode = "";
private string strTableInfoMode = ""; //获取所有表信息的方式;0为自动获取,1为手动输入

private const string Property_Size_Key = "FormSyncParams";

public frmSyncParams(SyncInstrumentItemInfo syncInstrumentItem=null)
{
InitializeComponent();
@@ -56,7 +59,7 @@ namespace CNAS_DBSync
if (strTableInfoMode == "1")
{
cbxInstrument.DropDownStyle = ComboBoxStyle.DropDown;
cbxCnas.DropDownStyle = ComboBoxStyle.DropDown;
//cbxCnas.DropDownStyle = ComboBoxStyle.DropDown;
}
}

@@ -73,7 +76,30 @@ namespace CNAS_DBSync
//绑定数据源,填写相关内容
if(lstSyncInstrument.Count!=0)
dgvInstrument.DataSource = new BindingList<SyncInstrumentItemInfo>(lstSyncInstrument);
dgvInstrument.DataSource = new BindingList<SyncInstrumentItemInfo>(lstSyncInstrument);

bool changed;
List<String> values = FormSizeHelper.Instance.LoadDefaultSize(this, Property_Size_Key, out changed);
if (changed && values != null && values.Count>0)
{
int pos;
if(int.TryParse(values[0], out pos))
{
if (pos> 0 && pos < this.Width / 2)
{
splitContainerCol.SplitterDistance = pos;
}
}
}
splitContainerCol.Panel1MinSize = 230;
}

private void frmSyncParams_FormClosing(object sender, FormClosingEventArgs e)
{
string value = string.Format("{0},{1},{2},{3},{4}",
Left, Top, Width, Height, splitContainerCol.SplitterDistance);
FormSizeHelper.Instance.SaveDefaultSize(Property_Size_Key, value);
}

/// <summary>
@@ -460,7 +486,8 @@ namespace CNAS_DBSync
frmDatabase.ShowDialog();

//加载数据
btnLoadDBData_Click(null, null);
if ((currentSyncItem.SyncInstrumentDSInfo.Host!=null&& currentSyncItem.SyncInstrumentDSInfo.Host.Length>0) || (currentSyncItem.SyncInstrumentDSInfo.Path!=null&& currentSyncItem.SyncInstrumentDSInfo.Path.Length>0))
btnLoadDBData_Click(null, null);
}

private void btnLoadDBData_Click(object sender, EventArgs e)
@@ -547,8 +574,11 @@ namespace CNAS_DBSync
{
List<string> lstCnasTables = new List<string>();
foreach (DataRow dr in dtCNAS.Rows)
{
lstCnasTables.Add(dr["TABNAME"].ToString());
{
if (dtCNAS.Columns.Contains("TABNAME"))
lstCnasTables.Add(dr["TABNAME"].ToString());
else if (dtCNAS.Columns.Contains("table_name"))
lstCnasTables.Add(dr["table_name"].ToString());
}

cbxCnas.DataSource = lstCnasTables;
@@ -584,8 +614,11 @@ namespace CNAS_DBSync
{
if (currentSyncItem.SyncInstrumentDSInfo == null) return -1;
if (currentSyncItem.SyncTargetDBInfo == null) return -2;
if (cbxInstrument.Text == ""||cbxCnas.Text=="") return -6;
if (cbxInstrument.Text == "") return -6;

int returnValue = 1;

//根据手动输入来源库的表名加载字段
InstrumentData instrumentData = InstrumentDataFact.CreateInstrumentDataSource(currentSyncItem.SyncInstrumentDSInfo, new object[] { cbxInstrument.Text, "", "" });
DataTable dataTableStruct = instrumentData.GetInstrumentDataStruct();
if (dataTableStruct != null && dataTableStruct.Columns.Count > 0)
@@ -594,17 +627,42 @@ namespace CNAS_DBSync
dictInstruTables.Add(cbxInstrument.Text, dataTableStruct);
cbxInstrument_SelectedIndexChanged(null, null);

if (CnasDataOperationFact.CnasDataOperation().TestConnect(currentSyncItem.SyncTargetDBInfo.DBHost, currentSyncItem.SyncTargetDBInfo.DBName, currentSyncItem.SyncTargetDBInfo.DBUser, currentSyncItem.SyncTargetDBInfo.DBPwd, currentSyncItem.SyncTargetDBInfo.DBPort))
cbxCnas_SelectedIndexChanged(null, null);
else
return -4;

return 1;
//return 1;
}
else
{
return -3;
returnValue = -3;
return returnValue;
}

//获取CNAS配置的数据库连接信息
DataTable dtCNAS = CnasDataOperationFact.CnasDataOperation().GetAllCNASTablesName(currentSyncItem.SyncTargetDBInfo);
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 = "";

if (currentSyncItem.LstSyncPramas != null && currentSyncItem.LstSyncPramas.Count > 0)
{
if (lstCnasTables.Contains(currentSyncItem.LstSyncPramas[0].TargetTable) || lstCnasTables.Contains(currentSyncItem.LstSyncPramas[0].TargetTable.ToUpper()) || lstCnasTables.Contains(currentSyncItem.LstSyncPramas[0].TargetTable.ToLower()))
{
cbxCnas.Text = currentSyncItem.LstSyncPramas[0].TargetTable;
//cbxCnas_SelectedIndexChanged(null, null);
}
else
returnValue = -5;
}
}
else
returnValue = -4;

return returnValue;
}

private void dgvMapping_CellValueChanged(object sender, DataGridViewCellEventArgs e)
@@ -668,6 +726,11 @@ namespace CNAS_DBSync

private void btnCNASFieldConfig_Click(object sender, EventArgs e)
{
if (currentSyncItem == null || currentSyncItem.LstSyncPramas == null || currentSyncItem.LstSyncPramas.Count == 0)
{
MessageBox.Show("请先指定至少一个映射字段。");
return;
}
frmCNASValue frmCNAS = new frmCNASValue(currentSyncItem);
if (frmCNAS.ShowDialog() == DialogResult.OK)
{
@@ -677,7 +740,12 @@ namespace CNAS_DBSync

private void btnSourceFilter_Click(object sender, EventArgs e)
{
frmSourceFilter frm = new frmSourceFilter(currentSyncItem);
if (currentSyncItem == null || currentSyncItem.LstSyncPramas == null || currentSyncItem.LstSyncPramas.Count == 0)
{
MessageBox.Show("请先指定至少一个映射字段。");
return;
}
frmSourceFilter frm = new frmSourceFilter(currentSyncItem,strTableInfoMode);
frm.sourceDataFilterHandler = delegate (SourceDataFilter dataFilter)
{
currentSyncItem.SourceFilter = dataFilter;
@@ -702,10 +770,11 @@ namespace CNAS_DBSync
lstInstrument[0].InstruType = Instrumentitem.InstruType;
}
};
frmCode.ShowDialog();

//绑定数据
dgvInstrument.DataSource = new BindingList<SyncInstrumentItemInfo>(lstSyncInstrument);
if (frmCode.ShowDialog() == DialogResult.OK)
{
//绑定数据
dgvInstrument.DataSource = new BindingList<SyncInstrumentItemInfo>(lstSyncInstrument);
}
}

private void cbxCNASColumn_SelectedIndexChanged(object sender, EventArgs e)
@@ -744,5 +813,64 @@ namespace CNAS_DBSync
cbxCNASColumn.Visible = false;
}
}

private void tsmServiceSetting_Click(object sender, EventArgs e)
{
frmServiceConfig frmServiceConfig = new frmServiceConfig();
frmServiceConfig.ShowDialog();
}

private void tsmSystemSetting_Click(object sender, EventArgs e)
{
frmSystemSetting frmSystem = new frmSystemSetting();
frmSystem.ShowDialog();

strTableInfoMode = FileOperation.GetSystemFormatConfigData().TableInfoMode;
if (strTableInfoMode == "1")
{
cbxInstrument.DropDownStyle = ComboBoxStyle.DropDown;
//cbxCnas.DropDownStyle = ComboBoxStyle.DropDown;
}
else
{
cbxInstrument.DropDownStyle = ComboBoxStyle.DropDownList;
}
}

private void tsmSourceSetting_Click(object sender, EventArgs e)
{
frmSourceSetting frmSource = new frmSourceSetting();
frmSource.ShowDialog();
}

private void tsmHelper_Click(object sender, EventArgs e)
{
string strHelpFilePath = FileHelper.getBasePath()+ @"\Helper.CHM";
//Help.ShowHelp(null, strHelpFilePath, HelpNavigator.TopicId, "1");
//Help.ShowHelpIndex(this, strHelpFilePath);
System.Diagnostics.Process.Start(strHelpFilePath);
}

private void splitContainerCol_SplitterMoved(object sender, SplitterEventArgs e)
{
dgvInstrument.Columns[0].Width = dgvInstrument.Width - 4;
}

private void splitContainerFields_SplitterMoved(object sender, SplitterEventArgs e)
{
cbxInstrument.Left = lbDevFields.Left + lbDevFields.Width + 4;
//cbxInstrument.Width = pnlleft.Width - (lbDevFields.Left + lbDevFields.Width) - 20;

cbxCnas.Left = lbCnasFields.Left + lbCnasFields.Width + 4;
//cbxCnas.Width = pnlRigh.Width - cbxCnas.Left - 20;
}

private void frmSyncParams_Resize(object sender, EventArgs e)
{
txtInstrumentColumn.Left = pnHeader.Width - txtInstrumentColumn.Width - 12;
cbxCNASColumn.Left = txtInstrumentColumn.Left;
cbxCNASColumn.Width = txtInstrumentColumn.Width;
lbDevField.Left = cbxCNASColumn.Left - 8 - lbDevField.Width;
}
}
}

+ 6
- 3
CNAS_DBSync/frmSyncParams.resx Näytä tiedosto

@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="Code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="InstrumentField.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -144,11 +147,11 @@
<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 name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>146, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>60</value>
<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">


+ 268
- 0
CNAS_DBSync/frmSystemSetting.Designer.cs Näytä tiedosto

@@ -0,0 +1,268 @@
namespace CNAS_DBSync
{
partial class frmSystemSetting
{
/// <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(frmSystemSetting));
this.pnlAll = new System.Windows.Forms.Panel();
this.pnlBody = new System.Windows.Forms.Panel();
this.btnOK = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.numpLogDataDays = new System.Windows.Forms.NumericUpDown();
this.label4 = new System.Windows.Forms.Label();
this.cbxAutomatic = new System.Windows.Forms.CheckBox();
this.cbxManual = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.numpShowDataDays = new System.Windows.Forms.NumericUpDown();
this.lblText1 = new System.Windows.Forms.Label();
this.pnlRight = new System.Windows.Forms.Panel();
this.pnlLeft = new System.Windows.Forms.Panel();
this.pnlBottom = new System.Windows.Forms.Panel();
this.pnlTop = new System.Windows.Forms.Panel();
this.pnlAll.SuspendLayout();
this.pnlBody.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numpLogDataDays)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numpShowDataDays)).BeginInit();
this.SuspendLayout();
//
// pnlAll
//
this.pnlAll.Controls.Add(this.pnlBody);
this.pnlAll.Controls.Add(this.pnlRight);
this.pnlAll.Controls.Add(this.pnlLeft);
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.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlAll.Name = "pnlAll";
this.pnlAll.Size = new System.Drawing.Size(441, 226);
this.pnlAll.TabIndex = 0;
//
// pnlBody
//
this.pnlBody.Controls.Add(this.btnOK);
this.pnlBody.Controls.Add(this.groupBox1);
this.pnlBody.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlBody.Location = new System.Drawing.Point(10, 10);
this.pnlBody.Name = "pnlBody";
this.pnlBody.Size = new System.Drawing.Size(421, 206);
this.pnlBody.TabIndex = 4;
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(325, 169);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(90, 30);
this.btnOK.TabIndex = 1;
this.btnOK.Text = "确定";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.numpLogDataDays);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.cbxAutomatic);
this.groupBox1.Controls.Add(this.cbxManual);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.numpShowDataDays);
this.groupBox1.Controls.Add(this.lblText1);
this.groupBox1.Location = new System.Drawing.Point(2, 6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(415, 157);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "设置";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(337, 109);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(20, 17);
this.label3.TabIndex = 8;
this.label3.Text = "天";
//
// numpLogDataDays
//
this.numpLogDataDays.Location = new System.Drawing.Point(211, 104);
this.numpLogDataDays.Name = "numpLogDataDays";
this.numpLogDataDays.Size = new System.Drawing.Size(120, 23);
this.numpLogDataDays.TabIndex = 7;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(41, 106);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(164, 17);
this.label4.TabIndex = 6;
this.label4.Text = "自动生成日志记录范围:最近";
//
// cbxAutomatic
//
this.cbxAutomatic.AutoSize = true;
this.cbxAutomatic.Checked = true;
this.cbxAutomatic.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbxAutomatic.Location = new System.Drawing.Point(250, 34);
this.cbxAutomatic.Name = "cbxAutomatic";
this.cbxAutomatic.Size = new System.Drawing.Size(51, 21);
this.cbxAutomatic.TabIndex = 5;
this.cbxAutomatic.Text = "自动";
this.cbxAutomatic.UseVisualStyleBackColor = true;
this.cbxAutomatic.CheckedChanged += new System.EventHandler(this.cbxAutomatic_CheckedChanged);
//
// cbxManual
//
this.cbxManual.AutoSize = true;
this.cbxManual.Location = new System.Drawing.Point(185, 34);
this.cbxManual.Name = "cbxManual";
this.cbxManual.Size = new System.Drawing.Size(51, 21);
this.cbxManual.TabIndex = 4;
this.cbxManual.Text = "手动";
this.cbxManual.UseVisualStyleBackColor = true;
this.cbxManual.CheckedChanged += new System.EventHandler(this.cbxManual_CheckedChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(41, 35);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(119, 17);
this.label2.TabIndex = 3;
this.label2.Text = "加载来源表结构方式:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(337, 75);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(20, 17);
this.label1.TabIndex = 2;
this.label1.Text = "天";
//
// numpShowDataDays
//
this.numpShowDataDays.Location = new System.Drawing.Point(211, 70);
this.numpShowDataDays.Name = "numpShowDataDays";
this.numpShowDataDays.Size = new System.Drawing.Size(120, 23);
this.numpShowDataDays.TabIndex = 1;
//
// lblText1
//
this.lblText1.AutoSize = true;
this.lblText1.Location = new System.Drawing.Point(41, 73);
this.lblText1.Name = "lblText1";
this.lblText1.Size = new System.Drawing.Size(164, 17);
this.lblText1.TabIndex = 0;
this.lblText1.Text = "数据展示界面显示范围:最近";
//
// pnlRight
//
this.pnlRight.Dock = System.Windows.Forms.DockStyle.Right;
this.pnlRight.Location = new System.Drawing.Point(431, 10);
this.pnlRight.Name = "pnlRight";
this.pnlRight.Size = new System.Drawing.Size(10, 206);
this.pnlRight.TabIndex = 3;
//
// pnlLeft
//
this.pnlLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.pnlLeft.Location = new System.Drawing.Point(0, 10);
this.pnlLeft.Name = "pnlLeft";
this.pnlLeft.Size = new System.Drawing.Size(10, 206);
this.pnlLeft.TabIndex = 2;
//
// pnlBottom
//
this.pnlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlBottom.Location = new System.Drawing.Point(0, 216);
this.pnlBottom.Name = "pnlBottom";
this.pnlBottom.Size = new System.Drawing.Size(441, 10);
this.pnlBottom.TabIndex = 1;
//
// 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(441, 10);
this.pnlTop.TabIndex = 0;
//
// frmSystemSetting
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(441, 226);
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.MaximizeBox = false;
this.Name = "frmSystemSetting";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "系统参数设置";
this.Load += new System.EventHandler(this.frmSystemSetting_Load);
this.pnlAll.ResumeLayout(false);
this.pnlBody.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numpLogDataDays)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numpShowDataDays)).EndInit();
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Panel pnlAll;
private System.Windows.Forms.Panel pnlBottom;
private System.Windows.Forms.Panel pnlTop;
private System.Windows.Forms.Panel pnlRight;
private System.Windows.Forms.Panel pnlLeft;
private System.Windows.Forms.Panel pnlBody;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.NumericUpDown numpShowDataDays;
private System.Windows.Forms.Label lblText1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox cbxAutomatic;
private System.Windows.Forms.CheckBox cbxManual;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.NumericUpDown numpLogDataDays;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button btnOK;
}
}

+ 72
- 0
CNAS_DBSync/frmSystemSetting.cs Näytä tiedosto

@@ -0,0 +1,72 @@
using CnasSynchronusClient;
using CnasSynchrousModel;
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;
using System.Xml.Serialization;

namespace CNAS_DBSync
{
public partial class frmSystemSetting : Form
{
private SystemFormatConfig systemConfig;
public frmSystemSetting()
{
InitializeComponent();
}

private void frmSystemSetting_Load(object sender, EventArgs e)
{
//加载配置信息
systemConfig= FileOperation.GetSystemFormatConfigData();

if (systemConfig.TableInfoMode == "1")
{
this.cbxManual.Checked = true;
this.cbxAutomatic.Checked = false;
}
else
{
this.cbxManual.Checked = false;
this.cbxAutomatic.Checked = true;
}

int days = 0;
if (Int32.TryParse(systemConfig.ShowDelayDays, out days))
{
this.numpShowDataDays.Value = -days;
}
if (Int32.TryParse(systemConfig.ShowLogDays, out days))
{
this.numpLogDataDays.Value = -days;
}
}

private void btnOK_Click(object sender, EventArgs e)
{
//判断合法性,存储配置信息
systemConfig.TableInfoMode = this.cbxManual.Checked ? "1" : "0";
systemConfig.ShowDelayDays = (-numpShowDataDays.Value).ToString();
systemConfig.ShowLogDays = (-numpLogDataDays.Value).ToString();

bool bSave = FileOperation.SaveSystemFormatConfigData(systemConfig);

MessageBox.Show(bSave?"保存成功!":"保存失败!");
}

private void cbxManual_CheckedChanged(object sender, EventArgs e)
{
cbxAutomatic.Checked = !cbxManual.Checked;
}

private void cbxAutomatic_CheckedChanged(object sender, EventArgs e)
{
cbxManual.Checked = !cbxAutomatic.Checked;
}
}
}

+ 167
- 0
CNAS_DBSync/frmSystemSetting.resx Näytä tiedosto

@@ -0,0 +1,167 @@
<?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>
AAABAAEAGBgAAAEAIACICQAAFgAAACgAAAAYAAAAMAAAAAEAIAAAAAAAAAkAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AwCAAAMAgAADAIAAAwCAAAMAwAAHAP8B
/wA=
</value>
</data>
</root>

+ 5
- 5
CNAS_DBSync/packages.config Näytä tiedosto

@@ -1,9 +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="EntityFramework" version="6.2.0" targetFramework="net40" requireReinstallation="true" />
<package id="log4net" version="2.0.8" targetFramework="net40" requireReinstallation="true" />
<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" />
<package id="System.Data.SQLite.Core" version="1.0.111.0" targetFramework="net40" requireReinstallation="true" />
<package id="System.Data.SQLite.EF6" version="1.0.111.0" targetFramework="net40" requireReinstallation="true" />
<package id="System.Data.SQLite.Linq" version="1.0.111.0" targetFramework="net40" requireReinstallation="true" />
</packages>

+ 21
- 0
CNAS_PortDataParsing/BalancePortParsing.cs Näytä tiedosto

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

namespace CNAS_PortDataParsing
{
public class BalancePortParsing : IDataParsing
{
public byte[] DataParsingByte(byte[] byteData)
{
throw new NotImplementedException();
}

public string DataParsingString(string strData)
{
return strData;
}
}
}

+ 49
- 0
CNAS_PortDataParsing/CNAS_PortDataParsing.csproj Näytä tiedosto

@@ -0,0 +1,49 @@
<?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>{9BEF74C8-F759-4AF3-9605-B4E32A992D02}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CNAS_PortDataParsing</RootNamespace>
<AssemblyName>CNAS_PortDataParsing</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BalancePortParsing.cs" />
<Compile Include="IDataParsing.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

+ 25
- 0
CNAS_PortDataParsing/IDataParsing.cs Näytä tiedosto

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CNAS_PortDataParsing
{
public interface IDataParsing
{
/// <summary>
/// 解析字符串数据
/// </summary>
/// <param name="strData"></param>
/// <returns></returns>
string DataParsingString(string strData);

/// <summary>
/// 解析字节数组数据
/// </summary>
/// <param name="byteData"></param>
/// <returns></returns>
Byte[] DataParsingByte(Byte[] byteData);
}
}

+ 36
- 0
CNAS_PortDataParsing/Properties/AssemblyInfo.cs Näytä tiedosto

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

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

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

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("9bef74c8-f759-4af3-9605-b4e32a992d02")]

// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

+ 27
- 11
CNAS_RunSync/CNAS_RunSync.csproj Näytä tiedosto

@@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>CNAS_RunSync</RootNamespace>
<AssemblyName>CNAS_RunSync</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
@@ -22,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -31,10 +32,14 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Synchronize_show.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -56,22 +61,25 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="frmSyncShow.cs">
<Compile Include="frmSynchrousMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmSyncShow.Designer.cs">
<DependentUpon>frmSyncShow.cs</DependentUpon>
<Compile Include="frmSynchrousMain.Designer.cs">
<DependentUpon>frmSynchrousMain.cs</DependentUpon>
</Compile>
<Compile Include="KMenuTabControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ucSyncShow.cs">
<Compile Include="ucSynchrousMain.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ucSyncShow.Designer.cs">
<DependentUpon>ucSyncShow.cs</DependentUpon>
<Compile Include="ucSynchrousMain.Designer.cs">
<DependentUpon>ucSynchrousMain.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="frmSyncShow.resx">
<DependentUpon>frmSyncShow.cs</DependentUpon>
<EmbeddedResource Include="frmSynchrousMain.resx">
<DependentUpon>frmSynchrousMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
@@ -83,8 +91,8 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="ucSyncShow.resx">
<DependentUpon>ucSyncShow.cs</DependentUpon>
<EmbeddedResource Include="ucSynchrousMain.resx">
<DependentUpon>ucSynchrousMain.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.config">
<SubType>Designer</SubType>
@@ -101,6 +109,10 @@
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CNASBalanceDBManage\CNASBalanceDBManage.csproj">
<Project>{d4d6a680-8b6b-4ecb-96d0-264954dabfc1}</Project>
<Name>CNASBalanceDBManage</Name>
</ProjectReference>
<ProjectReference Include="..\CnasSynchronousCommon\CnasSynchronousCommon.csproj">
<Project>{8e0e5f2e-2ba2-4952-9f31-34c072cd86b3}</Project>
<Name>CnasSynchronousCommon</Name>
@@ -118,5 +130,9 @@
<Name>CNAS_DBSync</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Synchronize_16px_1190987_easyicon.net.ico" />
<Content Include="Synchronize_show.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

+ 390
- 0
CNAS_RunSync/KMenuTabControl.cs Näytä tiedosto

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

namespace CNAS_RunSync
{
public partial class KMenuTabControl : System.Windows.Forms.TabControl
{
#region 属性、构造
Color SelectedColor = Color.FromArgb(235,235,235);
Color MoveColor = Color.FromArgb(225, 225, 225);
Color FontColor = Color.Black;
int TextLeft = 10;
[Browsable(true)]
[Description("选项卡标题左边距"), Category("TextLeft"), DefaultValue(typeof(Int32), "10")]
public int TitleTextLeft
{
get { return TextLeft; }
set { this.TextLeft = value; }
}

[Browsable(true)]
[Description("选项卡标题字体颜色"), Category("TitleColor"), DefaultValue(typeof(Color), "Black")]
public Color TitleFontColor
{
get { return FontColor; }
set { this.FontColor = value; }
}

[Browsable(true)]
[Description("选项卡标题字体选中颜色"), Category("TitleColor"), DefaultValue(typeof(Color), "LightSkyBlue")]
public Color TitleSelectedColor
{
get { return SelectedColor; }
set { this.SelectedColor = value; }
}

[Browsable(true)]
[Description("选项卡标题字体悬浮颜色"), Category("TitleColor"), DefaultValue(typeof(Color), "White")]
public Color TitleMoveColor
{
get { return MoveColor; }
set { this.MoveColor = value; }
}

[Browsable(true), Description("整个控件的背景色"), Category("外观")]
public Color TabControlBackColor { get; set; }

[Browsable(true), Description("TabControl ItemSize"), Category("外观")]
public Size TabControlItemSize { get; set; }

public KMenuTabControl()
{
this.SuspendLayout();
this.DrawMode = TabDrawMode.OwnerDrawFixed;
this.ResumeLayout(false);
this.SizeMode = TabSizeMode.Fixed;
this.Multiline = false;
this.TabControlBackColor = Color.WhiteSmoke;
this.TabControlItemSize = new Size(100, 28);
this.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.tabMenu_DrawItem);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.MainTabControl_MouseDown);
}
#endregion

protected override void OnPaint(PaintEventArgs e)
{
Rectangle tcRec = this.ClientRectangle;//整个tabControl的边框
e.Graphics.FillRectangle(new SolidBrush(this.TabControlBackColor), tcRec);

int MaxWidth = 100;
for (int i = 0; i < this.TabCount; i++)
{
Graphics gx = Graphics.FromImage(new Bitmap(1, 1));
SizeF size = gx.MeasureString(this.Controls[i].Text, this.Font);
if (MaxWidth < (int)size.Width + 30)
MaxWidth = (int)size.Width + 30;
}
this.TabControlItemSize = new Size(MaxWidth, this.TabControlItemSize.Height);
if (this.ItemSize != this.TabControlItemSize)
{
this.ItemSize = TabControlItemSize;
}

StringFormat sf = new StringFormat();//封装文本布局信息
sf.LineAlignment = StringAlignment.Center;
sf.Alignment = StringAlignment.Near;
for (int i = 0; i < this.TabCount; i++)
{
Graphics g = e.Graphics;
// int width = (int)g.MeasureString(this.Controls[i].Text, this.Font).Width + 40;
Rectangle rect = this.GetTabRect(i);
// rect.Width = width;
if (this.SelectedIndex == i)
g.FillRectangle(new SolidBrush(MoveColor), rect);
else
g.FillRectangle(new SolidBrush(SelectedColor), rect);

SolidBrush brush = new SolidBrush(FontColor);
// rect.Width = width;
rect.X += TextLeft;
g.DrawString(this.Controls[i].Text, this.Font, brush, rect, sf);

using (Pen objpen = new Pen(Color.Black))
{
int tx = (int)(rect.X + (rect.Width - 30));
rect.X = tx - 2;
Point p5 = new Point(tx, 8);
Font font = new System.Drawing.Font("微软雅黑", 12);
//g.DrawString("〇", font, brush, rect, sf);
font = new System.Drawing.Font("微软雅黑", 11);
rect.X = tx + 2;
rect.Y = rect.Y - 1;
g.DrawString("×", font, brush, rect, sf);
}
}
}

public override Rectangle DisplayRectangle
{
get
{
Rectangle rect = base.DisplayRectangle;
return new Rectangle(rect.Left - 2, rect.Top - 2, rect.Width + 4, rect.Height + 5);
}
}

int index = -1;
protected override void OnMouseMove(MouseEventArgs e)
{
int Count = 0;
try
{
Graphics g = this.CreateGraphics();
SolidBrush brush = new SolidBrush(FontColor);
StringFormat sf = new StringFormat();//封装文本布局信息
sf.LineAlignment = StringAlignment.Center;
sf.Alignment = StringAlignment.Near;

for (int i = 0; i < this.TabPages.Count; i++)
{
TabPage tp = this.TabPages[i];
if (this.GetTabRect(i).Contains(e.Location) && tp != this.SelectedTab)
{
if (index != i)
{
if (Count == 0)
{
if (index != -1 && this.TabPages[index] != this.SelectedTab)
{
g.FillRectangle(new SolidBrush(SelectedColor), this.GetTabRect(index));

RectangleF tRectangle = this.GetTabRect(index);
tRectangle.X += TextLeft;
g.DrawString(this.Controls[index].Text, this.Font, brush, tRectangle, sf);
}
Count = 1;
}
index = i;
g.FillRectangle(new SolidBrush(SelectedColor), this.GetTabRect(i));
RectangleF tRectangleF = this.GetTabRect(i);
tRectangleF.X += TextLeft;
g.DrawString(this.Controls[i].Text, this.Font, brush, tRectangleF, sf);
using (Pen objpen = new Pen(Color.Black))
{
int tx = (int)(tRectangleF.X + (tRectangleF.Width - 30));
tRectangleF.X = tx - 2;
brush.Color = Color.White;
Font font = new System.Drawing.Font("微软雅黑", 12);
//g.DrawString("〇", font, brush, tRectangleF, sf);
font = new System.Drawing.Font("微软雅黑", 11);
tRectangleF.X = tx + 2;
tRectangleF.Y = tRectangleF.Y - 1;
g.DrawString("×", font, brush, tRectangleF, sf);
}
}
}
if (this.GetTabRect(i).Contains(e.Location) && tp == this.SelectedTab)
{
if (index != -1 && index != this.SelectedIndex)
{
g.FillRectangle(new SolidBrush(SelectedColor), this.GetTabRect(index));
RectangleF tRectangleF = this.GetTabRect(index);
tRectangleF.X += TextLeft;
g.DrawString(this.Controls[index].Text, this.Font, brush, tRectangleF, sf);
using (Pen objpen = new Pen(Color.Black))
{
int tx = (int)(tRectangleF.X + (tRectangleF.Width - 30));
tRectangleF.X = tx - 2;
Font font = new System.Drawing.Font("微软雅黑", 12);
//g.DrawString("〇", font, brush, tRectangleF, sf);
font = new System.Drawing.Font("微软雅黑", 11);
tRectangleF.X = tx + 2;
tRectangleF.Y = tRectangleF.Y - 1;
g.DrawString("×", font, brush, tRectangleF, sf);
}
}
index = -1;
}
}
}
catch (Exception)
{
}
Count = 0;
base.OnMouseMove(e);
}

protected override void OnMouseLeave(EventArgs e)
{
try
{
Graphics g = this.CreateGraphics();
if (index != -1 && this.TabPages[index] != this.SelectedTab)
{
g.FillRectangle(new SolidBrush(SelectedColor), this.GetTabRect(index));
SolidBrush brush = new SolidBrush(FontColor);
RectangleF tRectangleF = this.GetTabRect(index);
StringFormat sf = new StringFormat();//封装文本布局信息
sf.LineAlignment = StringAlignment.Center;
sf.Alignment = StringAlignment.Near;
tRectangleF.X += TextLeft;
g.DrawString(this.Controls[index].Text, this.Font, brush, tRectangleF, sf);
using (Pen objpen = new Pen(Color.Black))
{
int tx = (int)(tRectangleF.X + (tRectangleF.Width - 30));
tRectangleF.X = tx - 2;
Point p5 = new Point(tx, 8);
Font font = new System.Drawing.Font("微软雅黑", 12);
//g.DrawString("〇", font, brush, tRectangleF, sf);
font = new System.Drawing.Font("微软雅黑", 11);
tRectangleF.X = tx + 2;
tRectangleF.Y = tRectangleF.Y - 1;
g.DrawString("×", font, brush, tRectangleF, sf);
}
}
}
catch (Exception)
{
}
index = -1;
base.OnMouseLeave(e);
}
/// <summary>
/// 重绘控件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tabMenu_DrawItem(object sender, DrawItemEventArgs e)
{
this.SetStyle(
ControlStyles.UserPaint | // 控件将自行绘制,而不是通过操作系统来绘制
ControlStyles.OptimizedDoubleBuffer | // 该控件首先在缓冲区中绘制,而不是直接绘制到屏幕上,这样可以减少闪烁
ControlStyles.AllPaintingInWmPaint | // 控件将忽略 WM_ERASEBKGND 窗口消息以减少闪烁
ControlStyles.ResizeRedraw | // 在调整控件大小时重绘控件
ControlStyles.SupportsTransparentBackColor, // 控件接受 alpha 组件小于 255 的 BackColor 以模拟透明
true); // 设置以上值为 true
this.UpdateStyles();
}

//关闭按钮功能
private void MainTabControl_MouseDown(object sender, MouseEventArgs e)
{
int closeSize = 20;
if (e.Button == MouseButtons.Left)
{
int x = e.X, y = e.Y;
//计算关闭区域
Rectangle tab = this.GetTabRect(this.SelectedIndex);
tab.Offset(tab.Width - (closeSize + 3), 4);
tab.Width = closeSize;
tab.Height = closeSize;

if (this.TabCount == 1) return;

//如果鼠标在区域内就关闭选项卡
bool isClose = x > tab.X && x < tab.Right && y > tab.Y && y < tab.Bottom;
if (isClose == true)
{
this.TabPages.Remove(this.SelectedTab);
}
}
}
}


public partial class KTabControl : System.Windows.Forms.TabControl
{
[Browsable(true), Description("整个控件的背景色"), Category("外观")]
public Color TabControlBackColor { get; set; }

[Browsable(true), Description("Tab的标题栏边框颜色"), Category("外观")]
public Color TabBorderColor { get; set; }

[Browsable(true), Description("当前激活Tab的标题栏背景色"), Category("外观")]
public Color ActivedTabBackColor { get; set; }

[Browsable(true), Description("当前激活Tab的标题文字颜色"), Category("外观")]
public Color ActivedTabLabelColor { get; set; }

[Browsable(true), Description("未激活Tab的标题栏背景色"), Category("外观")]
public Color InActivedTabBackColor { get; set; }

[Browsable(true), Description("未激活Tab的标题文字颜色"), Category("外观")]
public Color InActivedTabLabelColor { get; set; }

[Browsable(true), Description("Tab标题栏的大小"), Category("外观")]
public Size TabSize { get; set; }

public KTabControl()
{
//this.InitializeComponent();

TabSet();

this.TabBorderColor = Color.Black;
this.ActivedTabLabelColor = Color.Black;
this.InActivedTabLabelColor = Color.Black;
this.ActivedTabBackColor = Color.White;
this.InActivedTabBackColor = Color.FromArgb(0, 192, 192);
this.TabControlBackColor = Color.Transparent;
this.TabSize = new Size(100, 35);
}

protected override void OnMouseDoubleClick(MouseEventArgs e)
{
if (this.TabPages.Count == 1) return;
this.TabPages.RemoveAt(this.SelectedIndex);
}

protected override void OnPaint(PaintEventArgs e)
{
Rectangle tcRec = this.ClientRectangle;//整个tabControl的边框
e.Graphics.FillRectangle(new SolidBrush(this.TabControlBackColor), tcRec);

for (int i = 0; i < this.TabPages.Count; i++)
{
Rectangle tabRectangle = new Rectangle(1, 1 + i * TabSize.Height, TabSize.Width, TabSize.Height);
SolidBrush brush = new SolidBrush(this.InActivedTabLabelColor);
StringFormat sf = new StringFormat();//封装文本布局信息
sf.LineAlignment = StringAlignment.Center;
sf.Alignment = StringAlignment.Center;
if (i == this.SelectedIndex)
{
brush = new SolidBrush(this.ActivedTabLabelColor);
e.Graphics.FillRectangle(new SolidBrush(ActivedTabBackColor), tabRectangle);
e.Graphics.DrawRectangle(new Pen(this.TabBorderColor), tabRectangle);
}
else
{
e.Graphics.FillRectangle(new SolidBrush(InActivedTabBackColor), tabRectangle);
e.Graphics.DrawRectangle(new Pen(this.TabBorderColor), tabRectangle);
}
e.Graphics.DrawString(this.Controls[i].Text, this.Font, brush, tabRectangle, sf);
}
}

/// <summary>
/// 设定控件绘制模式
/// </summary>
private void TabSet()
{
this.DrawMode = TabDrawMode.OwnerDrawFixed;
this.Alignment = TabAlignment.Left;
this.SizeMode = TabSizeMode.Fixed;
this.Multiline = true;
base.SetStyle(
ControlStyles.UserPaint |
ControlStyles.OptimizedDoubleBuffer |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.ResizeRedraw |
ControlStyles.SupportsTransparentBackColor,
true);
base.UpdateStyles();
}

public override Rectangle DisplayRectangle
{
get
{
Rectangle rect = base.DisplayRectangle;
return new Rectangle(rect.Left - 3, rect.Top - 3, rect.Width + 6, rect.Height + 5);
}
}
}
}

+ 20
- 3
CNAS_RunSync/Program.cs Näytä tiedosto

@@ -3,6 +3,7 @@ using CnasSynchronusClient;
using CnasSynchrousModel;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Windows.Forms;

@@ -21,16 +22,32 @@ namespace CNAS_RunSync
string strMsg = "";
CheckAvailability(ref strMsg);
if (strMsg == "")
Application.Run(new frmSyncShow());
Application.Run(new frmSynchrousMain());
else
MessageBox.Show(strMsg);
}
//检查当前电脑是否可以启动程序
public static void CheckAvailability(ref string strErrorMsg)
{
SystemFormatConfig systemFormat = FileOperation.GetSystemFormatConfigData();
GlobalCommonOperation.strStartGeneralVersion = systemFormat.StartGeneralVersion;
GlobalCommonOperation.strStartWebApi = systemFormat.StartWebApi;
GlobalCommonOperation.strWebApiUrl = systemFormat.WebApiUrl;
GlobalCommonOperation.strTargetDbType = systemFormat.TargetDBType;
if (GlobalCommonOperation.strStartGeneralVersion == "1") //此时启动的时通用版本,不需检查Mac地址
{
return;
}
//1.读取本地CNAS数据库配置信息
DataBaseInfo Cnasdb = FileOperation.GetLocalCnasDB();
if (!CnasDataOperationFact.CnasDataOperation().TestConnect(Cnasdb.DBHost, Cnasdb.DBName, Cnasdb.DBUser, Cnasdb.DBPwd, Cnasdb.DBPort))
DataBaseInfo Cnasdb = null;
if (GlobalCommonOperation.strStartWebApi != "1")
Cnasdb = FileOperation.GetLocalCnasDB();
else
Cnasdb = new DataBaseInfo()
{
DataBaseCode = "cnas"
};
if (!CnasDataOperationFact.CnasDataOperation().TestConnect(Cnasdb))
{
strErrorMsg = "无法正常连接CNAS库,请先配置数据库连接。";
return;


+ 3
- 3
CNAS_RunSync/Properties/Resources.Designer.cs Näytä tiedosto

@@ -19,7 +19,7 @@ namespace CNAS_RunSync.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@@ -47,8 +47,8 @@ namespace CNAS_RunSync.Properties {
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {


+ 1
- 1
CNAS_RunSync/Properties/Settings.Designer.cs Näytä tiedosto

@@ -12,7 +12,7 @@ namespace CNAS_RunSync.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.3.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));


BIN
CNAS_RunSync/Synchronize_16px_1190987_easyicon.net.ico Näytä tiedosto

Before After

BIN
CNAS_RunSync/Synchronize_show.ico Näytä tiedosto

Before After

+ 28
- 25
CNAS_RunSync/app.config Näytä tiedosto

@@ -1,50 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<appSettings>
<add key="TargetDBType" value="MySQL" />
<add key="InitalOperationPwd" value="123456" />
<add key="DelayDays" value="-60" />
<add key="TargetDBType" value="Mysql"/>
<add key="InitalOperationPwd" value="123456"/>
<add key="DelayDays" value="-60"/>
<add key="GetMacMethod" value="1"/>
<add key="StartGeneralVersion" value="1"/>
<add key="StartWebApiUrl" value="1"/>
<add key="WebApiUrl" value="http://localhost:60101/api"/>
</appSettings>
<log4net>
<logger name="Log">
<level value="INFO" />
<appender-ref ref="RollingLog" />
<level value="INFO"/>
<appender-ref ref="RollingLog"/>
</logger>
<logger name="Err">
<level value="ERROR" />
<appender-ref ref="RollingErr" />
<level value="ERROR"/>
<appender-ref ref="RollingErr"/>
</logger>
<appender name="RollingLog" type="log4net.Appender.RollingFileAppender">
<file value="Log\" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.txt'" />
<staticLogFileName value="false" />
<file value="Log\"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyyMMdd'.txt'"/>
<staticLogFileName value="false"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 操作信息:%m%n" />
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 操作信息:%m%n"/>
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="INFO" />
<param name="LevelMin" value="INFO"/>
<param name="LevelMax" value="INFO"/>
</filter>
</appender>
<appender name="RollingErr" type="log4net.Appender.RollingFileAppender">
<file value="ErrorLog\" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.txt'" />
<staticLogFileName value="false" />
<file value="ErrorLog\"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyyMMdd'.txt'"/>
<staticLogFileName value="false"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 错误描述:%m%n" />
<conversionPattern value="记录时间:%d 线程ID:[%thread]- 错误描述:%m%n"/>
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="ERROR" />
<param name="LevelMax" value="ERROR" />
<param name="LevelMin" value="ERROR"/>
<param name="LevelMax" value="ERROR"/>
</filter>
</appender>
</log4net>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

+ 0
- 192
CNAS_RunSync/frmSyncShow.Designer.cs Näytä tiedosto

@@ -1,192 +0,0 @@
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.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.btnAutoService1 = new System.Windows.Forms.ToolStripMenuItem();
this.pnlRight = new System.Windows.Forms.Panel();
this.pnlLeft = new System.Windows.Forms.Panel();
this.pnlAll.SuspendLayout();
this.pnlCenter.SuspendLayout();
this.pnlCenterCenter.SuspendLayout();
this.pnlTop.SuspendLayout();
this.menuStrip1.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, 52);
this.pnlCenter.Name = "pnlCenter";
this.pnlCenter.Size = new System.Drawing.Size(923, 521);
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, 504);
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, 504);
this.tabcSyncData.TabIndex = 0;
//
// pnlCenterBottom
//
this.pnlCenterBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlCenterBottom.Location = new System.Drawing.Point(0, 504);
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.Controls.Add(this.menuStrip1);
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, 52);
this.pnlTop.TabIndex = 2;
//
// menuStrip1
//
this.menuStrip1.Dock = System.Windows.Forms.DockStyle.Fill;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnAutoService1});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(923, 52);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// btnAutoService1
//
this.btnAutoService1.Image = ((System.Drawing.Image)(resources.GetObject("btnAutoService1.Image")));
this.btnAutoService1.Name = "btnAutoService1";
this.btnAutoService1.Size = new System.Drawing.Size(92, 48);
this.btnAutoService1.Text = "自动服务配置";
this.btnAutoService1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
this.btnAutoService1.Click += new System.EventHandler(this.btnAutoService1_Click);
//
// 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.MainMenuStrip = this.menuStrip1;
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.pnlTop.ResumeLayout(false);
this.pnlTop.PerformLayout();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
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;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem btnAutoService1;
}
}


+ 0
- 64
CNAS_RunSync/frmSyncShow.cs Näytä tiedosto

@@ -1,64 +0,0 @@
using CNAS_DBSync;
using CnasSynchronusClient;
using CnasSynchrousModel;
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,展示这个仪器的详细信息和操作

//读取本地文件中存储的配置信息
lstSyncInstrument = FileOperation.GetLocalSyncInStrumentData();
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++;
}
}
else
{
MessageBox.Show("未找到相关仪器配置。");
}
}

private void btnAutoService1_Click(object sender, EventArgs e)
{
if (new frmOperationPwd().ShowDialog() == DialogResult.OK)
{
frmServiceConfig frmServiceConfig = new frmServiceConfig();
frmServiceConfig.ShowDialog();
}
}
}
}

+ 218
- 0
CNAS_RunSync/frmSynchrousMain.Designer.cs Näytä tiedosto

@@ -0,0 +1,218 @@
namespace CNAS_RunSync
{
partial class frmSynchrousMain
{
/// <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(frmSynchrousMain));
this.pnlLeft = new System.Windows.Forms.Panel();
this.pnlAll = new System.Windows.Forms.Panel();
this.pnlCenter = new System.Windows.Forms.Panel();
this.pnlCenterCenter = new System.Windows.Forms.Panel();
this.pnlCenterTop = new System.Windows.Forms.Panel();
this.menuButton = new System.Windows.Forms.MenuStrip();
this.tsmDbSeting = new System.Windows.Forms.ToolStripMenuItem();
this.tsmSynchrousSetting = new System.Windows.Forms.ToolStripMenuItem();
this.tsmHelper = new System.Windows.Forms.ToolStripMenuItem();
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.pnlAll.SuspendLayout();
this.pnlCenter.SuspendLayout();
this.pnlCenterTop.SuspendLayout();
this.menuButton.SuspendLayout();
this.SuspendLayout();
//
// pnlLeft
//
this.pnlLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.pnlLeft.Location = new System.Drawing.Point(0, 0);
this.pnlLeft.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlLeft.Name = "pnlLeft";
this.pnlLeft.Size = new System.Drawing.Size(5, 621);
this.pnlLeft.TabIndex = 0;
//
// 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.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlAll.Name = "pnlAll";
this.pnlAll.Size = new System.Drawing.Size(944, 621);
this.pnlAll.TabIndex = 1;
//
// pnlCenter
//
this.pnlCenter.Controls.Add(this.pnlCenterCenter);
this.pnlCenter.Controls.Add(this.pnlCenterTop);
this.pnlCenter.Controls.Add(this.pnlCenterBottom);
this.pnlCenter.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlCenter.Location = new System.Drawing.Point(5, 3);
this.pnlCenter.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlCenter.Name = "pnlCenter";
this.pnlCenter.Size = new System.Drawing.Size(934, 613);
this.pnlCenter.TabIndex = 4;
//
// pnlCenterCenter
//
this.pnlCenterCenter.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlCenterCenter.Location = new System.Drawing.Point(0, 30);
this.pnlCenterCenter.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlCenterCenter.Name = "pnlCenterCenter";
this.pnlCenterCenter.Size = new System.Drawing.Size(934, 579);
this.pnlCenterCenter.TabIndex = 3;
//
// pnlCenterTop
//
this.pnlCenterTop.Controls.Add(this.menuButton);
this.pnlCenterTop.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlCenterTop.Location = new System.Drawing.Point(0, 0);
this.pnlCenterTop.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlCenterTop.Name = "pnlCenterTop";
this.pnlCenterTop.Size = new System.Drawing.Size(934, 30);
this.pnlCenterTop.TabIndex = 2;
//
// menuButton
//
this.menuButton.GripMargin = new System.Windows.Forms.Padding(2, 2, 0, 2);
this.menuButton.ImageScalingSize = new System.Drawing.Size(24, 24);
this.menuButton.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmDbSeting,
this.tsmSynchrousSetting,
this.tsmHelper});
this.menuButton.Location = new System.Drawing.Point(0, 0);
this.menuButton.Name = "menuButton";
this.menuButton.Padding = new System.Windows.Forms.Padding(7, 3, 0, 3);
this.menuButton.Size = new System.Drawing.Size(934, 34);
this.menuButton.TabIndex = 0;
this.menuButton.Text = "menuStrip1";
this.menuButton.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.menuButton_ItemClicked);
//
// tsmDbSeting
//
this.tsmDbSeting.Name = "tsmDbSeting";
this.tsmDbSeting.Size = new System.Drawing.Size(139, 28);
this.tsmDbSeting.Text = "数据库配置(&B)";
this.tsmDbSeting.Click += new System.EventHandler(this.tsmDbSeting_Click);
//
// tsmSynchrousSetting
//
this.tsmSynchrousSetting.Name = "tsmSynchrousSetting";
this.tsmSynchrousSetting.Size = new System.Drawing.Size(120, 28);
this.tsmSynchrousSetting.Text = "同步配置(&S)";
this.tsmSynchrousSetting.Click += new System.EventHandler(this.tsmSynchrousSetting_Click);
//
// tsmHelper
//
this.tsmHelper.Name = "tsmHelper";
this.tsmHelper.Size = new System.Drawing.Size(88, 28);
this.tsmHelper.Text = "帮助(&H)";
this.tsmHelper.Click += new System.EventHandler(this.tsmHelper_Click);
//
// pnlCenterBottom
//
this.pnlCenterBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlCenterBottom.Location = new System.Drawing.Point(0, 609);
this.pnlCenterBottom.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlCenterBottom.Name = "pnlCenterBottom";
this.pnlCenterBottom.Size = new System.Drawing.Size(934, 4);
this.pnlCenterBottom.TabIndex = 0;
//
// pnlBottom
//
this.pnlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlBottom.Location = new System.Drawing.Point(5, 616);
this.pnlBottom.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlBottom.Name = "pnlBottom";
this.pnlBottom.Size = new System.Drawing.Size(934, 5);
this.pnlBottom.TabIndex = 3;
//
// pnlTop
//
this.pnlTop.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlTop.Location = new System.Drawing.Point(5, 0);
this.pnlTop.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlTop.Name = "pnlTop";
this.pnlTop.Size = new System.Drawing.Size(934, 3);
this.pnlTop.TabIndex = 2;
//
// pnlRight
//
this.pnlRight.Dock = System.Windows.Forms.DockStyle.Right;
this.pnlRight.Location = new System.Drawing.Point(939, 0);
this.pnlRight.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlRight.Name = "pnlRight";
this.pnlRight.Size = new System.Drawing.Size(5, 621);
this.pnlRight.TabIndex = 1;
//
// frmSynchrousMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(944, 621);
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.MainMenuStrip = this.menuButton;
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "frmSynchrousMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "CNAS取数端程序";
this.Load += new System.EventHandler(this.frmSynchrousMain_Load);
this.pnlAll.ResumeLayout(false);
this.pnlCenter.ResumeLayout(false);
this.pnlCenterTop.ResumeLayout(false);
this.pnlCenterTop.PerformLayout();
this.menuButton.ResumeLayout(false);
this.menuButton.PerformLayout();
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.Panel pnlLeft;
private System.Windows.Forms.Panel pnlAll;
private System.Windows.Forms.Panel pnlCenter;
private System.Windows.Forms.Panel pnlCenterCenter;
private System.Windows.Forms.Panel pnlCenterTop;
private System.Windows.Forms.MenuStrip menuButton;
private System.Windows.Forms.ToolStripMenuItem tsmDbSeting;
private System.Windows.Forms.ToolStripMenuItem tsmSynchrousSetting;
private System.Windows.Forms.ToolStripMenuItem tsmHelper;
private System.Windows.Forms.Panel pnlCenterBottom;
private System.Windows.Forms.Panel pnlBottom;
private System.Windows.Forms.Panel pnlTop;
private System.Windows.Forms.Panel pnlRight;
}
}

+ 118
- 0
CNAS_RunSync/frmSynchrousMain.cs Näytä tiedosto

@@ -0,0 +1,118 @@
using CNAS_DBSync;
using CNASBalanceDBManage;
using CnasSynchronusClient;
using CnasSynchrousModel;
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_RunSync
{
public partial class frmSynchrousMain : Form
{
public List<SyncInstrumentItemInfo> lstSyncInstrument = new List<SyncInstrumentItemInfo>();
KMenuTabControl kTabControl;
public frmSynchrousMain()
{
InitializeComponent();
}

private void frmSynchrousMain_Load(object sender, EventArgs e)
{
CreateTableControl();
}

public void CreateTableControl()
{
kTabControl = new KMenuTabControl();

kTabControl.Location = new System.Drawing.Point(398, 130);
kTabControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
kTabControl.Name = "taSyncData";
kTabControl.SelectedIndex = 0;
kTabControl.Size = new System.Drawing.Size(439, 644);
kTabControl.TabIndex = 0;

this.pnlCenterCenter.Controls.Add(kTabControl);
kTabControl.Dock = DockStyle.Fill;

//绑定用户自定义控件,进行数据展示
BindUserControl(kTabControl);
}

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

//读取本地文件中存储的配置信息
kTabControl.TabPages.Clear();

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

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

index++;
}
}
else
{
MessageBox.Show("未找到相关取数配置。");
}
}

private void tsmDbSeting_Click(object sender, EventArgs e)
{
if (new frmOperationPwd().ShowDialog() == DialogResult.OK)
{
frmBalanceDB frmSetting = new frmBalanceDB();
frmSetting.ShowDialog();
}
}

private void tsmSynchrousSetting_Click(object sender, EventArgs e)
{
if (new frmOperationPwd().ShowDialog() == DialogResult.OK)
{
frmSyncParams frmSyncConfig = new frmSyncParams();
frmSyncConfig.ShowDialog();

//重新绘制显示自定义控件的内容
BindUserControl(kTabControl);


//foreach(var control in kTabControl.SelectedTab.Controls)
//{
// ucSynchrousMain show = control as ucSynchrousMain;
// show.BindData();
//}
}
}

private void tsmHelper_Click(object sender, EventArgs e)
{
string strHelpFilePath = CnasSynchronousCommon.FileHelper.getBasePath() + @"\Helper.CHM";
//Help.ShowHelp(null, strHelpFilePath, HelpNavigator.TopicId, "1");
System.Diagnostics.Process.Start(strHelpFilePath);
}

private void menuButton_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{

}
}
}

CNAS_RunSync/frmSyncShow.resx → CNAS_RunSync/frmSynchrousMain.resx Näytä tiedosto

@@ -117,27 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="menuButton.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnAutoService1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAACcQAAAnEAGUaVEZAAAAB3RJ
TUUH4wEJBBwLasCJvwAAAm9JREFUSEutlclrFEEUhycuaFwhoHGJIrggiqIHF3AlEXPwIhr3iwYDERVB
xIvowYPgSVFElBxCBBXjElwOXjwIGg/+UX5fT72mZ9KZToI/+KCqp+q9qrfU1KahRbAs4fi/aDVcgMfw
Gt4lHPvN31wzbS2F6/AZNNQH22FtwvFJ8DfXuNY9U9J6eAVPYYsfKuQa17rHvS3lgk9wBWb5IWkuzIFO
2A3r0jzk2D3undSJV/QUYXwn7IBe6E/jW/AL3sMQHIXZEHKvNkrDZRy9ahvshR/wB77DRvCUJ6AHOuA4
6OgutINyjTa01SArwWRFzPfDT7gGfu8GpXMJWbIv4Q5ESLXhnobqilIMnYNx8IRX4QscgTKZl49wOJvV
FSWcyw+WnVoIb+AgnAETV+XkLDyDuIVlnR/YrrRxrG21Dd5CxPU8VDlZCd52RTar29Kmh83iaHfaQEoD
v8FkhnRiGG7AN4i1ylOfBgsicujv2tT2lBwo82JFfYU1fkgy6cfgEkR5NjioClFRW8FGsvHM2WZYBRfB
BgxpIw+RMiEmRkWSD2Szctlcz+E2WPcvwJt5AKXzR/VhXc1l6nwYFmSzcpmP++BtDZmODJXSuHnL1dxo
8+EJPIDi219stJugA2Ntp3sjn5VNMAaGrkHxVMQj5nPgrXxbTLwJPJXGhugyDIBONPgBNoB7fAEmqPjY
heaBuRmBUfgLVtg9WA6LE4fAF3YQXLsESlV8rq2UkI483R6wWrqgWbvgIRiultKJNzFckZNWMubiTSc9
ebNcWPWXGe+NN94HM5KVECVs41gx4jhKcUK1zFQ2oK0veYe2Vq32D/C5cVWZotg/AAAAAElFTkSuQmCC
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAGBYAAAEAIADACAAAFgAAACgAAAAYAAAALAAAAAEAIAAAAAAAQAgAAK8PAACvDwAAAAAAAAAA

CNAS_RunSync/ucSyncShow.Designer.cs → CNAS_RunSync/ucSynchrousMain.Designer.cs Näytä tiedosto

@@ -1,6 +1,6 @@
namespace CNAS_RunSync
{
partial class ucSyncShow
partial class ucSynchrousMain
{
/// <summary>
/// 必需的设计器变量。
@@ -28,15 +28,19 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ucSynchrousMain));
this.pnlAll = new System.Windows.Forms.Panel();
this.pnlCenter = new System.Windows.Forms.Panel();
this.pnlCenterBody = new System.Windows.Forms.Panel();
this.pnlCenterBody_Center = new System.Windows.Forms.Panel();
this.dgvSyncData = new System.Windows.Forms.DataGridView();
this.pnlTop = new System.Windows.Forms.Panel();
this.pnlCenterBody_Bottom = new System.Windows.Forms.Panel();
this.pnlSubmit_Right = new System.Windows.Forms.Panel();
this.btnRunData = new System.Windows.Forms.Button();
this.pnlCenterBody_Top = new System.Windows.Forms.Panel();
this.tableTop = new System.Windows.Forms.TableLayoutPanel();
this.pnlSelect = new System.Windows.Forms.Panel();
this.btnConfig = new System.Windows.Forms.Button();
this.btnRunData = new System.Windows.Forms.Button();
this.lblTitleMsg = new System.Windows.Forms.Label();
this.lblTitle = new System.Windows.Forms.Label();
this.pnlRunData = new System.Windows.Forms.Panel();
this.pnlConfig = new System.Windows.Forms.Panel();
@@ -49,74 +53,137 @@
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.label5 = 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.pnlCenterBottom = new System.Windows.Forms.Panel();
this.rtxtLog = new System.Windows.Forms.RichTextBox();
this.pnlCenterBottom_Top = new System.Windows.Forms.Panel();
this.pnlCenterBottom_Line = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.pnlRight = new System.Windows.Forms.Panel();
this.pnlLeft = new System.Windows.Forms.Panel();
this.pnlBottom = new System.Windows.Forms.Panel();
this.pnlTop = new System.Windows.Forms.Panel();
this.pnlAll.SuspendLayout();
this.pnlCenter.SuspendLayout();
this.pnlCenterBody.SuspendLayout();
this.pnlCenterBody_Center.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvSyncData)).BeginInit();
this.pnlTop.SuspendLayout();
this.pnlCenterBody_Bottom.SuspendLayout();
this.pnlSubmit_Right.SuspendLayout();
this.pnlCenterBody_Top.SuspendLayout();
this.tableTop.SuspendLayout();
this.pnlSelect.SuspendLayout();
this.pnlConfig.SuspendLayout();
this.pnlText.SuspendLayout();
this.pnlDate.SuspendLayout();
this.pnlCenterBottom.SuspendLayout();
this.pnlCenterBottom_Top.SuspendLayout();
this.SuspendLayout();
//
// pnlAll
//
this.pnlAll.Controls.Add(this.pnlCenter);
this.pnlAll.Controls.Add(this.pnlRight);
this.pnlAll.Controls.Add(this.pnlLeft);
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.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.Size = new System.Drawing.Size(920, 544);
this.pnlAll.TabIndex = 0;
//
// pnlCenter
//
this.pnlCenter.Controls.Add(this.dgvSyncData);
this.pnlCenter.Controls.Add(this.pnlCenterBody);
this.pnlCenter.Controls.Add(this.pnlCenterBottom);
this.pnlCenter.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlCenter.Location = new System.Drawing.Point(0, 82);
this.pnlCenter.Location = new System.Drawing.Point(2, 5);
this.pnlCenter.Name = "pnlCenter";
this.pnlCenter.Size = new System.Drawing.Size(772, 368);
this.pnlCenter.TabIndex = 2;
this.pnlCenter.Size = new System.Drawing.Size(916, 531);
this.pnlCenter.TabIndex = 4;
//
// pnlCenterBody
//
this.pnlCenterBody.Controls.Add(this.pnlCenterBody_Center);
this.pnlCenterBody.Controls.Add(this.pnlCenterBody_Bottom);
this.pnlCenterBody.Controls.Add(this.pnlCenterBody_Top);
this.pnlCenterBody.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlCenterBody.Location = new System.Drawing.Point(0, 0);
this.pnlCenterBody.Name = "pnlCenterBody";
this.pnlCenterBody.Size = new System.Drawing.Size(916, 431);
this.pnlCenterBody.TabIndex = 1;
//
// pnlCenterBody_Center
//
this.pnlCenterBody_Center.Controls.Add(this.dgvSyncData);
this.pnlCenterBody_Center.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlCenterBody_Center.Location = new System.Drawing.Point(0, 84);
this.pnlCenterBody_Center.Name = "pnlCenterBody_Center";
this.pnlCenterBody_Center.Size = new System.Drawing.Size(916, 306);
this.pnlCenterBody_Center.TabIndex = 2;
//
// dgvSyncData
//
this.dgvSyncData.AllowUserToAddRows = false;
this.dgvSyncData.AllowUserToDeleteRows = false;
this.dgvSyncData.BackgroundColor = System.Drawing.Color.White;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvSyncData.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
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.Size = new System.Drawing.Size(916, 306);
this.dgvSyncData.TabIndex = 0;
this.dgvSyncData.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSyncData_CellValueChanged);
//
// pnlTop
// pnlCenterBody_Bottom
//
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;
this.pnlCenterBody_Bottom.BackColor = System.Drawing.Color.White;
this.pnlCenterBody_Bottom.Controls.Add(this.pnlSubmit_Right);
this.pnlCenterBody_Bottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlCenterBody_Bottom.Location = new System.Drawing.Point(0, 390);
this.pnlCenterBody_Bottom.Name = "pnlCenterBody_Bottom";
this.pnlCenterBody_Bottom.Size = new System.Drawing.Size(916, 41);
this.pnlCenterBody_Bottom.TabIndex = 1;
//
// pnlSubmit_Right
//
this.pnlSubmit_Right.Controls.Add(this.btnRunData);
this.pnlSubmit_Right.Dock = System.Windows.Forms.DockStyle.Right;
this.pnlSubmit_Right.Location = new System.Drawing.Point(716, 0);
this.pnlSubmit_Right.Name = "pnlSubmit_Right";
this.pnlSubmit_Right.Size = new System.Drawing.Size(200, 41);
this.pnlSubmit_Right.TabIndex = 3;
//
// btnRunData
//
this.btnRunData.Image = ((System.Drawing.Image)(resources.GetObject("btnRunData.Image")));
this.btnRunData.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnRunData.Location = new System.Drawing.Point(100, 4);
this.btnRunData.Name = "btnRunData";
this.btnRunData.Size = new System.Drawing.Size(90, 30);
this.btnRunData.TabIndex = 2;
this.btnRunData.Text = "执行上传";
this.btnRunData.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnRunData.UseVisualStyleBackColor = true;
this.btnRunData.Click += new System.EventHandler(this.btnRunData_Click);
//
// pnlCenterBody_Top
//
this.pnlCenterBody_Top.Controls.Add(this.tableTop);
this.pnlCenterBody_Top.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlCenterBody_Top.Location = new System.Drawing.Point(0, 0);
this.pnlCenterBody_Top.Name = "pnlCenterBody_Top";
this.pnlCenterBody_Top.Size = new System.Drawing.Size(916, 84);
this.pnlCenterBody_Top.TabIndex = 0;
//
// tableTop
//
@@ -124,7 +191,7 @@
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.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 537F));
this.tableTop.Controls.Add(this.pnlSelect, 0, 0);
this.tableTop.Controls.Add(this.pnlRunData, 1, 0);
this.tableTop.Controls.Add(this.pnlConfig, 2, 0);
@@ -133,45 +200,34 @@
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;
this.tableTop.Size = new System.Drawing.Size(916, 84);
this.tableTop.TabIndex = 5;
//
// pnlSelect
//
this.pnlSelect.Controls.Add(this.btnConfig);
this.pnlSelect.Controls.Add(this.btnRunData);
this.pnlSelect.Controls.Add(this.lblTitleMsg);
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.Size = new System.Drawing.Size(357, 78);
this.pnlSelect.TabIndex = 0;
//
// btnConfig
// lblTitleMsg
//
this.btnConfig.Location = new System.Drawing.Point(9, 42);
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(90, 39);
this.btnRunData.Name = "btnRunData";
this.btnRunData.Size = new System.Drawing.Size(88, 30);
this.btnRunData.TabIndex = 0;
this.btnRunData.Text = "上传数据";
this.btnRunData.UseVisualStyleBackColor = true;
this.btnRunData.Click += new System.EventHandler(this.btnRunData_Click);
this.lblTitleMsg.AutoSize = true;
this.lblTitleMsg.Font = new System.Drawing.Font("微软雅黑", 8F);
this.lblTitleMsg.Location = new System.Drawing.Point(7, 39);
this.lblTitleMsg.Name = "lblTitleMsg";
this.lblTitleMsg.Size = new System.Drawing.Size(156, 16);
this.lblTitleMsg.TabIndex = 1;
this.lblTitleMsg.Text = "类型:<未知> 路径:<未知>";
//
// 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.Location = new System.Drawing.Point(6, 13);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(119, 19);
this.lblTitle.TabIndex = 0;
@@ -180,9 +236,9 @@
// pnlRunData
//
this.pnlRunData.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlRunData.Location = new System.Drawing.Point(298, 3);
this.pnlRunData.Location = new System.Drawing.Point(366, 3);
this.pnlRunData.Name = "pnlRunData";
this.pnlRunData.Size = new System.Drawing.Size(7, 76);
this.pnlRunData.Size = new System.Drawing.Size(9, 78);
this.pnlRunData.TabIndex = 1;
//
// pnlConfig
@@ -196,18 +252,18 @@
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.Location = new System.Drawing.Point(381, 3);
this.pnlConfig.Name = "pnlConfig";
this.pnlConfig.Size = new System.Drawing.Size(458, 76);
this.pnlConfig.Size = new System.Drawing.Size(532, 78);
this.pnlConfig.TabIndex = 2;
//
// btnCancelFind
//
this.btnCancelFind.Location = new System.Drawing.Point(349, 9);
this.btnCancelFind.Location = new System.Drawing.Point(449, 9);
this.btnCancelFind.Name = "btnCancelFind";
this.btnCancelFind.Size = new System.Drawing.Size(75, 25);
this.btnCancelFind.TabIndex = 9;
this.btnCancelFind.Text = "取消查询";
this.btnCancelFind.Text = "取消";
this.btnCancelFind.UseVisualStyleBackColor = true;
this.btnCancelFind.Click += new System.EventHandler(this.btnCancelFind_Click);
//
@@ -228,9 +284,9 @@
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.Size = new System.Drawing.Size(23, 17);
this.label3.TabIndex = 9;
this.label3.Text = "值";
this.label3.Text = "值:";
//
// txtFind
//
@@ -243,9 +299,9 @@
//
this.combCondition.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.combCondition.FormattingEnabled = true;
this.combCondition.Location = new System.Drawing.Point(53, 4);
this.combCondition.Location = new System.Drawing.Point(55, 4);
this.combCondition.Name = "combCondition";
this.combCondition.Size = new System.Drawing.Size(167, 25);
this.combCondition.Size = new System.Drawing.Size(173, 25);
this.combCondition.TabIndex = 7;
//
// label4
@@ -259,7 +315,7 @@
//
// pnlCheck
//
this.pnlCheck.Location = new System.Drawing.Point(4, 39);
this.pnlCheck.Location = new System.Drawing.Point(106, 39);
this.pnlCheck.Name = "pnlCheck";
this.pnlCheck.Size = new System.Drawing.Size(451, 34);
this.pnlCheck.TabIndex = 8;
@@ -267,7 +323,7 @@
// pnlDate
//
this.pnlDate.Controls.Add(this.label2);
this.pnlDate.Controls.Add(this.label1);
this.pnlDate.Controls.Add(this.label5);
this.pnlDate.Controls.Add(this.dtpSource);
this.pnlDate.Controls.Add(this.dtpTarget);
this.pnlDate.Location = new System.Drawing.Point(4, 86);
@@ -285,14 +341,14 @@
this.label2.TabIndex = 7;
this.label2.Text = "到";
//
// label1
// label5
//
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 = "从";
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(21, 9);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(20, 17);
this.label5.TabIndex = 6;
this.label5.Text = "从";
//
// dtpSource
//
@@ -317,46 +373,137 @@
// lblColumn
//
this.lblColumn.AutoSize = true;
this.lblColumn.Location = new System.Drawing.Point(24, 13);
this.lblColumn.Location = new System.Drawing.Point(99, 13);
this.lblColumn.Name = "lblColumn";
this.lblColumn.Size = new System.Drawing.Size(32, 17);
this.lblColumn.Size = new System.Drawing.Size(56, 17);
this.lblColumn.TabIndex = 5;
this.lblColumn.Text = "列:";
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.Location = new System.Drawing.Point(161, 9);
this.cmbColumns.Name = "cmbColumns";
this.cmbColumns.Size = new System.Drawing.Size(167, 25);
this.cmbColumns.Size = new System.Drawing.Size(173, 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.Location = new System.Drawing.Point(368, 9);
this.btnFind.Name = "btnFind";
this.btnFind.Size = new System.Drawing.Size(75, 25);
this.btnFind.TabIndex = 1;
this.btnFind.Text = "查";
this.btnFind.Text = "查";
this.btnFind.UseVisualStyleBackColor = true;
this.btnFind.Click += new System.EventHandler(this.btnFind_Click);
//
// ucSyncShow
// pnlCenterBottom
//
this.pnlCenterBottom.Controls.Add(this.rtxtLog);
this.pnlCenterBottom.Controls.Add(this.pnlCenterBottom_Top);
this.pnlCenterBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlCenterBottom.Location = new System.Drawing.Point(0, 431);
this.pnlCenterBottom.Name = "pnlCenterBottom";
this.pnlCenterBottom.Size = new System.Drawing.Size(916, 100);
this.pnlCenterBottom.TabIndex = 0;
//
// rtxtLog
//
this.rtxtLog.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtxtLog.Location = new System.Drawing.Point(0, 26);
this.rtxtLog.Name = "rtxtLog";
this.rtxtLog.ReadOnly = true;
this.rtxtLog.Size = new System.Drawing.Size(916, 74);
this.rtxtLog.TabIndex = 1;
this.rtxtLog.Text = "";
//
// pnlCenterBottom_Top
//
this.pnlCenterBottom_Top.Controls.Add(this.pnlCenterBottom_Line);
this.pnlCenterBottom_Top.Controls.Add(this.label1);
this.pnlCenterBottom_Top.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlCenterBottom_Top.Location = new System.Drawing.Point(0, 0);
this.pnlCenterBottom_Top.Name = "pnlCenterBottom_Top";
this.pnlCenterBottom_Top.Size = new System.Drawing.Size(916, 26);
this.pnlCenterBottom_Top.TabIndex = 0;
//
// pnlCenterBottom_Line
//
this.pnlCenterBottom_Line.BackColor = System.Drawing.Color.Gray;
this.pnlCenterBottom_Line.Dock = System.Windows.Forms.DockStyle.Top;
this.pnlCenterBottom_Line.Location = new System.Drawing.Point(0, 0);
this.pnlCenterBottom_Line.Name = "pnlCenterBottom_Line";
this.pnlCenterBottom_Line.Size = new System.Drawing.Size(916, 2);
this.pnlCenterBottom_Line.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(68, 17);
this.label1.TabIndex = 0;
this.label1.Text = "日志窗口:";
//
// pnlRight
//
this.pnlRight.BackColor = System.Drawing.Color.White;
this.pnlRight.Dock = System.Windows.Forms.DockStyle.Right;
this.pnlRight.Location = new System.Drawing.Point(918, 5);
this.pnlRight.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlRight.Name = "pnlRight";
this.pnlRight.Size = new System.Drawing.Size(2, 531);
this.pnlRight.TabIndex = 3;
//
// pnlLeft
//
this.pnlLeft.BackColor = System.Drawing.Color.White;
this.pnlLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.pnlLeft.Location = new System.Drawing.Point(0, 5);
this.pnlLeft.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlLeft.Name = "pnlLeft";
this.pnlLeft.Size = new System.Drawing.Size(2, 531);
this.pnlLeft.TabIndex = 2;
//
// pnlBottom
//
this.pnlBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlBottom.Location = new System.Drawing.Point(0, 536);
this.pnlBottom.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.pnlBottom.Name = "pnlBottom";
this.pnlBottom.Size = new System.Drawing.Size(920, 8);
this.pnlBottom.TabIndex = 1;
//
// pnlTop
//
this.pnlTop.BackColor = System.Drawing.Color.White;
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(920, 5);
this.pnlTop.TabIndex = 0;
//
// ucSynchrousMain
//
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.Name = "ucSynchrousMain";
this.Size = new System.Drawing.Size(920, 544);
this.Load += new System.EventHandler(this.ucSynchrousMain_Load);
this.pnlAll.ResumeLayout(false);
this.pnlCenter.ResumeLayout(false);
this.pnlCenterBody.ResumeLayout(false);
this.pnlCenterBody_Center.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvSyncData)).EndInit();
this.pnlTop.ResumeLayout(false);
this.pnlCenterBody_Bottom.ResumeLayout(false);
this.pnlSubmit_Right.ResumeLayout(false);
this.pnlCenterBody_Top.ResumeLayout(false);
this.tableTop.ResumeLayout(false);
this.pnlSelect.ResumeLayout(false);
this.pnlSelect.PerformLayout();
@@ -366,6 +513,9 @@
this.pnlText.PerformLayout();
this.pnlDate.ResumeLayout(false);
this.pnlDate.PerformLayout();
this.pnlCenterBottom.ResumeLayout(false);
this.pnlCenterBottom_Top.ResumeLayout(false);
this.pnlCenterBottom_Top.PerformLayout();
this.ResumeLayout(false);

}
@@ -373,30 +523,43 @@
#endregion

private System.Windows.Forms.Panel pnlAll;
private System.Windows.Forms.Panel pnlRight;
private System.Windows.Forms.Panel pnlLeft;
private System.Windows.Forms.Panel pnlBottom;
private System.Windows.Forms.Panel pnlTop;
private System.Windows.Forms.Label lblTitle;
private System.Windows.Forms.Panel pnlCenter;
private System.Windows.Forms.Panel pnlCenterBody;
private System.Windows.Forms.Panel pnlCenterBottom;
private System.Windows.Forms.RichTextBox rtxtLog;
private System.Windows.Forms.Panel pnlCenterBottom_Top;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Panel pnlCenterBody_Center;
private System.Windows.Forms.DataGridView dgvSyncData;
private System.Windows.Forms.Panel pnlCenterBody_Bottom;
private System.Windows.Forms.Panel pnlCenterBody_Top;
private System.Windows.Forms.Button btnRunData;
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.Label lblTitle;
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.Label lblColumn;
private System.Windows.Forms.ComboBox cmbColumns;
private System.Windows.Forms.Button btnCancelFind;
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.Label label3;
private System.Windows.Forms.TextBox txtFind;
private System.Windows.Forms.ComboBox combCondition;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Panel pnlCheck;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnCancelFind;
private System.Windows.Forms.Panel pnlDate;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.DateTimePicker dtpSource;
private System.Windows.Forms.DateTimePicker dtpTarget;
private System.Windows.Forms.Label lblColumn;
private System.Windows.Forms.ComboBox cmbColumns;
private System.Windows.Forms.Button btnFind;
private System.Windows.Forms.Label lblTitleMsg;
private System.Windows.Forms.Panel pnlCenterBottom_Line;
private System.Windows.Forms.Panel pnlSubmit_Right;
}
}

CNAS_RunSync/ucSyncShow.cs → CNAS_RunSync/ucSynchrousMain.cs Näytä tiedosto

@@ -6,40 +6,48 @@ using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Newtonsoft.Json;
using CnasSynchronusClient;
using CNAS_DBSync;
using System.Configuration;
using CnasSynchrousModel;
using CnasSynchronousCommon;

namespace CNAS_RunSync
{
public partial class ucSyncShow : UserControl
public partial class ucSynchrousMain : UserControl
{
private string delayDays= FileOperation.GetSystemFormatConfigData().ShowDelayDays;
private string delayDays = FileOperation.GetSystemFormatConfigData().ShowDelayDays;
private SyncInstrumentItemInfo syncInstrumentItem = new SyncInstrumentItemInfo();
//private Dictionary<string, DataTable> dictSourceTables = new Dictionary<string, DataTable>();
private DataTable dtSource = new 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 List<string> lstIntOrDouble = new List<string>() { "等于", "不等于", "大于", "小于", "不大于", "不小于" };
private List<string> lstText = new List<string>() { "等于", "不等于", "包含", "不包含" };
private Color FinedBackColor = Color.LightCyan; //查询后选中项
Dictionary<string, string> DictField = new Dictionary<string, string>();

public ucSynchrousMain()
{
InitializeComponent();
}

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

dgvSyncData.AutoGenerateColumns = false;
dgvSyncData.RowHeadersVisible = false;
//dgvSyncData.RowsDefaultCellStyle.BackColor = Color.Bisque;
dgvSyncData.AlternatingRowsDefaultCellStyle.BackColor = Color.WhiteSmoke;

this.syncInstrumentItem = syncInstrumentItem;
}

private void ucSyncShow_Load(object sender, EventArgs e)
/// <summary>
/// 控件加载时发生
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ucSynchrousMain_Load(object sender, EventArgs e)
{
BindData();
}
@@ -47,7 +55,7 @@ namespace CNAS_RunSync
/// <summary>
/// 绑定数据
/// </summary>
private void BindData()
public void BindData()
{
if (this.syncInstrumentItem == null) return;

@@ -57,6 +65,8 @@ namespace CNAS_RunSync
if (syncInstrumentItem.SyncInstrumentDSInfo == null) return;
//if (syncInstrumentItem.SyncInstrumentDSInfo.Path == null) return;
if (syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType == DataSourceType.None) return;
this.lblTitleMsg.Text= string.Format("类型:{0} 路径:{1}", syncInstrumentItem.SyncInstrumentDSInfo.InstrumentDataSourceType.ToString(),syncInstrumentItem.SyncInstrumentDSInfo.Path);

//清空现有绑定
DictComboBox.Clear();
@@ -64,24 +74,30 @@ namespace CNAS_RunSync

//加载相关数据
//1.1根据仪器类型加载本地存储的中英文字段说明映射
if (syncInstrumentItem.LstSyncPramas.Count > 0)
{
InstrumentDescribeZH describeZH = new InstrumentDescribeZH(syncInstrumentItem.InstruType, syncInstrumentItem.LstSyncPramas[0].SourceTable);
describeZH.GetFieldDescribe();
DictField = describeZH.DictField;
}
//if (syncInstrumentItem.LstSyncPramas.Count > 0)
//{
//InstrumentDescribeZH describeZH = new InstrumentDescribeZH(syncInstrumentItem.InstruType, syncInstrumentItem.LstSyncPramas[0].SourceTable);
//describeZH.GetFieldDescribe();
//DictField = describeZH.DictField;
//}

//2.datagridview中绑定数据(绑定的是从数据源中读取的数据)
//2.1 根据映射表,创建datagridviewcolumn/和绑定数据列
if (syncInstrumentItem.LstSyncPramas.Count <= 0) return;

//创建选择列
AddCheckBoxColumn(dgvSyncData, "selectedColumn", "选择", 80, true);

//创建数据列
foreach (var item in syncInstrumentItem.LstSyncPramas)
{
string strColumnName = item.SourceField;
if (DictField.ContainsKey(strColumnName))
strColumnName = DictField[strColumnName];
AddDatagridColumn(dgvSyncData, item.SourceField, strColumnName, 100);
AddDatagridColumn(dgvSyncData, item.SourceField, strColumnName, 150);
}
AddDatagridColumn(dgvSyncData, "GridGuid", "GridGuid", 100, false);
//创建GUID列
AddDatagridColumn(dgvSyncData, "GridGuid", "GridGuid", 50, false);

//2.2 获取数据源数据,构建datagridviewcell
//2.2.1 获取数据源数据
@@ -104,6 +120,11 @@ namespace CNAS_RunSync
DataGridViewRow dataGridViewRow = new DataGridViewRow();
foreach (DataGridViewColumn dataGridViewColumn in dgvSyncData.Columns)
{
if (dataGridViewColumn.Index == 0)
{
dataGridViewRow.Cells.Add(new DataGridViewCheckBoxCell());
}

if (dtSource.Columns.Contains(dataGridViewColumn.Name))
AddDataTextCell(dataGridViewRow, dataGridViewColumn, dr);
}
@@ -152,7 +173,7 @@ namespace CNAS_RunSync
/// <param name="strColumnHeaderText"></param>
/// <param name="Width"></param>
/// <param name="bVisible"></param>
private void AddDatagridColumn(DataGridView dgvShow,string strColumnName,string strColumnHeaderText,int Width,bool bVisible=true)
private void AddDatagridColumn(DataGridView dgvShow, string strColumnName, string strColumnHeaderText, int Width, bool bVisible = true)
{
DataGridViewColumn Column = new DataGridViewColumn()
{
@@ -160,21 +181,44 @@ namespace CNAS_RunSync
HeaderText = strColumnHeaderText,
Width = Width,
Visible = bVisible,
CellTemplate = new DataGridViewTextBoxCell()
};
CellTemplate = new DataGridViewTextBoxCell(),
ReadOnly = true
};

//设置文本对齐方式
Column.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
Column.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;

//设置该列背景颜色
dgvShow.Columns.Add(Column);
}

private void AddCheckBoxColumn(DataGridView dgvShow, string strColumnName, string strColumnHeaderText, int Width, bool bVisible = true)
{
DataGridViewCheckBoxColumn selectedColumn = new DataGridViewCheckBoxColumn()
{
HeaderText = strColumnHeaderText,
Name = strColumnName,
Visible = bVisible,
Width = Width,
ReadOnly = false
};

//设置文本对齐方式
selectedColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
selectedColumn.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;

//设置该列背景颜色
dgvShow.Columns.Add(selectedColumn);
}

/// <summary>
/// 添加datagridview的单元格
/// </summary>
/// <param name="dataGridViewRow"></param>
/// <param name="dataGridViewColumn"></param>
/// <param name="dr"></param>
private void AddDataTextCell(DataGridViewRow dataGridViewRow, DataGridViewColumn dataGridViewColumn,DataRow dr)
private void AddDataTextCell(DataGridViewRow dataGridViewRow, DataGridViewColumn dataGridViewColumn, DataRow dr)
{
DataGridViewTextBoxCell txtCell = new DataGridViewTextBoxCell();
txtCell.Value = Convert.ToString(dr[dataGridViewColumn.Name]);
@@ -189,7 +233,11 @@ namespace CNAS_RunSync
DataTable dtReadySource = dtSource.Clone();
GetUpLoadData(ref dtReadySource);
if (dtReadySource.Rows.Count <= 0)
MessageBox.Show("未能获得上传数据,请查询筛选后重试!");
{
string strMsg = "未能获得上传数据,请查询筛选后重试!";
MessageBox.Show(strMsg);
WriteMsgToRichTextBox(strMsg);
}

//执行上传
RunUpLoad(dtReadySource);
@@ -230,14 +278,15 @@ namespace CNAS_RunSync
if (dtTarget.Columns.Count <= 0)
{
MessageBox.Show("未能成功读取CNAS数据库列,请检查数据库配置。");
WriteMsgToRichTextBox("未能成功读取CNAS数据库列,请检查数据库配置。");
return;
}

//创建插入操作类
CnasInsertOperation insertOperation = new CnasInsertOperation{syncInstrumentItem = syncInstrumentItem};
CnasInsertOperation insertOperation = new CnasInsertOperation { syncInstrumentItem = syncInstrumentItem };

//逐行插入数据到内存表
string strErrorMsg = insertOperation.CreateInputData(dtReadySource,ref dtTarget);
string strErrorMsg = insertOperation.CreateInputData(dtReadySource, ref dtTarget);
if (strErrorMsg != "")
{
MessageBox.Show(strErrorMsg);
@@ -246,11 +295,12 @@ namespace CNAS_RunSync
if (dtTarget.Rows.Count <= 0)
{
MessageBox.Show("未能获取到符合要求的数据,请检查配置或联系管理员。");
WriteMsgToRichTextBox("未能获取到符合要求的数据,请检查配置或联系管理员。");
return;
}
}

//检查数据合法性
insertOperation.CheckInsertDataFormat(dtTarget, ref strErrorMsg);
insertOperation.CheckInsertDataFormat(dtTarget, ref strErrorMsg);
if (strErrorMsg != "")
{
MessageBox.Show(strErrorMsg);
@@ -261,16 +311,45 @@ namespace CNAS_RunSync
int ErrorCount = 0;
int SuccessCount = 0;
int OtherCount = 0;
List<DataRow> lstError = new List<DataRow>();
List<DataRow> lstError = new List<DataRow>();
foreach (DataRow dr in dtTarget.Rows)
{

if (dr[11].ToString().Length > 1)
{
AppLog.Error($"逐行插入目标数据,最终准备插入(更新)数据行{dr[11]}");
dr[11] = kxjsf(dr[11].ToString());

}
if (dr[12].ToString().Length > 1)
{
AppLog.Error($"逐行插入目标数据,最终准备插入(更新)数据行{dr[12]}");
}
if (dr[13].ToString().Length > 1)
{
AppLog.Error($"逐行插入目标数据,最终准备插入(更新)数据行{dr[13]}");
}
if (dr[14].ToString().Length > 1)
{
AppLog.Error($"逐行插入目标数据,最终准备插入(更新)数据行{dr[14]}");
}
if (dr[15].ToString().Length > 1)
{
AppLog.Error($"逐行插入目标数据,最终准备插入(更新)数据行{dr[15]}");
}
if (dr[16].ToString().Length > 1)
{
AppLog.Error($"逐行插入目标数据,最终准备插入(更新)数据行{dr[16]}");
}

dr.AcceptChanges();
int iReturn = CnasDataOperationFact.CnasDataOperation().InsertDataToCNASTable(GlobalCommonOperation.ConvertDataRowToTable(dr), syncInstrumentItem.SyncTargetDBInfo,syncInstrumentItem.LstSyncPramas, syncInstrumentItem.CnasInstrumentColumn,syncInstrumentItem.lstFixedValue);
int iReturn = CnasDataOperationFact.CnasDataOperation().InsertDataToCNASTable(GlobalCommonOperation.ConvertDataRowToTable(dr), syncInstrumentItem.SyncTargetDBInfo, syncInstrumentItem.LstSyncPramas, syncInstrumentItem.CnasInstrumentColumn, syncInstrumentItem.lstFixedValue);
if (iReturn <= 0) //此时出现问题
{
if (iReturn == -1)
{
AppLog.ServiceInfo("数据库连接中断,终止本次上传。");
WriteMsgToRichTextBox("数据库连接中断,终止本次上传。");
break; //此时数据库连接中断,直接跳出循环,结束本次数据同步传输
}
else if (iReturn == -2) //等于-2表示插入准备更新时发现数据一致,不再执行
@@ -300,11 +379,75 @@ namespace CNAS_RunSync
// AppLog.Error($"未成功上传的数据如下:{TransConvert.ListToString(lstError)}");
// MessageBox.Show("上传过程中发生异常,存在部分数据未成功上传,请联系管理员!");
//}
MessageBox.Show( $"上传操作完成!其中成功{SuccessCount}条,失败{ErrorCount}条,其他{OtherCount}条。");
if(lstError.Count> 0)
MessageBox.Show($"上传操作完成!其中成功{SuccessCount}条,失败{ErrorCount}条,其他{OtherCount}条。");
WriteMsgToRichTextBox($"上传操作完成!其中成功{SuccessCount}条,失败{ErrorCount}条,其他{OtherCount}条。");
if (lstError.Count > 0)
{
AppLog.Error($"未成功上传的数据如下:{TransConvert.ListToString(lstError)}");
WriteMsgToRichTextBox($"未成功上传的数据如下:{TransConvert.ListToString(lstError)}");
}
}

private string kxjsf(string sss)
{
double sd = Convert.ToDouble(sss);

//double sd = 123.123456;
string temps2 = "0";
string temps3 = "0";
string temps4 = "0";

int tempi2 = 0;
int tempi3 = 0;
int tempi4 = 0;
if (sss.Contains('.'))
{
string[] s1 = sss.Split('.');

if (s1[1].Length > 2)
{

if (s1[1].Length > 2)
{
temps2 = s1[1].Substring(1, 1);
temps3 = s1[1].Substring(2, 1);
}
tempi2 = int.Parse(temps2);
tempi3 = int.Parse(temps3);

if (s1[1].Length > 3)
{
temps4 = s1[1].Substring(3, 1);
}
tempi4 = int.Parse(temps4);

if (tempi3 > 5 || tempi3 < 5)
{
return sd.ToString("0.00");
}
else
{
if (tempi4 != 0)
{
return sd.ToString("0.00");
}
else
{
if (tempi2 == 0 || tempi2 == 2 || tempi2 == 4 || tempi2 == 6 || tempi2 == 8)
{
return sss.Substring(0, 5);
}
else
{
return sd.ToString("0.00");
}
}
}
}
}
return sss;

}

private void cmbColumns_SelectedIndexChanged(object sender, EventArgs e)
{
@@ -315,7 +458,7 @@ namespace CNAS_RunSync
Type selectType = DictComboBox[obj.Key];

switch (selectType.ToString())
{
{
case "System.DateTime":
UseDateTimeControl();
break;
@@ -324,7 +467,7 @@ namespace CNAS_RunSync
case "System.Int32":
UseNormalControl();
//绑定条件ComboBox
combCondition.DataSource = lstIntOrDouble ;
combCondition.DataSource = lstIntOrDouble;
break;
case "System.Byte[]":
case "System.String":
@@ -336,7 +479,6 @@ namespace CNAS_RunSync
}
}
}

/// <summary>
/// 使用时间类型专用的查询控件组
/// </summary>
@@ -367,11 +509,6 @@ namespace CNAS_RunSync
}
}

/// <summary>
/// 查询满足满足条件的项
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnFind_Click(object sender, EventArgs e)
{
if (cmbColumns.SelectedValue == null) return;
@@ -390,10 +527,10 @@ namespace CNAS_RunSync
{
btnCancelFind_Click(sender, e);
return;
}
}
}

//2.将datagridview中满足条件的项修改背景色
//2.1 判断当前显示的datagridview是否含有旧的查询数据
//2.2 将满足条件的项背景色改为特殊颜色
@@ -402,7 +539,7 @@ namespace CNAS_RunSync
dgvrow.DefaultCellStyle.BackColor = Color.White;

//查询列的当前值
string strGuid = dgvrow.Cells["GridGuid"].Value.ToString();
string strGuid = dgvrow.Cells["GridGuid"].Value.ToString();
if (DictField.Count > 0)
{
var query = DictField.Where(s => s.Value == cmbColumns.SelectedValue.ToString());
@@ -427,12 +564,11 @@ namespace CNAS_RunSync
}
}
}

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

DateTime dtSource = dtpSource.Value;
@@ -495,7 +631,7 @@ namespace CNAS_RunSync
/// <param name="strCondition"></param>
/// <param name="strValue"></param>
/// <returns></returns>
private string GetSelectString(string strColumnName,string strCondition, string strValue)
private string GetSelectString(string strColumnName, string strCondition, string strValue)
{
string strCondi = "";
switch (strCondition)
@@ -528,46 +664,54 @@ namespace CNAS_RunSync
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 void btnConfig_Click(object sender, EventArgs e)
{
if (new frmOperationPwd().ShowDialog() == DialogResult.OK)
{
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();
}
return string.Format("{0} {1} '{2}'", strColumnName, strCondi, strValue);
}

private void btnCancelFind_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow dgvrow in dgvSyncData.Rows)
{
if (dgvrow.DefaultCellStyle.BackColor != Color.White)
if (dgvrow.Cells[0].Value != null && dgvrow.Cells[0].Value.ToString() == "True")
dgvrow.Cells[0].Value = false;

if (dgvrow.Index % 2 == 1)
{
dgvrow.DefaultCellStyle.BackColor = Color.WhiteSmoke;
}
else
{
dgvrow.DefaultCellStyle.BackColor = Color.White;
}

}
}

private void btnAutoService_Click(object sender, EventArgs e)
private void dgvSyncData_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (new frmOperationPwd().ShowDialog() == DialogResult.OK)
//只有第一列“选择列”时触发
if (e.ColumnIndex == 0)
{
frmServiceConfig frmServiceConfig = new frmServiceConfig();
frmServiceConfig.ShowDialog();
if (dgvSyncData.Rows[e.RowIndex].Cells[0].Value.ToString() == "True")
dgvSyncData.Rows[e.RowIndex].DefaultCellStyle.BackColor = FinedBackColor;
else
{
if (e.RowIndex % 2 == 1)
{
dgvSyncData.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.WhiteSmoke;
}
else
{
dgvSyncData.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White;
}
}
}
}

public void WriteMsgToRichTextBox(string strMsg)
{
Invoke(new MethodInvoker(delegate ()
{
this.rtxtLog.Text += string.Format("{0} 日期: {1}\n", strMsg,DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
}));
}
}
}

+ 133
- 0
CNAS_RunSync/ucSynchrousMain.resx Näytä tiedosto

@@ -0,0 +1,133 @@
<?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="btnRunData.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6
JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAB3RJTUUH4wEJBBcNYFf1QQAAAUxJREFU
OE+F0t0qBlEUh/ERJV75vgc3QHKqlHLkzB0IcUxvwjHlo6Qo5U6cIicUh74SSbkFzzNmTTNjeP/1q5mp
vfbea1ZSk1Hs4QafmVscYAx/pgdNPOAa+1jJWPAKj1hHL0px8QlesIxhVDOERTzjFKUi7uzi6fTt/0zB
Ihto84N39tju3CrpArIArzPui/fzznXHLqaBTcygH5c4RNptGxbpQvvPY55u7OIds34gO7jzwd9kp427
HMPrxHFj8Rvm/JDFa3z5UCzQgTV8YAl2um6xyQs4JPYhYpFVuOgcr6guNtu498EJc0j8z5Eo8oS6xQO4
wJEvjqe/xCEpphMjiF4UMw+LT6RvxPF0OBySVpmEi7eQF7dZjqdFbM4gqvHYsfMZ+lCKRRxPr+OQ+J8t
JhvmnWPnX4sjHsnxdMIcEn+T7LYN886FniTJNztvSvHEs3jxAAAAAElFTkSuQmCC
</value>
</data>
</root>

Some files were not shown because too many files changed in this diff

Loading…
Peruuta
Tallenna