lixiaojun
2024-10-25 1e18310601b076d26329bb0a0e070afeb61d12f4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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();
        }
    }
}