| | |
| | | using DevExpress.XtraSpreadsheet.Model; |
| | | |
| | | namespace Yw.WinFrmUI |
| | | namespace Yw.WinFrmUI |
| | | { |
| | | public partial class SetHydroNozzleDlg : DevExpress.XtraEditors.XtraForm |
| | | { |
| | |
| | | { |
| | | InitializeComponent(); |
| | | this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; |
| | | this.layoutControl1.SetupLayoutControl(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回数据事件 |
| | | /// </summary> |
| | | public event Action<List<Yw.Model.HydroNozzleInfo>> ReloadDataEvent; |
| | | |
| | | |
| | | private List<Yw.Model.HydroNozzleInfo> _allNozzleList = null; |
| | | //所有构件列表 |
| | | private List<Yw.Model.HydroNozzleInfo> _allParterList = null; |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public void SetBindingData(Yw.Model.HydroNozzleInfo parter) |
| | | { |
| | | var allParterList = parter == null ? null : new List<Yw.Model.HydroNozzleInfo>() { parter }; |
| | | SetBindingData(allParterList); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | | /// </summary> |
| | | public void SetBindingData(List<Yw.Model.HydroNozzleInfo> allNozzleList) |
| | | { |
| | | _allNozzleList = allNozzleList; |
| | | if (_allNozzleList != null && _allNozzleList.Count == 1) |
| | | _allParterList = allNozzleList; |
| | | if (_allParterList != null && _allParterList.Count == 1) |
| | | { |
| | | var hydrant = _allNozzleList.First(); |
| | | this.txtElev.EditValue = hydrant.Elev; |
| | | this.txtMinorLoss.EditValue = hydrant.MinorLoss; |
| | | this.txtDemand.EditValue = hydrant.Demand; |
| | | this.txtCoefficient.EditValue = hydrant.Coefficient; |
| | | var parter = _allParterList.First(); |
| | | this.txtElev.EditValue = Math.Round(parter.Elev, 4); |
| | | this.txtMinorLoss.EditValue = parter.MinorLoss; |
| | | this.txtCoefficient.EditValue = parter.Coefficient; |
| | | this.txtDemand.EditValue = parter.Demand; |
| | | } |
| | | } |
| | | |
| | |
| | | // |
| | | private void btnOk_Click(object sender, EventArgs e) |
| | | { |
| | | if (_allNozzleList == null || _allNozzleList.Count < 1) |
| | | if (_allParterList == null || _allParterList.Count < 1) |
| | | { |
| | | return; |
| | | } |
| | |
| | | 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()); |
| | | _allNozzleList.ForEach(x => |
| | | _allParterList.ForEach(x => |
| | | { |
| | | x.Elev = elev; |
| | | x.MinorLoss = minorLoss; |
| | | x.Demand = demand; |
| | | x.Coefficient = coefficient; |
| | | }); |
| | | this.ReloadDataEvent?.Invoke(_allNozzleList); |
| | | this.ReloadDataEvent?.Invoke(_allParterList); |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | } |