duheng
2024-08-19 eaff2518ab6159c360ec2a865b45002b26fdc4cd
WinFrmUI/HStation.WinFrmUI.Basic/01-SysCatalogManage/SysCatalogManageMainPanel.cs
@@ -18,13 +18,13 @@
        public override void InitialDataSource()
        {
            this.typeTreeListCtrl2.SetBindingData();
            _bll = new Yw.BLL.SysCatalog();
        }
        //聚焦切换
        private async void TypeTreeListCtrl2_FocusedChangedEvent(long typeID)
        {
            _allBindingList = new List<SysCatalogViewModel>();
            _bll = new Yw.BLL.SysCatalog();
            var alllist = await _bll.GetByTypeID(typeID);
            _allBindingList.Clear();
            foreach (var item in alllist)
@@ -41,6 +41,8 @@
        {
            var dlg = new AddSysCatalogDlg();
            var typeID = this.typeTreeListCtrl2.GetCurrentID();
            if (typeID == 0)
                return;
            dlg.SetBindingData(typeID);
            dlg.ReloadDataEvent += async (rhs) =>
           {
@@ -119,17 +121,24 @@
            }
            if (MessageBoxHelper.IsClickOk($"确认删除数据行?", "提示"))
                return;
            var result = await _bll.DeleteByID(currentVm.ID);
            if (result)
            try
            {
                _allBindingList.Remove(currentVm);
                this.catlogViewModelBindingSource.ResetBindings(false);
                MessageBoxHelper.ShowSuccess($"删除成功!");
                var result = await _bll.DeleteByID(currentVm.ID);
                if (result)
                {
                    _allBindingList.Remove(currentVm);
                    this.catlogViewModelBindingSource.ResetBindings(false);
                    MessageBoxHelper.ShowSuccess($"删除成功!");
                }
                else
                {
                    MessageBoxHelper.ShowError($"删除失败!");
                    return;
                }
            }
            else
            catch (Yw.Dto.InternalException ex)
            {
                MessageBoxHelper.ShowError($"删除失败!");
                return;
                MessageBoxHelper.ShowError(ex.ErrorMsg);
            }
        }