| | |
| | | public EmployeeMgrMainPanel() |
| | | { |
| | | InitializeComponent(); |
| | | DateChanged(); |
| | | DateShow(); |
| | | //ShowEmloyee(); |
| | | } |
| | | |
| | | List<EmployeeViewModel> _AllEmployee = new List<EmployeeViewModel>(); |
| | | |
| | | private void DateChanged() |
| | | private void DateShow() |
| | | { |
| | | HStation.Service.EmployeeMain _service = new(); |
| | | _AllEmployee.Clear(); |
| | |
| | | } |
| | | dlg.SetDate(currentVm.ID); |
| | | dlg.ShowDialog(); |
| | | DateChanged(); |
| | | DateShow(); |
| | | this.employeeViewModelBindingSource.ResetBindings(false); |
| | | } |
| | | |
| | | //删除 |
| | | 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 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("删除成功!"); |
| | | } |
| | | } |
| | | } |
| | | // 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("删除成功!"); |
| | | // } |
| | | // } |
| | | //} |
| | | } |
| | | } |