using DevExpress.XtraEditors;
|
using HStation.Dto;
|
using HStation.WinFrmUI;
|
using HStation.WinFrmUI.Xhs.Project;
|
using System;
|
using Yw.Dto;
|
|
namespace ISupply.WinFrmUI
|
{
|
public partial class EditProjectDlg : DevExpress.XtraEditors.XtraForm
|
{
|
public EditProjectDlg()
|
{
|
InitializeComponent();
|
}
|
|
private UpdateXhsProjectInput _UpdateXhsProjectInput = null;
|
|
public event Func<UpdateXhsProjectInput, Task<bool>> ReloadEvent = null;
|
|
public void SetBindingData(XhsProjectDto xhsProjectDto)
|
{
|
this.NameTextEdit.Text = xhsProjectDto.Name;
|
this.CustomerNameTextEdit.Text = xhsProjectDto.CustomerName;
|
this.DescriptionTextEdit.Text = xhsProjectDto.Description;
|
this.AddressTextEdit.Text = xhsProjectDto.Address;
|
}
|
|
//验证
|
private bool Valid()
|
{
|
this.dxErrorProvider1.ClearErrors();
|
if (string.IsNullOrEmpty(this.NameTextEdit.Text.Trim()))
|
{
|
this.dxErrorProvider1.SetError(this.NameTextEdit, "必填项");
|
return false;
|
}
|
|
var tagName = this.ModleTextEdit.Text.Trim();
|
if (string.IsNullOrEmpty(tagName))
|
{
|
this.dxErrorProvider1.SetError(this.ModleTextEdit, "重复");
|
return false;
|
}
|
|
return true;
|
}
|
|
//确定
|
private async void btnOk_Click(object sender, EventArgs e)
|
{
|
if (!Valid())
|
return;
|
_UpdateXhsProjectInput = new UpdateXhsProjectInput();
|
_UpdateXhsProjectInput.Name = this.NameTextEdit.Text.Trim();
|
_UpdateXhsProjectInput.CustomerName = this.CustomerNameTextEdit.Text.Trim();
|
_UpdateXhsProjectInput.CreateTime = DateTime.Now;
|
_UpdateXhsProjectInput.Description = this.DescriptionTextEdit.Text.Trim();
|
if (await this.ReloadEvent.Invoke(_UpdateXhsProjectInput))
|
{
|
MessageBoxHelper.ShowSuccess("添加成功!");
|
}
|
else
|
{
|
MessageBoxHelper.ShowError("添加失败!");
|
}
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
|
//初始化
|
private void AddProjectDlg_Load(object sender, EventArgs e)
|
{
|
}
|
}
|
}
|