| | |
| | | |
| | | private BindingList<CurrentTreeViewModel> _allBindingList = null;//所有绑定列表 |
| | | |
| | | private BLL.PumpSeries _seriesbll = null; |
| | | private BLL.PumpGroup _groupbll = null; |
| | | private BLL.PumpType _typebll = null; |
| | | private BLL.PumpTypeSeriesMapSeriesMap _typeSeriesMapBll = null; |
| | | private BLL.AssetsPumpSeries _seriesbll = null; |
| | | private BLL.AssetsPumpGroup _groupbll = null; |
| | | private BLL.AssetsPumpType _typebll = null; |
| | | private BLL.AssetsPumpTypeSeriesMapSeriesMap _typeSeriesMapBll = null; |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | |
| | | /// </summary> |
| | | public async void SetBindingData() |
| | | { |
| | | _seriesbll = new BLL.PumpSeries(); |
| | | _groupbll = new BLL.PumpGroup(); |
| | | _typebll = new BLL.PumpType(); |
| | | _typeSeriesMapBll = new BLL.PumpTypeSeriesMapSeriesMap(); |
| | | _seriesbll = new BLL.AssetsPumpSeries(); |
| | | _groupbll = new BLL.AssetsPumpGroup(); |
| | | _typebll = new BLL.AssetsPumpType(); |
| | | _typeSeriesMapBll = new BLL.AssetsPumpTypeSeriesMapSeriesMap(); |
| | | _allBindingList = new BindingList<CurrentTreeViewModel>(); |
| | | var allType = await _typebll.GetAll(); |
| | | _allBindingList.Add(new CurrentTreeViewModel |
| | |
| | | var vm = this.treeList1.GetCurrentViewModel(_allBindingList); |
| | | if (vm != null) |
| | | { |
| | | var series = vm.Model as Vmo.PumpSeriesVmo; |
| | | var series = vm.Model as Vmo.AssetsPumpSeriesVmo; |
| | | if (series != null) |
| | | { |
| | | this.FocusedChangedEvent?.Invoke(series.ID, true); |
| | | } |
| | | else |
| | | { |
| | | var group = vm.Model as Vmo.PumpGroupVmo; |
| | | var group = vm.Model as Vmo.AssetsPumpGroupVmo; |
| | | if (group != null) |
| | | { |
| | | this.FocusedChangedEvent?.Invoke(group.ID, false); |
| | |
| | | { |
| | | if (_allBindingList == null) |
| | | return; |
| | | var dlg = new AddPumpTypeDlg(); |
| | | var dlg = new AddAssetsPumpTypeDlg(); |
| | | dlg.ReloadDataEvent += async (rhs) => |
| | | { |
| | | var bll = new BLL.PumpType(); |
| | | var bll = new BLL.AssetsPumpType(); |
| | | var id = await bll.Insert(rhs); |
| | | if (id > 0) |
| | | { |
| | |
| | | } |
| | | if (currentVm.IsGroup == false) |
| | | { |
| | | var series = currentVm.Model as Model.PumpSeries; |
| | | var series = currentVm.Model as Model.AssetsPumpSeries; |
| | | var dlg = new EditPumpProductSeriesDlg(); |
| | | var model = await new BLL.PumpSeries().GetByID(currentVm.ID); |
| | | var model = await new BLL.AssetsPumpSeries().GetByID(currentVm.ID); |
| | | if (model == null) |
| | | return; |
| | | dlg.SetBindingData(model); |
| | |
| | | else |
| | | { |
| | | var dlg = new EditPumpProductGroupDlg(); |
| | | var GroupDto = await new BLL.PumpGroup().GetByID(currentVm.ID); |
| | | var GroupDto = await new BLL.AssetsPumpGroup().GetByID(currentVm.ID); |
| | | if (GroupDto == null) |
| | | return; |
| | | dlg.SetBindingData(GroupDto); |
| | |
| | | } |
| | | else |
| | | { |
| | | var result = await BLLFactory<BLL.PumpSeries>.Instance.DeleteEx(currentVm.ID); |
| | | var result = await BLLFactory<BLL.AssetsPumpSeries>.Instance.DeleteEx(currentVm.ID); |
| | | if (result) |
| | | { |
| | | _allBindingList.Remove(currentVm); |
| | |
| | | dlg.SetBindingData(currentVm.ID); |
| | | dlg.ReloadDataEvent += async (model) => |
| | | { |
| | | var allchildList = await BLLFactory<BLL.PumpGroup>.Instance.GetAll(); |
| | | var allchildList = await BLLFactory<BLL.AssetsPumpGroup>.Instance.GetAll(); |
| | | model.SortCode = allchildList.Count == 0 ? 1 : allchildList.Max(x => x.SortCode) + 1; |
| | | var id = await _groupbll.Insert(model); |
| | | if (id > 0) |
| | | { |
| | | var vm = await BLLFactory<BLL.PumpGroup>.Instance.GetByID(id); |
| | | var vm = await BLLFactory<BLL.AssetsPumpGroup>.Instance.GetByID(id); |
| | | _allBindingList.Add(new CurrentTreeViewModel(vm)); |
| | | this.treeList1.Refresh(); |
| | | return true; |
| | |
| | | #region 类型菜单 |
| | | |
| | | //添加泵系列 |
| | | private void BarButtonAddPumpSeries_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private void BarButtonAddAssetsPumpSeries_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | if (_allBindingList == null) |
| | | return; |
| | |
| | | if (id > 0) |
| | | { |
| | | var typemapid = await _typeSeriesMapBll.Insert( |
| | | new Vmo.PumpTypeSeriesMap |
| | | new Vmo.AssetsPumpTypeSeriesMap |
| | | { |
| | | PumpSeriesID = id, |
| | | PumpTypeID = currentVm.ID |
| | |
| | | } |
| | | |
| | | //删除分类 |
| | | private async void BarButtonDeletePumpType_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private async void BarButtonDeleteAssetsPumpType_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var currentVm = this.treeList1.GetCurrentViewModel(_allBindingList); |
| | | if (currentVm == null) |
| | |
| | | } |
| | | |
| | | //编辑分类 |
| | | private void BarButtonEditPumpType_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private void BarButtonEditAssetsPumpType_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var currentVm = this.treeList1.GetCurrentViewModel(_allBindingList); |
| | | if (currentVm == null) |
| | |
| | | TipFormHelper.ShowWarn("请选择数据行!"); |
| | | return; |
| | | } |
| | | var dlg = new EditPumpTypeDlg(); |
| | | var dlg = new EditAssetsPumpTypeDlg(); |
| | | dlg.SetBindingData(currentVm.ID); |
| | | dlg.ReloadDataEvent += async (rhs) => |
| | | { |
| | | var bll = new BLL.PumpType(); |
| | | var bll = new BLL.AssetsPumpType(); |
| | | if (await bll.Update(rhs)) |
| | | { |
| | | currentVm.Reset(rhs); |
| | |
| | | |
| | | #region 型号菜单 |
| | | |
| | | public event Action<object, DevExpress.XtraBars.ItemClickEventArgs> AddPumpMain; |
| | | public event Action<object, DevExpress.XtraBars.ItemClickEventArgs> AddAssetsPumpMain; |
| | | |
| | | private void BarButtonAddPumpMain_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | private void BarButtonAddAssetsPumpMain_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | AddPumpMain.Invoke(null, null); |
| | | AddAssetsPumpMain.Invoke(null, null); |
| | | } |
| | | |
| | | #endregion 型号菜单 |