lixiaojun
2024-12-05 f5cdfeae3594e3e6e1461300e93c266ce79c1a8a
WinFrmUI/Yw.WinFrmUI.Hydro.Core/06-visual/09-hydrant/SetHydroHydrantDlg.cs
@@ -43,23 +43,6 @@
            }
        }
        //验证
        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()
        {
@@ -67,20 +50,28 @@
            {
                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;