namespace HStation.WinFrmUI.Basic { public partial class EditSysFlagDlg : DevExpress.XtraEditors.XtraForm { public EditSysFlagDlg() { InitializeComponent(); this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; } public event Func> ReloadDataEvent = null; private Yw.Vmo.SysFlagVmo _UpdateFlagDto { get; set; } public async void SetBindingData(long ID) { var bll = new Yw.BLL.SysFlag(); var model = await bll.GetByID(ID); _UpdateFlagDto = model; this.TextEditName.Text = _UpdateFlagDto.Name; this.TextEditDescription.Text = _UpdateFlagDto.Description; } //数据验证 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; _UpdateFlagDto.Name = TextEditName.Text.Trim(); _UpdateFlagDto.Description = TextEditDescription.Text.Trim(); if (await this.ReloadDataEvent.Invoke(_UpdateFlagDto)) { MessageBoxHelper.ShowSuccess("修改成功!"); } else { MessageBoxHelper.ShowError("修改失败!"); } this.DialogResult = DialogResult.OK; this.Close(); } } }