瀏覽代碼

解锁和锁定功能开发

final
OCEAN 3 月之前
父節點
當前提交
7339c8c375
共有 13 個文件被更改,包括 22512 次插入60 次删除
  1. 二進制
      AuthorizeDll/CNAS_Authorize.exe
  2. +9
    -0
      CNAS_DBSync/CNAS_DBSync.csproj
  3. +110
    -0
      CNAS_DBSync/frmLockPwd.Designer.cs
  4. +85
    -0
      CNAS_DBSync/frmLockPwd.cs
  5. +120
    -0
      CNAS_DBSync/frmLockPwd.resx
  6. +61
    -49
      CNAS_DBSync/frmSyncParams.Designer.cs
  7. +39
    -11
      CNAS_DBSync/frmSyncParams.cs
  8. +1
    -0
      CnasSynchronusClient/CnasSynchronusBLL.csproj
  9. +54
    -0
      CnasSynchronusClient/LockStateOperation.cs
  10. 二進制
      dll/CNAS_DBSync.exe
  11. 二進制
      dll/CnasSynchronusClient.dll
  12. +1
    -0
      dll/Data/FormLockState.mes
  13. +22032
    -0
      dll/ErrorLog/20250313.txt

二進制
AuthorizeDll/CNAS_Authorize.exe 查看文件


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

@@ -93,6 +93,12 @@
<DependentUpon>ActivationForm.cs</DependentUpon>
</Compile>
<Compile Include="FormSizeHelper.cs" />
<Compile Include="frmLockPwd.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmLockPwd.Designer.cs">
<DependentUpon>frmLockPwd.cs</DependentUpon>
</Compile>
<Compile Include="frmStartEndSubstring.cs">
<SubType>Form</SubType>
</Compile>
@@ -214,6 +220,9 @@
<EmbeddedResource Include="frmInstrumentCode.resx">
<DependentUpon>frmInstrumentCode.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmLockPwd.resx">
<DependentUpon>frmLockPwd.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmOperationPwd.resx">
<DependentUpon>frmOperationPwd.cs</DependentUpon>
</EmbeddedResource>


+ 110
- 0
CNAS_DBSync/frmLockPwd.Designer.cs 查看文件

@@ -0,0 +1,110 @@
namespace CNAS_DBSync
{
partial class frmLockPwd
{
/// <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.lblPrompt = new System.Windows.Forms.Label();
this.txtPwd = new System.Windows.Forms.TextBox();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblPrompt
//
this.lblPrompt.AutoSize = true;
this.lblPrompt.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblPrompt.Location = new System.Drawing.Point(30, 25);
this.lblPrompt.Name = "lblPrompt";
this.lblPrompt.Size = new System.Drawing.Size(180, 20);
this.lblPrompt.TabIndex = 0;
this.lblPrompt.Text = "请输入cnas数据库root密码";
//
// txtPwd
//
this.txtPwd.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtPwd.Location = new System.Drawing.Point(30, 55);
this.txtPwd.Name = "txtPwd";
this.txtPwd.PasswordChar = '*';
this.txtPwd.Size = new System.Drawing.Size(320, 26);
this.txtPwd.TabIndex = 1;
//
// btnOK
//
this.btnOK.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOK.Location = new System.Drawing.Point(100, 100);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(80, 35);
this.btnOK.TabIndex = 2;
this.btnOK.Text = "确认";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(200, 100);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(80, 35);
this.btnCancel.TabIndex = 3;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = true;
//
// frmLockPwd
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(380, 160);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.txtPwd);
this.Controls.Add(this.lblPrompt);
this.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmLockPwd";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "密码验证";
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.frmLockPwd_KeyDown);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.frmLockPwd_MouseDown);
this.ResumeLayout(false);
this.PerformLayout();
}

#endregion

private System.Windows.Forms.Label lblPrompt;
private System.Windows.Forms.TextBox txtPwd;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
}
}

+ 85
- 0
CNAS_DBSync/frmLockPwd.cs 查看文件

@@ -0,0 +1,85 @@
using CnasSynchronousCommon;
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 frmLockPwd : Form
{
private bool isLocking;

public frmLockPwd(bool isLocking)
{
InitializeComponent();
this.isLocking = isLocking;
this.Text = isLocking ? "锁定操作" : "解锁操作";
}

private void btnOK_Click(object sender, EventArgs e)
{
Config();
}

public void Config()
{
DataBaseInfo Cnasdb = FileOperation.GetLocalCnasDB();
if (this.txtPwd.Text.Trim() == Cnasdb.DBPwd)
{
// 保存锁定状态
LockStateOperation.SaveLockState(isLocking);
this.DialogResult = DialogResult.OK;
this.Close();
}
else
{
MessageBox.Show("密码无效。");
}
}

private void frmLockPwd_KeyDown(object sender, KeyEventArgs e)
{
try
{
if (!btnOK.Focused)
{
FormKeyEventClass fke = new FormKeyEventClass();
fke.FormKeyEvent += new FormKeyEventClass.FormKey(Config);
fke.FormKeyEventRun(e);
}
}
catch (Exception ex)
{
AppLog.Error(ex.Message.ToString());
}
}

[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_MOVE = 0xF010;
public const int HTCAPTION = 0x0002;

private void frmLockPwd_MouseDown(object sender, MouseEventArgs e)
{
try
{
ReleaseCapture();
SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
}
catch (Exception ex)
{
AppLog.Error(ex.Message.ToString());
}
}
}
}

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

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

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

+ 61
- 49
CNAS_DBSync/frmSyncParams.Designer.cs 查看文件

@@ -1,4 +1,4 @@
namespace CNAS_DBSync
namespace CNAS_DBSync
{
partial class frmSyncParams
{
@@ -82,6 +82,7 @@
this.btnLoadDBData = new System.Windows.Forms.Button();
this.btnAddMapping = new System.Windows.Forms.Button();
this.btnDatabaseConfig = new System.Windows.Forms.Button();
this.btnLock = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.dgvInstrument = new System.Windows.Forms.DataGridView();
this.Code = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -199,7 +200,7 @@
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(3, 23);
this.splitContainer1.Location = new System.Drawing.Point(3, 27);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
@@ -211,8 +212,8 @@
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.tabControl1);
this.splitContainer1.Size = new System.Drawing.Size(1045, 652);
this.splitContainer1.SplitterDistance = 264;
this.splitContainer1.Size = new System.Drawing.Size(1045, 648);
this.splitContainer1.SplitterDistance = 262;
this.splitContainer1.TabIndex = 2;
//
// panel15
@@ -221,7 +222,7 @@
this.panel15.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel15.Location = new System.Drawing.Point(0, 37);
this.panel15.Name = "panel15";
this.panel15.Size = new System.Drawing.Size(1045, 227);
this.panel15.Size = new System.Drawing.Size(1045, 225);
this.panel15.TabIndex = 2;
//
// dgvMapping
@@ -254,9 +255,8 @@
this.dgvMapping.RowsDefaultCellStyle = dataGridViewCellStyle2;
this.dgvMapping.RowTemplate.Height = 23;
this.dgvMapping.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvMapping.Size = new System.Drawing.Size(1045, 227);
this.dgvMapping.Size = new System.Drawing.Size(1045, 225);
this.dgvMapping.TabIndex = 1;
//
// InstrumentField
//
@@ -306,12 +306,12 @@
this.cmsMapping.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnDelMap});
this.cmsMapping.Name = "cmsMapping";
this.cmsMapping.Size = new System.Drawing.Size(109, 28);
this.cmsMapping.Size = new System.Drawing.Size(117, 34);
//
// btnDelMap
//
this.btnDelMap.Name = "btnDelMap";
this.btnDelMap.Size = new System.Drawing.Size(108, 24);
this.btnDelMap.Size = new System.Drawing.Size(116, 30);
this.btnDelMap.Text = "移除";
this.btnDelMap.Click += new System.EventHandler(this.btnDelMap_Click);
//
@@ -332,7 +332,7 @@
this.txtInstrumentColumn.Location = new System.Drawing.Point(453, 9);
this.txtInstrumentColumn.Name = "txtInstrumentColumn";
this.txtInstrumentColumn.ReadOnly = true;
this.txtInstrumentColumn.Size = new System.Drawing.Size(195, 27);
this.txtInstrumentColumn.Size = new System.Drawing.Size(195, 31);
this.txtInstrumentColumn.TabIndex = 7;
this.txtInstrumentColumn.DoubleClick += new System.EventHandler(this.txtInstrumentColumn_DoubleClick);
//
@@ -342,7 +342,7 @@
this.cbxCNASColumn.FormattingEnabled = true;
this.cbxCNASColumn.Location = new System.Drawing.Point(453, 9);
this.cbxCNASColumn.Name = "cbxCNASColumn";
this.cbxCNASColumn.Size = new System.Drawing.Size(184, 28);
this.cbxCNASColumn.Size = new System.Drawing.Size(184, 32);
this.cbxCNASColumn.TabIndex = 6;
this.cbxCNASColumn.Visible = false;
this.cbxCNASColumn.SelectedIndexChanged += new System.EventHandler(this.cbxCNASColumn_SelectedIndexChanged);
@@ -353,7 +353,7 @@
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(321, 10);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(141, 20);
this.label3.Size = new System.Drawing.Size(168, 24);
this.label3.TabIndex = 5;
this.label3.Text = "CNAS仪器信息列:";
//
@@ -362,7 +362,7 @@
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 10);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(114, 20);
this.label2.Size = new System.Drawing.Size(136, 24);
this.label2.TabIndex = 4;
this.label2.Text = "字段映射信息:";
//
@@ -373,16 +373,16 @@
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1045, 384);
this.tabControl1.Size = new System.Drawing.Size(1045, 382);
this.tabControl1.TabIndex = 1;
//
// tabPage6
//
this.tabPage6.Controls.Add(this.splitContainer2);
this.tabPage6.Location = new System.Drawing.Point(4, 29);
this.tabPage6.Location = new System.Drawing.Point(4, 33);
this.tabPage6.Name = "tabPage6";
this.tabPage6.Padding = new System.Windows.Forms.Padding(3);
this.tabPage6.Size = new System.Drawing.Size(1037, 351);
this.tabPage6.Size = new System.Drawing.Size(1037, 345);
this.tabPage6.TabIndex = 1;
this.tabPage6.Text = "字段";
this.tabPage6.UseVisualStyleBackColor = true;
@@ -402,7 +402,7 @@
//
this.splitContainer2.Panel2.Controls.Add(this.dgvCnas);
this.splitContainer2.Panel2.Controls.Add(this.pnlRight);
this.splitContainer2.Size = new System.Drawing.Size(1031, 345);
this.splitContainer2.Size = new System.Drawing.Size(1031, 339);
this.splitContainer2.SplitterDistance = 508;
this.splitContainer2.TabIndex = 1;
//
@@ -432,7 +432,7 @@
this.dgvInstruDS.RowsDefaultCellStyle = dataGridViewCellStyle4;
this.dgvInstruDS.RowTemplate.Height = 23;
this.dgvInstruDS.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvInstruDS.Size = new System.Drawing.Size(508, 311);
this.dgvInstruDS.Size = new System.Drawing.Size(508, 305);
this.dgvInstruDS.TabIndex = 1;
//
// InstruFieldName
@@ -478,7 +478,7 @@
this.cbxInstrument.FormattingEnabled = true;
this.cbxInstrument.Location = new System.Drawing.Point(129, 6);
this.cbxInstrument.Name = "cbxInstrument";
this.cbxInstrument.Size = new System.Drawing.Size(200, 28);
this.cbxInstrument.Size = new System.Drawing.Size(200, 32);
this.cbxInstrument.TabIndex = 1;
this.cbxInstrument.SelectedIndexChanged += new System.EventHandler(this.cbxInstrument_SelectedIndexChanged);
//
@@ -487,7 +487,7 @@
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(3, 10);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(129, 20);
this.label12.Size = new System.Drawing.Size(154, 24);
this.label12.TabIndex = 0;
this.label12.Text = "设备数据源表名:";
//
@@ -517,7 +517,7 @@
this.dgvCnas.RowsDefaultCellStyle = dataGridViewCellStyle6;
this.dgvCnas.RowTemplate.Height = 23;
this.dgvCnas.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvCnas.Size = new System.Drawing.Size(519, 311);
this.dgvCnas.Size = new System.Drawing.Size(519, 305);
this.dgvCnas.TabIndex = 2;
//
// CNASFieldName
@@ -563,7 +563,7 @@
this.cbxCnas.FormattingEnabled = true;
this.cbxCnas.Location = new System.Drawing.Point(150, 6);
this.cbxCnas.Name = "cbxCnas";
this.cbxCnas.Size = new System.Drawing.Size(184, 28);
this.cbxCnas.Size = new System.Drawing.Size(184, 32);
this.cbxCnas.TabIndex = 2;
this.cbxCnas.SelectedIndexChanged += new System.EventHandler(this.cbxCnas_SelectedIndexChanged);
//
@@ -572,13 +572,14 @@
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(3, 10);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(141, 20);
this.label13.Size = new System.Drawing.Size(168, 24);
this.label13.TabIndex = 1;
this.label13.Text = "CNAS数据库表名:";
//
// panel1
//
this.panel1.Controls.Add(this.panel7);
this.panel1.Controls.Add(this.btnLock);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 678);
this.panel1.Name = "panel1";
@@ -600,7 +601,7 @@
//
// btnSourceFilter
//
this.btnSourceFilter.Location = new System.Drawing.Point(86, 3);
this.btnSourceFilter.Location = new System.Drawing.Point(89, 3);
this.btnSourceFilter.Name = "btnSourceFilter";
this.btnSourceFilter.Size = new System.Drawing.Size(79, 32);
this.btnSourceFilter.TabIndex = 6;
@@ -610,7 +611,7 @@
//
// btnCNASFieldConfig
//
this.btnCNASFieldConfig.Location = new System.Drawing.Point(168, 3);
this.btnCNASFieldConfig.Location = new System.Drawing.Point(170, 3);
this.btnCNASFieldConfig.Name = "btnCNASFieldConfig";
this.btnCNASFieldConfig.Size = new System.Drawing.Size(79, 35);
this.btnCNASFieldConfig.TabIndex = 5;
@@ -630,9 +631,9 @@
//
// btnAddMapping
//
this.btnAddMapping.Location = new System.Drawing.Point(3, 3);
this.btnAddMapping.Location = new System.Drawing.Point(-5, 3);
this.btnAddMapping.Name = "btnAddMapping";
this.btnAddMapping.Size = new System.Drawing.Size(79, 32);
this.btnAddMapping.Size = new System.Drawing.Size(95, 32);
this.btnAddMapping.TabIndex = 2;
this.btnAddMapping.Text = "新增映射";
this.btnAddMapping.UseVisualStyleBackColor = true;
@@ -648,6 +649,16 @@
this.btnDatabaseConfig.UseVisualStyleBackColor = true;
this.btnDatabaseConfig.Click += new System.EventHandler(this.btnDatabaseConfig_Click);
//
// btnLock
//
this.btnLock.Location = new System.Drawing.Point(14, 4);
this.btnLock.Name = "btnLock";
this.btnLock.Size = new System.Drawing.Size(58, 32);
this.btnLock.TabIndex = 20;
this.btnLock.Text = "锁定";
this.btnLock.UseVisualStyleBackColor = true;
this.btnLock.Click += new System.EventHandler(this.btnLock_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.dgvInstrument);
@@ -679,7 +690,7 @@
this.dgvInstrument.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Code});
this.dgvInstrument.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvInstrument.Location = new System.Drawing.Point(6, 60);
this.dgvInstrument.Location = new System.Drawing.Point(6, 64);
this.dgvInstrument.MultiSelect = false;
this.dgvInstrument.Name = "dgvInstrument";
this.dgvInstrument.ReadOnly = true;
@@ -688,7 +699,7 @@
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dgvInstrument.RowsDefaultCellStyle = dataGridViewCellStyle8;
this.dgvInstrument.RowTemplate.Height = 23;
this.dgvInstrument.Size = new System.Drawing.Size(134, 610);
this.dgvInstrument.Size = new System.Drawing.Size(134, 606);
this.dgvInstrument.TabIndex = 0;
this.dgvInstrument.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvInstrument_CellDoubleClick);
this.dgvInstrument.CellMouseDown += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvInstrument_CellMouseDown);
@@ -706,17 +717,17 @@
// panel17
//
this.panel17.Dock = System.Windows.Forms.DockStyle.Right;
this.panel17.Location = new System.Drawing.Point(140, 60);
this.panel17.Location = new System.Drawing.Point(140, 64);
this.panel17.Name = "panel17";
this.panel17.Size = new System.Drawing.Size(3, 610);
this.panel17.Size = new System.Drawing.Size(3, 606);
this.panel17.TabIndex = 8;
//
// panel16
//
this.panel16.Dock = System.Windows.Forms.DockStyle.Left;
this.panel16.Location = new System.Drawing.Point(3, 60);
this.panel16.Location = new System.Drawing.Point(3, 64);
this.panel16.Name = "panel16";
this.panel16.Size = new System.Drawing.Size(3, 610);
this.panel16.Size = new System.Drawing.Size(3, 606);
this.panel16.TabIndex = 7;
//
// panel9
@@ -753,7 +764,7 @@
//
this.panel8.Controls.Add(this.label1);
this.panel8.Dock = System.Windows.Forms.DockStyle.Top;
this.panel8.Location = new System.Drawing.Point(3, 23);
this.panel8.Location = new System.Drawing.Point(3, 27);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(140, 37);
this.panel8.TabIndex = 4;
@@ -763,7 +774,7 @@
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(84, 20);
this.label1.Size = new System.Drawing.Size(100, 24);
this.label1.TabIndex = 3;
this.label1.Text = "当前选中:";
//
@@ -778,6 +789,7 @@
//
// menuStrip1
//
this.menuStrip1.GripMargin = new System.Windows.Forms.Padding(2, 2, 0, 2);
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsmSystemSetting,
@@ -786,14 +798,14 @@
this.tsmHelper});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1197, 30);
this.menuStrip1.Size = new System.Drawing.Size(1197, 32);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// tsmSystemSetting
//
this.tsmSystemSetting.Name = "tsmSystemSetting";
this.tsmSystemSetting.Size = new System.Drawing.Size(104, 24);
this.tsmSystemSetting.Size = new System.Drawing.Size(123, 28);
this.tsmSystemSetting.Text = "系统设置(&G)";
this.tsmSystemSetting.Visible = false;
this.tsmSystemSetting.Click += new System.EventHandler(this.tsmSystemSetting_Click);
@@ -801,21 +813,21 @@
// tsmServiceSetting
//
this.tsmServiceSetting.Name = "tsmServiceSetting";
this.tsmServiceSetting.Size = new System.Drawing.Size(102, 26);
this.tsmServiceSetting.Size = new System.Drawing.Size(120, 28);
this.tsmServiceSetting.Text = "服务设置(&S)";
this.tsmServiceSetting.Click += new System.EventHandler(this.tsmServiceSetting_Click);
//
// tsmSourceSetting
//
this.tsmSourceSetting.Name = "tsmSourceSetting";
this.tsmSourceSetting.Size = new System.Drawing.Size(101, 26);
this.tsmSourceSetting.Size = new System.Drawing.Size(119, 28);
this.tsmSourceSetting.Text = "来源设置(&L)";
this.tsmSourceSetting.Click += new System.EventHandler(this.tsmSourceSetting_Click);
//
// tsmHelper
//
this.tsmHelper.Name = "tsmHelper";
this.tsmHelper.Size = new System.Drawing.Size(75, 26);
this.tsmHelper.Size = new System.Drawing.Size(88, 28);
this.tsmHelper.Text = "帮助(&H)";
this.tsmHelper.Click += new System.EventHandler(this.tsmHelper_Click);
//
@@ -899,7 +911,7 @@
//
// frmSyncParams
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1207, 793);
this.Controls.Add(this.panel4);
@@ -990,13 +1002,6 @@
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.Button btnLoadDBData;
private System.Windows.Forms.Panel panel7;
private System.Windows.Forms.Panel panel9;
private System.Windows.Forms.Panel panel8;
private System.Windows.Forms.Panel panel11;
private System.Windows.Forms.Panel panel12;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel panel13;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.Button btnCNASFieldConfig;
private System.Windows.Forms.Button btnSourceFilter;
private System.Windows.Forms.Panel panel15;
@@ -1009,6 +1014,8 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Code;
private System.Windows.Forms.Panel panel17;
private System.Windows.Forms.Panel panel16;
private System.Windows.Forms.Panel panel9;
private System.Windows.Forms.Panel panel8;
private System.Windows.Forms.Panel pnlMenuTop;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem tsmSystemSetting;
@@ -1028,6 +1035,11 @@
private System.Windows.Forms.DataGridViewTextBoxColumn CnasDataType;
private System.Windows.Forms.DataGridViewTextBoxColumn 字段描述;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.Panel panel11;
private System.Windows.Forms.Panel panel12;
private System.Windows.Forms.Panel panel13;
private System.Windows.Forms.Button btnLock;
}
}


+ 39
- 11
CNAS_DBSync/frmSyncParams.cs 查看文件

@@ -1,4 +1,4 @@
using CnasSynchronousCommon;
using CnasSynchronousCommon;
using CnasSynchronusClient;
using CnasSynchrousModel;
using System;
@@ -25,6 +25,7 @@ namespace CNAS_DBSync
public Dictionary<string, DataTable> dictInstruTables = new Dictionary<string, DataTable>(); //当前仪器项的来源表结构
private SyncInstrumentItemInfo syncInstrumentItem; //其他调用传递的仪器项
public ReferenceChangeSyncParamHanlder ParamsChangedDelegate; //传递仪器参数委托
private bool isLocked = false; // Track lock state

private string strMode = "";
private string strTableInfoMode = ""; //获取所有表信息的方式;0为自动获取,1为手动输入
@@ -54,13 +55,40 @@ namespace CNAS_DBSync
this.btnDel.Visible = false;
}


if (LockStateOperation.GetLockState())
{
isLocked = true;
btnLock.Text = "解锁";
btnAdd.Enabled = false;
btnDel.Enabled = false;
}
}





private void btnLock_Click(object sender, EventArgs e)
{
if (isLocked)
{
// Try to unlock
if (new frmLockPwd(false).ShowDialog() == DialogResult.OK)
{
isLocked = false;
btnLock.Text = "锁定";
btnAdd.Enabled = true;
btnDel.Enabled = true;
}
}
else
{
// Try to lock
if (new frmLockPwd(true).ShowDialog() == DialogResult.OK)
{
isLocked = true;
btnLock.Text = "解锁";
btnAdd.Enabled = false;
btnDel.Enabled = false;
}
}
}

private void Option1_Click(object sender, EventArgs e)
{
@@ -373,7 +401,7 @@ namespace CNAS_DBSync
case DataSourceType.Kingbase:
dtTableType = SelectTableType.KingSql(strTableName_Instru);
break;
default:
strTableName_Instru = matchedInstrument.SyncInstrumentDSInfo.InstrumentDataSourceType.ToString();

@@ -409,13 +437,13 @@ namespace CNAS_DBSync
}
break;
case DataSourceType.Oracle:
strTableName_Instru = cbxInstrument.Text.ToString();
strTableName_Instru = cbxInstrument.Text.ToString();
if (dictInstruTables.ContainsKey(strTableName_Instru))
{
DataTable dt = dictInstruTables[strTableName_Instru];
if (dt != null)
{
dtInstruShow = new DataTable();
dtInstruShow = new DataTable();
dtInstruShow.Columns.Add("InstruFieldName");
dtInstruShow.Columns.Add("InstruDataType");

@@ -831,10 +859,10 @@ namespace CNAS_DBSync

case DataSourceType.Access:
//根据手动输入来源库的表名加载字段
dataTableStruct = SelectTableType.AccSql(currentSyncItem.SyncInstrumentDSInfo, sql);
dataTableStruct = SelectTableType.AccSql(currentSyncItem.SyncInstrumentDSInfo, sql);
break;
default:
break;
}
DataTable dtInstruShow = new DataTable();


+ 1
- 0
CnasSynchronusClient/CnasSynchronusBLL.csproj 查看文件

@@ -58,6 +58,7 @@
<Compile Include="InsturmentData\DmServerInstrumentData.cs" />
<Compile Include="InsturmentData\KingbaseInstrumentData.cs" />
<Compile Include="InsturmentData\PostgreSQLServerInstrumentData.cs" />
<Compile Include="LockStateOperation.cs" />
<Compile Include="TargetCnasData\DB2CNASDataOperation.cs" />
<Compile Include="TargetCnasData\ICnasDataOperation.cs" />
<Compile Include="InsturmentData\AccessInstrumentData.cs" />


+ 54
- 0
CnasSynchronusClient/LockStateOperation.cs 查看文件

@@ -0,0 +1,54 @@
using CnasSynchronousCommon;
using System;

namespace CnasSynchronusClient
{
public class LockStateOperation
{
private static readonly string strLocalConfigPath = FileHelper.getBasePath() + @"\Data\";

/// <summary>
/// 获取表单锁定状态
/// </summary>
/// <returns></returns>
public static bool GetLockState()
{
bool isLocked = false;
try
{
string strLocalFileString = FileHelper.GetLocalFile(strLocalConfigPath, "FormLockState.mes");
if (strLocalFileString != "")
{
string strState = EncryptionOperation.Decrypt(strLocalFileString, "NZJXD--CnasClientJXDJXDJ");
bool.TryParse(strState, out isLocked);
}
}
catch (Exception ex)
{
AppLog.Error(ex.Message);
}
return isLocked;
}

/// <summary>
/// 保存表单锁定状态到本地
/// </summary>
/// <param name="isLocked">锁定状态</param>
/// <returns></returns>
public static bool SaveLockState(bool isLocked)
{
bool bIfSuccess = true;
try
{
string strEncrypString = EncryptionOperation.Encrypt(isLocked.ToString(), "NZJXD--CnasClientJXDJXDJ");
bIfSuccess = FileHelper.SaveLocalFile(strLocalConfigPath, "FormLockState.mes", strEncrypString);
}
catch (Exception ex)
{
bIfSuccess = false;
AppLog.Error(ex.Message);
}
return bIfSuccess;
}
}
}

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


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


+ 1
- 0
dll/Data/FormLockState.mes 查看文件

@@ -0,0 +1 @@
ROcwvAcTAdc=

+ 22032
- 0
dll/ErrorLog/20250313.txt
文件差異過大導致無法顯示
查看文件


Loading…
取消
儲存