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