duheng
2025-03-14 a906f71640d9ba5cd9f8d689a51de3a557d8bbff
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
using DevExpress.XtraEditors.Controls;
using PBS.Model;
using System.Data;
 
namespace PBS.WinFrmUI
{
    public partial class BuildWizardForm : DevExpress.XtraEditors.XtraUserControl
    {
        public BuildWizardForm()
        {
            InitializeComponent();
        }
 
        //基础验证
        public bool Valid()
        {
            bool isExist = true;
            this.dxErrorProvider1.ClearErrors();
            return isExist;
        }
 
        public PlaceBuildParasInfo GetData()
        {
            if (!Valid())
            {
                return null;
            }
            /*var m = new PlaceBuildParasInfo()
            {
                //  Address = txtAddress.Text,
                //   Area = (long?)this.cbArea.EditValue,
                //    City = (long?)this.cbCity.EditValue,
                //    Dist = (long?)this.cbDist.EditValue,
                AreaSquare = string.IsNullOrEmpty(txtAreaSquare.Text) ? decimal.Zero : decimal.Parse(txtAreaSquare.Text),
                CompletionTime = txtCompletionTime.Text,
                Developer = txtDeveloper.Text,
                GreeningRate = string.IsNullOrEmpty(this.textGreeningRate.Text) ? decimal.Zero : decimal.Parse(textGreeningRate.Text),
                //  Name = txtName.Text,
                PlotRatio = string.IsNullOrEmpty(txtPlotRatio.Text) ? decimal.Zero : decimal.Parse(txtPlotRatio.Text),
                PropertyType = 1,
                ProperTyYears = string.IsNullOrEmpty(txtProperTyYears.Text) ? 0 : int.Parse(txtProperTyYears.Text),
                TotalHouseHolds = string.IsNullOrEmpty(txtTotalHouseHolds.Text) ? 0 : int.Parse(txtTotalHouseHolds.Text)
            };*/
            var m = new PlaceBuildParasInfo();
             // 处理 AreaSquare
            if (string.IsNullOrEmpty(txtAreaSquare.Text) || !decimal.TryParse(txtAreaSquare.Text, out decimal areaSquare))
            {
                m.AreaSquare = decimal.Zero;
            }
            else
            {
                m.AreaSquare = areaSquare;
            }
 
            // 处理 CompletionTime
            m.CompletionTime = txtCompletionTime.Text;
 
            // 处理 Developer
            m.Developer = txtDeveloper.Text;
 
            // 处理 GreeningRate
            if (string.IsNullOrEmpty(textGreeningRate.Text) || !decimal.TryParse(textGreeningRate.Text, out decimal greeningRate))
            {
                m.GreeningRate = decimal.Zero;
            }
            else
            {
                m.GreeningRate = greeningRate;
            }
 
            // 处理 PlotRatio
            if (string.IsNullOrEmpty(txtPlotRatio.Text) || !decimal.TryParse(txtPlotRatio.Text, out decimal plotRatio))
            {
                m.PlotRatio = decimal.Zero;
            }
            else
            {
                m.PlotRatio = plotRatio;
            }
 
            // 处理 PropertyType
            m.PropertyType = 1;
 
            // 处理 ProperTyYears
            if (string.IsNullOrEmpty(txtProperTyYears.Text) || !int.TryParse(txtProperTyYears.Text, out int properTyYears))
            {
                m.ProperTyYears = 0;
            }
            else
            {
                m.ProperTyYears = properTyYears;
            }
 
            // 处理 TotalHouseHolds
            if (string.IsNullOrEmpty(txtTotalHouseHolds.Text) || !int.TryParse(txtTotalHouseHolds.Text, out int totalHouseHolds))
            {
                m.TotalHouseHolds = 0;
            }
            else
            {
                m.TotalHouseHolds = totalHouseHolds;
            }
            return m;
        }
 
        public void SetData(PlaceBuildParasInfo model)
        {
            if (model == null) return;
            //   txtAddress.Text = model.Address;
            txtAreaSquare.Text = model.AreaSquare.ToString();
            txtCompletionTime.Text = model.CompletionTime.ToString();
            txtDeveloper.Text = model.Developer.ToString();
            textGreeningRate.Text = model.GreeningRate.ToString();
            //    txtName.Text = model.Name.ToString();
            txtPlotRatio.Text = model.PlotRatio.ToString();
            txtProperTyYears.Text = model.ProperTyYears.ToString();
            txtTotalHouseHolds.Text = model.TotalHouseHolds.ToString();
            //        cbArea.EditValue = model.Area;
            //       cbCity.EditValue = model.City;
            //      cbDist.EditValue = model.Dist;
        }
 
    }
}