| | |
| | | using DevExpress.XtraEditors; |
| | | using DevExpress.XtraBars.Docking2010.DragEngine; |
| | | using DevExpress.XtraEditors; |
| | | using HStation.WinFrmUI.Xhs.Project; |
| | | using ISupply.WinFrmUI; |
| | | using Yw.Basic; |
| | | |
| | | namespace HStation.WinFrmUI.Xhs |
| | | { |
| | |
| | | public TypeTreeListCtrl() |
| | | { |
| | | InitializeComponent(); |
| | | this.treeList1.InitialDefaultSettings(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public event Action<long> FocusedChangedEvent; |
| | | |
| | | private List<TypeViewModel> _allBindingList = null; |
| | | private List<TypeTreeListViewModel> _allBindingList = null; |
| | | |
| | | private Yw.BLL.SysModule _bll = null; |
| | | private Yw.BLL.SysTypeStd _bll = null; |
| | | |
| | | private Yw.BLL.SysModule _Modulebll = null; |
| | | |
| | | /// <summary> |
| | | /// 绑定数据 |
| | |
| | | /// </summary> |
| | | public async void SetBindingData() |
| | | { |
| | | _allBindingList = new List<TypeViewModel>(); |
| | | |
| | | _allBindingList = new List<TypeTreeListViewModel>(); |
| | | _bll = new Yw.BLL.SysTypeStd(); |
| | | var alllist = await _bll.GetLogicalTreeListByExtendType(eExtendType.Catalog); |
| | | foreach (var item in alllist) |
| | | { |
| | | var module = new TypeTreeListViewModel(item); |
| | | _allBindingList.Add(module); |
| | | foreach (var child in item.Children) |
| | | { |
| | | var children = new TypeTreeListViewModel(child); |
| | | _allBindingList.Add(children); |
| | | } |
| | | } |
| | | this.moduleViewModelBindingSource.DataSource = _allBindingList; |
| | | this.moduleViewModelBindingSource.ResetBindings(false); |
| | | } |
| | |
| | | var dlg = new AddMoudleDlg(); |
| | | dlg.ReloadDataEvent += async (rhs) => |
| | | { |
| | | var id = await _bll.Insert(rhs); |
| | | var id = await _Modulebll.Insert(rhs); |
| | | if (id > 0) |
| | | { |
| | | var model = await _bll.GetByID(id); |
| | | // _allBindingList.Add(new ModuleViewModel(model)); |
| | | var model = await _Modulebll.GetByID(id); |
| | | // _allBindingList.Add(new ModuleViewModel(model)); |
| | | this.moduleViewModelBindingSource.ResetBindings(false); |
| | | return true; |
| | | } |
| | |
| | | dlg.SetBindingData(vm.ID); |
| | | dlg.ReloadDataEvent += async (rhs) => |
| | | { |
| | | if (await _bll.Update(rhs)) |
| | | if (await _Modulebll.Update(rhs)) |
| | | { |
| | | //vm.Reset(rhs); |
| | | this.moduleViewModelBindingSource.ResetBindings(false); |
| | |
| | | } |
| | | if (MessageBoxHelper.IsClickOk("确认删除数据行?", "提示")) |
| | | return; |
| | | if (await _bll.IsExistByModuleID(currentVm.ID)) |
| | | if (await _Modulebll.IsExistByModuleID(currentVm.ID)) |
| | | { |
| | | MessageBoxHelper.ShowWarning("存在系统类型,不可删除!"); |
| | | return; |
| | | } |
| | | var result = await _bll.DeleteByID(currentVm.ID); |
| | | var result = await _Modulebll.DeleteByID(currentVm.ID); |
| | | if (result) |
| | | { |
| | | _allBindingList.Remove(currentVm); |