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;
|
}
|
|
|
}
|
|
|
|
|
|
}
|
}
|