using DevExpress.XtraEditors.Controls;
|
|
namespace HStation.WinFrmUI.Assets
|
{
|
public partial class AddValveSeriesDlg : DevExpress.XtraEditors.XtraForm
|
{
|
public AddValveSeriesDlg()
|
{
|
InitializeComponent();
|
}
|
|
public event Func<Vmo.ValveSeries, Task<bool>> ReloadDataEvent = null;
|
|
private Yw.BLL.SysCatalog _bll = null;
|
|
//数据验证
|
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)
|
{
|
if (!Valid())
|
return;
|
var model = new Vmo.ValveSeries();
|
model.Name = NameTextEdit.Text;
|
|
if (await this.ReloadDataEvent.Invoke(model))
|
{
|
MessageBoxHelper.ShowSuccess("添加成功!");
|
}
|
else
|
{
|
MessageBoxHelper.ShowError("添加失败!");
|
}
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
}
|
}
|