namespace HStation.WinFrmUI.Xhs.PumpProduct { public partial class AddPumpProductGroupDlg : DevExpress.XtraEditors.XtraForm { public AddPumpProductGroupDlg() { InitializeComponent(); this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; } public event Func> ReloadDataEvent = null; private Vmo.AssetsPumpGroupVmo _AddAssetsPumpGroupDto { get; set; } public void SetBindingData(long ID) { _AddAssetsPumpGroupDto = new Vmo.AssetsPumpGroupVmo(); _AddAssetsPumpGroupDto.PumpSeriesID = ID; } //数据验证 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) { _AddAssetsPumpGroupDto.TagName = TagNameTextEdit.Text.Trim(); _AddAssetsPumpGroupDto.Name = NameTextEdit.Text.Trim(); _AddAssetsPumpGroupDto.Description = DescriptionTextEdit.Text.Trim(); if (await this.ReloadDataEvent.Invoke(_AddAssetsPumpGroupDto)) { MessageBoxHelper.ShowSuccess("添加成功!"); } else { MessageBoxHelper.ShowError("添加失败!"); } this.DialogResult = DialogResult.OK; this.Close(); } } }