using Mapster; namespace HStation.WinFrmUI.Xhs.PumpProduct { public partial class EditPumpProductSeriesDlg : DevExpress.XtraEditors.XtraForm { public EditPumpProductSeriesDlg() { InitializeComponent(); this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; } public event Func> ReloadDataEvent = null; private Vmo.AssetsPumpSeriesVmo _UpdataeAssetsPumpSeriesDto = null; public void SetBindingData(Vmo.AssetsPumpSeriesVmo seriesVmo) { _UpdataeAssetsPumpSeriesDto = seriesVmo; this.NameTextEdit.Text = _UpdataeAssetsPumpSeriesDto.Name; this.DescriptionTextEdit.Text = _UpdataeAssetsPumpSeriesDto.Description; this.TagNameTextEdit.Text = _UpdataeAssetsPumpSeriesDto.TagName; this.MotorFrequencyTextEdit.Text = _UpdataeAssetsPumpSeriesDto.MotorFrequency; } //数据验证 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) { _UpdataeAssetsPumpSeriesDto.Name = NameTextEdit.Text.Trim(); _UpdataeAssetsPumpSeriesDto.TagName = TagNameTextEdit.Text.Trim(); if (await this.ReloadDataEvent.Invoke(_UpdataeAssetsPumpSeriesDto)) { MessageBoxHelper.ShowSuccess("编辑成功!"); } else { MessageBoxHelper.ShowError("编辑失败!"); } this.DialogResult = DialogResult.OK; this.Close(); } } }