From 574dcf9d32ee25cbad686e9a00d02fb87ce38f3e Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 9 Mar 2022 14:09:44 +0100 Subject: [PATCH] Zooflow: Add user relations --- GUIs.ZooFlow/Administration/ClassConstants.vb | 1 + .../Administration/ClassDetailForm.vb | 213 ++++------- .../frmAdmin_UserGroupRelations.Designer.vb | 354 ++++++++++++++++++ .../Users/frmAdmin_UserGroupRelations.resx | 120 ++++++ .../Users/frmAdmin_UserGroupRelations.vb | 155 ++++++++ .../Administration/frmAdmin_Start.Designer.vb | 1 + GUIs.ZooFlow/Administration/frmAdmin_Start.vb | 4 + GUIs.ZooFlow/ZooFlow.vbproj | 9 + 8 files changed, 710 insertions(+), 147 deletions(-) create mode 100644 GUIs.ZooFlow/Administration/Users/frmAdmin_UserGroupRelations.Designer.vb create mode 100644 GUIs.ZooFlow/Administration/Users/frmAdmin_UserGroupRelations.resx create mode 100644 GUIs.ZooFlow/Administration/Users/frmAdmin_UserGroupRelations.vb diff --git a/GUIs.ZooFlow/Administration/ClassConstants.vb b/GUIs.ZooFlow/Administration/ClassConstants.vb index 1dd281cd..e3e4bcc6 100644 --- a/GUIs.ZooFlow/Administration/ClassConstants.vb +++ b/GUIs.ZooFlow/Administration/ClassConstants.vb @@ -24,6 +24,7 @@ Public Const PAGE_USERS_USERLIST = "USERS_USERLIST" Public Const PAGE_USERS_GROUPLIST = "USERS_GROUPLIST" Public Const PAGE_USERS_MODULELIST = "USERS_MODULELIST" + Public Const PAGE_USERS_USER_GROUP_RELATIONS = "USERS_USER_GROUP_RELATIONS" Public Const COLUMN_NAME_ACTIVE = "ACTIVE" diff --git a/GUIs.ZooFlow/Administration/ClassDetailForm.vb b/GUIs.ZooFlow/Administration/ClassDetailForm.vb index 3d9e3196..2c2ea18b 100644 --- a/GUIs.ZooFlow/Administration/ClassDetailForm.vb +++ b/GUIs.ZooFlow/Administration/ClassDetailForm.vb @@ -84,11 +84,10 @@ Public Class ClassDetailForm .[Module] = MODULE_USERS, .Entity = PAGE_USERS_GROUPLIST }}, - {PAGE_USERS_MODULELIST, New DetailSettings With { - .GridTitle = "Modul Übersicht", - .NewRecordTitle = "Neues Modul", + {PAGE_USERS_USER_GROUP_RELATIONS, New DetailSettings With { + .GridTitle = "User Group Relations", .[Module] = MODULE_USERS, - .Entity = PAGE_USERS_MODULELIST + .Entity = PAGE_USERS_USER_GROUP_RELATIONS }} } @@ -96,184 +95,104 @@ Public Class ClassDetailForm MyBase.New(LogConfig) End Sub - Public Function LoadData() As Boolean + Public Function Handle_OpenDetail(PrimaryKey As Integer, Page As String, IsInsert As Boolean) As Boolean Try - Dim oTable As DataTable = My.DatabaseECM.GetDatatable("SELECT * FROM TBZF_ADMIN_SOURCE_SQL WHERE SCOPE = 'OVERVIEW' ORDER BY GUID") - DetailDataList.Clear() + Dim oForm As Form = Nothing - For Each oRow As DataRow In oTable.Rows - Dim oCHeck = oRow.Item("ENTITY_TITLE").ToString - Dim oItem As New ClassDetailForm.DetailData With { - .Guid = CInt(oRow.Item("GUID")), - .ParentId = CInt(oRow.Item("PARENT_ID")), - .Entity = oRow.Item("ENTITY_TITLE").ToString, - .Scope = oRow.Item("SCOPE").ToString, - .SQLCommand = oRow.Item("SQL_COMMAND").ToString.Replace("@LANG_CODE", My.Application.User.Language), - .PrimaryKey = Utils.NotNull(oRow.Item("PK_COLUMN"), String.Empty) - } + Select Case Page + Case PAGE_IDB_ATTRIBUTES + oForm = New frmAdmin_IDBAttribute(PrimaryKey) With {.IsInsert = IsInsert} - Try - oItem.SQLResult = My.DatabaseECM.GetDatatable(oItem.SQLCommand) - Catch ex As Exception - oItem.SQLResult = Nothing - Logger.Error(ex) - End Try + Case PAGE_IDB_BUSINESS_ENTITIES + oForm = New frmAdmin_IDBEntity(PrimaryKey) With {.IsInsert = IsInsert} - Dim oKey As String = oItem.Entity & "-" & oItem.Scope - DetailDataList.Add(oKey, oItem) - Next + Case PAGE_IDB_OBJECT_STORES + oForm = New frmAdmin_IDBObjectStore(PrimaryKey) With {.IsInsert = IsInsert} - Return True + Case PAGE_CW_PROFILES + oForm = New frmAdmin_ClipboardWatcher(PrimaryKey) With {.IsInsert = IsInsert} - Catch ex As Exception - Logger.Error(ex) - Return False + Case PAGE_GI_PROFILES + GLOBIX_JUMP_DOCTYPE_ID = PrimaryKey + oForm = New frmAdmin_Globix(PrimaryKey) With {.IsInsert = IsInsert} - End Try - End Function + Case PAGE_META_SOURCE_SQL + oForm = New frmAdmin_SourceSQL(PrimaryKey) With {.IsInsert = IsInsert} - Public Function Handle_OpenDetail(PrimaryKey As Integer, Page As String, IsInsert As Boolean) As Boolean - Select Case Page - Case PAGE_IDB_ATTRIBUTES - Load_IDBAttribute(PrimaryKey, IsInsert) - Return True + Case PAGE_IDB_ATTRIBUTE_REL + oForm = New frmAdmin_IDBBERelations - Case PAGE_IDB_BUSINESS_ENTITIES - Load_IDBEntity(PrimaryKey, IsInsert) - Return True + Case PAGE_GI_RELATIONS + oForm = New frmAdmin_GlobixRelations - Case PAGE_IDB_OBJECT_STORES - Load_IDBObjectstore(PrimaryKey, IsInsert) - Return True + Case PAGE_IDB_DOCTYPE_CONFIG + oForm = New frmAdmin_DoctypeConfig(PrimaryKey) With {.IsInsert = IsInsert} - Case PAGE_CW_PROFILES - Load_CWProfile(PrimaryKey, IsInsert) - Return True - - Case PAGE_GI_PROFILES - GLOBIX_JUMP_DOCTYPE_ID = PrimaryKey - Load_GLOBIXProfile(PrimaryKey, IsInsert) - Return True + Case PAGE_IDB_DOCTYPE + oForm = New frmAdmin_Doctype(0) - Case PAGE_META_SOURCE_SQL - Load_SourceSQL(PrimaryKey, IsInsert) - Return True + Case PAGE_IDB_DOCTYPE_BE + oForm = New frmAdmin_DoctypeBE() - Case PAGE_IDB_ATTRIBUTE_REL - Dim oForm As New frmAdmin_IDBBERelations - oForm.ShowDialog() - Return True + Case PAGE_USERS_USERLIST + oForm = New frmAdmin_User(PrimaryKey) With {.IsInsert = IsInsert} - Case PAGE_GI_RELATIONS - Dim oForm As New frmAdmin_GlobixRelations - oForm.ShowDialog() - Return True + Case PAGE_USERS_USER_GROUP_RELATIONS + oForm = New frmAdmin_UserGroupRelations(PrimaryKey) With {.isinsert = IsInsert} - Case PAGE_IDB_DOCTYPE_CONFIG - Dim oForm As New frmAdmin_DoctypeConfig(PrimaryKey) With {.IsInsert = IsInsert} - oForm.ShowDialog() - Return True + End Select - Case PAGE_IDB_DOCTYPE - Dim oForm As New frmAdmin_Doctype(0) + ' If the selected form was valid, open it + ' and then raise the form closed event for it + If oForm IsNot Nothing Then oForm.ShowDialog() + RaiseEvent DetailFormClosed(Me, oForm) Return True - Case PAGE_IDB_DOCTYPE_BE - Dim oForm As New frmAdmin_DoctypeBE() - oForm.ShowDialog() - Return True - - Case PAGE_USERS_USERLIST - Load_User(PrimaryKey, IsInsert) - Return True - - Case Else + Else Return False - End Select - End Function - - Private Sub Load_SourceSQL(PrimaryKey As Integer, IsInsert As Boolean) - Try - Dim oForm As New frmAdmin_SourceSQL(PrimaryKey) With {.IsInsert = IsInsert} - oForm.ShowDialog() - - RaiseEvent DetailFormClosed(Me, oForm) - Catch ex As Exception - Logger.Error(ex) - Throw ex - End Try - End Sub + End If - Private Sub Load_IDBAttribute(PrimaryKey As Integer, IsInsert As Boolean) - Try - Dim oForm As New frmAdmin_IDBAttribute(PrimaryKey) With {.IsInsert = IsInsert} - oForm.ShowDialog() - - RaiseEvent DetailFormClosed(Me, oForm) Catch ex As Exception - Logger.Error(ex) Throw ex End Try - End Sub - Private Sub Load_User(PrimaryKey As Integer, IsInsert As Boolean) - Try - Dim oForm As New frmAdmin_User(PrimaryKey) With {.IsInsert = IsInsert} - oForm.ShowDialog() - - RaiseEvent DetailFormClosed(Me, oForm) - Catch ex As Exception - Logger.Error(ex) - Throw ex - End Try - End Sub + End Function - Private Sub Load_IDBObjectstore(PrimaryKey As Integer, IsInsert As Boolean) + Public Function LoadData() As Boolean Try - Dim oForm As New frmAdmin_IDBObjectStore(PrimaryKey) With {.IsInsert = IsInsert} - oForm.ShowDialog() + Dim oTable As DataTable = My.DatabaseECM.GetDatatable("SELECT * FROM TBZF_ADMIN_SOURCE_SQL WHERE SCOPE = 'OVERVIEW' ORDER BY GUID") + DetailDataList.Clear() - RaiseEvent DetailFormClosed(Me, oForm) - Catch ex As Exception - Logger.Error(ex) - Throw ex - End Try - End Sub + For Each oRow As DataRow In oTable.Rows + Dim oCHeck = oRow.Item("ENTITY_TITLE").ToString + Dim oItem As New ClassDetailForm.DetailData With { + .Guid = CInt(oRow.Item("GUID")), + .ParentId = CInt(oRow.Item("PARENT_ID")), + .Entity = oRow.Item("ENTITY_TITLE").ToString, + .Scope = oRow.Item("SCOPE").ToString, + .SQLCommand = oRow.Item("SQL_COMMAND").ToString.Replace("@LANG_CODE", My.Application.User.Language), + .PrimaryKey = Utils.NotNull(oRow.Item("PK_COLUMN"), String.Empty) + } - Private Sub Load_IDBEntity(PrimaryKey As Integer, IsInsert As Boolean) - Try - Dim oForm As New frmAdmin_IDBEntity(PrimaryKey) With {.IsInsert = IsInsert} - oForm.ShowDialog() + Try + oItem.SQLResult = My.DatabaseECM.GetDatatable(oItem.SQLCommand) + Catch ex As Exception + oItem.SQLResult = Nothing + Logger.Error(ex) + End Try - RaiseEvent DetailFormClosed(Me, oForm) - Catch ex As Exception - Logger.Error(ex) - Throw ex - End Try - End Sub + Dim oKey As String = oItem.Entity & "-" & oItem.Scope + DetailDataList.Add(oKey, oItem) + Next - Private Sub Load_CWProfile(PrimaryKey As Integer, IsInsert As Boolean) - Try - Dim oForm As New frmAdmin_ClipboardWatcher(PrimaryKey) With {.IsInsert = IsInsert} - oForm.ShowDialog() + Return True - RaiseEvent DetailFormClosed(Me, oForm) Catch ex As Exception Logger.Error(ex) - Throw ex - End Try - End Sub - Private Sub Load_GLOBIXProfile(PrimaryKey As Integer, IsInsert As Boolean) - Try - Dim oForm As New frmAdmin_Globix(PrimaryKey) With {.IsInsert = IsInsert} - oForm.ShowDialog() + Return False - RaiseEvent DetailFormClosed(Me, oForm) - Catch ex As Exception - Logger.Error(ex) - Throw ex End Try - End Sub + End Function Public Class DetailSettings Public Property GridTitle As String diff --git a/GUIs.ZooFlow/Administration/Users/frmAdmin_UserGroupRelations.Designer.vb b/GUIs.ZooFlow/Administration/Users/frmAdmin_UserGroupRelations.Designer.vb new file mode 100644 index 00000000..c2353987 --- /dev/null +++ b/GUIs.ZooFlow/Administration/Users/frmAdmin_UserGroupRelations.Designer.vb @@ -0,0 +1,354 @@ + _ +Partial Class frmAdmin_UserGroupRelations + Inherits DevExpress.XtraBars.Ribbon.RibbonForm + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + _ + Private Sub InitializeComponent() + Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl() + Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() + Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.RibbonStatusBar1 = New DevExpress.XtraBars.Ribbon.RibbonStatusBar() + Me.RibbonPage2 = New DevExpress.XtraBars.Ribbon.RibbonPage() + Me.LayoutControl1 = New DevExpress.XtraLayout.LayoutControl() + Me.GridControl3 = New DevExpress.XtraGrid.GridControl() + Me.GridView3 = New DevExpress.XtraGrid.Views.Grid.GridView() + Me.colUsername2 = New DevExpress.XtraGrid.Columns.GridColumn() + Me.GridControl2 = New DevExpress.XtraGrid.GridControl() + Me.GridView2 = New DevExpress.XtraGrid.Views.Grid.GridView() + Me.colName = New DevExpress.XtraGrid.Columns.GridColumn() + Me.colInternal = New DevExpress.XtraGrid.Columns.GridColumn() + Me.colActive = New DevExpress.XtraGrid.Columns.GridColumn() + Me.GridControl1 = New DevExpress.XtraGrid.GridControl() + Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView() + Me.colUsername = New DevExpress.XtraGrid.Columns.GridColumn() + Me.Root = New DevExpress.XtraLayout.LayoutControlGroup() + Me.SimpleLabelItem1 = New DevExpress.XtraLayout.SimpleLabelItem() + Me.LayoutControlItem1 = New DevExpress.XtraLayout.LayoutControlItem() + Me.SimpleLabelItem2 = New DevExpress.XtraLayout.SimpleLabelItem() + Me.SimpleLabelItem3 = New DevExpress.XtraLayout.SimpleLabelItem() + Me.LayoutControlItem2 = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlItem3 = New DevExpress.XtraLayout.LayoutControlItem() + Me.colSurname = New DevExpress.XtraGrid.Columns.GridColumn() + Me.colSurname2 = New DevExpress.XtraGrid.Columns.GridColumn() + CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.LayoutControl1.SuspendLayout() + CType(Me.GridControl3, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridView3, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridControl2, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridView2, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.Root, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.SimpleLabelItem1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.SimpleLabelItem2, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.SimpleLabelItem3, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem3, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'RibbonControl1 + ' + Me.RibbonControl1.ExpandCollapseItem.Id = 0 + Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem}) + Me.RibbonControl1.Location = New System.Drawing.Point(0, 0) + Me.RibbonControl1.MaxItemId = 1 + Me.RibbonControl1.Name = "RibbonControl1" + Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1}) + Me.RibbonControl1.Size = New System.Drawing.Size(1221, 158) + Me.RibbonControl1.StatusBar = Me.RibbonStatusBar1 + ' + 'RibbonPage1 + ' + Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2}) + Me.RibbonPage1.Name = "RibbonPage1" + Me.RibbonPage1.Text = "RibbonPage1" + ' + 'RibbonPageGroup1 + ' + Me.RibbonPageGroup1.Name = "RibbonPageGroup1" + Me.RibbonPageGroup1.Text = "RibbonPageGroup1" + ' + 'RibbonPageGroup2 + ' + Me.RibbonPageGroup2.Name = "RibbonPageGroup2" + Me.RibbonPageGroup2.Text = "RibbonPageGroup2" + ' + 'RibbonStatusBar1 + ' + Me.RibbonStatusBar1.Location = New System.Drawing.Point(0, 651) + Me.RibbonStatusBar1.Name = "RibbonStatusBar1" + Me.RibbonStatusBar1.Ribbon = Me.RibbonControl1 + Me.RibbonStatusBar1.Size = New System.Drawing.Size(1221, 24) + ' + 'RibbonPage2 + ' + Me.RibbonPage2.Name = "RibbonPage2" + Me.RibbonPage2.Text = "RibbonPage2" + ' + 'LayoutControl1 + ' + Me.LayoutControl1.Controls.Add(Me.GridControl3) + Me.LayoutControl1.Controls.Add(Me.GridControl2) + Me.LayoutControl1.Controls.Add(Me.GridControl1) + Me.LayoutControl1.Dock = System.Windows.Forms.DockStyle.Fill + Me.LayoutControl1.Location = New System.Drawing.Point(0, 158) + Me.LayoutControl1.Name = "LayoutControl1" + Me.LayoutControl1.Root = Me.Root + Me.LayoutControl1.Size = New System.Drawing.Size(1221, 493) + Me.LayoutControl1.TabIndex = 2 + Me.LayoutControl1.Text = "LayoutControl1" + ' + 'GridControl3 + ' + Me.GridControl3.AllowDrop = True + Me.GridControl3.Location = New System.Drawing.Point(816, 45) + Me.GridControl3.MainView = Me.GridView3 + Me.GridControl3.MenuManager = Me.RibbonControl1 + Me.GridControl3.Name = "GridControl3" + Me.GridControl3.Size = New System.Drawing.Size(393, 436) + Me.GridControl3.TabIndex = 6 + Me.GridControl3.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView3}) + ' + 'GridView3 + ' + Me.GridView3.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colUsername2, Me.colSurname2}) + Me.GridView3.GridControl = Me.GridControl3 + Me.GridView3.Name = "GridView3" + ' + 'colUsername2 + ' + Me.colUsername2.Caption = "Benutzername" + Me.colUsername2.FieldName = "USERNAME" + Me.colUsername2.Name = "colUsername2" + Me.colUsername2.Visible = True + Me.colUsername2.VisibleIndex = 0 + ' + 'GridControl2 + ' + Me.GridControl2.Location = New System.Drawing.Point(414, 45) + Me.GridControl2.MainView = Me.GridView2 + Me.GridControl2.MenuManager = Me.RibbonControl1 + Me.GridControl2.Name = "GridControl2" + Me.GridControl2.Size = New System.Drawing.Size(398, 436) + Me.GridControl2.TabIndex = 5 + Me.GridControl2.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView2}) + ' + 'GridView2 + ' + Me.GridView2.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colName, Me.colInternal, Me.colActive}) + Me.GridView2.GridControl = Me.GridControl2 + Me.GridView2.Name = "GridView2" + ' + 'colName + ' + Me.colName.Caption = "Name" + Me.colName.FieldName = "NAME" + Me.colName.Name = "colName" + Me.colName.Visible = True + Me.colName.VisibleIndex = 0 + ' + 'colInternal + ' + Me.colInternal.Caption = "Systemgruppe" + Me.colInternal.FieldName = "INTERNAL" + Me.colInternal.Name = "colInternal" + Me.colInternal.Visible = True + Me.colInternal.VisibleIndex = 1 + ' + 'colActive + ' + Me.colActive.Caption = "Aktiv" + Me.colActive.FieldName = "ACTIVE" + Me.colActive.Name = "colActive" + Me.colActive.Visible = True + Me.colActive.VisibleIndex = 2 + ' + 'GridControl1 + ' + Me.GridControl1.AllowDrop = True + Me.GridControl1.Location = New System.Drawing.Point(12, 45) + Me.GridControl1.MainView = Me.GridView1 + Me.GridControl1.MenuManager = Me.RibbonControl1 + Me.GridControl1.Name = "GridControl1" + Me.GridControl1.Size = New System.Drawing.Size(398, 436) + Me.GridControl1.TabIndex = 4 + Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1}) + ' + 'GridView1 + ' + Me.GridView1.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colSurname, Me.colUsername}) + Me.GridView1.GridControl = Me.GridControl1 + Me.GridView1.Name = "GridView1" + ' + 'colUsername + ' + Me.colUsername.Caption = "Benutzername" + Me.colUsername.FieldName = "USERNAME" + Me.colUsername.Name = "colUsername" + Me.colUsername.Visible = True + Me.colUsername.VisibleIndex = 1 + ' + 'Root + ' + Me.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True] + Me.Root.GroupBordersVisible = False + Me.Root.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.SimpleLabelItem1, Me.LayoutControlItem1, Me.SimpleLabelItem2, Me.SimpleLabelItem3, Me.LayoutControlItem2, Me.LayoutControlItem3}) + Me.Root.Name = "Root" + Me.Root.Size = New System.Drawing.Size(1221, 493) + Me.Root.TextVisible = False + ' + 'SimpleLabelItem1 + ' + Me.SimpleLabelItem1.AllowHotTrack = False + Me.SimpleLabelItem1.Location = New System.Drawing.Point(0, 0) + Me.SimpleLabelItem1.Name = "SimpleLabelItem1" + Me.SimpleLabelItem1.Padding = New DevExpress.XtraLayout.Utils.Padding(10, 10, 10, 10) + Me.SimpleLabelItem1.Size = New System.Drawing.Size(402, 33) + Me.SimpleLabelItem1.Text = "Nicht zugeordnete Benutzer" + Me.SimpleLabelItem1.TextSize = New System.Drawing.Size(144, 13) + ' + 'LayoutControlItem1 + ' + Me.LayoutControlItem1.Control = Me.GridControl1 + Me.LayoutControlItem1.Location = New System.Drawing.Point(0, 33) + Me.LayoutControlItem1.Name = "LayoutControlItem1" + Me.LayoutControlItem1.Size = New System.Drawing.Size(402, 440) + Me.LayoutControlItem1.TextSize = New System.Drawing.Size(0, 0) + Me.LayoutControlItem1.TextVisible = False + ' + 'SimpleLabelItem2 + ' + Me.SimpleLabelItem2.AllowHotTrack = False + Me.SimpleLabelItem2.Location = New System.Drawing.Point(402, 0) + Me.SimpleLabelItem2.Name = "SimpleLabelItem2" + Me.SimpleLabelItem2.Padding = New DevExpress.XtraLayout.Utils.Padding(10, 10, 10, 10) + Me.SimpleLabelItem2.Size = New System.Drawing.Size(402, 33) + Me.SimpleLabelItem2.Text = "Gruppen" + Me.SimpleLabelItem2.TextSize = New System.Drawing.Size(144, 13) + ' + 'SimpleLabelItem3 + ' + Me.SimpleLabelItem3.AllowHotTrack = False + Me.SimpleLabelItem3.Location = New System.Drawing.Point(804, 0) + Me.SimpleLabelItem3.Name = "SimpleLabelItem3" + Me.SimpleLabelItem3.Padding = New DevExpress.XtraLayout.Utils.Padding(10, 10, 10, 10) + Me.SimpleLabelItem3.Size = New System.Drawing.Size(397, 33) + Me.SimpleLabelItem3.Text = "Zugeordnete Benutzer" + Me.SimpleLabelItem3.TextSize = New System.Drawing.Size(144, 13) + ' + 'LayoutControlItem2 + ' + Me.LayoutControlItem2.Control = Me.GridControl2 + Me.LayoutControlItem2.Location = New System.Drawing.Point(402, 33) + Me.LayoutControlItem2.Name = "LayoutControlItem2" + Me.LayoutControlItem2.Size = New System.Drawing.Size(402, 440) + Me.LayoutControlItem2.TextSize = New System.Drawing.Size(0, 0) + Me.LayoutControlItem2.TextVisible = False + ' + 'LayoutControlItem3 + ' + Me.LayoutControlItem3.Control = Me.GridControl3 + Me.LayoutControlItem3.Location = New System.Drawing.Point(804, 33) + Me.LayoutControlItem3.Name = "LayoutControlItem3" + Me.LayoutControlItem3.Size = New System.Drawing.Size(397, 440) + Me.LayoutControlItem3.TextSize = New System.Drawing.Size(0, 0) + Me.LayoutControlItem3.TextVisible = False + ' + 'colSurname + ' + Me.colSurname.Caption = "Name" + Me.colSurname.FieldName = "NAME" + Me.colSurname.Name = "colSurname" + Me.colSurname.Visible = True + Me.colSurname.VisibleIndex = 0 + ' + 'colSurname2 + ' + Me.colSurname2.Caption = "Name" + Me.colSurname2.FieldName = "NAME" + Me.colSurname2.Name = "colSurname2" + Me.colSurname2.Visible = True + Me.colSurname2.VisibleIndex = 1 + ' + 'frmAdmin_UserGroupRelations + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(1221, 675) + Me.Controls.Add(Me.LayoutControl1) + Me.Controls.Add(Me.RibbonStatusBar1) + Me.Controls.Add(Me.RibbonControl1) + Me.Name = "frmAdmin_UserGroupRelations" + Me.Ribbon = Me.RibbonControl1 + Me.StatusBar = Me.RibbonStatusBar1 + Me.Text = "frmAdmin_UserGroupRelations" + CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).EndInit() + Me.LayoutControl1.ResumeLayout(False) + CType(Me.GridControl3, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridView3, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridControl2, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridView2, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.Root, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.SimpleLabelItem1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.SimpleLabelItem2, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.SimpleLabelItem3, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem3, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents RibbonControl1 As DevExpress.XtraBars.Ribbon.RibbonControl + Friend WithEvents RibbonPage1 As DevExpress.XtraBars.Ribbon.RibbonPage + Friend WithEvents RibbonPageGroup1 As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents RibbonPageGroup2 As DevExpress.XtraBars.Ribbon.RibbonPageGroup + Friend WithEvents RibbonStatusBar1 As DevExpress.XtraBars.Ribbon.RibbonStatusBar + Friend WithEvents RibbonPage2 As DevExpress.XtraBars.Ribbon.RibbonPage + Friend WithEvents LayoutControl1 As DevExpress.XtraLayout.LayoutControl + Friend WithEvents GridControl3 As DevExpress.XtraGrid.GridControl + Friend WithEvents GridView3 As DevExpress.XtraGrid.Views.Grid.GridView + Friend WithEvents GridControl2 As DevExpress.XtraGrid.GridControl + Friend WithEvents GridView2 As DevExpress.XtraGrid.Views.Grid.GridView + Friend WithEvents GridControl1 As DevExpress.XtraGrid.GridControl + Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView + Friend WithEvents Root As DevExpress.XtraLayout.LayoutControlGroup + Friend WithEvents SimpleLabelItem1 As DevExpress.XtraLayout.SimpleLabelItem + Friend WithEvents LayoutControlItem1 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents SimpleLabelItem2 As DevExpress.XtraLayout.SimpleLabelItem + Friend WithEvents SimpleLabelItem3 As DevExpress.XtraLayout.SimpleLabelItem + Friend WithEvents LayoutControlItem2 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlItem3 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents colName As DevExpress.XtraGrid.Columns.GridColumn + Friend WithEvents colInternal As DevExpress.XtraGrid.Columns.GridColumn + Friend WithEvents colActive As DevExpress.XtraGrid.Columns.GridColumn + Friend WithEvents colUsername2 As DevExpress.XtraGrid.Columns.GridColumn + Friend WithEvents colUsername As DevExpress.XtraGrid.Columns.GridColumn + Friend WithEvents colSurname2 As DevExpress.XtraGrid.Columns.GridColumn + Friend WithEvents colSurname As DevExpress.XtraGrid.Columns.GridColumn +End Class diff --git a/GUIs.ZooFlow/Administration/Users/frmAdmin_UserGroupRelations.resx b/GUIs.ZooFlow/Administration/Users/frmAdmin_UserGroupRelations.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/GUIs.ZooFlow/Administration/Users/frmAdmin_UserGroupRelations.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/GUIs.ZooFlow/Administration/Users/frmAdmin_UserGroupRelations.vb b/GUIs.ZooFlow/Administration/Users/frmAdmin_UserGroupRelations.vb new file mode 100644 index 00000000..bb3a0ae3 --- /dev/null +++ b/GUIs.ZooFlow/Administration/Users/frmAdmin_UserGroupRelations.vb @@ -0,0 +1,155 @@ +Imports DigitalData.GUIs.Common +Imports DigitalData.GUIs.Common.Base + +Public Class frmAdmin_UserGroupRelations + Implements IBaseForm, IAdminForm + + Public ReadOnly Property LogConfig As Modules.Logging.LogConfig Implements IBaseForm.LogConfig + Public ReadOnly Property Logger As Modules.Logging.Logger Implements IBaseForm.Logger + Public ReadOnly Property ErrorHandler As BaseErrorHandler Implements IBaseForm.ErrorHandler + Public Property PrimaryKey As Integer Implements IAdminForm.PrimaryKey + Public Property HasChanges As Boolean Implements IAdminForm.HasChanges + Public Property IsInsert As Boolean Implements IAdminForm.IsInsert + + Private Property SelectedGroupId As Integer = Nothing + + Public Sub New(pPrimaryKey As Integer) + ' Dieser Aufruf ist für den Designer erforderlich. + InitializeComponent() + + ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. + LogConfig = My.LogConfig + ErrorHandler = New BaseErrorHandler(LogConfig, Me) + End Sub + + Private Async Sub frmAdmin_UserGroupRelations_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Try + Dim DragDropManager = New ClassDragDrop(LogConfig) + DragDropManager.AddGridView(GridView1) + DragDropManager.AddGridView(GridView3) + + Dim GridBuilder = New GridBuilder(GridView1, GridView2, GridView3) + GridBuilder. + WithDefaults(). + WithReadOnlyOptions() + + Dim oSQL = "SELECT * FROM TBDD_GROUPS" + Dim oTable As DataTable = Await My.DatabaseECM.GetDatatableAsync(oSQL) + GridControl2.DataSource = oTable + Catch ex As Exception + ErrorHandler.ShowErrorMessage(ex, "Fehler beim Laden des Formulars") + End Try + End Sub + + Private Async Function GetAvailableUsersByGroupId(pGroupId As Integer) As Threading.Tasks.Task(Of DataTable) + Try + Dim oSql As String = $" + SELECT T1.GUID, T1.PRENAME, T1.NAME, T1.USERNAME, T1.SHORTNAME, T1.EMAIL, T1.LANGUAGE, T1.COMMENT, T1.DATE_FORMAT, T1.ADDED_WHO, T1.ADDED_WHEN, T1.CHANGED_WHO, T1.CHANGED_WHEN + FROM TBDD_USER AS T1 INNER JOIN + TBDD_GROUPS_USER AS T2 ON T1.GUID = T2.USER_ID + WHERE (T2.GROUP_ID = {pGroupId}) + " + Dim oTable = Await My.DatabaseECM.GetDatatableAsync(oSql) + Return oTable + Catch ex As Exception + ErrorHandler.ShowErrorMessage(ex, "GetAvailableUsersByGroupId") + Return Nothing + End Try + End Function + + Private Async Function GetRelatedUsersByGroupId(pGroupId As Integer) As Threading.Tasks.Task(Of DataTable) + Try + Dim oSql As String = $" + SELECT GUID, PRENAME, NAME, USERNAME, SHORTNAME, EMAIL, LANGUAGE, COMMENT, DATE_FORMAT, ADDED_WHO, ADDED_WHEN, CHANGED_WHO, CHANGED_WHEN + FROM TBDD_USER + WHERE (GUID NOT IN + (SELECT DISTINCT T.GUID + FROM TBDD_USER AS T INNER JOIN TBDD_GROUPS_USER AS T1 ON T.GUID = T1.USER_ID + WHERE (T1.GROUP_ID = {pGroupId}))) + " + Dim oTable = Await My.DatabaseECM.GetDatatableAsync(oSql) + Return oTable + Catch ex As Exception + ErrorHandler.ShowErrorMessage(ex, "GetRelatedUsersByGroupId") + Return Nothing + End Try + End Function + + Public Function DeleteData() As Boolean Implements IAdminForm.DeleteData + Throw New NotImplementedException() + End Function + + Private Async Sub GridView2_FocusedRowChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles GridView2.FocusedRowChanged + Dim oRowView As DataRowView = GridView2.GetRow(GridView2.FocusedRowHandle) + Dim oRow As DataRow = oRowView.Row + + If oRow IsNot Nothing Then + SelectedGroupId = oRow.Item("GUID") + Await UpdateUsers(SelectedGroupId) + + End If + End Sub + + Private Async Function UpdateUsers(pGroupId As Integer) As Threading.Tasks.Task + Dim oAvailableTable = Await GetAvailableUsersByGroupId(SelectedGroupId) + GridControl1.DataSource = oAvailableTable + + Dim oRelatedTable = Await GetRelatedUsersByGroupId(SelectedGroupId) + GridControl3.DataSource = oRelatedTable + End Function + + Private Async Sub GridControl1_DragDrop(sender As Object, e As DragEventArgs) Handles GridControl1.DragDrop + Dim oData As String = e.Data.GetData(DataFormats.Text) + Dim oGuid As Integer = oData.Split("|").ToList.First() + + If Await AddUserToGroup(oGuid, SelectedGroupId) Then + Await UpdateUsers(SelectedGroupId) + End If + End Sub + + Private Async Sub GridControl3_DragDrop(sender As Object, e As DragEventArgs) Handles GridControl3.DragDrop + Dim oData As String = e.Data.GetData(DataFormats.Text) + Dim oGuid As Integer = oData.Split("|").ToList.First() + + If Await RemoveUserFromGroup(oGuid, SelectedGroupId) Then + Await UpdateUsers(SelectedGroupId) + End If + End Sub + + Private Async Function AddUserToGroup(pUserId As Integer, pGroupId As Integer) As Threading.Tasks.Task(Of Boolean) + Try + Dim oUser = My.Application.User.UserName + Dim oSql = $" + INSERT INTO TBDD_GROUPS_USER + (USER_ID, GROUP_ID, COMMENT, ADDED_WHO) + VALUES ( + {pUserId}, + {pGroupId}, + 'Assign User {pUserId} to Group {pGroupId}', + '{oUser}' + )" + Return Await My.DatabaseECM.ExecuteNonQueryAsync(oSql) + + Catch ex As Exception + Logger.error(ex) + Return False + + End Try + End Function + + Private Async Function RemoveUserFromGroup(pUserId As Integer, pGroupId As Integer) As Threading.Tasks.Task(Of Boolean) + Try + Dim oUser = My.Application.User.UserName + Dim oSql = $" + DELETE FROM TBDD_GROUPS_USER + WHERE USER_ID = {pUserId} AND GROUP_ID = {pGroupId} + " + Return Await My.DatabaseECM.ExecuteNonQueryAsync(oSql) + + Catch ex As Exception + Logger.Error(ex) + Return False + + End Try + End Function +End Class \ No newline at end of file diff --git a/GUIs.ZooFlow/Administration/frmAdmin_Start.Designer.vb b/GUIs.ZooFlow/Administration/frmAdmin_Start.Designer.vb index 319fa4df..44862208 100644 --- a/GUIs.ZooFlow/Administration/frmAdmin_Start.Designer.vb +++ b/GUIs.ZooFlow/Administration/frmAdmin_Start.Designer.vb @@ -439,6 +439,7 @@ Partial Class frmAdmin_Start Me.TreeListMenu.AppendNode(New Object() {"User Management"}, -1, 11, 11, -1) Me.TreeListMenu.AppendNode(New Object() {"User List"}, 16, 5, 5, -1, "USERS_USERLIST") Me.TreeListMenu.AppendNode(New Object() {"Group List"}, 16, 12, 12, -1, "USERS_GROUPLIST") + Me.TreeListMenu.AppendNode(New Object() {"User To Group Relations"}, 16, "USERS_USER_GROUP_RELATIONS") Me.TreeListMenu.EndUnboundLoad() Me.TreeListMenu.OptionsBehavior.Editable = False Me.TreeListMenu.OptionsView.ShowColumns = False diff --git a/GUIs.ZooFlow/Administration/frmAdmin_Start.vb b/GUIs.ZooFlow/Administration/frmAdmin_Start.vb index 8066e65d..abe6e38f 100644 --- a/GUIs.ZooFlow/Administration/frmAdmin_Start.vb +++ b/GUIs.ZooFlow/Administration/frmAdmin_Start.vb @@ -274,4 +274,8 @@ Public Class frmAdmin_Start Dim oForm As New frmAdmin_ImportUser() oForm.ShowDialog() End Sub + + Private Sub RibbonControl1_Click(sender As Object, e As EventArgs) Handles RibbonControl1.Click + + End Sub End Class \ No newline at end of file diff --git a/GUIs.ZooFlow/ZooFlow.vbproj b/GUIs.ZooFlow/ZooFlow.vbproj index 6eece590..8fa13c19 100644 --- a/GUIs.ZooFlow/ZooFlow.vbproj +++ b/GUIs.ZooFlow/ZooFlow.vbproj @@ -241,6 +241,12 @@ Form + + frmAdmin_UserGroupRelations.vb + + + Form + frmWaitForm.vb @@ -479,6 +485,9 @@ frmAdmin_User.vb + + frmAdmin_UserGroupRelations.vb + frmWaitForm.vb