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