using Mapster;
|
using Yw.Basic;
|
using Yw.Dto;
|
|
namespace HStation.WinFrmUI.Xhs.Project
|
{
|
public partial class AddPropDlg : DevExpress.XtraEditors.XtraForm
|
{
|
public AddPropDlg()
|
{
|
InitializeComponent();
|
}
|
|
public event Func<Yw.Dto.AddSysPropInput, Task<bool>> ReloadDataEvent = null;
|
|
private AddSysPropInput _AddPropDto { get; set; }
|
|
public async void SetBindingData(long GroupID)
|
{
|
_AddPropDto = new AddSysPropInput();
|
_AddPropDto.GroupID = GroupID;
|
}
|
|
//数据验证
|
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_ClickAsync(object sender, EventArgs e)
|
{
|
_AddPropDto.Name = TextEditName.Text.Trim();
|
_AddPropDto.Description = TextEditDescription.Text.Trim();
|
_AddPropDto.Code = TextEditCode.Text.Trim();
|
if (await this.ReloadDataEvent.Invoke(_AddPropDto))
|
{
|
MessageBoxHelper.ShowSuccess("添加成功!");
|
}
|
else
|
{
|
MessageBoxHelper.ShowError("添加失败!");
|
}
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
}
|
}
|