lixiaojun
2024-11-30 ff39bbf7e3a3d02f7f051ce1bee06cec007be3ff
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
namespace HStation.WinFrmUI.Auth
{
    public partial class RoleInfoCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        public RoleInfoCtrl()
        {
            InitializeComponent();
        }
        Yw.Vmo.Role _Role = new Yw.Vmo.Role();
 
        public void SetBangDingData(Yw.Vmo.Role role, out string error)
        {
            error = "";
            if (role.ID == 0)
            {
                error = "入参为空!";
                return;
            }
            textEditRoleCode.Text = role.Code;
            textEditRole.Text = role.Name;
            textEditCorpID.Text = role.CorpID.ToString();
            if (role.UseStatus == Yw.Vmo.eUseStatus.Disable)
            {
                imageComboBoxEditUseStatus.SelectedIndex = 0;
            }
            else
            {
                imageComboBoxEditUseStatus.SelectedIndex = 1;
            }
            textEditDescription.Text = role.Description;
        }
        public Yw.Vmo.Role GetBangDingData(out string error)
        {
            error = "";
            Yw.Vmo.Role role = new Yw.Vmo.Role();
            role = _Role;
            dxValidationProviderIsNotBlank.Validate();
            if (string.IsNullOrEmpty(textEditCorpID.Text))
            {
                error = "请输入客户ID!";
                return null;
            }
            if (string.IsNullOrEmpty(textEditRoleCode.Text))
            {
                error = "请输入角色编号!";
                return null;
            }
            if (string.IsNullOrEmpty(textEditRole.Text))
            {
                error = "请输入角色名称!";
                return null;
            }
            role.Code = textEditRoleCode.Text;
            role.Name = textEditRole.Text;
            role.Description = textEditDescription.Text;
            long Id;
            if (!long.TryParse(textEditCorpID.Text, out Id))
            {
                error = "请输入纯数字格式的客户ID!";
                return null;
            }
            role.CorpID = Id;
            if (imageComboBoxEditUseStatus.SelectedIndex == 0)
            {
                role.UseStatus = Yw.Vmo.eUseStatus.Disable;
            }
            else
            {
                role.UseStatus = Yw.Vmo.eUseStatus.Enable;
            }
 
            return role;
        }
        public Yw.Vmo.Role OperateData(out string error, Yw.Vmo.Role role)
        {
            error = "";
            this._Role = role;
            if (_Role.ID == 0)
            {
                _Role = GetBangDingData(out error);
                if (!string.IsNullOrEmpty(error))
                {
                    return null;
                }
                return _Role;
            }
            else
            {
                _Role = GetBangDingData(out error);
                if (_Role.ID == 0)
                {
                    error = "出现错误!";
                    return null;
                }
                if (!string.IsNullOrEmpty(error))
                {
                    return null;
                }
                return _Role;
            }
 
 
        }
 
 
 
 
 
    }
}