MS
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
Imports DevExpress.XtraBars
|
||||
Imports DevExpress.XtraEditors.Controls
|
||||
Imports DevExpress.XtraEditors.Repository
|
||||
Imports DevExpress.XtraGrid
|
||||
Imports DevExpress.XtraGrid.Columns
|
||||
Imports DevExpress.XtraTreeList
|
||||
Imports DigitalData.GUIs.ZooFlow.ClassConstants
|
||||
Public Class frmTreeViewNavi
|
||||
Dim RightAddActive As Boolean = False
|
||||
Dim FormShown As Boolean = False
|
||||
Dim SelectedNodeID As Integer = 0
|
||||
Dim selectedNodeCapt As String
|
||||
Private Sub frmTreeViewNavi_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Try
|
||||
Dim oSQL = "select SN_ID ChildID,SN_PARENT_ID ParentID,TERM_VALUE as CAPTION from VWIDB_STRUCTURE_NODES_STRUCTURE"
|
||||
@@ -37,41 +40,62 @@ Public Class frmTreeViewNavi
|
||||
End Sub
|
||||
|
||||
Private Sub TreeList2_SelectionChanged(sender As Object, e As EventArgs) Handles TreeList2.SelectionChanged
|
||||
Try
|
||||
Dim KeyValue As Object
|
||||
KeyValue = TreeList2.FocusedNode(TreeList2.KeyFieldName)
|
||||
Console.WriteLine($"keyfield: {KeyValue.ToString}")
|
||||
If IsNumeric(KeyValue) And RightAddActive Then
|
||||
SelectedNodeID = KeyValue
|
||||
Refresh_Relations()
|
||||
If XtraTabControlRelationScope.SelectedTabPageIndex = 0 Then
|
||||
Refresh_FreeUsers()
|
||||
End If
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
Sub Refresh_all()
|
||||
Refresh_Relations()
|
||||
If XtraTabControlRelationScope.SelectedTabPageIndex = 0 Then
|
||||
Refresh_FreeUsers()
|
||||
GridViewFreeUser.FocusedRowHandle = GridControl.InvalidRowHandle
|
||||
Else
|
||||
Refresh_FreeGroups()
|
||||
GridViewFreeGroups.FocusedRowHandle = GridControl.InvalidRowHandle
|
||||
End If
|
||||
GridViewRelations.FocusedRowHandle = GridControl.InvalidRowHandle
|
||||
|
||||
|
||||
End Sub
|
||||
Private Sub BarCheckItemAdminFolderRights_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarCheckItemAdminFolderRights.CheckedChanged
|
||||
Dim oitm As BarCheckItem = e.Item
|
||||
RightAddActive = oitm.Checked
|
||||
SplitContainerControl1.Collapsed = Not RightAddActive
|
||||
|
||||
If RightAddActive = True Then
|
||||
RibbonPageGroupRelationsChange.Visible = True
|
||||
If SelectedNodeID > 0 Then
|
||||
Refresh_all()
|
||||
End If
|
||||
Else
|
||||
RibbonPageGroupRelationsChange.Visible = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub Refresh_FreeUsers()
|
||||
Try
|
||||
Dim oSQL = $"SELECT GUID as USR_ID, EMAIL FROM DD_ECM.dbo.TBDD_USER USR WHERE GUID NOT IN (
|
||||
SELECT ScopeID FROM VWIDB_SN_RELATIONS WHERE SN_ID = {SelectedNodeID}) AND USR.ACTIVE = 1 AND LEN(EMAIL) > 0"
|
||||
SELECT ScopeID FROM VWIDB_SN_RELATIONS WHERE Scope = 'USR' AND SN_ID = {SelectedNodeID}) AND USR.ACTIVE = 1 AND LEN(EMAIL) > 0"
|
||||
Dim oDT As DataTable = My.DatabaseIDB.GetDatatable(oSQL)
|
||||
If Not IsNothing(oDT) Then
|
||||
GridViewFreeUser.Columns.Clear()
|
||||
GridControlFreeUser.DataSource = oDT
|
||||
GridViewFreeUser.Columns("USR_ID").Visible = False
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub Refresh_FreeGroups()
|
||||
Try
|
||||
Dim oSQL = $"SELECT GUID as GroupID, NAME FROM DD_ECM.dbo.TBDD_GROUPS GRP WHERE GUID NOT IN (
|
||||
SELECT ScopeID FROM VWIDB_SN_RELATIONS WHERE Scope = 'GRP' AND SN_ID = {SelectedNodeID}) AND GRP.ACTIVE = 1 "
|
||||
Dim oDT As DataTable = My.DatabaseIDB.GetDatatable(oSQL)
|
||||
If Not IsNothing(oDT) Then
|
||||
GridViewFreeGroups.Columns.Clear()
|
||||
GridControlFreeGroups.DataSource = oDT
|
||||
GridViewFreeGroups.Columns("GroupID").Visible = False
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
@@ -93,12 +117,14 @@ Public Class frmTreeViewNavi
|
||||
GridViewRelations.Columns("REL_ID").Visible = False
|
||||
GridViewRelations.Columns("SN_ID").Visible = False
|
||||
GridViewRelations.Columns("Scope").Visible = False
|
||||
GridViewRelations.Columns("ScopeID").Visible = False
|
||||
GridViewRelations.Columns("NODE_CAPTION").Visible = False
|
||||
|
||||
GridViewRelations.Columns.Item("ICON").MaxWidth = 25
|
||||
GridViewRelations.Columns.Item("ICON").MinWidth = 25
|
||||
GridViewRelations.Columns.Item("ICON").AppearanceCell.BackColor = Color.White
|
||||
GridViewRelations.Columns.Item("ICON").Fixed = FixedStyle.Left
|
||||
GridViewRelations.ViewCaption = $"Relationen für [{selectedNodeCapt}]"
|
||||
If oDT.Rows.Count > 0 Then
|
||||
Dim oRowIndex As Integer = 0
|
||||
For Each oRow As DataRow In oDT.Rows
|
||||
@@ -120,6 +146,7 @@ Public Class frmTreeViewNavi
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
@@ -130,41 +157,88 @@ Public Class frmTreeViewNavi
|
||||
SplitContainerControl1.Collapsed = True
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemAddRelation.ItemClick
|
||||
Dim oInsert As String
|
||||
oInsert = $"INSERT INTO [dbo].[TBIDB_STRUCTURE_NODES_RELATIONS]
|
||||
([SN_ID]"
|
||||
If XtraTabControlRelationScope.SelectedTabPageIndex = 0 Then
|
||||
Dim oInsert = $"INSERT INTO [dbo].[TBIDB_STRUCTURE_NODES_RELATIONS]
|
||||
([SN_ID]
|
||||
,[USR_ID]
|
||||
,[ADDED_WHO]) VALUES ({SelectedNodeID}, {BarButtonItem2.Tag},'{My.Application.User.UserName}')"
|
||||
If My.DatabaseIDB.ExecuteNonQuery(oInsert) = True Then
|
||||
Refresh_Relations()
|
||||
Refresh_FreeUsers()
|
||||
oInsert &= ",[USR_ID]"
|
||||
|
||||
End If
|
||||
Else
|
||||
oInsert &= ",[GRP_ID]"
|
||||
End If
|
||||
oInsert &= $",[ADDED_WHO]) VALUES ({SelectedNodeID}, {BarButtonItemRelationDel.Tag},'{My.Application.User.UserName}')"
|
||||
If My.DatabaseIDB.ExecuteNonQuery(oInsert) = True Then
|
||||
Refresh_all()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GridViewFreeUser_FocusedRowChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles GridViewFreeUser.FocusedRowChanged
|
||||
Dim oFocusedUSR = GridViewFreeUser.GetFocusedRowCellValue(GridViewFreeUser.Columns("USR_ID"))
|
||||
If Not IsNothing(oFocusedUSR) Then
|
||||
RibbonPageGroup3.Enabled = True
|
||||
BarButtonItem1.Enabled = True
|
||||
BarButtonItem2.Enabled = False
|
||||
BarButtonItem2.Tag = oFocusedUSR
|
||||
RibbonPageGroupRelationsChange.Enabled = True
|
||||
BarButtonItemAddRelation.Enabled = True
|
||||
BarButtonItemRelationDel.Enabled = False
|
||||
BarButtonItemRelationDel.Tag = oFocusedUSR
|
||||
GridViewRelations.FocusedRowHandle = GridControl.InvalidRowHandle
|
||||
Else
|
||||
RibbonPageGroup3.Enabled = False
|
||||
RibbonPageGroupRelationsChange.Enabled = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GridViewRelations_FocusedRowChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles GridViewRelations.FocusedRowChanged
|
||||
Dim oFocusedRELID = GridViewRelations.GetFocusedRowCellValue(GridViewRelations.Columns("REL_ID"))
|
||||
If Not IsNothing(oFocusedRELID) Then
|
||||
RibbonPageGroup3.Enabled = True
|
||||
BarButtonItem1.Enabled = False
|
||||
BarButtonItem2.Enabled = True
|
||||
BarButtonItem2.Tag = oFocusedRELID
|
||||
RibbonPageGroupRelationsChange.Enabled = True
|
||||
BarButtonItemAddRelation.Enabled = False
|
||||
BarButtonItemRelationDel.Enabled = True
|
||||
BarButtonItemRelationDel.Tag = oFocusedRELID
|
||||
|
||||
Else
|
||||
RibbonPageGroup3.Enabled = False
|
||||
RibbonPageGroupRelationsChange.Enabled = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem2_ItemClick(sender As Object, e As ItemClickEventArgs) Handles BarButtonItemRelationDel.ItemClick
|
||||
Dim oDel = $"DELETE FROM TBIDB_STRUCTURE_NODES_RELATIONS WHERE GUID = {BarButtonItemRelationDel.Tag}"
|
||||
If My.DatabaseIDB.ExecuteNonQuery(oDel) = True Then
|
||||
Refresh_all()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub TreeList2_FocusedNodeChanged(sender As Object, e As FocusedNodeChangedEventArgs) Handles TreeList2.FocusedNodeChanged
|
||||
Try
|
||||
Dim KeyValue As Object
|
||||
KeyValue = TreeList2.FocusedNode(TreeList2.KeyFieldName)
|
||||
If IsNothing(KeyValue) Then
|
||||
Exit Sub
|
||||
End If
|
||||
Dim oNodeCaption = e.Node.GetDisplayText("CAPTION")
|
||||
|
||||
selectedNodeCapt = oNodeCaption
|
||||
Console.WriteLine($"keyfield: {KeyValue.ToString}")
|
||||
If IsNumeric(KeyValue) Then
|
||||
SelectedNodeID = KeyValue
|
||||
Else
|
||||
Exit Sub
|
||||
End If
|
||||
If RightAddActive Then
|
||||
Refresh_all()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub GridViewFreeGroups_FocusedRowChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles GridViewFreeGroups.FocusedRowChanged
|
||||
Dim oFocusedGRP = GridViewFreeGroups.GetFocusedRowCellValue(GridViewFreeGroups.Columns("GroupID"))
|
||||
If Not IsNothing(oFocusedGRP) Then
|
||||
RibbonPageGroupRelationsChange.Enabled = True
|
||||
BarButtonItemAddRelation.Enabled = True
|
||||
BarButtonItemRelationDel.Enabled = False
|
||||
BarButtonItemRelationDel.Tag = oFocusedGRP
|
||||
Else
|
||||
RibbonPageGroupRelationsChange.Enabled = False
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user