duheng
2024-09-15 c4d0807d911a3ee09cffaa9942638ea41cd414f6
WinFrmUI/HStation.WinFrmUI.Assets.Core/05-valveManage/01-series/AddValveSeriesDlg.cs
@@ -1,6 +1,4 @@
using DevExpress.XtraEditors.Controls;
namespace HStation.WinFrmUI.Assets
namespace HStation.WinFrmUI.Assets
{
    public partial class AddValveSeriesDlg : DevExpress.XtraEditors.XtraForm
    {
@@ -10,6 +8,12 @@
        }
        public event Func<Vmo.ValveSeriesVmo, Task<bool>> ReloadDataEvent = null;
        //初始化
        private void AddValveSeriesDlg_Load(object sender, EventArgs e)
        {
            TextEditType.Properties.AddEnum(typeof(HStation.Service.Assets.eValveSeriesType));
        }
        //数据验证
        private bool Valid()
@@ -30,14 +34,19 @@
                return;
            var model = new Vmo.ValveSeriesVmo();
            model.Name = NameTextEdit.Text;
            if (Enum.TryParse(Convert.ToString(TextEditType.EditValue), true, out HStation.Service.Assets.eValveSeriesType valvetype))
            {
                model.Type = valvetype;
            }
            model.TagName = TagNameTextEdit.Text;
            model.Description = DescriptionTextEdit.Text;
            if (await this.ReloadDataEvent.Invoke(model))
            {
                TipFormHelper.ShowSucceed("添加成功!");
            }
            else
            {
                TipFormHelper.ShowSucceed("添加失败!");
                TipFormHelper.ShowError("添加失败!");
            }
            this.DialogResult = DialogResult.OK;
            this.Close();