| | |
| | | InitializeComponent(); |
| | | } |
| | | |
| | | private Vmo.AdaptingManageVmo _AdaptingVmo = null; |
| | | private Vmo.PipeLineManageVmo _PipeLineVmo = null; |
| | | |
| | | public async void SetBindingData(Service.Assets.eAdaptingType AdaptingType) |
| | | public async void SetBindingData() |
| | | { |
| | | _AdaptingVmo = new Vmo.AdaptingManageVmo(); |
| | | _AdaptingVmo.AdaptingType = AdaptingType; |
| | | _PipeLineVmo = new Vmo.PipeLineManageVmo(); |
| | | var allCaliber = await new Yw.BLL.SysDictData().GetByTypeCode("1"); |
| | | if (allCaliber != null) |
| | | { |
| | |
| | | TextEditCaliber.Properties.Items.Add(imageItem); |
| | | } |
| | | } |
| | | var allMaterial = await new Yw.BLL.SysDictData().GetByTypeCode("2"); |
| | | var allMaterial = await new Yw.BLL.SysDictData().GetByTypeCode("3"); |
| | | if (allMaterial != null) |
| | | { |
| | | foreach (var item in allMaterial) |
| | |
| | | TextEditMaterial.Properties.Items.Add(imageItem); |
| | | } |
| | | } |
| | | TextEditCaliber.SelectedIndex = 0; |
| | | TextEditMaterial.SelectedIndex = 0; |
| | | } |
| | | |
| | | public event Func<Vmo.AdaptingManageVmo, List<Vmo.PipeLineRoughnessCoefficientVmo>, Task<bool>> ReloadDataEvent = null; |
| | | public event Func<Vmo.PipeLineManageVmo, Task<bool>> ReloadDataEvent = null; |
| | | |
| | | //数据验证 |
| | | private bool Valid() |
| | |
| | | { |
| | | if (!(Valid())) |
| | | return; |
| | | _AdaptingVmo.Material = TextEditMaterial.Text.Trim(); |
| | | _AdaptingVmo.Coefficient = TextEditHazenStatrtValue.Text.Trim(); |
| | | _AdaptingVmo.Description = DescriptionTextEdit.Text.Trim(); |
| | | _AdaptingVmo.Name = TextEditName.Text.Trim(); |
| | | _AdaptingVmo.Caliber = TextEditCaliber.Text.Trim(); |
| | | var coefficientList = new List<Vmo.PipeLineRoughnessCoefficientVmo>(); |
| | | coefficientList.Add(new Vmo.PipeLineRoughnessCoefficientVmo() { eAlgorithmType = Service.Assets.eAlgorithmType.Hazen, StartValue = TextEditHazenStatrtValue.Text, EndValue = TextEditHazenEndValue.Text }); |
| | | coefficientList.Add(new Vmo.PipeLineRoughnessCoefficientVmo() { eAlgorithmType = Service.Assets.eAlgorithmType.Darcy, StartValue = TextEditDarcyStartValue.Text, EndValue = TextEditDarcyEndValue.Text }); |
| | | coefficientList.Add(new Vmo.PipeLineRoughnessCoefficientVmo() { eAlgorithmType = Service.Assets.eAlgorithmType.Manning, StartValue = TextEditManningStartValue.Text, EndValue = TextEditManningEndValue.Text }); |
| | | if (await this.ReloadDataEvent.Invoke(_AdaptingVmo, coefficientList)) |
| | | _PipeLineVmo.Material = TextEditMaterial.Text.Trim(); |
| | | _PipeLineVmo.Coefficient = TextEditHazenValue.Text.Trim(); |
| | | _PipeLineVmo.Description = DescriptionTextEdit.Text.Trim(); |
| | | _PipeLineVmo.Name = TextEditName.Text.Trim(); |
| | | _PipeLineVmo.Caliber = TextEditCaliber.Text.Trim(); |
| | | _PipeLineVmo.Hazen = TextEditHazenValue.Text; |
| | | _PipeLineVmo.Darcy = TextEditDarcyValue.Text; |
| | | _PipeLineVmo.Manning = TextEditManningValue.Text; |
| | | if (await this.ReloadDataEvent.Invoke(_PipeLineVmo)) |
| | | { |
| | | TipFormHelper.ShowSucceed("添加成功!"); |
| | | } |
| | | else |
| | | { |
| | | TipFormHelper.ShowSucceed("添加失败!"); |
| | | TipFormHelper.ShowError("添加失败!"); |
| | | } |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | } |
| | | |
| | | private async void TextEditMaterial_SelectedIndexChanged(object sender, EventArgs e) |
| | | { |
| | | TextEditManningValue.Text = null; |
| | | TextEditHazenValue.Text = null; |
| | | TextEditManningValue.Text = null; |
| | | var bll = new BLL.PipeLineRoughnessCoefficient(); |
| | | var materialid = Convert.ToInt64(TextEditMaterial.EditValue); |
| | | var alllist = await bll.GetByPipeID(materialid); |
| | | if (alllist == null || alllist.Count == 0) |
| | | return; |
| | | var manning = alllist.Find(x => x.eAlgorithmType == Service.Assets.eAlgorithmType.Manning); |
| | | if (manning != null) |
| | | { |
| | | if (manning.EndValue != null) |
| | | { |
| | | this.toolTipController1.SetToolTip(TextEditManningValue, "正确范围应在:" + string.Format("{0}~{1}", manning.StartValue, manning.EndValue)); |
| | | } |
| | | else |
| | | { |
| | | this.TextEditManningValue.Text = manning.StartValue.ToString(); |
| | | } |
| | | } |
| | | var hazen = alllist.Find(x => x.eAlgorithmType == Service.Assets.eAlgorithmType.Hazen); |
| | | if (hazen != null) |
| | | { |
| | | if (hazen.EndValue != null) |
| | | { |
| | | this.toolTipController1.SetToolTip(TextEditHazenValue, "正确范围应在:" + string.Format("{0}~{1}", hazen.StartValue, hazen.EndValue)); |
| | | } |
| | | else |
| | | { |
| | | this.TextEditHazenValue.Text = hazen.StartValue.ToString(); |
| | | } |
| | | } |
| | | var darcy = alllist.Find(x => x.eAlgorithmType == Service.Assets.eAlgorithmType.Darcy); |
| | | if (darcy != null) |
| | | { |
| | | if (darcy.EndValue != null) |
| | | { |
| | | this.toolTipController1.SetToolTip(TextEditDarcyValue, "正确范围应在:" + string.Format("{0}~{1}", darcy.StartValue, darcy.EndValue)); |
| | | } |
| | | else |
| | | { |
| | | this.TextEditDarcyValue.Text = darcy.StartValue.ToString(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |