| | |
| | | /// </summary> |
| | | public event Action<List<Yw.Model.HydroCoolingInfo>> ReloadDataEvent; |
| | | |
| | | //所有构件列表 |
| | | private List<Yw.Model.HydroCoolingInfo> _allVisualList = null; |
| | | |
| | | private List<Yw.Model.HydroCoolingInfo> _allVisualList = null; //所有构件列表 |
| | | private HydroChangeHelper _changeHelper = null;//改变辅助类 |
| | | private HydroPropStatusHelper _propStatusHelper = null;//属性状态辅助类 |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public void SetBindingData(Yw.Model.HydroCoolingInfo visual) |
| | | public void SetBindingData |
| | | ( |
| | | Yw.Model.HydroCoolingInfo visual, |
| | | HydroChangeHelper changeHelper = null, |
| | | HydroPropStatusHelper propStatusHelper = null |
| | | ) |
| | | { |
| | | var allVisualList = visual == null ? null : new List<Yw.Model.HydroCoolingInfo>() { visual }; |
| | | SetBindingData(allVisualList); |
| | | SetBindingData(allVisualList, changeHelper, propStatusHelper); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public void SetBindingData(List<Yw.Model.HydroCoolingInfo> allVisualList) |
| | | public void SetBindingData |
| | | ( |
| | | List<Yw.Model.HydroCoolingInfo> allVisualList, |
| | | HydroChangeHelper changeHelper = null, |
| | | HydroPropStatusHelper propStatusHelper = null |
| | | ) |
| | | { |
| | | _allVisualList = allVisualList; |
| | | _changeHelper = changeHelper; |
| | | _propStatusHelper = propStatusHelper; |
| | | if (_allVisualList != null && _allVisualList.Count == 1) |
| | | { |
| | | var parter = _allVisualList.First(); |
| | | this.txtElev.EditValue = Math.Round(parter.Elev, 4); |
| | | this.txtMinorLoss.EditValue = parter.MinorLoss; |
| | | this.txtMaterial.EditValue = parter.Material; |
| | | this.txtCaliber.EditValue = parter.Caliber; |
| | | this.txtCoefficient.EditValue = parter.Coefficient; |
| | | this.txtLowerLimit.EditValue = parter.LowerLimit; |
| | | } |
| | |
| | | { |
| | | return; |
| | | } |
| | | 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()); |
| | | string material = this.txtMaterial.Text.Trim(); |
| | | double? caliber = this.txtCaliber.EditValue == null ? null : double.Parse(this.txtCaliber.EditValue.ToString()); |
| | | double? coefficient = this.txtCoefficient.EditValue == null ? null : double.Parse(this.txtCoefficient.EditValue.ToString()); |
| | | double? lowerLimit = this.txtLowerLimit.EditValue == null ? null : double.Parse(this.txtLowerLimit.EditValue.ToString()); |
| | | _allVisualList.ForEach(x => |
| | | { |
| | | if (elev.HasValue) |
| | | if (!string.IsNullOrEmpty(material)) |
| | | { |
| | | x.Elev = elev.Value; |
| | | if (x.Material != material) |
| | | { |
| | | _changeHelper.Append(x, eChangeType.Update); |
| | | _propStatusHelper?.UpdatePropStatus(x.Code, nameof(x.Material), Yw.Hydro.ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过设置组件修改"); |
| | | } |
| | | x.Material = material; |
| | | } |
| | | if (minorLoss.HasValue) |
| | | if (caliber.HasValue) |
| | | { |
| | | x.MinorLoss = minorLoss.Value; |
| | | if (x.Caliber != caliber.Value) |
| | | { |
| | | _changeHelper.Append(x, eChangeType.Update); |
| | | _propStatusHelper?.UpdatePropStatus(x.Code, nameof(x.Caliber), Yw.Hydro.ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过设置组件修改"); |
| | | } |
| | | x.Caliber = caliber.Value; |
| | | } |
| | | if (coefficient.HasValue) |
| | | { |
| | | if (x.Coefficient != coefficient.Value) |
| | | { |
| | | _changeHelper.Append(x, eChangeType.Update); |
| | | _propStatusHelper?.UpdatePropStatus(x.Code, nameof(x.Coefficient), Yw.Hydro.ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过设置组件修改"); |
| | | } |
| | | x.Coefficient = coefficient.Value; |
| | | } |
| | | if (lowerLimit.HasValue) |
| | | { |
| | | if (x.LowerLimit != lowerLimit.Value) |
| | | { |
| | | _changeHelper.Append(x, eChangeType.Update); |
| | | _propStatusHelper?.UpdatePropStatus(x.Code, nameof(x.LowerLimit), Yw.Hydro.ePropStatus.Normal, $"{DateTime.Now.ToStandardString()}通过设置组件修改"); |
| | | } |
| | | x.LowerLimit = lowerLimit.Value; |
| | | } |
| | | }); |