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