Dim tr As WinForm.TreeView = e.Form.Controls("TreeView2") Dim nd As WinForm.TreeNode = tr.SelectedNode If nd IsNot Nothing Then Dim Result As DialogResult Result = MessageBox.Show(" 如果删除选定的组织机构,将导致本机构的安全职责及责任制考核标准同时被删除. 您确定要删除当前节点吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If Result = DialogResult.Yes Then Dim pth() As String = nd.FullPath.Split("\") Select Case nd.Level Case 0 DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "'") Case 1 DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "'") Case 2 DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "' And 岗位设置 = '" & pth(2) & "'") Case 3 DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "' And 岗位设置 = '" & pth(2) & "' and 第四层机构设置 = '" & pth(3) & "'") Case 4 DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "' And 岗位设置 = '" & pth(2) & "' and 第四层机构设置 = '" & pth(3) & "' and 第五层机构设置 = '" & pth(4) & "'") Case 5 DataTables("组织机构和职责").DeleteFor("企业名称 = '" & pth(0) & "' And 部门设置 = '" & pth(1) & "' And 岗位设置 = '" & pth(2) & "' and 第四层机构设置 = '" & pth(3) & "' and 第五层机构设置 = '" & pth(4) & "' and 第六层机构设置 = '" & pth(5) & "'") End Select nd.Delete() Else End If End If tr.Select()
|