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