using DevExpress.CodeParser; using DevExpress.XtraEditors; using Furion.LinqBuilder; using HStation.Dto; using HStation.Vmo; using HStation.WinFrmUI.Organize.Core._00_UserControl; using Mapster; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Forms; namespace HStation.WinFrmUI.Organize { public partial class UpdateEmployeeDlg : DevExpress.XtraEditors.XtraForm { public UpdateEmployeeDlg() { InitializeComponent(); } string error; string NowErpCode = ""; HStation.Vmo.EmployeeMain _employee = new HStation.Vmo.EmployeeMain(); public void IncomingData(HStation.Vmo.EmployeeMain employee) { error = ""; NowErpCode = employee.ErpCode; this._employee = employee; emloyeeInfoCtrl.GetBindingData(_employee, out error); if (!string.IsNullOrEmpty(error)) { MessageBox.Show(error); return; } } private async void QueRensimpleButton_Click(object sender, EventArgs e) { var bll = new BLL.EmployeeMain(); error = ""; _employee = emloyeeInfoCtrl.SetBindingData(_employee, out error); if (!string.IsNullOrEmpty(error)) { MessageBox.Show(error); return; } HStation.Vmo.EmployeeMain employeeDate = await bll.GetByErpCode(_employee.ErpCode); if (employeeDate != null && !String.IsNullOrEmpty(_employee.ErpCode) && NowErpCode != _employee.ErpCode) { MessageBox.Show("编号重复,请重新输入!"); return; } if (!await bll.Update(_employee)) { MessageBox.Show("编辑失败!可能数据库连接失败!"); return; } MessageBox.Show("编辑成功!"); this.DialogResult = DialogResult.OK; this.Close(); } private void QuXiaosimpleButton_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; this.Close(); } } }