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();
|
}
|
|
|
|
|
}
|
}
|