@@ -59,19 +59,23 @@ namespace HKCardManager.UserPages | |||||
{ | { | ||||
if (!string.IsNullOrEmpty(temp.CardNum)) | if (!string.IsNullOrEmpty(temp.CardNum)) | ||||
{ | { | ||||
var res = await HKLibHelper.CardStutasChange(new CardStutasDto() | |||||
if (MessageBox.Show($"确认是否[{TagName}]用户[{temp.UserName}]!", "操作", MessageBoxButtons.YesNo) == DialogResult.Yes) | |||||
{ | { | ||||
keywrod = name, | |||||
Stutas = status | |||||
}); | |||||
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} 失败,请检查名称是否正常"); | |||||
var res = await HKLibHelper.CardStutasChange(new CardStutasDto() | |||||
{ | |||||
keywrod = name, | |||||
Stutas = status | |||||
}); | |||||
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 | else | ||||
@@ -213,8 +213,7 @@ namespace HKCardManager.UserPages | |||||
var res = UHFCardHelper.GetInstance().WriteCard(userDto.CardNo); | var res = UHFCardHelper.GetInstance().WriteCard(userDto.CardNo); | ||||
if (res != null && res.Res) | if (res != null && res.Res) | ||||
{ | { | ||||
MessageBox.Show($"用户 【{userDto.Name}】 写卡成功..."); | |||||
MessageLogNotify.GetInstance.Show($"用户 【{userDto.Name}】 写卡成功"); | |||||
MessageLogNotify.GetInstance.Show($"用户 【{userDto.Name}】 写卡成功..."); | |||||
textBox2.Text = String.Empty; | textBox2.Text = String.Empty; | ||||
button2.Enabled = false; | button2.Enabled = false; | ||||
} | } | ||||
@@ -226,8 +225,8 @@ namespace HKCardManager.UserPages | |||||
var result = await HKLibHelper.AddUserAndBindCard(userDto); | var result = await HKLibHelper.AddUserAndBindCard(userDto); | ||||
if (result) | if (result) | ||||
{ | { | ||||
MessageBox.Show($"用户 【{userDto.Name}】 添加成功..."); | |||||
MessageLogNotify.GetInstance.Show($"用户 【{userDto.Name}】 添加成功"); | |||||
MessageLogNotify.GetInstance.Show($"用户 【{userDto.Name}】 写卡成功,卡号:{userDto.CardNo}"); | |||||
MessageBox.Show($"用户 【{userDto.Name}】 写卡成功,卡号:{userDto.CardNo}"); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -360,8 +359,8 @@ namespace HKCardManager.UserPages | |||||
var result = await HKLibHelper.AddUserAndBindCard(userDto); | var result = await HKLibHelper.AddUserAndBindCard(userDto); | ||||
if (result) | if (result) | ||||
{ | { | ||||
MessageLogNotify.GetInstance.Show($"用户 【{userDto.Name}】 添加成功"); | |||||
MessageBox.Show($"用户 【{userDto.Name}】 添加成功!"); | |||||
MessageLogNotify.GetInstance.Show($"用户 【{userDto.Name}】 写卡成功,卡号:{userDto.CardNo}"); | |||||
MessageBox.Show($"用户 【{userDto.Name}】 写卡成功,卡号:{userDto.CardNo}"); | |||||
RefreshTheData(comboBox_jglb.Text); | RefreshTheData(comboBox_jglb.Text); | ||||
this.Invoke(() => { button_pl_write.Enabled = false; }); | this.Invoke(() => { button_pl_write.Enabled = false; }); | ||||
} | } | ||||
@@ -36,127 +36,133 @@ namespace HKCardManager.UserPages | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
int index = dataGridView1.CurrentRow.Index; | |||||
if (index >= 0 && index < dataGridView1.Rows.Count) | |||||
{ | { | ||||
dataGridView1.Columns[2].ReadOnly = true; | |||||
dataGridView1.Columns[3].ReadOnly = true; | |||||
if (dataGridView1.CurrentCell.Value?.ToString() == "删除") | |||||
int index = dataGridView1.CurrentRow.Index; | |||||
if (index >= 0 && index < dataGridView1.Rows.Count) | |||||
{ | { | ||||
var res = Global.OrgTables.FirstOrDefault(p => p.Name == dataGridView1.Rows[index].Cells[0].Value?.ToString())?.SId; | |||||
if (string.IsNullOrEmpty(res)) | |||||
dataGridView1.Columns[2].ReadOnly = true; | |||||
dataGridView1.Columns[3].ReadOnly = true; | |||||
if (dataGridView1.CurrentCell.Value?.ToString() == "删除") | |||||
{ | { | ||||
MessageBox.Show("错误!!!\n 获取机构ID失败..."); | |||||
MessageLogNotify.GetInstance.ShowError("获取机构ID失败"); | |||||
return; | |||||
} | |||||
try | |||||
{ | |||||
var tempname = dataGridView1.Rows[index].Cells[0].Value?.ToString(); | |||||
if (await HKLibHelper.DelOrg(res)) | |||||
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; | |||||
} | |||||
try | |||||
{ | { | ||||
//Global.OrgTables.Clear(); | |||||
//Global.OrgTables = HKLibHelper.GetOrg(); | |||||
var result = await HKLibHelper.GetOrg(); | |||||
if (result != null) | |||||
var tempname = dataGridView1.Rows[index].Cells[0].Value?.ToString(); | |||||
if (MessageBox.Show($"确认是否删除[{tempname}]!", "操作", MessageBoxButtons.YesNo) == DialogResult.Yes) | |||||
{ | { | ||||
dataGridView1.DataSource = null; | |||||
Global.OrgTables.Clear(); | |||||
Global.OrgTables = result; | |||||
dataGridView1.DataSource = Global.OrgTables; | |||||
if (await HKLibHelper.DelOrg(res)) | |||||
{ | |||||
//Global.OrgTables.Clear(); | |||||
//Global.OrgTables = HKLibHelper.GetOrg(); | |||||
var result = await HKLibHelper.GetOrg(); | |||||
if (result != null) | |||||
{ | |||||
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}】 删除失败"); | |||||
} | |||||
} | } | ||||
MessageBox.Show($"{tempname} 机构删除成功!"); | |||||
MessageLogNotify.GetInstance.Show($"机构:【{tempname}】 删除成功"); | |||||
} | } | ||||
else | |||||
catch (Exception ex) | |||||
{ | { | ||||
MessageBox.Show($"{tempname} 机构删除失败,请稍后重试..."); | |||||
MessageLogNotify.GetInstance.ShowError($"机构:【{tempname}】 删除失败"); | |||||
MessageBox.Show($"机构删除失败,错误原因:" + ex.Message); | |||||
MessageLogNotify.GetInstance.ShowEx(ex.ToString()); | |||||
} | |||||
finally | |||||
{ | |||||
dataGridView1.Columns[2].ReadOnly = false; | |||||
dataGridView1.Columns[3].ReadOnly = false; | |||||
} | } | ||||
} | } | ||||
catch (Exception ex) | |||||
{ | |||||
MessageBox.Show($"机构删除失败,错误原因:" + ex.Message); | |||||
MessageLogNotify.GetInstance.ShowEx(ex.ToString()); | |||||
} | |||||
finally | |||||
{ | |||||
dataGridView1.Columns[2].ReadOnly = false; | |||||
dataGridView1.Columns[3].ReadOnly = false; | |||||
} | |||||
} | |||||
else if (dataGridView1.CurrentCell.Value?.ToString() == "修改") | |||||
{ | |||||
var name = dataGridView1.Rows[index].Cells[0].Value?.ToString();//原名称 | |||||
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; | |||||
} | |||||
//Task.Factory.StartNew(async () => | |||||
//{ | |||||
try | |||||
else if (dataGridView1.CurrentCell.Value?.ToString() == "修改") | |||||
{ | { | ||||
if (await HKLibHelper.AlterOrg(changeName, id)) | |||||
var name = dataGridView1.Rows[index].Cells[0].Value?.ToString();//原名称 | |||||
var changeName = dataGridView1.Rows[index].Cells[1].Value?.ToString();//修改后名称 | |||||
if (string.IsNullOrEmpty(name)) | |||||
{ | |||||
MessageBox.Show("错误!!!\n原机构名称无效..."); | |||||
MessageLogNotify.GetInstance.ShowError("原机构名称无效"); | |||||
return; | |||||
} | |||||
if (string.IsNullOrEmpty(changeName)) | |||||
{ | { | ||||
var result = await HKLibHelper.GetOrg(); | |||||
if (result != null) | |||||
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; | |||||
} | |||||
//Task.Factory.StartNew(async () => | |||||
//{ | |||||
try | |||||
{ | |||||
if (await HKLibHelper.AlterOrg(changeName, id)) | |||||
{ | |||||
var result = await HKLibHelper.GetOrg(); | |||||
if (result != null) | |||||
{ | |||||
dataGridView1.DataSource = null; | |||||
Global.OrgTables.Clear(); | |||||
Global.OrgTables = result; | |||||
dataGridView1.DataSource = Global.OrgTables; | |||||
} | |||||
MessageBox.Show($"{name} 机构修改成功..."); | |||||
MessageLogNotify.GetInstance.Show($"{name} 机构修改成功"); | |||||
} | |||||
else | |||||
{ | { | ||||
dataGridView1.DataSource = null; | |||||
Global.OrgTables.Clear(); | |||||
Global.OrgTables = result; | |||||
dataGridView1.DataSource = Global.OrgTables; | |||||
MessageBox.Show($"{name} 机构修改失败,请稍后重试..."); | |||||
MessageLogNotify.GetInstance.ShowError($"{name} 机构修改失败"); | |||||
} | } | ||||
MessageBox.Show($"{name} 机构修改成功..."); | |||||
MessageLogNotify.GetInstance.Show($"{name} 机构修改成功"); | |||||
} | } | ||||
else | |||||
catch (Exception ex) | |||||
{ | { | ||||
MessageBox.Show($"{name} 机构修改失败,请稍后重试..."); | |||||
MessageLogNotify.GetInstance.ShowError($"{name} 机构修改失败"); | |||||
MessageBox.Show($"{name} 机构修改失败,请稍后重试...,错误原因:" + ex.Message); | |||||
MessageLogNotify.GetInstance.ShowEx(ex.ToString()); | |||||
} | } | ||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageBox.Show($"{name} 机构修改失败,请稍后重试...,错误原因:"+ex.Message); | |||||
MessageLogNotify.GetInstance.ShowEx(ex.ToString()); | |||||
} | |||||
finally | |||||
{ | |||||
this.Invoke(() => | |||||
finally | |||||
{ | { | ||||
dataGridView1.Rows[index].Cells[1].Value = string.Empty; | |||||
dataGridView1.Columns[2].ReadOnly = false; | |||||
dataGridView1.Columns[3].ReadOnly = false; | |||||
}); | |||||
this.Invoke(() => | |||||
{ | |||||
dataGridView1.Rows[index].Cells[1].Value = string.Empty; | |||||
dataGridView1.Columns[2].ReadOnly = false; | |||||
dataGridView1.Columns[3].ReadOnly = false; | |||||
}); | |||||
} | |||||
//}); | |||||
} | } | ||||
//}); | |||||
} | } | ||||
} | } | ||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -28,7 +28,7 @@ | |||||
/// </summary> | /// </summary> | ||||
private void InitializeComponent() | private void InitializeComponent() | ||||
{ | { | ||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); | |||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PersonnelEntryPage)); | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PersonnelEntryPage)); | ||||
this.button2 = new System.Windows.Forms.Button(); | this.button2 = new System.Windows.Forms.Button(); | ||||
this.comboBox2 = new System.Windows.Forms.ComboBox(); | this.comboBox2 = new System.Windows.Forms.ComboBox(); | ||||
@@ -44,6 +44,7 @@ | |||||
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.删除 = new System.Windows.Forms.DataGridViewButtonColumn(); | ||||
this.button1 = new System.Windows.Forms.Button(); | |||||
this.pictureBox2 = new System.Windows.Forms.PictureBox(); | this.pictureBox2 = new System.Windows.Forms.PictureBox(); | ||||
this.pictureBox1 = new System.Windows.Forms.PictureBox(); | this.pictureBox1 = new System.Windows.Forms.PictureBox(); | ||||
this.生成Excel = new System.Windows.Forms.Button(); | this.生成Excel = new System.Windows.Forms.Button(); | ||||
@@ -63,6 +64,7 @@ | |||||
this.label8 = new System.Windows.Forms.Label(); | this.label8 = new System.Windows.Forms.Label(); | ||||
this.label_down = new System.Windows.Forms.Label(); | this.label_down = new System.Windows.Forms.Label(); | ||||
this.label_end = new System.Windows.Forms.Label(); | this.label_end = new System.Windows.Forms.Label(); | ||||
this.label2 = new System.Windows.Forms.Label(); | |||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); | ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); | ||||
this.splitContainer1.Panel1.SuspendLayout(); | this.splitContainer1.Panel1.SuspendLayout(); | ||||
this.splitContainer1.Panel2.SuspendLayout(); | this.splitContainer1.Panel2.SuspendLayout(); | ||||
@@ -74,7 +76,7 @@ | |||||
// | // | ||||
// button2 | // button2 | ||||
// | // | ||||
this.button2.Location = new System.Drawing.Point(460, 56); | |||||
this.button2.Location = new System.Drawing.Point(503, 57); | |||||
this.button2.Name = "button2"; | this.button2.Name = "button2"; | ||||
this.button2.Size = new System.Drawing.Size(90, 32); | this.button2.Size = new System.Drawing.Size(90, 32); | ||||
this.button2.TabIndex = 20; | this.button2.TabIndex = 20; | ||||
@@ -90,7 +92,7 @@ | |||||
this.comboBox2.Items.AddRange(new object[] { | this.comboBox2.Items.AddRange(new object[] { | ||||
"男", | "男", | ||||
"女"}); | "女"}); | ||||
this.comboBox2.Location = new System.Drawing.Point(320, 58); | |||||
this.comboBox2.Location = new System.Drawing.Point(301, 58); | |||||
this.comboBox2.Name = "comboBox2"; | this.comboBox2.Name = "comboBox2"; | ||||
this.comboBox2.Size = new System.Drawing.Size(97, 29); | this.comboBox2.Size = new System.Drawing.Size(97, 29); | ||||
this.comboBox2.TabIndex = 16; | this.comboBox2.TabIndex = 16; | ||||
@@ -99,7 +101,7 @@ | |||||
// | // | ||||
this.label3.AutoSize = true; | 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.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); | ||||
this.label3.Location = new System.Drawing.Point(240, 62); | |||||
this.label3.Location = new System.Drawing.Point(221, 62); | |||||
this.label3.Name = "label3"; | this.label3.Name = "label3"; | ||||
this.label3.Size = new System.Drawing.Size(90, 21); | this.label3.Size = new System.Drawing.Size(90, 21); | ||||
this.label3.TabIndex = 15; | this.label3.TabIndex = 15; | ||||
@@ -136,6 +138,8 @@ | |||||
// | // | ||||
// splitContainer1.Panel2 | // splitContainer1.Panel2 | ||||
// | // | ||||
this.splitContainer1.Panel2.Controls.Add(this.label2); | |||||
this.splitContainer1.Panel2.Controls.Add(this.button1); | |||||
this.splitContainer1.Panel2.Controls.Add(this.pictureBox2); | this.splitContainer1.Panel2.Controls.Add(this.pictureBox2); | ||||
this.splitContainer1.Panel2.Controls.Add(this.pictureBox1); | this.splitContainer1.Panel2.Controls.Add(this.pictureBox1); | ||||
this.splitContainer1.Panel2.Controls.Add(this.生成Excel); | this.splitContainer1.Panel2.Controls.Add(this.生成Excel); | ||||
@@ -185,11 +189,18 @@ | |||||
this.dataGridView1.TabIndex = 0; | this.dataGridView1.TabIndex = 0; | ||||
this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); | this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); | ||||
// | // | ||||
// 编号 | |||||
// | |||||
this.编号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; | |||||
this.编号.DataPropertyName = "Num"; | |||||
this.编号.HeaderText = "编号"; | |||||
this.编号.Name = "编号"; | |||||
// | |||||
// 名称 | // 名称 | ||||
// | // | ||||
this.名称.DataPropertyName = "UserName"; | this.名称.DataPropertyName = "UserName"; | ||||
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |||||
this.名称.DefaultCellStyle = dataGridViewCellStyle1; | |||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |||||
this.名称.DefaultCellStyle = dataGridViewCellStyle2; | |||||
this.名称.HeaderText = "姓名"; | this.名称.HeaderText = "姓名"; | ||||
this.名称.Name = "名称"; | this.名称.Name = "名称"; | ||||
this.名称.ReadOnly = true; | this.名称.ReadOnly = true; | ||||
@@ -238,11 +249,21 @@ | |||||
this.删除.Text = "删除"; | this.删除.Text = "删除"; | ||||
this.删除.UseColumnTextForButtonValue = true; | this.删除.UseColumnTextForButtonValue = true; | ||||
// | // | ||||
// button1 | |||||
// | |||||
this.button1.Location = new System.Drawing.Point(404, 57); | |||||
this.button1.Name = "button1"; | |||||
this.button1.Size = new System.Drawing.Size(90, 32); | |||||
this.button1.TabIndex = 26; | |||||
this.button1.Text = "查询"; | |||||
this.button1.UseVisualStyleBackColor = true; | |||||
this.button1.Click += new System.EventHandler(this.button1_Click); | |||||
// | |||||
// pictureBox2 | // pictureBox2 | ||||
// | // | ||||
this.pictureBox2.BackColor = System.Drawing.Color.Transparent; | this.pictureBox2.BackColor = System.Drawing.Color.Transparent; | ||||
this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); | this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); | ||||
this.pictureBox2.Location = new System.Drawing.Point(773, 62); | |||||
this.pictureBox2.Location = new System.Drawing.Point(791, 64); | |||||
this.pictureBox2.Name = "pictureBox2"; | this.pictureBox2.Name = "pictureBox2"; | ||||
this.pictureBox2.Size = new System.Drawing.Size(20, 20); | this.pictureBox2.Size = new System.Drawing.Size(20, 20); | ||||
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; | this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; | ||||
@@ -253,7 +274,7 @@ | |||||
// | // | ||||
this.pictureBox1.BackColor = System.Drawing.Color.Transparent; | this.pictureBox1.BackColor = System.Drawing.Color.Transparent; | ||||
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); | this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); | ||||
this.pictureBox1.Location = new System.Drawing.Point(591, 61); | |||||
this.pictureBox1.Location = new System.Drawing.Point(609, 63); | |||||
this.pictureBox1.Name = "pictureBox1"; | this.pictureBox1.Name = "pictureBox1"; | ||||
this.pictureBox1.Size = new System.Drawing.Size(20, 20); | this.pictureBox1.Size = new System.Drawing.Size(20, 20); | ||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; | ||||
@@ -262,7 +283,7 @@ | |||||
// | // | ||||
// 生成Excel | // 生成Excel | ||||
// | // | ||||
this.生成Excel.Location = new System.Drawing.Point(581, 55); | |||||
this.生成Excel.Location = new System.Drawing.Point(599, 57); | |||||
this.生成Excel.Name = "生成Excel"; | this.生成Excel.Name = "生成Excel"; | ||||
this.生成Excel.Size = new System.Drawing.Size(169, 32); | this.生成Excel.Size = new System.Drawing.Size(169, 32); | ||||
this.生成Excel.TabIndex = 22; | this.生成Excel.TabIndex = 22; | ||||
@@ -272,9 +293,9 @@ | |||||
// | // | ||||
// 导入Excel | // 导入Excel | ||||
// | // | ||||
this.导入Excel.Location = new System.Drawing.Point(756, 55); | |||||
this.导入Excel.Location = new System.Drawing.Point(774, 57); | |||||
this.导入Excel.Name = "导入Excel"; | this.导入Excel.Name = "导入Excel"; | ||||
this.导入Excel.Size = new System.Drawing.Size(167, 32); | |||||
this.导入Excel.Size = new System.Drawing.Size(154, 32); | |||||
this.导入Excel.TabIndex = 21; | this.导入Excel.TabIndex = 21; | ||||
this.导入Excel.Text = "导入(Excel)"; | this.导入Excel.Text = "导入(Excel)"; | ||||
this.导入Excel.UseVisualStyleBackColor = true; | this.导入Excel.UseVisualStyleBackColor = true; | ||||
@@ -397,10 +418,10 @@ | |||||
// | // | ||||
// label_down | // label_down | ||||
// | // | ||||
this.编号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; | |||||
this.编号.DataPropertyName = "Num"; | |||||
this.编号.HeaderText = "编号"; | |||||
this.编号.Name = "编号"; | |||||
this.label_down.Location = new System.Drawing.Point(0, 0); | |||||
this.label_down.Name = "label_down"; | |||||
this.label_down.Size = new System.Drawing.Size(100, 23); | |||||
this.label_down.TabIndex = 25; | |||||
// | // | ||||
// label_end | // label_end | ||||
// | // | ||||
@@ -411,6 +432,16 @@ | |||||
this.label_end.TabIndex = 4; | this.label_end.TabIndex = 4; | ||||
this.label_end.Text = "尾页"; | this.label_end.Text = "尾页"; | ||||
// | // | ||||
// label2 | |||||
// | |||||
this.label2.AutoSize = true; | |||||
this.label2.Location = new System.Drawing.Point(205, 19); | |||||
this.label2.Name = "label2"; | |||||
this.label2.Size = new System.Drawing.Size(44, 17); | |||||
this.label2.TabIndex = 27; | |||||
this.label2.Text = "下一页"; | |||||
this.label2.Click += new System.EventHandler(this.label_down_Click); | |||||
// | |||||
// PersonnelEntryPage | // PersonnelEntryPage | ||||
// | // | ||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); | ||||
@@ -465,5 +496,7 @@ | |||||
private DataGridViewTextBoxColumn 手机号; | private DataGridViewTextBoxColumn 手机号; | ||||
private DataGridViewTextBoxColumn 卡号; | private DataGridViewTextBoxColumn 卡号; | ||||
private DataGridViewButtonColumn 删除; | private DataGridViewButtonColumn 删除; | ||||
private Button button1; | |||||
private Label label2; | |||||
} | } | ||||
} | } |
@@ -187,33 +187,38 @@ namespace HKCardManager.UserPages | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
int index = dataGridView1.CurrentRow.Index; | |||||
if (index >= 0 && index < dataGridView1.Rows.Count) | |||||
{ | { | ||||
if (dataGridView1.CurrentCell.Value?.ToString() == "删除") | |||||
int index = dataGridView1.CurrentRow.Index; | |||||
if (index >= 0 && index < dataGridView1.Rows.Count) | |||||
{ | { | ||||
var res = dataGridView1.Rows[index].Cells[1].Value?.ToString(); | |||||
if (string.IsNullOrEmpty(res)) | |||||
if (dataGridView1.CurrentCell.Value?.ToString() == "删除") | |||||
{ | { | ||||
MessageBox.Show("用户名无效.请重试!"); | |||||
MessageLogNotify.GetInstance.ShowError("用户名无效"); | |||||
return; | |||||
} | |||||
var result = await HKLibHelper.DisableUser(res); | |||||
if (result) | |||||
{ | |||||
GetUser(); | |||||
MessageBox.Show($"用户:【{res}】 删除成功"); | |||||
MessageLogNotify.GetInstance.Show($"用户:【{res}】 删除成功"); | |||||
} | |||||
else | |||||
{ | |||||
MessageBox.Show($"用户:【{res}】 删除失败"); | |||||
MessageLogNotify.GetInstance.ShowError($"用户:【{res}】 删除失败"); | |||||
var res = dataGridView1.Rows[index].Cells[1].Value?.ToString(); | |||||
if (string.IsNullOrEmpty(res)) | |||||
{ | |||||
MessageBox.Show("用户名无效.请重试!"); | |||||
MessageLogNotify.GetInstance.ShowError("用户名无效"); | |||||
return; | |||||
} | |||||
if (MessageBox.Show($"确认是否删除[{res}]!", "操作", MessageBoxButtons.YesNo) == DialogResult.Yes) | |||||
{ | |||||
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) | catch (Exception ex) | ||||
{ | { | ||||
@@ -542,11 +547,13 @@ namespace HKCardManager.UserPages | |||||
message += "\n" + item.Key + "列表:\n"; | message += "\n" + item.Key + "列表:\n"; | ||||
(item.Value as List<UserDtoModel>)?.ForEach(par => | (item.Value as List<UserDtoModel>)?.ForEach(par => | ||||
{ | { | ||||
message += par.Name + "[" + par.OrgId + "]\n"; | |||||
message += par.Name + "[" + par.OrgId + "] "; | |||||
}); | }); | ||||
} | } | ||||
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"); | |||||
MessageLogNotify.GetInstance.Show($"批量录入成功!\n成功{RrrorUser["成功"].Count}条\n失败{(RrrorUser["名字重复"].Count + RrrorUser["机构不存在"].Count + RrrorUser["添加出错"].Count)}条\n"); | |||||
MessageLogNotify.GetInstance.Show($"{message}\n"); | |||||
MessageBox.Show($"批量录入成功!"); | |||||
} | } | ||||
catch (Exception ex) | catch (Exception ex) | ||||
{ | { | ||||
@@ -601,5 +608,58 @@ namespace HKCardManager.UserPages | |||||
} | } | ||||
} | } | ||||
#endregion | #endregion | ||||
/// <summary> | |||||
/// 查询 | |||||
/// </summary> | |||||
/// <param name="sender"></param> | |||||
/// <param name="e"></param> | |||||
private void button1_Click(object sender, EventArgs e) | |||||
{ | |||||
try | |||||
{ | |||||
if (string.IsNullOrEmpty(textBox1.Text)) | |||||
{ | |||||
MessageBox.Show("用户名不能为空.请重试!"); | |||||
MessageLogNotify.GetInstance.ShowError("用户名不能为空.请重试!"); | |||||
return; | |||||
} | |||||
string name=string.Empty; | |||||
bool cxindex = false; | |||||
int index = 0; | |||||
for (int i = 0; i < dataGridView1.Rows.Count; i++) | |||||
{ | |||||
this.dataGridView1.Rows[i].Selected = false; | |||||
var res = dataGridView1.Rows[i].Cells[1].Value?.ToString(); | |||||
if (string.IsNullOrEmpty(res)) | |||||
{ | |||||
MessageBox.Show("用户名无效.请重试!"); | |||||
MessageLogNotify.GetInstance.ShowError("用户名无效"); | |||||
return; | |||||
} | |||||
if (res.Contains(textBox1.Text)) | |||||
{ | |||||
cxindex = true; name = res; | |||||
this.dataGridView1.Rows[i].Selected = true; | |||||
index=i; | |||||
} | |||||
} | |||||
if (cxindex) | |||||
{ | |||||
dataGridView1.CurrentCell = dataGridView1.Rows[index].Cells[1]; | |||||
MessageBox.Show($"用户:【{name}】 查询成功,已定位到该用户!"); | |||||
MessageLogNotify.GetInstance.Show($"用户:【{name}】 查询成功,已定位到该用户!"); | |||||
} else | |||||
{ | |||||
MessageBox.Show($"未查询到用户..."); | |||||
MessageLogNotify.GetInstance.ShowError($"未查询到用户..."); | |||||
} | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
} | |||||
} | |||||
} | } | ||||
} | } |
@@ -247,4 +247,25 @@ | |||||
WSNRerYAAAAASUVORK5CYII= | WSNRerYAAAAASUVORK5CYII= | ||||
</value> | </value> | ||||
</data> | </data> | ||||
<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> | |||||
<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> | |||||
<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> | |||||
<metadata name="删除.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | |||||
<value>True</value> | |||||
</metadata> | |||||
</root> | </root> |