From 4cb1f00f84d160f97afd0fb86cf600e1be667dd5 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期四, 17 十月 2024 11:22:15 +0800 Subject: [PATCH] 水力组件更新 --- WinFrmUI/HStation.WinFrmUI.Organize.Core/02-Employee/EmployeeMgrMainPanel.cs | 86 +++++++++++++++++++++++++++--------------- 1 files changed, 55 insertions(+), 31 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Organize.Core/02-Employee/EmployeeMgrMainPanel.cs b/WinFrmUI/HStation.WinFrmUI.Organize.Core/02-Employee/EmployeeMgrMainPanel.cs index 9c2bf80..b24d832 100644 --- a/WinFrmUI/HStation.WinFrmUI.Organize.Core/02-Employee/EmployeeMgrMainPanel.cs +++ b/WinFrmUI/HStation.WinFrmUI.Organize.Core/02-Employee/EmployeeMgrMainPanel.cs @@ -26,26 +26,26 @@ HStation.BLL.EmployeeMain _service = new(); _AllEmployee.Clear(); var _All = await _service.GetAll(); + foreach (HStation.Vmo.EmployeeMain emp in _All) { + //HStation.WinFrmUI.Organize.EmployeeViewModel All = new HStation.WinFrmUI.Organize.EmployeeViewModel(emp); _AllEmployee.Add(emp); } - employeeViewModelBindingSource.DataSource = _AllEmployee; - this.employeeViewModelBindingSource.ResetBindings(false); + employeeModelBindingSource.DataSource = _AllEmployee; + this.employeeModelBindingSource.ResetBindings(false); } - //娣诲姞 private void BtnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { - var dlg = new AddEmployeeDlg(); + var dlg = new AddEmployeeDlg(); if (dlg.ShowDialog() != DialogResult.OK) { return; } DateShow(); - this.employeeViewModelBindingSource.ResetBindings(false); } //缂栬緫 @@ -53,43 +53,67 @@ { var dlg = new UpdateEmployeeDlg(); var currentVm = this.gridView1.GetCurrentViewModel(_AllEmployee); + //var a =currentVm.ErpCode; if (currentVm == null) { MessageBoxHelper.ShowWarning("璇烽�夋嫨鏁版嵁琛�"); return; } dlg.IncomingData(currentVm); - if (dlg.ShowDialog() == DialogResult.OK) + if (dlg.ShowDialog() != DialogResult.OK) { - DateShow(); - this.employeeViewModelBindingSource.ResetBindings(false); + return; } + DateShow(); } - ////鍒犻櫎 - //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 - // { + private void gridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e) + { + if (e.Column == colStaffStatus) + { + var employee = e.Row as HStation.Vmo.EmployeeMain; + if (employee == null) + { + return; + } - // 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("鍒犻櫎鎴愬姛!"); - // } - // } - //} + e.Value = employee.StaffStatus == eJobType.exist ? "鍦ㄨ亴" : "绂昏亴"; + } + if (e.Column == colRequirePasswordReset) + { + var employee = e.Row as HStation.Vmo.EmployeeMain; + if (employee == null) + { + return; + } + e.Value = employee.RequirePasswordReset == 1 ? "鏄�" : "鍚�"; + } + + + } + //鍒犻櫎 + 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("鍒犻櫎鎴愬姛!"); + } + } + + } } \ No newline at end of file -- Gitblit v1.9.3