ÎļþÃû´Ó WinFrmUI/HStation.WinFrmUI.Assets.Core/08-Nozzle/01-series/NozzleTreeListCtrl.cs ÐÞ¸Ä |
| | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public partial class NozzleTreeListCtrl : XtraUserControl |
| | | public partial class SprinklerTreeListCtrl : XtraUserControl |
| | | { |
| | | public NozzleTreeListCtrl() |
| | | public SprinklerTreeListCtrl() |
| | | { |
| | | InitializeComponent(); |
| | | this.treeList1.InitialDefaultSettings(); |
| | |
| | | //èç¦æ¹åäºä»¶ |
| | | public event Action<long> ReloadEvent = null; |
| | | |
| | | private BLL.AssetsNozzleSeries _bll = null; |
| | | private BLL.AssetsSprinklerSeries _bll = null; |
| | | |
| | | private List<AssetsNozzleSeriesViewModel> _allBindingList = new List<AssetsNozzleSeriesViewModel>(); |
| | | private List<AssetsSprinklerSeriesViewModel> _allBindingList = new List<AssetsSprinklerSeriesViewModel>(); |
| | | |
| | | public async void SetBindingData() |
| | | { |
| | | _bll = new BLL.AssetsNozzleSeries(); |
| | | _bll = new BLL.AssetsSprinklerSeries(); |
| | | var alllist = await _bll.GetAll(); |
| | | if (alllist != null) |
| | | { |
| | | foreach (var item in alllist) |
| | | { |
| | | _allBindingList.Add(new AssetsNozzleSeriesViewModel(item)); |
| | | _allBindingList.Add(new AssetsSprinklerSeriesViewModel(item)); |
| | | } |
| | | } |
| | | this.treeList1.DataSource = _allBindingList; |
| | |
| | | } |
| | | |
| | | //è·åç³»åID |
| | | public AssetsNozzleSeriesViewModel GetCurrentSeries() |
| | | public AssetsSprinklerSeriesViewModel GetCurrentSeries() |
| | | { |
| | | var vm = this.treeList1.GetCurrentViewModel(_allBindingList); |
| | | if (vm == null) |
| | |
| | | //æ·»å éé¨ç³»å |
| | | private void BtnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var dlg = new AddAssetsNozzleSeriesDlg(); |
| | | var dlg = new AddAssetsSprinklerSeriesDlg(); |
| | | dlg.ReloadDataEvent += async (rhs) => |
| | | { |
| | | var bll = new BLL.AssetsNozzleSeries(); |
| | | var bll = new BLL.AssetsSprinklerSeries(); |
| | | var id = await bll.Insert(rhs); |
| | | if (id > 0) |
| | | { |
| | | rhs.ID = id; |
| | | _allBindingList.Add(new AssetsNozzleSeriesViewModel(rhs)); |
| | | _allBindingList.Add(new AssetsSprinklerSeriesViewModel(rhs)); |
| | | this.treeList1.RefreshDataSource(); |
| | | return true; |
| | | } |
| | |
| | | MessageBoxHelper.ShowWarning("è¯·éæ©æ°æ®è¡!"); |
| | | return; |
| | | } |
| | | var dlg = new EditAssetsNozzleSeriesDlg(); |
| | | var AssetsNozzleSeries = await BLLFactory<BLL.AssetsNozzleSeries>.Instance.GetByID(vm.ID); |
| | | if (AssetsNozzleSeries == null) |
| | | var dlg = new EditAssetsSprinklerSeriesDlg(); |
| | | var AssetsSprinklerSeries = await BLLFactory<BLL.AssetsSprinklerSeries>.Instance.GetByID(vm.ID); |
| | | if (AssetsSprinklerSeries == null) |
| | | return; |
| | | dlg.SetBindingData(AssetsNozzleSeries); |
| | | dlg.SetBindingData(AssetsSprinklerSeries); |
| | | dlg.ReloadDataEvent += async (rhs) => |
| | | { |
| | | if (await BLLFactory<BLL.AssetsNozzleSeries>.Instance.Update(rhs)) |
| | | if (await BLLFactory<BLL.AssetsSprinklerSeries>.Instance.Update(rhs)) |
| | | { |
| | | vm.Reset(rhs); |
| | | this.treeList1.RefreshDataSource(); |