namespace HStation.WinFrmUI.Assets
|
{
|
public partial class EditPumpTypeDlg : DevExpress.XtraEditors.XtraForm
|
{
|
public EditPumpTypeDlg()
|
{
|
InitializeComponent();
|
this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon;
|
}
|
|
public event Func<Vmo.PumpTypeVmo, Task<bool>> ReloadDataEvent = null;
|
|
private Vmo.PumpTypeVmo _PumpType;
|
|
public async void SetBindingData(long TypeID)
|
{
|
var bll = new BLL.PumpType();
|
_PumpType = await bll.GetByID(TypeID);
|
if (_PumpType != null)
|
{
|
this.TextEditName.Text = _PumpType.Name;
|
this.memoEditDescription.Text = _PumpType.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_Click(object sender, EventArgs e)
|
{
|
_PumpType.Name = TextEditName.Text.Trim();
|
_PumpType.Description = memoEditDescription.Text.Trim();
|
if (await this.ReloadDataEvent.Invoke(_PumpType))
|
{
|
MessageBoxHelper.ShowSuccess("修改成功!");
|
}
|
else
|
{
|
MessageBoxHelper.ShowError("修改失败!");
|
}
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
}
|
}
|