| | |
| | | using DevExpress.XtraEditors.Controls; |
| | | using PBS.Model; |
| | | using System.Data; |
| | | using PBS.Model; |
| | | using PBS.Vmo; |
| | | |
| | | namespace PBS.WinFrmUI |
| | | { |
| | |
| | | { |
| | | bool isExist = true; |
| | | this.dxErrorProvider1.ClearErrors(); |
| | | if (this.cbArea.Text == "请选择") |
| | | { |
| | | this.dxErrorProvider1.SetError(this.cbArea, "必填项"); |
| | | isExist = false; |
| | | } |
| | | if (this.cbCity.Text == "请选择") |
| | | { |
| | | this.dxErrorProvider1.SetError(this.cbCity, "必填项"); |
| | | isExist = false; |
| | | } |
| | | if (this.cbDist.Text == "请选择") |
| | | { |
| | | this.dxErrorProvider1.SetError(this.cbDist, "必填项"); |
| | | isExist = false; |
| | | } |
| | | if (string.IsNullOrEmpty(this.txtName.Text.Trim())) |
| | | { |
| | | this.dxErrorProvider1.SetError(this.txtName, "必填项"); |
| | | isExist = false; |
| | | } |
| | | return isExist; |
| | | } |
| | | |
| | | public PlaceBuildParasInfo GetData() |
| | | public PlaceBuildParasInfoVmo GetData() |
| | | { |
| | | if (!Valid()) |
| | | { |
| | | return null; |
| | | } |
| | | var m = new PlaceBuildParasInfo() |
| | | /*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), |
| | | AreaSquare = string.IsNullOrEmpty(txtAreaSquare.Text) ? null : double.Parse(txtAreaSquare.Text), |
| | | CompletionTime = txtCompletionTime.Text, |
| | | Developer = txtDeveloper.Text, |
| | | GreeningRate = string.IsNullOrEmpty(this.textGreeningRate.Text) ? decimal.Zero : decimal.Parse(textGreeningRate.Text), |
| | | GreeningRate = string.IsNullOrEmpty(this.textGreeningRate.Text) ? null : double.Parse(textGreeningRate.Text), |
| | | // Name = txtName.Text, |
| | | PlotRatio = string.IsNullOrEmpty(txtPlotRatio.Text) ? decimal.Zero : decimal.Parse(txtPlotRatio.Text), |
| | | PlotRatio = string.IsNullOrEmpty(txtPlotRatio.Text) ? null : double.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 PlaceBuildParasInfoVmo(); |
| | | // 处理 AreaSquare |
| | | if (string.IsNullOrEmpty(txtAreaSquare.Text) || !double.TryParse(txtAreaSquare.Text, out double areaSquare)) |
| | | { |
| | | m.AreaSquare = null; |
| | | } |
| | | else |
| | | { |
| | | m.AreaSquare = areaSquare; |
| | | } |
| | | |
| | | // 处理 CompletionTime |
| | | m.CompletionTime = txtCompletionTime.Text; |
| | | |
| | | // 处理 Developer |
| | | m.Developer = txtDeveloper.Text; |
| | | |
| | | // 处理 GreeningRate |
| | | if (string.IsNullOrEmpty(textGreeningRate.Text) || !double.TryParse(textGreeningRate.Text, out double greeningRate)) |
| | | { |
| | | m.GreeningRate = null; |
| | | } |
| | | else |
| | | { |
| | | m.GreeningRate = greeningRate; |
| | | } |
| | | |
| | | // 处理 PlotRatio |
| | | if (string.IsNullOrEmpty(txtPlotRatio.Text) || !double.TryParse(txtPlotRatio.Text, out double plotRatio)) |
| | | { |
| | | m.PlotRatio = null; |
| | | } |
| | | 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) |
| | | public void SetData(PlaceBuildParasInfoVmo model) |
| | | { |
| | | if (model == null) return; |
| | | // txtAddress.Text = model.Address; |
| | |
| | | // cbArea.EditValue = model.Area; |
| | | // cbCity.EditValue = model.City; |
| | | // cbDist.EditValue = model.Dist; |
| | | } |
| | | |
| | | public string getText() |
| | | { |
| | | return "a"; |
| | | } |
| | | |
| | | private void BuildWizardForm_Load(object sender, EventArgs e) |
| | | { |
| | | /* var allProvince = new BLL.Region().GetAll().Where(x => x.Type == eRegionType.Province).ToList(); |
| | | foreach (var item in allProvince) |
| | | { |
| | | var imageItem = new ImageComboBoxItem(item.Name, item.ID); |
| | | cbArea.Properties.Items.Add(imageItem); |
| | | //城市添加省份只是为了临时用,后期会更改 |
| | | cbCity.Properties.Items.Add(imageItem); |
| | | } |
| | | ValueChangeEvent(); //为了编辑页面的时候可以选中所选项*/ |
| | | } |
| | | |
| | | private void cbArea_SelectedIndexChanged(object sender, EventArgs e) |
| | | { |
| | | ValueChangeEvent(); |
| | | } |
| | | |
| | | private void ValueChangeEvent() |
| | | { |
| | | /* if (cbArea.EditValue != null) |
| | | { |
| | | var AllDist = new BLL.Region().GetChildrenByID((long)cbArea.EditValue); |
| | | foreach (var item in AllDist) |
| | | { |
| | | var imageItem = new ImageComboBoxItem(item.Name, item.ID); |
| | | cbDist.Properties.Items.Add(imageItem); |
| | | } |
| | | }*/ |
| | | } |
| | | } |
| | | } |