ÎļþÃû´Ó WinFrmUI/HStation.WinFrmUI.Assets.Core/05-elbow/02-main/EditAssetsCoolingMainDlg.cs ÐÞ¸Ä |
| | |
| | | using DevExpress.XtraEditors; |
| | | using HStation.Assets; |
| | | using HStation.Vmo; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | | public partial class EditAssetsCoolingMainDlg : DevExpress.XtraEditors.XtraForm |
| | | public partial class EditAssetsElbowMainDlg : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | public EditAssetsCoolingMainDlg() |
| | | public EditAssetsElbowMainDlg() |
| | | { |
| | | InitializeComponent(); |
| | | this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; |
| | |
| | | /// <summary> |
| | | /// è¿åæ°æ®äºä»¶ |
| | | /// </summary> |
| | | public event Action<HStation.Vmo.AssetsCoolingMainVmo> ReloadDataEvent; |
| | | public event Action<HStation.Vmo.AssetsElbowMainVmo> ReloadDataEvent; |
| | | |
| | | private HStation.Vmo.AssetsCoolingMainVmo _vmo = null; |
| | | private HStation.Vmo.AssetsElbowMainVmo _vmo = null; |
| | | |
| | | /// <summary> |
| | | /// ç»å®æ°æ® |
| | | /// </summary> |
| | | public async void SetBindingData(HStation.Vmo.AssetsCoolingMainVmo vmo) |
| | | public async void SetBindingData(HStation.Vmo.AssetsElbowMainVmo vmo) |
| | | { |
| | | if (vmo == null) |
| | | { |
| | | return; |
| | | } |
| | | _vmo = new Vmo.AssetsCoolingMainVmo(vmo); |
| | | _vmo = new Vmo.AssetsElbowMainVmo(vmo); |
| | | this.txtName.EditValue = vmo.Name; |
| | | this.txtMaterial.EditValue = vmo.Material; |
| | | this.txtCaliber.EditValue = vmo.Caliber; |
| | | this.txtCoefficient.EditValue = vmo.Coefficient; |
| | | this.txtLowerLimit.EditValue = vmo.LowerLimit; |
| | | this.txtCoefficient.EditValue = vmo.MinorLoss; |
| | | this.txtKeyWord.EditValue = HStation.Service.Assets.KeyWordHelper.ToString(vmo.KeyWords); |
| | | var flags = await BLLFactory<Yw.BLL.SysFlag>.Instance.GetBySysType(HStation.Assets.DataType.CoolingMain); |
| | | var flags = await BLLFactory<Yw.BLL.SysFlag>.Instance.GetBySysType(HStation.Assets.DataType.ElbowMain); |
| | | this.setFlagsEditCtrl1.SetBindingData(flags?.Select(x => x.Name).ToList(), vmo.Flags); |
| | | this.txtTagName.EditValue = vmo.TagName; |
| | | this.txtDescription.EditValue = vmo.Description; |
| | | this.imageComboBoxEditConnectlenght.Properties.AddEnum(typeof(eElbowType)); |
| | | this.imageComboBoxEditConnectlenght.EditValue = vmo.ElbowType; |
| | | this.txtAngle.EditValue= vmo.Angle; |
| | | } |
| | | |
| | | //éªè¯ |
| | |
| | | this.dxErrorProvider1.SetError(this.txtCoefficient, "å¿
填项"); |
| | | return false; |
| | | } |
| | | if (string.IsNullOrEmpty(this.txtLowerLimit.Text.Trim())) |
| | | { |
| | | this.dxErrorProvider1.SetError(this.txtLowerLimit, "å¿
填项"); |
| | | return false; |
| | | } |
| | | var tagname = this.txtTagName.Text.Trim(); |
| | | if (!string.IsNullOrEmpty(tagname)) |
| | | { |
| | | if (await BLLFactory<HStation.BLL.AssetsCoolingMain>.Instance.IsExistTagNameExceptID(tagname, _vmo.ID)) |
| | | if (await BLLFactory<HStation.BLL.AssetsElbowMain>.Instance.IsExistTagNameExceptID(tagname, _vmo.ID)) |
| | | { |
| | | this.dxErrorProvider1.SetError(this.txtTagName, "éå¤"); |
| | | return false; |
| | |
| | | _vmo.Name = this.txtName.Text.Trim(); |
| | | _vmo.Material = this.txtMaterial.Text.Trim(); |
| | | _vmo.Caliber = this.txtCaliber.EditValue == null ? null : double.Parse(this.txtCaliber.EditValue?.ToString()); |
| | | _vmo.Coefficient = double.Parse(this.txtCoefficient.EditValue?.ToString()); |
| | | _vmo.LowerLimit = double.Parse(this.txtLowerLimit.EditValue?.ToString()); |
| | | _vmo.MinorLoss = double.Parse(this.txtCoefficient.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(); |
| | | |
| | | var bol = await BLLFactory<HStation.BLL.AssetsCoolingMain>.Instance.Update(_vmo); |
| | | _vmo.ElbowType = (eElbowType)this.imageComboBoxEditConnectlenght.EditValue; |
| | | _vmo.Angle = int.Parse(this.txtAngle.EditValue?.ToString()); |
| | | var bol = await BLLFactory<HStation.BLL.AssetsElbowMain>.Instance.Update(_vmo); |
| | | if (!bol) |
| | | { |
| | | TipFormHelper.ShowError("æ´æ°å¤±è´¥ï¼"); |
| | | return; |
| | | } |
| | | var vmo = await BLLFactory<HStation.BLL.AssetsCoolingMain>.Instance.GetByID(_vmo.ID); |
| | | var vmo = await BLLFactory<HStation.BLL.AssetsElbowMain>.Instance.GetByID(_vmo.ID); |
| | | this.ReloadDataEvent?.Invoke(vmo); |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |