| | |
| | | } |
| | | } |
| | | |
| | | //验证 |
| | | private bool Valid() |
| | | { |
| | | this.dxErrorProvider1.ClearErrors(); |
| | | if (this.txtElev.EditValue == null) |
| | | { |
| | | this.dxErrorProvider1.SetError(this.txtElev, "必填项"); |
| | | return false; |
| | | } |
| | | if (this.txtCoefficient.EditValue == null) |
| | | { |
| | | this.dxErrorProvider1.SetError(this.txtCoefficient, "必填项"); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | //确定 |
| | | private void GeneralOkAndCancelCtrl1_OkEvent() |
| | | { |
| | |
| | | { |
| | | return; |
| | | } |
| | | if (!Valid()) |
| | | { |
| | | return; |
| | | } |
| | | var elev = double.Parse(this.txtElev.EditValue.ToString()); |
| | | double? elev = this.txtElev.EditValue == null ? null : double.Parse(this.txtElev.EditValue.ToString()); |
| | | double? minorLoss = this.txtMinorLoss.EditValue == null ? null : double.Parse(this.txtMinorLoss.EditValue.ToString()); |
| | | double? demand = this.txtDemand.EditValue == null ? null : double.Parse(this.txtDemand.EditValue.ToString()); |
| | | var coefficient = double.Parse(this.txtCoefficient.EditValue.ToString()); |
| | | double? coefficient = this.txtCoefficient.EditValue == null ? null : double.Parse(this.txtCoefficient.EditValue.ToString()); |
| | | _allVisualList.ForEach(x => |
| | | { |
| | | x.Elev = elev; |
| | | x.MinorLoss = minorLoss; |
| | | x.Demand = demand; |
| | | x.Coefficient = coefficient; |
| | | if (elev.HasValue) |
| | | { |
| | | x.Elev = elev.Value; |
| | | } |
| | | if (minorLoss.HasValue) |
| | | { |
| | | x.MinorLoss = minorLoss.Value; |
| | | } |
| | | if (demand.HasValue) |
| | | { |
| | | x.Demand = demand.Value; |
| | | } |
| | | if (coefficient.HasValue) |
| | | { |
| | | x.Coefficient = coefficient.Value; |
| | | } |
| | | }); |
| | | this.ReloadDataEvent?.Invoke(_allVisualList); |
| | | this.DialogResult = DialogResult.OK; |