| | |
| | | using Yw.WinFrmUI; |
| | | using DevExpress.CodeParser; |
| | | using DevExpress.XtraEditors.TextEditController.Win32; |
| | | using DevExpress.XtraGrid; |
| | | using HStation.Vmo; |
| | | using HStation.WinFrmUI.Organize.Core._00_UserControl; |
| | | using HStation.WinFrmUI.Organize.Core._02_Employee; |
| | | using Mapster; |
| | | using Yw.WinFrmUI; |
| | | using static DevExpress.Xpo.DB.DataStoreLongrunnersWatch; |
| | | |
| | | namespace HStation.WinFrmUI.Organize |
| | | { |
| | |
| | | public EmployeeMgrMainPanel() |
| | | { |
| | | InitializeComponent(); |
| | | DateShow(); |
| | | //ShowEmloyee(); |
| | | } |
| | | |
| | | private async void simpleButton1_Click(object sender, EventArgs e) |
| | | List<HStation.Vmo.EmployeeMain> _AllEmployee = new List<HStation.Vmo.EmployeeMain>(); |
| | | |
| | | private async void DateShow() |
| | | { |
| | | var bll = new BLL.EmployeeMain(); |
| | | await bll.Insert(new Dto.AddEmployeeMainDto |
| | | HStation.BLL.EmployeeMain _service = new(); |
| | | _AllEmployee.Clear(); |
| | | var _All = await _service.GetAll(); |
| | | foreach (HStation.Vmo.EmployeeMain emp in _All) |
| | | { |
| | | ErpCode = "1", |
| | | PositonName = "测试", |
| | | StaffStatus = 1, |
| | | Telephone = 11111.ToString(), |
| | | AddTime = DateTime.Now, |
| | | AddUser = "432", |
| | | LastName = "32323", |
| | | RequirePasswordReset = 1, |
| | | DrawSignal = "432312w", |
| | | FirstName = "3243", |
| | | Email = "23232323@", |
| | | LastModifyUser = "43241", |
| | | }); |
| | | |
| | | var mapbll = new BLL.UserLoginMap(); |
| | | await mapbll.Insert(new Dto.AddUserLoginMapDto |
| | | { |
| | | ObjectType = Service.Organize.eObjectType.Employee, |
| | | ObjectID = 1123, |
| | | LoginID = 123213, |
| | | }); |
| | | |
| | | var loginbll = new BLL.LoginUserMain(); |
| | | await loginbll.Insert(new Dto.AddLoginUserMainDto |
| | | { |
| | | LoginName = "xhsadmin", |
| | | PassWord = "123456", |
| | | CreateTime = DateTime.Now, |
| | | }); |
| | | _AllEmployee.Add(emp); |
| | | } |
| | | employeeViewModelBindingSource.DataSource = _AllEmployee; |
| | | this.employeeViewModelBindingSource.ResetBindings(false); |
| | | } |
| | | |
| | | |
| | | |
| | | //添加 |
| | | private void BtnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var dlg = new AddEmployeeDlg(); |
| | | dlg.ShowDialog(); |
| | | var dlg = new AddEmployeeDlg(); |
| | | if (dlg.ShowDialog() != DialogResult.OK) |
| | | { |
| | | return; |
| | | } |
| | | DateShow(); |
| | | this.employeeViewModelBindingSource.ResetBindings(false); |
| | | } |
| | | |
| | | //编辑 |
| | | private void barBtnEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var dlg = new UpdateEmployeeDlg(); |
| | | var currentVm = this.gridView1.GetCurrentViewModel(_AllEmployee); |
| | | if (currentVm == null) |
| | | { |
| | | MessageBoxHelper.ShowWarning("请选择数据行"); |
| | | return; |
| | | } |
| | | dlg.IncomingData(currentVm); |
| | | if (dlg.ShowDialog() == DialogResult.OK) |
| | | { |
| | | DateShow(); |
| | | this.employeeViewModelBindingSource.ResetBindings(false); |
| | | } |
| | | |
| | | } |
| | | |
| | | //删除 |
| | | private void BtnDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | } |
| | | ////删除 |
| | | //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("删除成功!"); |
| | | // } |
| | | // } |
| | | //} |
| | | } |
| | | } |