| | |
| | | namespace HStation.WinFrmUI.Assets |
| | | using DevExpress.XtraEditors.Controls; |
| | | using HStation.Vmo; |
| | | |
| | | namespace HStation.WinFrmUI.Assets |
| | | { |
| | | public partial class EditAssetsPackageSeriesDlg : DevExpress.XtraEditors.XtraForm |
| | | { |
| | |
| | | this.IconOptions.Icon = Yw.WinFrmUI.GlobalParas.AppIcon; |
| | | } |
| | | |
| | | public event Func<Vmo.AssetsPackageSeriesVmo, object, Task<bool>> ReloadDataEvent = null; |
| | | public event Func<Vmo.AssetsPackageSeriesVmo, object, AssetsPackageMfrMappingVmo, Task<bool>> ReloadDataEvent = null; |
| | | |
| | | private Vmo.AssetsPackageSeriesVmo _assetsEquipmentSeries = null; |
| | | private List<AssetsPackageSeriesViewModel> _assetsEquipmentSeriesViews; |
| | | |
| | | private Vmo.AssetsPackageMfrMappingVmo _manufacturerMappingVmo; |
| | | |
| | | public async void SetBindingData(Vmo.AssetsPackageSeriesVmo seriesVmo) |
| | | { |
| | |
| | | if (_assetsEquipmentSeries.ParentIds.Count > 0) |
| | | { |
| | | this.textEditParentList.EditValue = _assetsEquipmentSeries.ParentIds.Last(); |
| | | } |
| | | var manufacturerList = await new BLL.AssetsManufacturer().GetAll(); |
| | | if (manufacturerList != null) |
| | | { |
| | | foreach (var item in manufacturerList) |
| | | { |
| | | var imageItem = new ImageComboBoxItem(item.Name, item.ID); |
| | | this.textEditManufacturer.Properties.Items.Add(imageItem); |
| | | } |
| | | } |
| | | _manufacturerMappingVmo = await new BLL.AssetsPackageSeriesManufacturerMapping().GetBySeriesID(seriesVmo.ID); |
| | | if (_manufacturerMappingVmo != null) |
| | | { |
| | | this.textEditManufacturer.EditValue = _manufacturerMappingVmo.ManufacturerID; |
| | | } |
| | | } |
| | | |
| | |
| | | _assetsEquipmentSeries.Name = NameTextEdit.Text; |
| | | _assetsEquipmentSeries.TagName = TagNameTextEdit.Text; |
| | | _assetsEquipmentSeries.Description = DescriptionTextEdit.Text; |
| | | if (await this.ReloadDataEvent.Invoke(_assetsEquipmentSeries, this.textEditParentList.EditValue)) |
| | | if (_manufacturerMappingVmo != null) |
| | | { |
| | | if (this.textEditManufacturer.EditValue != null) |
| | | { |
| | | _manufacturerMappingVmo.ManufacturerID = Convert.ToInt64(textEditManufacturer.EditValue); |
| | | } |
| | | } |
| | | if (await this.ReloadDataEvent.Invoke(_assetsEquipmentSeries, this.textEditParentList.EditValue, _manufacturerMappingVmo)) |
| | | { |
| | | TipFormHelper.ShowSucceed("修改成功!"); |
| | | } |