123
tangxu
2024-07-25 65e211e44704a9ca155cbd31d990c2ad62b34e93
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using DevExpress.XtraEditors;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
namespace IStation.WinFrmUI.Basic.basic.pumpmgr
{
    public partial class AddPumpDlg : DevExpress.XtraEditors.XtraForm
    {
        public AddPumpDlg()
        {
            InitializeComponent();
        }
 
        public event Func<Model.Product<Model.Pump>,bool>  ReloadBingData=null;
        private Model.Product<Model.Pump> _model=null;
 
 
        public void SetbindingData()
        {
 
        }
 
        private bool  Virify()
        {
            this.dxErrorProvider1.ClearErrors();
            if (string.IsNullOrEmpty(this.txtNameEdit.Text))
            {
                this.dxErrorProvider1.SetError(this.txtNameEdit,"必填项");
                return false;
            }
            return true;
        }
 
        //确定
        private void BtnOk_Click(object sender, EventArgs e)
        {
            if (!Virify())
                return;
            var pump= new Model.Pump();
            _model = new Model.Product<Model.Pump>();
            double Qr = 0;
            if (double.TryParse(this.txtQrEdit.Text, out Qr))       //尝试类型转换
                pump.Qr = Qr;
            double er = 0;
            if (double.TryParse(this.txtErEdit.Text, out er))
                pump.Er = er;
            double hr = 0;
            if (double.TryParse(this.txtHrEdit.Text, out hr))
                pump.Hr = hr;
            double oc = 0;
            if (double.TryParse(this.txtOcEdit.Text, out oc))
                pump.Oc = oc;
            double pr = 0;
            if (double.TryParse(this.txtPrEdit.Text, out pr))
                pump.Pr = pr;
            double nr = 0;
            if (double.TryParse(this.txtNrEdit.Text, out nr))
                pump.Nr = nr;
            int str = 0;
            if (int.TryParse(this.txtStNumrEdit.Text, out str))
                pump.StNumr = str;
            int ic = 0;
            if (int.TryParse(this.txtlcEdit.Text, out ic))
                pump.Ic = ic;
            _model.Name = this.txtNameEdit.Text;
            _model.Supplier = this.txtSupplierEdit.Text;
            pump.IsBp = txtIsBpEdit.Checked;
            pump.IsSxp = txtIsSxpEdit.Checked;
            _model.RatedParas = (pump);
            var isOk = this.ReloadBingData.Invoke(_model);
            if (isOk == false)
            {
                XtraMessageBox.Show("添加失败!");
                return;
            }
            XtraMessageBox.Show("添加成功!");
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
 
 
    }
}