| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraScheduler.Outlook.Interop; |
| | | using HStation.Service.Assets; |
| | | using HStation.Service.Assets; |
| | | using HStation.Vmo; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | | using System.Drawing; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using Yw; |
| | | |
| | | namespace HStation.WinFrmUI |
| | |
| | | { |
| | | this.txtName.EditValue = _last.Name; |
| | | this.txtKeyWord.EditValue = KeyWordHelper.ToString(_last.KeyWords); |
| | | this.TextEditMinorLoss.EditValue = _last.MinorLoss; |
| | | this.setFlagsEditCtrl1.SetBindingData(flags?.Select(x => x.Name).ToList(), _last.Flags); |
| | | this.txtTagName.EditValue = _last.TagName; |
| | | this.txtDescription.EditValue = _last.Description; |
| | | this.TextEditHazenValue.EditValue = _last.Hazen; |
| | | } |
| | | } |
| | | |
| | |
| | | this.dxErrorProvider1.SetError(this.txtName, "必填项"); |
| | | return false; |
| | | } |
| | | if (string.IsNullOrEmpty(this.TextEditMinorLoss.Text.Trim())) |
| | | if (string.IsNullOrEmpty(this.TextEditHazenValue.Text.Trim())) |
| | | { |
| | | this.dxErrorProvider1.SetError(this.TextEditMinorLoss, "必填项"); |
| | | this.dxErrorProvider1.SetError(this.TextEditHazenValue, "必填项"); |
| | | return false; |
| | | } |
| | | var tagname = this.txtTagName.Text.Trim(); |
| | |
| | | return; |
| | | } |
| | | _vmo.Name = this.txtName.Text.Trim(); |
| | | _vmo.MinorLoss = double.Parse(this.TextEditMinorLoss.EditValue?.ToString()); |
| | | _vmo.Caliber = this.txtCaliber.EditValue == null ? null : double.Parse(this.txtCaliber.EditValue?.ToString()); |
| | | _vmo.KeyWords = HStation.Service.Assets.KeyWordHelper.ToList(this.txtKeyWord.Text.Trim()); |
| | | _vmo.Flags = this.setFlagsEditCtrl1.SelectedFlagList; |
| | | _vmo.TagName = this.txtTagName.Text.Trim(); |
| | | _vmo.Description = this.txtDescription.Text.Trim(); |
| | | _vmo.Material = this.txtMaterial.Text.Trim(); |
| | | _vmo.Hazen = double.Parse(this.TextEditHazenValue.EditValue?.ToString()); |
| | | _vmo.Manning = double.Parse(this.TextEditManningValue.EditValue?.ToString()); |
| | | _vmo.Darcy = double.Parse(this.TextEditDarcyValue.EditValue?.ToString()); |
| | | var id = await BLLFactory<HStation.BLL.AssetsPipeMain>.Instance.Insert(_vmo); |
| | | if (id < 1) |
| | | { |
| | |
| | | //匹配系数 |
| | | private async void MatchingFactor() |
| | | { |
| | | if (this.TextEditMinorLoss.EditValue == null) |
| | | if (this.TextEditHazenValue.EditValue == null) |
| | | { |
| | | var allFactorList = await GetAllFactorList(); |
| | | if (allFactorList != null && allFactorList.Count > 0) |
| | | { |
| | | var name = this.txtName.Text.Trim(); |
| | | var material = this.txtMaterial.Text.Trim(); |
| | | double? caliber = this.txtCaliber.EditValue == null ? null : double.Parse(this.txtCaliber.EditValue.ToString()); |
| | | var factorList = allFactorList.ToList(); |
| | | if (!string.IsNullOrEmpty(name)) |
| | | if (!string.IsNullOrEmpty(material)) |
| | | { |
| | | factorList = factorList.Where(x => !string.IsNullOrEmpty(x.Name) && x.Name.Contains(name)).ToList(); |
| | | factorList = factorList.Where(x => !string.IsNullOrEmpty(x.Material) && x.Material.Contains(material)).ToList(); |
| | | } |
| | | if (caliber.HasValue) |
| | | { |
| | | factorList = factorList.Where(x => x.Caliber.HasValue && x.Caliber.Value == caliber.Value).ToList(); |
| | | } |
| | | var factor = factorList.FirstOrDefault(); |
| | | if (factor != null) |
| | | { |
| | | this.TextEditMinorLoss.EditValue = factor.MinorLoss; |
| | | this.TextEditHazenValue.EditValue = factor.MinorLoss; |
| | | } |
| | | } |
| | | } |