ningshuxia
4 小时以前 71c12ff40d58c3dbdde6867396dd99224e57fc32
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
namespace HStation.WinFrmUI.Auth
{
    public partial class UpdateRoleDlg : DevExpress.XtraEditors.XtraForm
    {
        public UpdateRoleDlg()
        {
            InitializeComponent();
        }
        string error = "";
        Yw.Vmo.Role _role = new Yw.Vmo.Role();
        Yw.BLL.Role _service = new Yw.BLL.Role();
        public void IncomingData(Yw.Vmo.Role role)
        {
            error = "";
            _role = role;
            roleFrom.SetBangDingData(role, out error);
            if (!string.IsNullOrEmpty(error))
            {
                MessageBox.Show(error);
                return;
            }
        }
        //确定
        private async void simpleButtonQueDing_Click(object sender, EventArgs e)
        {
            if (e == null)
            {
                return;
            }
            error = "";
            Yw.Vmo.Role thisrole = new Yw.Vmo.Role();
            thisrole = _role;
            var b = thisrole.UseStatus;//修改前
            thisrole = roleFrom.OperateData(out error, thisrole);
            if (!string.IsNullOrEmpty(error))
            {
                MessageBox.Show(error);
                return;
            }
            List<Yw.Vmo.Role> AllRole = await _service.GetAll();
            foreach (Yw.Vmo.Role emp in AllRole)
            {
                if (emp.Code == thisrole.Code && thisrole.Code != _role.Code)
                {
                    MessageBox.Show("编号重复!请重新输入!");
                    return;
                }
            }
            var a = thisrole.UseStatus;//修改后
            if (!await _service.Update(thisrole))
            {
                MessageBox.Show("添加失败!");
                return;
            }
            MessageBox.Show("编辑成功!");
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        //取消
        private void simpleButtonQuXiao_Click(object sender, EventArgs e)
        {
            if (e == null)
            {
                return;
            }
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}