duheng
2024-04-15 154d4c352b9ab06a925451f1fdcea6afd1701e10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using DevExpress.XtraEditors;
 
namespace ISupply.WinFrm.Main
{
    public partial class AddSyStemTypeDlg : DevExpress.XtraEditors.XtraForm
    {
        public AddSyStemTypeDlg()
        {
            InitializeComponent();
        }
 
        public event Func<Model.SystemType, bool> ReloadEvent;
 
 
 
        //验证
        private bool Valid()
        {
            this.dxErrorProvider1.ClearErrors();
            if (string.IsNullOrEmpty(this.TxtName.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.TxtName, "必填项");
                return false;
            }
            return true;
        }
 
 
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!Valid()) return;
            var model = new Model.SystemType();
            model.Name = this.TxtName.Text;
            model.TagName = this.TagName.Text;
            model.Description = this.TxtDescription.Text;
            model.UseStatus = Model.eUseStatus.Enable;
            if (ReloadEvent(model))
            {
                XtraMessageBox.Show("添加成功!");
            }
            this.Close();
        }
    }
}