lixiaojun
2024-08-13 0859032a8242f870f2e717b7aeb8de42c2c86155
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
45
46
47
48
49
namespace HStation.WinFrmUI.Xhs
{
    public partial class AddProjectDlg : DevExpress.XtraEditors.XtraForm
    {
        public AddProjectDlg()
        {
            InitializeComponent();
        }
 
        public event Func<Vmo.Xhs.XhsProjectExtensions, Task<bool>> ReloadDataEvent;
 
        //数据验证
        private bool Valid()
        {
            return true;
        }
 
        //确定
        private async void BtnOk_Click(object sender, EventArgs e)
        {
            if (!Valid())
                return;
            var model = new Vmo.Xhs.XhsProjectExtensions();
            model.Address = this.TextAdress.Text.Trim();
            model.Customer = this.TextCustomerName.Text.Trim();
            model.Description = this.TextDescription.Text.Trim();
            model.Name = this.TextProjectName.Text.Trim();
            model.TagName = this.TextTagName.Text.Trim();
            model.SiteList = new List<Vmo.Xhs.XhsProjectSite>
            {
                new Vmo.Xhs.XhsProjectSite
                {
                    Name=this.TextProjectName.Text,
                    Description=this.TextDescription.Text,
                }
            };
            if (await this.ReloadDataEvent.Invoke(model))
            {
                MessageBoxHelper.ShowSuccess("添加成功!");
            }
            else
            {
                MessageBoxHelper.ShowError("添加失败!");
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}