namespace HStation.WinFrmUI.Basic
|
{
|
public partial class AddSysFlagDlg : DevExpress.XtraEditors.XtraForm
|
{
|
public AddSysFlagDlg()
|
{
|
InitializeComponent();
|
this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
|
}
|
|
public event Func<Yw.Vmo.SysFlagVmo, Task<bool>> ReloadDataEvent = null;
|
|
private Yw.Vmo.SysFlagVmo _AddFlagDto { get; set; }
|
|
public void SetBindingData(long typeId)
|
{
|
_AddFlagDto = new Yw.Vmo.SysFlagVmo();
|
_AddFlagDto.TypeID = typeId;
|
}
|
|
//数据验证
|
private bool Valid()
|
{
|
this.dxErrorProvider1.ClearErrors();
|
if (string.IsNullOrEmpty(TextEditName.Text.Trim()))
|
{
|
this.dxErrorProvider1.SetError(this.TextEditName, "必填项");
|
return false;
|
}
|
return true;
|
}
|
|
//完成
|
private async void BtnOk_ClickAsync(object sender, EventArgs e)
|
{
|
if (!Valid())
|
return;
|
_AddFlagDto.Name = TextEditName.Text.Trim();
|
_AddFlagDto.Description = TextEditDescription.Text.Trim();
|
if (await this.ReloadDataEvent.Invoke(_AddFlagDto))
|
{
|
MessageBoxHelper.ShowSuccess("添加成功!");
|
}
|
else
|
{
|
MessageBoxHelper.ShowError("添加失败!");
|
}
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
}
|
}
|