| | |
| | | using DevExpress.XtraEditors; |
| | | using Yw; |
| | | using Yw.Untity; |
| | | |
| | | namespace HStation.WinFrmUI.Assets |
| | | { |
| | |
| | | |
| | | private BLL.AssetsPipeSeries _bll = null; |
| | | |
| | | private List<PipeLineSeriesViewModel> _allBindingList = new List<PipeLineSeriesViewModel>(); |
| | | private List<AssetsPipeSeriesViewModel> _allBindingList = new List<AssetsPipeSeriesViewModel>(); |
| | | |
| | | public async void SetBindingData() |
| | | { |
| | |
| | | { |
| | | foreach (var item in alllist) |
| | | { |
| | | _allBindingList.Add(new PipeLineSeriesViewModel(item)); |
| | | _allBindingList.Add(new AssetsPipeSeriesViewModel(item)); |
| | | } |
| | | } |
| | | this.treeList1.DataSource = _allBindingList; |
| | |
| | | } |
| | | |
| | | //获取系列ID |
| | | public PipeLineSeriesViewModel GetCurrentSeries() |
| | | public AssetsPipeSeriesViewModel GetCurrentSeries() |
| | | { |
| | | var vm = this.treeList1.GetCurrentViewModel(_allBindingList); |
| | | if (vm == null) |
| | |
| | | private void BtnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var dlg = new AddPipeLineSeriesDlg(); |
| | | dlg.ReloadDataEvent += async (rhs) => |
| | | dlg.ReloadDataEvent += async (rhs, currentId) => |
| | | { |
| | | if (currentId != null) |
| | | { |
| | | var select = await _bll.GetByID(Convert.ToInt64(currentId)); |
| | | rhs.ParentIds = TreeParentIdsHelper.GetChildParentIds(select.ID, select.ParentIds); |
| | | } |
| | | var bll = new BLL.AssetsPipeSeries(); |
| | | var id = await bll.Insert(rhs); |
| | | if (id > 0) |
| | | { |
| | | rhs.ID = id; |
| | | _allBindingList.Add(new PipeLineSeriesViewModel(rhs)); |
| | | _allBindingList.Add(new AssetsPipeSeriesViewModel(rhs)); |
| | | this.treeList1.RefreshDataSource(); |
| | | return true; |
| | | } |
| | |
| | | if (PipeLineSeries == null) |
| | | return; |
| | | dlg.SetBindingData(PipeLineSeries); |
| | | dlg.ReloadDataEvent += async (rhs) => |
| | | dlg.ReloadDataEvent += async (rhs, currentId) => |
| | | { |
| | | if (currentId != null) |
| | | { |
| | | var select = await _bll.GetByID(Convert.ToInt64(currentId)); |
| | | rhs.ParentIds = TreeParentIdsHelper.GetChildParentIds(select.ID, select.ParentIds); |
| | | } |
| | | if (await BLLFactory<BLL.AssetsPipeSeries>.Instance.Update(rhs)) |
| | | { |
| | | vm.Reset(rhs); |