| | |
| | | using DevExpress.XtraEditors.Controls; |
| | | using HStation.Assets; |
| | | |
| | | namespace HStation.WinFrmUI.Assets |
| | | { |
| | | public partial class AddValveMainDlg : DevExpress.XtraEditors.XtraForm |
| | | public partial class AddAssetsValveMainDlg : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | public AddValveMainDlg() |
| | | public AddAssetsValveMainDlg() |
| | | { |
| | | InitializeComponent(); |
| | | this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; |
| | | } |
| | | |
| | | private Vmo.ValveMainVmo _ValveMain = null; //阀门型号 |
| | | private Vmo.AssetsValveMainVmo _AssetsValveMain = null; //阀门型号 |
| | | |
| | | public async void SetBindingData(long SeriesID, HStation.Assets.eValveSeriesType type) |
| | | public async void SetBindingData(long SeriesID, HStation.Assets.eAssetsValveSeriesType type) |
| | | { |
| | | _ValveMain = new Vmo.ValveMainVmo(); |
| | | _ValveMain.SeriesID = SeriesID; |
| | | _ValveMain.SeriesType = type; |
| | | _AssetsValveMain = new Vmo.AssetsValveMainVmo(); |
| | | _AssetsValveMain.SeriesID = SeriesID; |
| | | _AssetsValveMain.SeriesType = type; |
| | | var allCaliber = await new Yw.BLL.SysDictData().GetByTypeCode("1"); |
| | | if (allCaliber != null) |
| | | { |
| | |
| | | TextEditMaterial.Properties.Items.Add(imageItem); |
| | | } |
| | | } |
| | | imageComboBoxEditValveType.Properties.AddEnum(typeof(eValveOpenStatus)); |
| | | TextEditCaliber.SelectedIndex = 0; |
| | | TextEditMaterial.SelectedIndex = 0; |
| | | } |
| | | |
| | | public event Func<Vmo.ValveMainVmo, Task<bool>> ReloadDataEvent = null; |
| | | public event Func<Vmo.AssetsValveMainVmo, Task<bool>> ReloadDataEvent = null; |
| | | |
| | | //数据验证 |
| | | private bool Valid() |
| | |
| | | { |
| | | if (!(Valid())) |
| | | return; |
| | | _ValveMain.Name = TextEditName.Text.Trim(); |
| | | _AssetsValveMain.Name = TextEditName.Text.Trim(); |
| | | if (double.TryParse(TextEditCoefficient.Text, out double coefficient)) |
| | | { |
| | | _ValveMain.Coefficient = coefficient; |
| | | _AssetsValveMain.Coefficient = coefficient; |
| | | } |
| | | _ValveMain.Material = TextEditMaterial.Text.Trim(); |
| | | _ValveMain.Description = TextEditDescription.Text.Trim(); |
| | | if (TextEditMaterial.Text != "默认") |
| | | { |
| | | _AssetsValveMain.MaterialName = TextEditMaterial.Text.Trim(); |
| | | } |
| | | _AssetsValveMain.Description = TextEditDescription.Text.Trim(); |
| | | if (double.TryParse(TextEditCaliber.Text, out double caliber)) |
| | | { |
| | | _ValveMain.Caliber = caliber; |
| | | _AssetsValveMain.Caliber = caliber; |
| | | } |
| | | if (await this.ReloadDataEvent.Invoke(_ValveMain)) |
| | | _AssetsValveMain.OpenStatus = (eValveOpenStatus)this.imageComboBoxEditValveType.EditValue; |
| | | if (await this.ReloadDataEvent.Invoke(_AssetsValveMain)) |
| | | { |
| | | TipFormHelper.ShowSucceed("添加成功!"); |
| | | } |