duheng
2025-03-31 be65218617cab71a90a9a05cf488fbb6e206b5c5
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
using PBS.Vmo;
 
namespace PBS.WinFrmUI
{
    public partial class BuildWizardForm : DevExpress.XtraEditors.XtraUserControl
    {
        public BuildWizardForm()
        {
            InitializeComponent();
            this.Load += BuildWizardForm_Load;
        }
 
        private void BuildWizardForm_Load(object sender, EventArgs e)
        {
            this.cbPropertyType.Properties.AddEnum(typeof(ePropertyType));
        }
 
        //基础验证
        public bool Valid()
        {
            bool isExist = true;
            this.dxErrorProvider1.ClearErrors();
            return isExist;
        }
 
        public PlaceBuildParasInfoVmo GetData()
        {
            if (!Valid())
            {
                return null;
            }
            var model = new PlaceBuildParasInfoVmo();
            // 处理 AreaSquare
            if (string.IsNullOrEmpty(txtAreaSquare.Text) || !double.TryParse(txtAreaSquare.Text, out double areaSquare))
            {
                model.AreaSquare = null;
            }
            else
            {
                model.AreaSquare = areaSquare;
            }
 
            // 处理 CompletionTime
            model.CompletionTime = txtCompletionTime.Text;
 
            // 处理 Developer
            model.Developer = txtDeveloper.Text;
 
            // 处理 GreeningRate
            if (string.IsNullOrEmpty(textGreeningRate.Text) || !double.TryParse(textGreeningRate.Text, out double greeningRate))
            {
                model.GreeningRate = null;
            }
            else
            {
                model.GreeningRate = greeningRate;
            }
 
            // 处理 PlotRatio
            if (string.IsNullOrEmpty(txtPlotRatio.Text) || !double.TryParse(txtPlotRatio.Text, out double plotRatio))
            {
                model.PlotRatio = null;
            }
            else
            {
                model.PlotRatio = plotRatio;
            }
 
            // 处理 ProperTyYears
            if (string.IsNullOrEmpty(txtProperTyYears.Text) || !int.TryParse(txtProperTyYears.Text, out int properTyYears))
            {
                model.ProperTyYears = 0;
            }
            else
            {
                model.ProperTyYears = properTyYears;
            }
 
            // 处理 TotalHouseHolds
            if (string.IsNullOrEmpty(txtTotalHouseHolds.Text) || !int.TryParse(txtTotalHouseHolds.Text, out int totalHouseHolds))
            {
                model.TotalHouseHolds = 0;
            }
            else
            {
                model.TotalHouseHolds = totalHouseHolds;
            }
            if (this.cbPropertyType.EditValue != null)
            {
                model.PropertyType = (ePropertyType)this.cbPropertyType.EditValue;
            }
            return model;
        }
 
        public void SetData(PlaceBuildParasInfoVmo model)
        {
            if (model == null) return;
            txtAreaSquare.Text = model.AreaSquare.ToString();
            txtCompletionTime.Text = model.CompletionTime.ToString();
            txtDeveloper.Text = model.Developer.ToString();
            textGreeningRate.Text = model.GreeningRate.ToString();
            txtPlotRatio.Text = model.PlotRatio.ToString();
            txtProperTyYears.Text = model.ProperTyYears.ToString();
            txtTotalHouseHolds.Text = model.TotalHouseHolds.ToString();
           
            this.cbPropertyType.EditValue = model.PropertyType;
        }
    }
}