ningshuxia
2025-03-13 25d1bf4c50f43cf6690c5ac92824959865c9d78f
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
namespace PBS.WinFrmUI
{
    public partial class FacilitiesCtrl : DevExpress.XtraEditors.XtraUserControl
    {
        public FacilitiesCtrl()
        {
            InitializeComponent();
            this.Load += FacilitiesCtrl_Load;
        }
 
        private void FacilitiesCtrl_Load(object sender, EventArgs e)
        {
            SetBindingData();
        }
 
        //基础验证
        public bool Valid()
        {
            bool isExist = true;
            this.dxErrorProvider1.ClearErrors();
            if (string.IsNullOrEmpty(this.txtName.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.txtName, "必填项");
                isExist = false;
            }
            if (string.IsNullOrEmpty(this.txtFloor.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.txtFloor, "必填项");
                isExist = false;
            }
            if (string.IsNullOrEmpty(this.txtFloorHeight.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.txtFloorHeight, "必填项");
                isExist = false;
            }
            if (string.IsNullOrEmpty(this.txtFloorHouseHolds.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.txtFloorHouseHolds, "必填项");
                isExist = false;
            }
            if (string.IsNullOrEmpty(this.txtConstantP.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.txtConstantP, "必填项");
                isExist = false;
            }
            if (this.comboBoxCompletePlant.Text == "请选择")
            {
                this.dxErrorProvider1.SetError(this.comboBoxCompletePlant, "必填项");
                isExist = false;
            }
            if (this.comboBoxWaterSupply.Text == "请选择")
            {
                this.dxErrorProvider1.SetError(this.comboBoxWaterSupply, "必填项");
                isExist = false;
            }
            if (string.IsNullOrEmpty(this.txtMaxWaterDemand.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.txtMaxWaterDemand, "必填项");
                return false;
            }
            if (string.IsNullOrEmpty(this.txtWaterPressure.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.txtWaterPressure, "必填项");
                return false;
            }
            if (string.IsNullOrEmpty(this.textEdit11.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.textEdit11, "必填项");
                return false;
            }
            return isExist;
        }
 
        public async void SetBindingData()
        {
            /*            this.txtName.EditValue = model.Name;
                        this.txtFloor.EditValue = model.Floor;
                        this.txtFloorHouseHolds.EditValue = model.Households;
                        this.txtFloorHeight.EditValue = model.FloorHeight;
                        this.txtMaxWaterDemand.EditValue = model.MaxWaterDemand;
                        this.txtWaterPressure.EditValue = model.TerminalPressure;
                        this.comboBoxWaterSupply.EditValue = model.WaterSupply;
 
                        this.txtConstantP.EditValue = model.ConstantPressure;
                        this.imageComboBoxEdit11.EditValue = model.SupplyMode;
                        *//*            if (_model.ModelConfig.Contains("2d"))
                                        checkedListBoxControl1.Items[0].CheckState = System.Windows.Forms.CheckState.Checked;
                                    if (_model.ModelConfig.Contains("3d"))
                                        checkedListBoxControl1.Items[1].CheckState = System.Windows.Forms.CheckState.Checked;
                        *//*
                        layoutControlItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                        layoutControlItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
 
            */
            this.textEditWaterModel.Properties.AddEnum(typeof(HStation.PBS.eSupplyMode));
            this.comboBoxWaterSupply.Properties.AddEnum(typeof(HStation.PBS.eWaterSupply));
            var allPackages = await new HStation.BLL.AssetsPackageMain().GetAll();
        }
 
        //获取文本信息
        public Vmo.FacilityVmo GetData()
        {
            if (!Valid())
                return null;
            var model = new Vmo.FacilityVmo();
            model.Floor = int.Parse(txtFloor.Text);
            model.Name = txtName.Text;
            // BuildingID = buildid,
            model.SupplyMode = HStation.PBS.eSupplyMode.WaterTank;
            //TemplateID = templateID,
            model.UseStatus = Yw.Vmo.eUseStatus.Disable;
            model.FloorHeight = double.Parse(txtFloorHeight.Text);
            model.Households = int.Parse(txtFloorHouseHolds.Text);
            model.ConstantPressure = double.Parse(txtConstantP.Text);
            //  ModelConfig = mc,
            model.MaxWaterDemand = Convert.ToDouble(txtMaxWaterDemand.EditValue);
            model.TerminalPressure = Convert.ToDouble(txtWaterPressure.EditValue);
            //CompletePlant = comboBoxCompletePlant.EditValue.ToString(),
            if (comboBoxWaterSupply.EditValue != null)
            {
                model.WaterSupply = (HStation.PBS.eWaterSupply)comboBoxWaterSupply.EditValue;
            }
            return model;
            //= Convert.ToDouble(textEdit11.EditValue),
            // ModelType = imageComboBoxEdit11.EditValue.ToString(),
        }
    }
}