ningshuxia
2025-03-20 5aa0bae63df66d66fefb6a0d180eb3774c172d3a
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
namespace PBS.WinFrmUI
{
    public partial class BuildPlaceInfoCtrl : DevExpress.XtraEditors.XtraUserControl, IPlaceInfo
    {
        public BuildPlaceInfoCtrl()
        {
            InitializeComponent();
        }
 
 
        private PlaceBuildParasInfoVmo _model = null; 
 
        public void Set(string info)
        {
            _model = PlaceBuildParasInfoVmo.ToModel(info);
            _model ??= new();
 
            this.txtAreaSquare.EditValue = _model.AreaSquare;
            this.txtCompletionTime.EditValue = _model.CompletionTime;
            this.txtDeveloper.EditValue = _model.Developer;
            this.textGreeningRate.EditValue = _model.GreeningRate;
            this.txtPlotRatio.EditValue = _model.PlotRatio;
            this.txtProperTyYears.EditValue = _model.ProperTyYears;
            this.txtTotalHouseHolds.EditValue = _model.TotalHouseHolds;
            this.cbPropertyType.EditValue = _model.PropertyType;
        }
 
        public bool Verify()
        {  
            this.dxErrorProvider1.ClearErrors(); 
            return true;
        }
 
        public string Get()
        {
            if (!Verify())
            {
                return null;
            }
 
            _model.CompletionTime = txtCompletionTime.Text;
            _model.Developer = txtDeveloper.Text; 
            _model.PropertyType = cbPropertyType.SelectedIndex;
 
            if (string.IsNullOrEmpty(this.txtAreaSquare.Text) || !double.TryParse(this.txtAreaSquare.Text, out double areaSquare))
            {
                _model.AreaSquare = null;
            }
            else
            {
                _model.AreaSquare = areaSquare;
            }
 
            if (string.IsNullOrEmpty(this.textGreeningRate.Text) || !double.TryParse(this.textGreeningRate.Text, out double greeningRate))
            {
                _model.GreeningRate =  null;
            }
            else
            {
                _model.GreeningRate = greeningRate;
            }
 
            if (string.IsNullOrEmpty(this.txtPlotRatio.Text) || !double.TryParse(this.txtPlotRatio.Text, out double plotRatio))
            {
                _model.PlotRatio =  null;
            }
            else
            {
                _model.PlotRatio = plotRatio;
            }
 
 
            if (string.IsNullOrEmpty(this.txtProperTyYears.Text) || !int.TryParse(this.txtProperTyYears.Text, out int properTyYears))
            {
                _model.ProperTyYears = 0;
            }
            else
            {
                _model.ProperTyYears = properTyYears;
            }
 
            if (string.IsNullOrEmpty(this.txtTotalHouseHolds.Text) || !int.TryParse(this.txtTotalHouseHolds.Text, out int totalHouseHolds))
            {
                _model.TotalHouseHolds = 0;
            }
            else
            {
                _model.TotalHouseHolds = totalHouseHolds;
            }
 
            return _model.ToJson();
        }
 
 
        
         
    }
}