From a434b83043a5646d5dd99c3e934cc8a30ac6165f Mon Sep 17 00:00:00 2001
From: Shuxia Ning <NingShuxia0927@outlook.com>
Date: 星期二, 29 十月 2024 13:29:35 +0800
Subject: [PATCH] 曲线修改

---
 WinFrmUI/HStation.WinFrmUI.Organize.Core/02-Employee/EmployeeMgrMainPanel.cs |   57 +++++++++++++++++++++++++++------------------------------
 1 files changed, 27 insertions(+), 30 deletions(-)

diff --git a/WinFrmUI/HStation.WinFrmUI.Organize.Core/02-Employee/EmployeeMgrMainPanel.cs b/WinFrmUI/HStation.WinFrmUI.Organize.Core/02-Employee/EmployeeMgrMainPanel.cs
index c38d910..b24d832 100644
--- a/WinFrmUI/HStation.WinFrmUI.Organize.Core/02-Employee/EmployeeMgrMainPanel.cs
+++ b/WinFrmUI/HStation.WinFrmUI.Organize.Core/02-Employee/EmployeeMgrMainPanel.cs
@@ -35,7 +35,7 @@
             employeeModelBindingSource.DataSource = _AllEmployee;
             this.employeeModelBindingSource.ResetBindings(false);
         }
-       
+
 
         //娣诲姞
         private void BtnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
@@ -46,7 +46,6 @@
                 return;
             }
             DateShow();
-            this.employeeModelBindingSource.ResetBindings(false);
         }
 
         //缂栬緫
@@ -61,11 +60,11 @@
                 return;
             }
             dlg.IncomingData(currentVm);
-            if (dlg.ShowDialog() == DialogResult.OK)
+            if (dlg.ShowDialog() != DialogResult.OK)
             {
-                DateShow();
-                this.employeeModelBindingSource.ResetBindings(false);
+                return;
             }
+            DateShow();
 
         }
 
@@ -81,7 +80,7 @@
 
                 e.Value = employee.StaffStatus == eJobType.exist ? "鍦ㄨ亴" : "绂昏亴";
             }
-            if(e.Column == colRequirePasswordReset)
+            if (e.Column == colRequirePasswordReset)
             {
                 var employee = e.Row as HStation.Vmo.EmployeeMain;
                 if (employee == null)
@@ -93,30 +92,28 @@
 
 
         }
+        //鍒犻櫎
+        private async void barButtonItemDelEmployee_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
+        {
+            var currentVm = this.gridView1.GetCurrentViewModel(_AllEmployee);
+            HStation.BLL.EmployeeMain _service = new();
+            if (currentVm == null)
+            {
+                MessageBox.Show("璇烽�夋嫨鏁版嵁琛岋紒");
+                return;
+            }
+            if (MessageBox.Show("纭鍒犻櫎杩欎釜鍛樺伐鍚楋紵" , "鍒犻櫎", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
+            {
+                return;
+            }
+            if (await _service.DeleteByID(currentVm.EmployeeID))
+            {
+                _AllEmployee.Remove(currentVm);
+                this.employeeModelBindingSource.ResetBindings(false);
+                MessageBox.Show("鍒犻櫎鎴愬姛!");
+            }
+        }
 
-        ////鍒犻櫎
-        //private async void BtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
-        //{
-        //    var bll = new BLL.EmployeeMain();
-        //    var currentVm = this.gridView1.GetCurrentViewModel(_AllEmployee);
-        //    if (currentVm == null)
-        //    {
-        //        MessageBox.Show("璇烽�夋嫨鏁版嵁琛岋紒");
-        //    }
-        //    else
-        //    {
-
-        //        if (MessageBox.Show("纭鍒犻櫎鍛樺伐" + currentVm.ID + "鍚楋紵", "鍒犻櫎", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
-        //        {
-        //            return;
-        //        }
-        //        if (await bll.DeleteByID(currentVm.ID))
-        //        {
-        //            _AllEmployee.Remove(currentVm);
-        //            this.employeeViewModelBindingSource.ResetBindings(false);
-        //            MessageBox.Show("鍒犻櫎鎴愬姛!");
-        //        }
-        //    }
-        //}
+       
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3