From 1def560485a73bf4a2a9263eec68a202fb76816c Mon Sep 17 00:00:00 2001 From: fyf Date: Tue, 25 Oct 2022 10:37:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8F=90=E7=A4=BA=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HKCardManager/Form1.cs | 2 + HKCardManager/UserPages/CancellationPage.cs | 16 +- .../UserPages/CarMangerPage.Designer.cs | 441 +++++++++--------- HKCardManager/UserPages/CarMangerPage.cs | 138 +++--- HKCardManager/UserPages/CarMangerPage.resx | 6 - .../UserPages/InstitutionalEntryPage.cs | 39 +- HKCardManager/UserPages/PersonnelEntryPage.cs | 35 +- HKCardManager/options.json | 4 +- HKHelper/Function.cs | 8 +- 9 files changed, 356 insertions(+), 333 deletions(-) diff --git a/HKCardManager/Form1.cs b/HKCardManager/Form1.cs index 2c69e1a..d82061b 100644 --- a/HKCardManager/Form1.cs +++ b/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("É豸δÁ¬½Ó"); } } diff --git a/HKCardManager/UserPages/CancellationPage.cs b/HKCardManager/UserPages/CancellationPage.cs index 587e1ff..fe3a05a 100644 --- a/HKCardManager/UserPages/CancellationPage.cs +++ b/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; }); diff --git a/HKCardManager/UserPages/CarMangerPage.Designer.cs b/HKCardManager/UserPages/CarMangerPage.Designer.cs index f635561..7660071 100644 --- a/HKCardManager/UserPages/CarMangerPage.Designer.cs +++ b/HKCardManager/UserPages/CarMangerPage.Designer.cs @@ -28,8 +28,8 @@ /// 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 å¡å·; } } diff --git a/HKCardManager/UserPages/CarMangerPage.cs b/HKCardManager/UserPages/CarMangerPage.cs index 0086f05..2eda024 100644 --- a/HKCardManager/UserPages/CarMangerPage.cs +++ b/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); } } - + /// + /// 当å‰æ­£åœ¨æ’å…¥çš„ç”¨æˆ·æ•°æ® + /// 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) + /// + /// åˆ·æ–°æ•°æ® + /// + /// + public void RefreshTheData(string Name) { try { - GetUser(); - if (Name == "全部") + var res = HKLibHelper.GetUserListSync(""); + Global.UserListDtos.Clear(); + res?.ToList()?.ForEach(item => { - List 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 data = Global.UserListDtos?.FindAll(par => string.IsNullOrEmpty(par.CardNum)); + List 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 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) diff --git a/HKCardManager/UserPages/CarMangerPage.resx b/HKCardManager/UserPages/CarMangerPage.resx index 3c21093..ccf8bb6 100644 --- a/HKCardManager/UserPages/CarMangerPage.resx +++ b/HKCardManager/UserPages/CarMangerPage.resx @@ -75,9 +75,6 @@ True - - True - True @@ -96,7 +93,4 @@ True - - True - \ No newline at end of file diff --git a/HKCardManager/UserPages/InstitutionalEntryPage.cs b/HKCardManager/UserPages/InstitutionalEntryPage.cs index a955c0d..8146e04 100644 --- a/HKCardManager/UserPages/InstitutionalEntryPage.cs +++ b/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; }); - //}); } } } diff --git a/HKCardManager/UserPages/PersonnelEntryPage.cs b/HKCardManager/UserPages/PersonnelEntryPage.cs index a7dde14..4ab27f9 100644 --- a/HKCardManager/UserPages/PersonnelEntryPage.cs +++ b/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)?.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); } } diff --git a/HKCardManager/options.json b/HKCardManager/options.json index 4155ba4..3408462 100644 --- a/HKCardManager/options.json +++ b/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 ] } diff --git a/HKHelper/Function.cs b/HKHelper/Function.cs index 6a47b8c..c228c7e 100644 --- a/HKHelper/Function.cs +++ b/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(IEnumerable 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; } } }