using DevExpress.XtraEditors; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace HStation.WinFrmUI.Organize.Core._02_Employee { public partial class AddEmployeeDlg : DevExpress.XtraEditors.XtraForm { public AddEmployeeDlg() { InitializeComponent(); } //确定 private async void simpleButtonOK_Click(object sender, EventArgs e) { var bll = new BLL.EmployeeMain(); string error; HStation.Vmo.EmployeeMain employee =new Vmo.EmployeeMain(); employee = emloyeeInfoCtrl.SetBindingData(employee, out error); //var a = employee.AddTime; //var b =employee.LastModifyTime; if (!string.IsNullOrEmpty(error)) { MessageBox.Show(error); return; } var employeeDate = await bll.GetByErpCode(employee.ErpCode) ; if (employeeDate != null && !String.IsNullOrEmpty(employee.ErpCode)) { MessageBox.Show("编号重复,请重新输入!"); return; } var ids = await bll.InsertEx(employee); //var a =employee.FirstName; if (ids == null) { MessageBox.Show("添加失败!可能数据库连接失败!"); return; } this.DialogResult = DialogResult.OK; MessageBox.Show("添加成功!"); this.Close(); } //取消 private void simpleButtonCancel_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; this.Close(); } //private void AddEmployeeDlg_Load(object sender, EventArgs e) //{ // emloyeeInfoCtrl.SetBindingData(null); //} //private async void QueDingsimpleButton_Click(object sender, EventArgs e) //{ // string error; // var employe = emloyeeInfoCtrl.GetBindingData(out error); // if (employe == null) // { // MessageBox.Show(error); // return; // } // // var bll = new BLL.EmployeeMain(); // EmployeeMain employeeDate = await bll.GetByErpCode(emloyeeInfoCtrl.GetBindingData(out error).ErpCode); // if (employeeDate != null && String.IsNullOrEmpty(emloyeeInfoCtrl.GetBindingData(out error).ErpCode)) // { // MessageBox.Show("编号重复,请重新输入!"); // return; // } // var ids = await bll.InsertEx(employe); // if (ids == null) // { // 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(); //} } }