瀏覽代碼

增加提示框

Lishi
fyf 2 年之前
父節點
當前提交
1def560485
共有 9 個檔案被更改,包括 356 行新增333 行删除
  1. +2
    -0
      HKCardManager/Form1.cs
  2. +14
    -2
      HKCardManager/UserPages/CancellationPage.cs
  3. +209
    -232
      HKCardManager/UserPages/CarMangerPage.Designer.cs
  4. +72
    -66
      HKCardManager/UserPages/CarMangerPage.cs
  5. +0
    -6
      HKCardManager/UserPages/CarMangerPage.resx
  6. +22
    -17
      HKCardManager/UserPages/InstitutionalEntryPage.cs
  7. +29
    -6
      HKCardManager/UserPages/PersonnelEntryPage.cs
  8. +2
    -2
      HKCardManager/options.json
  9. +6
    -2
      HKHelper/Function.cs

+ 2
- 0
HKCardManager/Form1.cs 查看文件

@@ -307,6 +307,7 @@ namespace HKCardManager
var res = UHFCardHelper.GetInstance().ReadCard();
if (string.IsNullOrEmpty(res))
{
MessageBox.Show("提示!!!\n 请放入卡片,在选择销卡...");
MessageLogNotify.GetInstance.Show("请放入卡片");
return;
}
@@ -321,6 +322,7 @@ namespace HKCardManager
}
else
{
MessageBox.Show("提示!!!\n 设备未连接...");
MessageLogNotify.GetInstance.ShowWarning("设备未连接");
}
}


+ 14
- 2
HKCardManager/UserPages/CancellationPage.cs 查看文件

@@ -33,12 +33,14 @@ namespace HKCardManager.UserPages
string name = textBox1.Text.Trim();
if (string.IsNullOrEmpty(name))
{
MessageBox.Show("提示!!!\n 请输入用户名...");
MessageLogNotify.GetInstance.ShowWarning("请输入用户名");
return;
}
string TagName = this.Tag.ToString();
if (string.IsNullOrEmpty(TagName))
{
MessageBox.Show("提示!!!\n 功能名称为空,操作失败,请重试...");
MessageLogNotify.GetInstance.ShowError("功能名称为空,操作失败,请重试");
}
else
@@ -62,16 +64,26 @@ namespace HKCardManager.UserPages
keywrod = name,
Stutas = status
});
if (res) MessageLogNotify.GetInstance.Show($"用户【{temp.UserName}】 {TagName} 成功");
else MessageLogNotify.GetInstance.ShowError($"用户【{temp.UserName}】 {TagName} 失败,请检查名称是否正常");
if (res)
{
MessageBox.Show($"用户【{temp.UserName}】 {TagName} 成功");
MessageLogNotify.GetInstance.Show($"用户【{temp.UserName}】 {TagName} 成功");
}
else {
MessageBox.Show($"用户【{temp.UserName}】 {TagName} 失败,请检查名称是否正常");
MessageLogNotify.GetInstance.ShowError($"用户【{temp.UserName}】 {TagName} 失败,请检查名称是否正常");
}
}
else
{
MessageBox.Show("提示!!!\n 该用户未注册卡号,请重试...");

MessageLogNotify.GetInstance.ShowError("该用户未注册卡号");
}
}
else
{
MessageBox.Show("提示!!!\n 该用户不存在...");
MessageLogNotify.GetInstance.ShowError("该用户不存在");
}
//this.Invoke(() => { button2.Enabled = true; });


+ 209
- 232
HKCardManager/UserPages/CarMangerPage.Designer.cs 查看文件

@@ -28,8 +28,8 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.textBox2 = new System.Windows.Forms.TextBox();
@@ -44,47 +44,43 @@
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel7 = new System.Windows.Forms.Panel();
this.labelName = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.button_pl_read = new System.Windows.Forms.Button();
this.button_pl_write = new System.Windows.Forms.Button();
this.panel6 = new System.Windows.Forms.Panel();
this.dataGridView_No = new System.Windows.Forms.DataGridView();
this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewButtonColumn1 = new System.Windows.Forms.DataGridViewButtonColumn();
this.panel5 = new System.Windows.Forms.Panel();
this.label6 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.panel4 = new System.Windows.Forms.Panel();
this.dataGridView1_全部 = new System.Windows.Forms.DataGridView();
this.编号 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.名称 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.卡状态 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.机构 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.手机号 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.卡号 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.删除 = new System.Windows.Forms.DataGridViewButtonColumn();
this.panel3 = new System.Windows.Forms.Panel();
this.label5 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.comboBox_jglb = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.labelName = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.comboBox4 = new System.Windows.Forms.ComboBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button6 = new System.Windows.Forms.Button();
this.comboBox4 = new System.Windows.Forms.ComboBox();
this.label14 = new System.Windows.Forms.Label();
this.编号 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.名称 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.卡状态 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.机构 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.手机号 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.卡号 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.panel1.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.panel7.SuspendLayout();
this.panel6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView_No)).BeginInit();
@@ -93,6 +89,7 @@
((System.ComponentModel.ISupportInitialize)(this.dataGridView1_全部)).BeginInit();
this.panel3.SuspendLayout();
this.panel2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.SuspendLayout();
//
// button2
@@ -244,7 +241,6 @@
this.tabPage2.Text = "批量制卡";
this.tabPage2.UseVisualStyleBackColor = true;
//
// comboBox3
// panel7
//
this.panel7.Controls.Add(this.labelName);
@@ -257,6 +253,30 @@
this.panel7.Size = new System.Drawing.Size(1096, 62);
this.panel7.TabIndex = 45;
//
// labelName
//
this.labelName.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelName.AutoSize = true;
this.labelName.Font = new System.Drawing.Font("Microsoft YaHei UI", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.labelName.ForeColor = System.Drawing.Color.Maroon;
this.labelName.Location = new System.Drawing.Point(138, 16);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(82, 41);
this.labelName.TabIndex = 38;
this.labelName.Text = "张三";
//
// label7
//
this.label7.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.label7.ForeColor = System.Drawing.Color.Black;
this.label7.Location = new System.Drawing.Point(10, 27);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(122, 21);
this.label7.TabIndex = 37;
this.label7.Text = "即将制卡人员:";
//
// button_pl_read
//
this.button_pl_read.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
@@ -302,8 +322,7 @@
this.dataGridViewTextBoxColumn3,
this.dataGridViewTextBoxColumn4,
this.dataGridViewTextBoxColumn5,
this.dataGridViewTextBoxColumn6,
this.dataGridViewButtonColumn1});
this.dataGridViewTextBoxColumn6});
this.dataGridView_No.Location = new System.Drawing.Point(0, 0);
this.dataGridView_No.Name = "dataGridView_No";
this.dataGridView_No.RowHeadersVisible = false;
@@ -311,66 +330,6 @@
this.dataGridView_No.Size = new System.Drawing.Size(1096, 327);
this.dataGridView_No.TabIndex = 38;
//
// dataGridViewTextBoxColumn1
//
this.dataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.dataGridViewTextBoxColumn1.DataPropertyName = "Num";
this.dataGridViewTextBoxColumn1.HeaderText = "编号";
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
//
// dataGridViewTextBoxColumn2
//
this.dataGridViewTextBoxColumn2.DataPropertyName = "UserName";
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle5;
this.dataGridViewTextBoxColumn2.HeaderText = "姓名";
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
this.dataGridViewTextBoxColumn2.ReadOnly = true;
this.dataGridViewTextBoxColumn2.Width = 150;
//
// dataGridViewTextBoxColumn3
//
this.dataGridViewTextBoxColumn3.DataPropertyName = "State";
this.dataGridViewTextBoxColumn3.HeaderText = "卡状态";
this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
this.dataGridViewTextBoxColumn3.ReadOnly = true;
this.dataGridViewTextBoxColumn3.Width = 150;
//
// dataGridViewTextBoxColumn4
//
this.dataGridViewTextBoxColumn4.DataPropertyName = "OrgName";
this.dataGridViewTextBoxColumn4.HeaderText = "机构";
this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
this.dataGridViewTextBoxColumn4.ReadOnly = true;
this.dataGridViewTextBoxColumn4.Width = 150;
//
// dataGridViewTextBoxColumn5
//
this.dataGridViewTextBoxColumn5.DataPropertyName = "Phone";
this.dataGridViewTextBoxColumn5.HeaderText = "手机号";
this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
this.dataGridViewTextBoxColumn5.ReadOnly = true;
this.dataGridViewTextBoxColumn5.Visible = false;
this.dataGridViewTextBoxColumn5.Width = 150;
//
// dataGridViewTextBoxColumn6
//
this.dataGridViewTextBoxColumn6.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.dataGridViewTextBoxColumn6.DataPropertyName = "CardNum";
this.dataGridViewTextBoxColumn6.HeaderText = "卡号";
this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
this.dataGridViewTextBoxColumn6.ReadOnly = true;
//
// dataGridViewButtonColumn1
//
this.dataGridViewButtonColumn1.DataPropertyName = "ContextName";
this.dataGridViewButtonColumn1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.dataGridViewButtonColumn1.HeaderText = "删除";
this.dataGridViewButtonColumn1.Name = "dataGridViewButtonColumn1";
this.dataGridViewButtonColumn1.ReadOnly = true;
this.dataGridViewButtonColumn1.Text = "删除";
this.dataGridViewButtonColumn1.UseColumnTextForButtonValue = true;
//
// panel5
//
this.panel5.Controls.Add(this.label6);
@@ -381,6 +340,18 @@
this.panel5.Size = new System.Drawing.Size(1096, 28);
this.panel5.TabIndex = 43;
//
// label6
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft YaHei UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.label6.ForeColor = System.Drawing.Color.Maroon;
this.label6.Location = new System.Drawing.Point(122, 7);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(400, 16);
this.label6.TabIndex = 22;
this.label6.Text = "[温馨提示]:先点击“读卡”,读取卡号后。再点击写卡,默认写“未制卡列表第一行”。";
//
// label4
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.Left;
@@ -412,8 +383,7 @@
this.卡状态,
this.机构,
this.手机号,
this.卡号,
this.删除});
this.卡号});
this.dataGridView1_全部.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView1_全部.Location = new System.Drawing.Point(0, 0);
this.dataGridView1_全部.Name = "dataGridView1_全部";
@@ -422,92 +392,6 @@
this.dataGridView1_全部.Size = new System.Drawing.Size(1096, 137);
this.dataGridView1_全部.TabIndex = 37;
//
// 编号
//
this.编号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.编号.DataPropertyName = "Num";
this.编号.HeaderText = "编号";
this.编号.Name = "编号";
//
// 名称
//
this.名称.DataPropertyName = "UserName";
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.名称.DefaultCellStyle = dataGridViewCellStyle6;
this.名称.HeaderText = "姓名";
this.名称.Name = "名称";
this.名称.ReadOnly = true;
this.名称.Width = 150;
//
// tabPage3
// 卡状态
//
this.tabPage3.Controls.Add(this.label14);
this.tabPage3.Controls.Add(this.comboBox4);
this.tabPage3.Controls.Add(this.textBox1);
this.tabPage3.Controls.Add(this.button6);
this.tabPage3.Location = new System.Drawing.Point(4, 26);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(1102, 579);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "管理员";
this.tabPage3.UseVisualStyleBackColor = true;
this.卡状态.DataPropertyName = "State";
this.卡状态.HeaderText = "卡状态";
this.卡状态.Name = "卡状态";
this.卡状态.ReadOnly = true;
this.卡状态.Width = 150;
//
// textBox1
// 机构
//
this.textBox1.Location = new System.Drawing.Point(456, 218);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(190, 23);
this.textBox1.TabIndex = 31;
this.机构.DataPropertyName = "OrgName";
this.机构.HeaderText = "机构";
this.机构.Name = "机构";
this.机构.ReadOnly = true;
this.机构.Width = 150;
//
// button6
// 手机号
//
this.button6.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.button6.Location = new System.Drawing.Point(456, 283);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(190, 34);
this.button6.TabIndex = 30;
this.button6.Text = "制作管理卡";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
this.手机号.DataPropertyName = "Phone";
this.手机号.HeaderText = "手机号";
this.手机号.Name = "手机号";
this.手机号.ReadOnly = true;
this.手机号.Visible = false;
this.手机号.Width = 150;
//
// 卡号
//
this.卡号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.卡号.DataPropertyName = "CardNum";
this.卡号.HeaderText = "卡号";
this.卡号.Name = "卡号";
this.卡号.ReadOnly = true;
//
// 删除
//
this.删除.DataPropertyName = "ContextName";
this.删除.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.删除.HeaderText = "删除";
this.删除.Name = "删除";
this.删除.ReadOnly = true;
this.删除.Text = "删除";
this.删除.UseColumnTextForButtonValue = true;
//
// panel3
//
this.panel3.Controls.Add(this.label5);
@@ -549,14 +433,8 @@
this.comboBox_jglb.Size = new System.Drawing.Size(190, 29);
this.comboBox_jglb.TabIndex = 21;
//
// comboBox4
// label3
//
this.comboBox4.FormattingEnabled = true;
this.comboBox4.Location = new System.Drawing.Point(525, 251);
this.comboBox4.Name = "comboBox4";
this.comboBox4.Size = new System.Drawing.Size(121, 25);
this.comboBox4.TabIndex = 32;
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.label3.Location = new System.Drawing.Point(10, 15);
@@ -565,50 +443,154 @@
this.label3.TabIndex = 20;
this.label3.Text = "机构名称:";
//
// label4
// 1
// tabPage3
//
this.tabPage3.Controls.Add(this.label14);
this.tabPage3.Controls.Add(this.comboBox4);
this.tabPage3.Controls.Add(this.textBox1);
this.tabPage3.Controls.Add(this.button6);
this.tabPage3.Location = new System.Drawing.Point(4, 26);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(1102, 579);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "管理员";
this.tabPage3.UseVisualStyleBackColor = true;
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(456, 255);
this.label14.Name = "label4";
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(56, 17);
this.label14.TabIndex = 33;
this.label14.Text = "卡号选择";
//
// label6
// comboBox4
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft YaHei UI", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.label6.ForeColor = System.Drawing.Color.Maroon;
this.label6.Location = new System.Drawing.Point(122, 7);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(400, 16);
this.label6.TabIndex = 22;
this.label6.Text = "[温馨提示]:先点击“读卡”,读取卡号后。再点击写卡,默认写“未制卡列表第一行”。";
this.comboBox4.FormattingEnabled = true;
this.comboBox4.Location = new System.Drawing.Point(525, 251);
this.comboBox4.Name = "comboBox4";
this.comboBox4.Size = new System.Drawing.Size(121, 25);
this.comboBox4.TabIndex = 32;
//
// label7
// textBox1
//
this.label7.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.label7.ForeColor = System.Drawing.Color.Black;
this.label7.Location = new System.Drawing.Point(10, 27);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(122, 21);
this.label7.TabIndex = 37;
this.label7.Text = "即将制卡人员:";
this.textBox1.Location = new System.Drawing.Point(456, 218);
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(190, 23);
this.textBox1.TabIndex = 31;
//
// labelName
// button6
//
this.labelName.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelName.AutoSize = true;
this.labelName.Font = new System.Drawing.Font("Microsoft YaHei UI", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.labelName.ForeColor = System.Drawing.Color.Maroon;
this.labelName.Location = new System.Drawing.Point(138, 16);
this.labelName.Name = "labelName";
this.labelName.Size = new System.Drawing.Size(82, 41);
this.labelName.TabIndex = 38;
this.labelName.Text = "张三";
this.button6.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.button6.Location = new System.Drawing.Point(456, 283);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(190, 34);
this.button6.TabIndex = 30;
this.button6.Text = "制作管理卡";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// 编号
//
this.编号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.编号.DataPropertyName = "Num";
this.编号.HeaderText = "编号";
this.编号.Name = "编号";
//
// 名称
//
this.名称.DataPropertyName = "UserName";
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.名称.DefaultCellStyle = dataGridViewCellStyle2;
this.名称.HeaderText = "姓名";
this.名称.Name = "名称";
this.名称.ReadOnly = true;
this.名称.Width = 150;
//
// 卡状态
//
this.卡状态.DataPropertyName = "State";
this.卡状态.HeaderText = "卡状态";
this.卡状态.Name = "卡状态";
this.卡状态.ReadOnly = true;
this.卡状态.Width = 150;
//
// 机构
//
this.机构.DataPropertyName = "OrgName";
this.机构.HeaderText = "机构";
this.机构.Name = "机构";
this.机构.ReadOnly = true;
this.机构.Width = 150;
//
// 手机号
//
this.手机号.DataPropertyName = "Phone";
this.手机号.HeaderText = "手机号";
this.手机号.Name = "手机号";
this.手机号.ReadOnly = true;
this.手机号.Visible = false;
this.手机号.Width = 150;
//
// 卡号
//
this.卡号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.卡号.DataPropertyName = "CardNum";
this.卡号.HeaderText = "卡号";
this.卡号.Name = "卡号";
this.卡号.ReadOnly = true;
//
// dataGridViewTextBoxColumn1
//
this.dataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.dataGridViewTextBoxColumn1.DataPropertyName = "Num";
this.dataGridViewTextBoxColumn1.HeaderText = "编号";
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
//
// dataGridViewTextBoxColumn2
//
this.dataGridViewTextBoxColumn2.DataPropertyName = "UserName";
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle1;
this.dataGridViewTextBoxColumn2.HeaderText = "姓名";
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
this.dataGridViewTextBoxColumn2.ReadOnly = true;
this.dataGridViewTextBoxColumn2.Width = 150;
//
// dataGridViewTextBoxColumn3
//
this.dataGridViewTextBoxColumn3.DataPropertyName = "State";
this.dataGridViewTextBoxColumn3.HeaderText = "卡状态";
this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
this.dataGridViewTextBoxColumn3.ReadOnly = true;
this.dataGridViewTextBoxColumn3.Width = 150;
//
// dataGridViewTextBoxColumn4
//
this.dataGridViewTextBoxColumn4.DataPropertyName = "OrgName";
this.dataGridViewTextBoxColumn4.HeaderText = "机构";
this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
this.dataGridViewTextBoxColumn4.ReadOnly = true;
this.dataGridViewTextBoxColumn4.Width = 150;
//
// dataGridViewTextBoxColumn5
//
this.dataGridViewTextBoxColumn5.DataPropertyName = "Phone";
this.dataGridViewTextBoxColumn5.HeaderText = "手机号";
this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
this.dataGridViewTextBoxColumn5.ReadOnly = true;
this.dataGridViewTextBoxColumn5.Visible = false;
this.dataGridViewTextBoxColumn5.Width = 150;
//
// dataGridViewTextBoxColumn6
//
this.dataGridViewTextBoxColumn6.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.dataGridViewTextBoxColumn6.DataPropertyName = "CardNum";
this.dataGridViewTextBoxColumn6.HeaderText = "卡号";
this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
this.dataGridViewTextBoxColumn6.ReadOnly = true;
//
// CarMangerPage
//
@@ -622,11 +604,6 @@
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
//((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
//((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
this.panel7.ResumeLayout(false);
this.panel7.PerformLayout();
this.panel6.ResumeLayout(false);
@@ -639,6 +616,8 @@
this.panel3.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
this.ResumeLayout(false);

}
@@ -667,22 +646,8 @@
private Label label4;
private ComboBox comboBox4;
private DataGridView dataGridView1_全部;
private DataGridViewTextBoxColumn 编号;
private DataGridViewTextBoxColumn 名称;
private DataGridViewTextBoxColumn 卡状态;
private DataGridViewTextBoxColumn 机构;
private DataGridViewTextBoxColumn 手机号;
private DataGridViewTextBoxColumn 卡号;
private DataGridViewButtonColumn 删除;
private Label label14;
private DataGridView dataGridView_No;
private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
private DataGridViewButtonColumn dataGridViewButtonColumn1;
private Label label5;
private Panel panel7;
private Panel panel6;
@@ -693,5 +658,17 @@
private Label label6;
private Label labelName;
private Label label7;
private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
private DataGridViewTextBoxColumn 编号;
private DataGridViewTextBoxColumn 名称;
private DataGridViewTextBoxColumn 卡状态;
private DataGridViewTextBoxColumn 机构;
private DataGridViewTextBoxColumn 手机号;
private DataGridViewTextBoxColumn 卡号;
}
}

+ 72
- 66
HKCardManager/UserPages/CarMangerPage.cs 查看文件

@@ -64,8 +64,6 @@ namespace HKCardManager.UserPages
ComboBox_jglb_TextChanged(null, null);
}



private void ComboBox2_SelectedValueChanged(object? sender, EventArgs e)
{
if (radioButton2.Checked)
@@ -187,12 +185,14 @@ namespace HKCardManager.UserPages
{
if (string.IsNullOrEmpty(textBox2.Text.Trim()))
{
MessageBox.Show("提示!!!\n 请输入姓名...");
MessageLogNotify.GetInstance.ShowWarning("请输入姓名");
return;
}
var res1 = await HKLibHelper.GetUserList(textBox2.Text.Trim());
if (res1?.Count > 0)
{
MessageBox.Show("提示!!!\n 用户已经存在,请勿重复添加...");
MessageLogNotify.GetInstance.ShowWarning("用户已经存在,请勿重复添加");
return;
}
@@ -213,25 +213,32 @@ namespace HKCardManager.UserPages
var res = UHFCardHelper.GetInstance().WriteCard(userDto.CardNo);
if (res != null && res.Res)
{
MessageBox.Show($"用户 【{userDto.Name}】 写卡成功...");
MessageLogNotify.GetInstance.Show($"用户 【{userDto.Name}】 写卡成功");
textBox2.Text = String.Empty;
button2.Enabled = false;
}
else
{
MessageBox.Show($"用户 【{userDto.Name}】 写卡失败,原因:{res?.ResMes}");
MessageLogNotify.GetInstance.ShowError($"用户 【{userDto.Name}】 写卡失败,原因:{res?.ResMes}");
}
var result = await HKLibHelper.AddUserAndBindCard(userDto);
if (result)
{
MessageBox.Show($"用户 【{userDto.Name}】 添加成功...");
MessageLogNotify.GetInstance.Show($"用户 【{userDto.Name}】 添加成功");
}
else
{
MessageBox.Show($"用户 【{userDto.Name}】 添加失败,请重试!");
MessageLogNotify.GetInstance.ShowError($"用户 【{userDto.Name}】 添加失败,请重试!");
}
//});
}
else
{
MessageBox.Show("提示!!!\n 设备未连接...");
MessageLogNotify.GetInstance.ShowWarning("设备未连接");
}
}
@@ -244,6 +251,7 @@ namespace HKCardManager.UserPages
var res = UHFCardHelper.GetInstance().ReadCard();
if (string.IsNullOrEmpty(res))
{
MessageBox.Show("提示!!!\n 请放入卡片...");
MessageLogNotify.GetInstance.Show("请放入卡片");
return;
}
@@ -270,6 +278,7 @@ namespace HKCardManager.UserPages
}
else
{
MessageBox.Show("提示!!!\n 设备未连接...");
MessageLogNotify.GetInstance.ShowWarning("设备未连接");
}
}
@@ -284,9 +293,16 @@ namespace HKCardManager.UserPages
{
if (UHFCardHelper.GetInstance().ComOpen)
{
if (FirstUser == null)
{
MessageBox.Show("提示!!!\n 没有可以制卡的成员...");
MessageLogNotify.GetInstance.ShowWarning("没有可以制卡的成员!");
return;
}
var res = UHFCardHelper.GetInstance().ReadCard();
if (string.IsNullOrEmpty(res))
{
MessageBox.Show("提示!!!\n 请放入卡片,再读卡...");
MessageLogNotify.GetInstance.Show("请放入卡片");
return;
}
@@ -305,6 +321,7 @@ namespace HKCardManager.UserPages
}
else
{
MessageBox.Show("提示!!!\n 设备未连接...");
MessageLogNotify.GetInstance.ShowWarning("设备未连接");
}
}
@@ -320,6 +337,7 @@ namespace HKCardManager.UserPages

if (FirstUser == null)
{
MessageBox.Show("提示!!!\n 没有可以制卡的成员...");
MessageLogNotify.GetInstance.ShowWarning("没有可以制卡的成员!");
return;
}
@@ -335,6 +353,7 @@ namespace HKCardManager.UserPages
var res = UHFCardHelper.GetInstance().WriteCard(userDto.CardNo);
if (res.Res == false)
{
MessageBox.Show("提示!!!\n "+ $"用户 【{userDto.Name}】 写卡失败!");
MessageBox.Show($"用户 【{userDto.Name}】 写卡失败!");
return;
}
@@ -343,14 +362,17 @@ namespace HKCardManager.UserPages
{
MessageLogNotify.GetInstance.Show($"用户 【{userDto.Name}】 添加成功");
MessageBox.Show($"用户 【{userDto.Name}】 添加成功!");
刷新数据(comboBox_jglb.Text);
RefreshTheData(comboBox_jglb.Text);
this.Invoke(() => { button_pl_write.Enabled = false; });
}
else
else {
MessageBox.Show($"用户 【{userDto.Name}】 添加失败,请重试!");
MessageLogNotify.GetInstance.ShowError($"用户 【{userDto.Name}】 添加失败,请重试!");
}
}
else
{
MessageBox.Show("提示!!!\n 设备未连接...");
MessageLogNotify.GetInstance.ShowWarning("设备未连接");
}
}
@@ -363,92 +385,76 @@ namespace HKCardManager.UserPages
{
try
{
刷新数据(comboBox_jglb.Text);
RefreshTheData(comboBox_jglb.Text);
}
catch (Exception ex)
{
MessageLogNotify.GetInstance.ShowWarning(ex.Message);
}
}

/// <summary>
/// 当前正在插入的用户数据
/// </summary>
public UserInfoModel FirstUser { get; set; }
//获取所有用户信息
private void GetUser()
{
var res = HKLibHelper.GetUserListSync("");
Global.UserListDtos.Clear();
res?.ToList()?.ForEach(item =>
{
string status = "";
string cardNum = "";
if (item.Cards != null && item.Cards.Count > 0)
{
cardNum = item.Cards.ElementAt(0).CardNum;
status = ((CarStatus)item.Cards.ElementAt(0).State).ToString();
}
Global.UserListDtos.Add(new UserInfoModel()
{
Num = item.Num,
UserName = item.Name,
Phone = item.Phone,
OrgName = item.OrgInfo?.Count > 0 ? item.OrgInfo.ElementAt(0).Name : "",
CardNum = cardNum,
State = status
});
});
}

public void 刷新数据(string Name)
/// <summary>
/// 刷新数据
/// </summary>
/// <param name="Name"></param>
public void RefreshTheData(string Name)
{
try
{
GetUser();
if (Name == "全部")
var res = HKLibHelper.GetUserListSync("");
Global.UserListDtos.Clear();
res?.ToList()?.ForEach(item =>
{
List<UserInfoModel> data = Global.UserListDtos?.FindAll(par => string.IsNullOrEmpty(par.CardNum));
dataGridView_No.DataSource = null;
dataGridView_No.DataSource = data;
dataGridView1_全部.DataSource = null;
dataGridView1_全部.DataSource = Global.UserListDtos?.FindAll(par => !string.IsNullOrEmpty(par.CardNum));
if (data != null && data.Count > 0)
string status = "";
string cardNum = "";
if (item.Cards != null && item.Cards.Count > 0)
{
FirstUser = data.FirstOrDefault();
labelName.Text = FirstUser.UserName;
cardNum = item.Cards.ElementAt(0).CardNum;
status = ((CarStatus)item.Cards.ElementAt(0).State).ToString();
}
else
Global.UserListDtos.Add(new UserInfoModel()
{
FirstUser = null;
labelName.Text = "";
}
Num = item.Num,
UserName = item.Name,
Phone = item.Phone,
OrgName = item.OrgInfo?.Count > 0 ? item.OrgInfo.ElementAt(0).Name : "",
CardNum = cardNum,
State = status
});
});

List<UserInfoModel> data = Global.UserListDtos?.FindAll(par => string.IsNullOrEmpty(par.CardNum));
List<UserInfoModel> dataYes = Global.UserListDtos?.FindAll(par => !string.IsNullOrEmpty(par.CardNum));
if (Name != "全部")
{
data = Global.UserListDtos?.FindAll(par => string.IsNullOrEmpty(par.CardNum) && par.OrgName == Name);
dataYes = Global.UserListDtos?.FindAll(par => !string.IsNullOrEmpty(par.CardNum) && par.OrgName == Name);
}
dataGridView_No.DataSource = null;
dataGridView_No.DataSource = data;
dataGridView1_全部.DataSource = null;
dataGridView1_全部.DataSource = dataYes;
if (data != null && data.Count > 0)
{
FirstUser = data.FirstOrDefault();
labelName.Text = FirstUser.UserName;
}
else
{
List<UserInfoModel> data = Global.UserListDtos?.FindAll(par => string.IsNullOrEmpty(par.CardNum) && par.OrgName == Name);
dataGridView_No.DataSource = null;
dataGridView_No.DataSource = data;
dataGridView1_全部.DataSource = null;
dataGridView1_全部.DataSource = Global.UserListDtos?.FindAll(par => !string.IsNullOrEmpty(par.CardNum) && par.OrgName == Name);
if (data != null && data.Count > 0)
{
FirstUser = data.FirstOrDefault();
labelName.Text = FirstUser.UserName;
}
else
{
FirstUser = null;
labelName.Text = "";
}
FirstUser = null;
labelName.Text = "";
}
}
catch (Exception ex)
{
MessageLogNotify.GetInstance.ShowWarning(ex.Message);
}
}
#endregion



private async void button6_Click(object sender, EventArgs e)
{
if (SqlLogic.GetAdmin() > 3)


+ 0
- 6
HKCardManager/UserPages/CarMangerPage.resx 查看文件

@@ -75,9 +75,6 @@
<metadata name="dataGridViewTextBoxColumn6.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewButtonColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="编号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -96,7 +93,4 @@
<metadata name="卡号.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="删除.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

+ 22
- 17
HKCardManager/UserPages/InstitutionalEntryPage.cs 查看文件

@@ -46,11 +46,10 @@ namespace HKCardManager.UserPages
var res = Global.OrgTables.FirstOrDefault(p => p.Name == dataGridView1.Rows[index].Cells[0].Value?.ToString())?.SId;
if (string.IsNullOrEmpty(res))
{
MessageBox.Show("错误!!!\n 获取机构ID失败...");
MessageLogNotify.GetInstance.ShowError("获取机构ID失败");
return;
}
//Task.Factory.StartNew(() =>
//{
try
{
var tempname = dataGridView1.Rows[index].Cells[0].Value?.ToString();
@@ -61,33 +60,30 @@ namespace HKCardManager.UserPages
var result = await HKLibHelper.GetOrg();
if (result != null)
{
//this.Invoke(() =>
//{
dataGridView1.DataSource = null;
Global.OrgTables.Clear();
Global.OrgTables = result;
dataGridView1.DataSource = Global.OrgTables;
//});
}
MessageBox.Show($"{tempname} 机构删除成功!");
MessageLogNotify.GetInstance.Show($"机构:【{tempname}】 删除成功");
}
else
{
MessageBox.Show($"{tempname} 机构删除失败,请稍后重试...");
MessageLogNotify.GetInstance.ShowError($"机构:【{tempname}】 删除失败");
}
}
catch (Exception ex)
{
MessageBox.Show($"机构删除失败,错误原因:" + ex.Message);
MessageLogNotify.GetInstance.ShowEx(ex.ToString());
}
finally
{
//this.Invoke(() =>
//{
dataGridView1.Columns[2].ReadOnly = false;
dataGridView1.Columns[3].ReadOnly = false;
//});
}
//});
}
else if (dataGridView1.CurrentCell.Value?.ToString() == "修改")
{
@@ -95,22 +91,26 @@ namespace HKCardManager.UserPages
var changeName = dataGridView1.Rows[index].Cells[1].Value?.ToString();//修改后名称
if (string.IsNullOrEmpty(name))
{
MessageBox.Show("错误!!!\n原机构名称无效...");
MessageLogNotify.GetInstance.ShowError("原机构名称无效");
return;
}
if (string.IsNullOrEmpty(changeName))
{
MessageBox.Show("错误!!!\n请输入新机构名称...");
MessageLogNotify.GetInstance.ShowError("请输入新机构名称");
return;
}
if (name == changeName)
{
MessageBox.Show("错误!!!\n新名称和旧名称一致...");
MessageLogNotify.GetInstance.ShowError("新名称和旧名称一致,无法修改");
return;
}
var id = Global.OrgTables.FirstOrDefault(p => p.Name == name)?.SId;
if (string.IsNullOrEmpty(id))
{
MessageBox.Show("未找到对应ID.请稍后重试...");
MessageLogNotify.GetInstance.ShowError("未找到对应ID");
return;
}
@@ -124,22 +124,23 @@ namespace HKCardManager.UserPages
var result = await HKLibHelper.GetOrg();
if (result != null)
{
//this.Invoke(() =>
//{
dataGridView1.DataSource = null;
Global.OrgTables.Clear();
Global.OrgTables = result;
dataGridView1.DataSource = Global.OrgTables;
//});
}
MessageBox.Show($"{name} 机构修改成功...");
MessageLogNotify.GetInstance.Show($"{name} 机构修改成功");
}
else
{
MessageBox.Show($"{name} 机构修改失败,请稍后重试...");
MessageLogNotify.GetInstance.ShowError($"{name} 机构修改失败");
}
}
catch (Exception ex)
{
MessageBox.Show($"{name} 机构修改失败,请稍后重试...,错误原因:"+ex.Message);
MessageLogNotify.GetInstance.ShowEx(ex.ToString());
}
finally
@@ -176,17 +177,18 @@ namespace HKCardManager.UserPages
string name = this.textBox1.Text.Trim();
if (string.IsNullOrEmpty(name))
{
MessageBox.Show("请输入机构名称,在尝试添加...");
MessageLogNotify.GetInstance.ShowWarning("请输入机构名称");
return;
}
var res = await HKLibHelper.GetOrg();
if (res?.FirstOrDefault(t => t.Name == name) != null)
{
MessageBox.Show("机构已存在请勿重复添加...");
MessageLogNotify.GetInstance.ShowWarning("机构已存在请勿重复添加");
return;
}
//Task.Factory.StartNew(() =>
//{
this.Invoke(() => { button2.Enabled = false; });
var result = await HKLibHelper.SetOrg(name);
if (!string.IsNullOrEmpty(result))
@@ -197,6 +199,7 @@ namespace HKCardManager.UserPages
Name = name,
SId = result
});
MessageBox.Show($"【{name}】 机构添加成功...");
MessageLogNotify.GetInstance.Show($"【{name}】 机构添加成功");
this.Invoke(() =>
{
@@ -205,9 +208,11 @@ namespace HKCardManager.UserPages
});
}
else
{
MessageBox.Show($"【{name}】 机构添加失败,请稍后重试...");
MessageLogNotify.GetInstance.ShowError($"【{name}】 机构添加失败,请重试");
}
this.Invoke(() => { button2.Enabled = true; });
//});
}
}
}

+ 29
- 6
HKCardManager/UserPages/PersonnelEntryPage.cs 查看文件

@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
@@ -127,12 +128,14 @@ namespace HKCardManager.UserPages
{
if (string.IsNullOrEmpty(textBox1.Text.Trim()))
{
MessageBox.Show("请输入姓名,在尝试添加...");
MessageLogNotify.GetInstance.ShowWarning("请输入姓名");
return;
}

if (Global.UserListDtos.FirstOrDefault(p => p.UserName == textBox1.Text.Trim()) != null)
{
MessageBox.Show("用户已经存在,请勿重复添加!");
MessageLogNotify.GetInstance.ShowWarning("用户已经存在,请勿重复添加");
return;
}
@@ -165,10 +168,14 @@ namespace HKCardManager.UserPages
textBox1.Text = string.Empty;
//textBox2.Text = string.Empty;
//});
MessageBox.Show($"用户 【{userDto.Name}】 添加成功");
MessageLogNotify.GetInstance.Show($"用户 【{userDto.Name}】 添加成功");
}
else
{
MessageBox.Show($"用户 【{userDto.Name}】 添加失败,请重试!");
MessageLogNotify.GetInstance.ShowError($"用户 【{userDto.Name}】 添加失败,请重试!");
}
//this.Invoke(() => { button2.Enabled = true; });
button2.Enabled = true;

@@ -188,25 +195,29 @@ namespace HKCardManager.UserPages
var res = dataGridView1.Rows[index].Cells[1].Value?.ToString();
if (string.IsNullOrEmpty(res))
{
MessageBox.Show("用户名无效.请重试!");
MessageLogNotify.GetInstance.ShowError("用户名无效");
return;
}
//Task.Factory.StartNew(() =>
//{

var result = await HKLibHelper.DisableUser(res);
if (result)
{
GetUser();
MessageBox.Show($"用户:【{res}】 删除成功");
MessageLogNotify.GetInstance.Show($"用户:【{res}】 删除成功");
}
else
{
MessageBox.Show($"用户:【{res}】 删除失败");
MessageLogNotify.GetInstance.ShowError($"用户:【{res}】 删除失败");
//});
}
}
}
}
catch (Exception ex)
{
MessageBox.Show($"用户删除失败,错误原因:"+ex.Message);
MessageLogNotify.GetInstance.ShowEx(ex.ToString());
}

@@ -518,17 +529,19 @@ namespace HKCardManager.UserPages
string message = string.Empty;
foreach (var item in RrrorUser)
{
message += item.Key + "列表:\n";
message +="\n"+ item.Key + "列表:\n";
(item.Value as List<UserDtoModel>)?.ForEach(par =>
{
message += par.Name + "_" + par.OrgId + "\n";
message += par.Name + "[" + par.OrgId + "]\n";
});
}
MessageBox.Show(message + $"批量录入成功!成功{RrrorUser["成功"].Count}条,失败{(RrrorUser["名字重复"].Count + RrrorUser["机构不存在"].Count + RrrorUser["添加出错"].Count)}条");
MessageLogNotify.GetInstance.Show(message + $"\n批量录入成功!\n成功{RrrorUser["成功"].Count}条\n失败{(RrrorUser["名字重复"].Count + RrrorUser["机构不存在"].Count + RrrorUser["添加出错"].Count)}条\n");
MessageBox.Show(message + $"\n批量录入成功!\n成功{RrrorUser["成功"].Count}条\n失败{(RrrorUser["名字重复"].Count + RrrorUser["机构不存在"].Count + RrrorUser["添加出错"].Count)}条\n");
}
}
catch (Exception ex)
{
MessageBox.Show($"导入失败,请重试!" + ex.Message);
MessageLogNotify.GetInstance.ShowError($"导入失败,请重试!" + ex.Message);
}
}
@@ -560,10 +573,20 @@ namespace HKCardManager.UserPages
var exporter = new ExcelExporter();
var bytes = exporter.ObjectToExcelBytes(models);
File.WriteAllBytes(path, bytes);
MessageLogNotify.GetInstance.Show("模板生成成功,路径:"+ path);
MessageLogNotify.GetInstance.Show("尝试打开文件...");
//打开文件
ProcessStartInfo processStartInfo = new ProcessStartInfo(path);
Process process = new Process();
process.StartInfo = processStartInfo;
process.StartInfo.UseShellExecute = true;
process.Start();
MessageLogNotify.GetInstance.Show("模板生成成功并打开,请编辑后导入系统!");
}
}
catch (Exception ex)
{
MessageBox.Show($"模板生成失败,请重试!" + ex.Message);
MessageLogNotify.GetInstance.ShowError($"模板生成失败,请重试!" + ex.Message);
}
}


+ 2
- 2
HKCardManager/options.json 查看文件

@@ -1,6 +1,6 @@
{
//此配置为测试环境配置
"SaasRoute":"http://192.168.1.43:5000/",//"https://bpa.black-pa.com:21528/kitchen/",
"SaasRoute": "https://bpa.black-pa.com:21528/kitchen/", //"http://192.168.1.43:5000/",//"https://bpa.black-pa.com:21528/kitchen/",
//加盟商Id
"TenantId": "78d635f7-8ee4-4be4-b26a-462016196826",
//测试环境广告地址
@@ -9,5 +9,5 @@
//"MQ": "host=10.2.1.43:15672;username=username;password=pwd"
//MQ正式地址
"MQ": "host=47.108.65.220;username=root;password=pwd",
"Admin": [ 666,888, 999 ]
"Admin": [ 666, 888, 999 ]
}

+ 6
- 2
HKHelper/Function.cs 查看文件

@@ -7,6 +7,8 @@ using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using System.Collections;
using NPOI.XSSF.UserModel;
using NPOI.HSSF.Util;

namespace HKHelper
{
@@ -241,6 +243,8 @@ namespace HKHelper

public class ExcelExporter
{


public byte[] ObjectToExcelBytes<TModel>(IEnumerable<TModel> data)
{
var workbook = new HSSFWorkbook();
@@ -345,9 +349,9 @@ namespace HKHelper

public class UserDtoModel
{
[Excel("机构", Order = 1)]
[Excel("组织机构", Order = 2)]
public string OrgId { get; set; }
[Excel("姓名", Order = 2)]
[Excel("姓名", Order = 1)]
public string Name { get; set; }
}
}

Loading…
取消
儲存