duheng
2024-12-24 ea882c1741812b0783b2924548cb9e8c638a1be9
WinFrmUI/HStation.WinFrmUI.Assets.Core/05-elbow/03-factor/AddAssetsElbowFactorDlg.cs
ÎļþÃû´Ó WinFrmUI/HStation.WinFrmUI.Assets.Core/05-elbow/03-factor/AddAssetsCoolingFactorDlg.cs ÐÞ¸Ä
@@ -13,9 +13,9 @@
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;
@@ -23,28 +23,27 @@
            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;
            }
        }
@@ -90,22 +89,19 @@
            _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();
        }
    }
}