lixiaojun
2024-10-18 1fe41eb1c9f2b2914b4a66a145f1ad0a75b9c915
WinFrmUI/HStation.WinFrmUI.Organize.Core/02-Employee/AddEmployeeDlg.cs
@@ -1,4 +1,15 @@
namespace HStation.WinFrmUI.Organize
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
    {
@@ -6,19 +17,90 @@
        {
            InitializeComponent();
        }
        //完成
        private async void BtnOk_Click(object sender, EventArgs e)
        //确定
        private async void simpleButtonOK_Click(object sender, EventArgs e)
        {
            var bll = new BLL.EmployeeMain();
            await bll.InsertLoginUserEx(new Dto.AddEmployeeMainDto
            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))
            {
                AddTime = DateTime.Now,
            }, new Dto.AddUserLoginMapDto
                MessageBox.Show(error);
                return;
            }
            var employeeDate = await bll.GetByErpCode(employee.ErpCode) ;
            if (employeeDate != null && !String.IsNullOrEmpty(employee.ErpCode))
            {
                ObjectType = Service.Organize.eObjectType.Employee,
                ObjectID = 1123
            }, new Dto.AddLoginUserMainDto { LoginName = "duheng", PassWord = "123" });
                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();
        //}
    }
}