ÎļþÃû´Ó WinFrmUI/HStation.WinFrmUI.Assets.Core/05-elbow/03-factor/AddAssetsCoolingFactorDlg.cs ÐÞ¸Ä |
| | |
| | | |
| | | namespace HStation.WinFrmUI |
| | | { |
| | | public partial class AddAssetsCoolingFactorDlg : DevExpress.XtraEditors.XtraForm |
| | | public partial class AddAssetsElbowFactorDlg : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | public AddAssetsCoolingFactorDlg() |
| | | public AddAssetsElbowFactorDlg() |
| | | { |
| | | InitializeComponent(); |
| | | this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; |
| | |
| | | this.generalOkAndCancelCtrl1.OkEvent += GeneralOkAndCancelCtrl1_OkEvent; |
| | | } |
| | | |
| | | private static AssetsCoolingFactorVmo _last = null; |
| | | private static AssetsElbowFactorVmo _last = null; |
| | | |
| | | /// <summary> |
| | | /// è¿åæ°æ®äºä»¶ |
| | | /// </summary> |
| | | public event Action<HStation.Vmo.AssetsCoolingFactorVmo> ReloadDataEvent; |
| | | public event Action<HStation.Vmo.AssetsElbowFactorVmo> ReloadDataEvent; |
| | | |
| | | private HStation.Vmo.AssetsCoolingFactorVmo _vmo = null; |
| | | private HStation.Vmo.AssetsElbowFactorVmo _vmo = null; |
| | | |
| | | /// <summary> |
| | | /// ç»å®æ°æ® |
| | | /// </summary> |
| | | public void SetBindingData() |
| | | { |
| | | _vmo = new Vmo.AssetsCoolingFactorVmo(); |
| | | _vmo = new Vmo.AssetsElbowFactorVmo(); |
| | | if (_last != null) |
| | | { |
| | | this.txtName.EditValue = _last.Name; |
| | | this.txtMaterial.EditValue = _last.Material; |
| | | this.txtCaliber.EditValue = _last.Caliber; |
| | | this.txtCoefficient.EditValue = _last.Coefficient; |
| | | this.txtLowerLimit.EditValue = _last.LowerLimit; |
| | | this.txtCoefficient.EditValue = _last.MinorLoss; |
| | | this.txtDescription.EditValue = _last.Description; |
| | | } |
| | | } |
| | |
| | | _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.Description = this.txtDescription.Text.Trim(); |
| | | var id = await BLLFactory<HStation.BLL.AssetsCoolingFactor>.Instance.Insert(_vmo); |
| | | var id = await BLLFactory<HStation.BLL.AssetsElbowFactor>.Instance.Insert(_vmo); |
| | | if (id < 1) |
| | | { |
| | | TipFormHelper.ShowError("æ·»å 失败ï¼"); |
| | | return; |
| | | } |
| | | var vmo = await BLLFactory<HStation.BLL.AssetsCoolingFactor>.Instance.GetByID(id); |
| | | var vmo = await BLLFactory<HStation.BLL.AssetsElbowFactor>.Instance.GetByID(id); |
| | | _last = vmo; |
| | | this.ReloadDataEvent?.Invoke(vmo); |
| | | this.DialogResult = DialogResult.OK; |
| | | this.Close(); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |