add groups, count functions per search

This commit is contained in:
Jonathan Jenne
2019-07-25 13:19:13 +02:00
parent dfadc2b778
commit 4438c6e9a7
20 changed files with 6829 additions and 703 deletions

View File

@@ -25,6 +25,23 @@ Public Class frmAdministration
MsgBox("Unexpected Error in Load Profiles: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Sub Load_ProfileTypes()
Dim oTypeNames As New Dictionary(Of Integer, String) From {
{0, "Dokumente und Daten"},
{1, "Nur Dokumente"},
{2, "Nur Daten"}
}
For Each oTypeName As KeyValuePair(Of Integer, String) In oTypeNames
Dim oRow = MyDataset.TBWH_PROFILE_TYPE.NewTBWH_PROFILE_TYPERow()
oRow.TYPE_ID = oTypeName.Key
oRow.TYPE_NAME = oTypeName.Value
MyDataset.TBWH_PROFILE_TYPE.Rows.Add(oRow)
Next
End Sub
Sub Save_Profile()
Try
Me.TBCW_PROFILESBindingSource.EndEdit()
@@ -42,12 +59,7 @@ Public Class frmAdministration
End Sub
Private Sub frmAdministration_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Load_Profiles()
PROFILE_TYPEComboBox.DataSource = New List(Of ProfileType) From {
New ProfileType() With {.Id = 0, .Name = "Daten und Dokumente"},
New ProfileType() With {.Id = 1, .Name = "Nur Dokumente"},
New ProfileType() With {.Id = 2, .Name = "Nur Daten"}
}
Load_ProfileTypes()
lbllicenseCount.Text = LICENSE_COUNT
If LICENSE_DATE.ToString.Contains("2099") Then
@@ -64,6 +76,7 @@ Public Class frmAdministration
Private Sub TBCW_PROFILESBindingSource_AddingNew(sender As Object, e As System.ComponentModel.AddingNewEventArgs) Handles TBCW_PROFILESBindingSource.AddingNew
MyDataset.TBCW_PROFILES.ADDED_WHOColumn.DefaultValue = Environment.UserName
MyDataset.TBCW_PROFILES.PROFILE_TYPEColumn.DefaultValue = 0
End Sub
Private Sub btnaddSearch_Click(sender As Object, e As EventArgs) Handles btnaddSearch.Click
@@ -79,28 +92,33 @@ Public Class frmAdministration
Private Sub GUIDTextBox_TextChanged(sender As Object, e As EventArgs) Handles GUIDTextBox.TextChanged
If GUIDTextBox.Text <> "" Then
Refresh_Profile_user()
Refresh_ProfileData()
Refresh_Free_Users(GUIDTextBox.Text)
Refresh_Free_Groups(GUIDTextBox.Text)
Load_Profile_Process()
TBCW_PROF_DOC_SEARCHTableAdapter.Connection.ConnectionString = MyConnectionString
TBCW_PROF_DOC_SEARCHTableAdapter.Fill(MyDataset.TBCW_PROF_DOC_SEARCH, GUIDTextBox.Text)
TBCW_PROF_DATA_SEARCHTableAdapter.Connection.ConnectionString = MyConnectionString
TBCW_PROF_DATA_SEARCHTableAdapter.Fill(MyDataset.TBCW_PROF_DATA_SEARCH, GUIDTextBox.Text)
End If
End Sub
Sub Refresh_Profile_user()
Sub Refresh_ProfileData()
Try
Try
Dim ID = CInt(GUIDTextBox.Text)
Catch ex As Exception
Exit Sub
End Try
Me.VWUSER_PROFILETableAdapter.Connection.ConnectionString = MyConnectionString
Me.VWUSER_PROFILETableAdapter.Fill(Me.MyDataset.VWUSER_PROFILE, GUIDTextBox.Text)
VWUSER_PROFILETableAdapter.Connection.ConnectionString = MyConnectionString
VWUSER_PROFILETableAdapter.Fill(MyDataset.VWUSER_PROFILE, GUIDTextBox.Text)
VWCW_GROUP_PROFILETableAdapter.Connection.ConnectionString = MyConnectionString
VWCW_GROUP_PROFILETableAdapter.Fill(MyDataset.VWCW_GROUP_PROFILE, GUIDTextBox.Text)
Catch ex As Exception
MsgBox("Unexpected Error in Refresh Profile User: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub btnAddUser2Profile_Click(sender As Object, e As EventArgs) Handles btnAddUser2Profile.Click
Private Sub btnAddUser2Profile_Click(sender As Object, e As EventArgs) Handles btnAddUserToProfile.Click
Try
Try
Dim i As Integer = CInt(GUIDTextBox.Text)
@@ -120,7 +138,7 @@ Public Class frmAdministration
Next
If GUIDTextBox.Text <> "" Then
Refresh_Free_Users(GUIDTextBox.Text)
Refresh_Profile_user()
Refresh_ProfileData()
End If
Catch ex As Exception
@@ -158,9 +176,28 @@ Public Class frmAdministration
End Sub
Private Sub btndeleteUserConstructorRel_Click(sender As Object, e As EventArgs) Handles btndeleteUserConstructorRel.Click
Sub Refresh_Free_Groups(PROFILE_ID As Integer)
Dim Sql = String.Format("SELECT DISTINCT * FROM TBDD_GROUPS WHERE GUID NOT IN (SELECT GROUP_ID FROM TBCW_GROUP_PROFILE WHERE PROFILE_ID = {0}) ORDER BY NAME", PROFILE_ID)
Dim oDataTable = clsDatabase.Return_Datatable(Sql)
Try
Dim ID = GridViewProfileUser.GetFocusedRowCellValue(GridViewProfileUser.Columns("GUID"))
MyDataset.TBWH_GROUP.Clear()
For Each row As DataRow In oDataTable.Rows
Dim oNewRow As MyDataset.TBWH_GROUPRow
oNewRow = MyDataset.TBWH_GROUP.NewTBWH_GROUPRow
oNewRow.NAME = row.Item("NAME")
oNewRow.ID = row.Item("GUID")
MyDataset.TBWH_GROUP.Rows.Add(oNewRow)
Next
Catch ex As Exception
MsgBox("Unexpected Error in Refresh_Free_Groups: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub btndeleteUserConstructorRel_Click(sender As Object, e As EventArgs) Handles btnRemoveUserFromProfile.Click
Try
Dim ID = GridViewUserInProfile.GetFocusedRowCellValue(GridViewUserInProfile.Columns("GUID"))
Try
Dim I As Integer = CInt(ID)
Catch ex As Exception
@@ -168,7 +205,7 @@ Public Class frmAdministration
End Try
Dim del = String.Format("DELETE FROM TBCW_USER_PROFILE WHERE GUID = {0}", ID)
If clsDatabase.Execute_non_Query(del) = True Then
Refresh_Profile_user()
Refresh_ProfileData()
If GUIDTextBox.Text <> "" Then
Refresh_Free_Users(GUIDTextBox.Text)
End If
@@ -179,10 +216,6 @@ Public Class frmAdministration
End Try
End Sub
Private Sub chkRunwindowCheck_CheckedChanged(sender As Object, e As EventArgs)
End Sub
Private Sub TimerTest_Tick(sender As Object, e As EventArgs) Handles TimerTest.Tick
clsWINDOWSApi.Get_ForegroundWindow_Info()
If PID <> CurrPROC_PID And CurrPROC_Name <> "DD_Clipboard_Watcher" Then
@@ -268,6 +301,7 @@ Public Class frmAdministration
Private Sub frmAdministration_Shown(sender As Object, e As EventArgs) Handles Me.Shown
If GUIDTextBox.Text = "" Then
Refresh_Free_Users(0)
Refresh_Free_Groups(0)
End If
End Sub
@@ -286,12 +320,91 @@ Public Class frmAdministration
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
Load_Profiles()
Refresh_Profile_user()
Refresh_ProfileData()
Try
Dim ID = CInt(GUIDTextBox.Text)
Catch ex As Exception
Exit Sub
End Try
Refresh_Free_Users(GUIDTextBox.Text)
Refresh_Free_Groups(GUIDTextBox.Text)
End Sub
Private Sub TBCW_PROF_DATA_SEARCHBindingSource_AddingNew(sender As Object, e As System.ComponentModel.AddingNewEventArgs) Handles TBCW_PROF_DATA_SEARCHBindingSource.AddingNew
MyDataset.TBCW_PROF_DATA_SEARCH.ADDED_WHOColumn.DefaultValue = Environment.UserName
MyDataset.TBCW_PROF_DATA_SEARCH.PROFILE_IDColumn.DefaultValue = GUIDTextBox.Text
MyDataset.TBCW_PROF_DATA_SEARCH.CONN_IDColumn.DefaultValue = 1
End Sub
Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs) Handles ToolStripButton3.Click
Try
TBCW_PROF_DATA_SEARCHBindingSource.EndEdit()
If Not IsNothing(MyDataset.TBCW_PROF_DATA_SEARCH.GetChanges) Then
CHANGED_WHOTextBox1.Text = Environment.UserName
TBCW_PROF_DATA_SEARCHBindingSource.EndEdit()
TBCW_PROF_DATA_SEARCHTableAdapter.Update(MyDataset.TBCW_PROF_DATA_SEARCH)
End If
Catch ex As Exception
MsgBox("Unexpected Error in Save Data Search: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click
Try
TBCW_PROF_DOC_SEARCHBindingSource.EndEdit()
If Not IsNothing(MyDataset.TBCW_PROF_DOC_SEARCH.GetChanges) Then
CHANGED_WHOTextBox2.Text = Environment.UserName
TBCW_PROF_DOC_SEARCHBindingSource.EndEdit()
TBCW_PROF_DOC_SEARCHTableAdapter.Update(MyDataset.TBCW_PROF_DOC_SEARCH)
End If
Catch ex As Exception
MsgBox("Unexpected Error in Save Data Search: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub btnAddGroupToProfile_Click(sender As Object, e As EventArgs) Handles btnAddGroupToProfile.Click
Try
Dim oSelectedGroups = GridViewGroupNotInProfile.GetSelectedRows()
For Each oRowHandle In oSelectedGroups
Dim oRow As MyDataset.TBWH_GROUPRow = DirectCast(GridViewGroupNotInProfile.GetRow(oRowHandle), DataRowView).Row
Dim oGroupId As Integer = oRow.ID
Dim oSQL As String = $"INSERT INTO TBCW_GROUP_PROFILE (PROFILE_ID,GROUP_ID) VALUES ({GUIDTextBox.Text},{oGroupId})"
If clsDatabase.Execute_non_Query(oSQL) = False Then
MsgBox("Could not insert the Group-Definition....Check the logfile!", MsgBoxStyle.Exclamation)
End If
Next
GridViewGroupNotInProfile.ClearSelection()
Refresh_Free_Groups(GUIDTextBox.Text)
Refresh_ProfileData()
Catch ex As Exception
MsgBox("Unexpected Error while adding Group-Rights: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub btnRemoveGroupFromProfile_Click(sender As Object, e As EventArgs) Handles btnRemoveGroupFromProfile.Click
Try
Dim oSelectedGroups = GridViewGroupInProfile.GetSelectedRows()
For Each oRowHandle In oSelectedGroups
Dim oRow As MyDataset.VWCW_GROUP_PROFILERow = DirectCast(GridViewGroupInProfile.GetRow(oRowHandle), DataRowView).Row
Dim oGroupId As Integer = oRow.GUID
Dim oSQL As String = $"DELETE FROM TBCW_GROUP_PROFILE WHERE GUID = ({oGroupId})"
If clsDatabase.Execute_non_Query(oSQL) = False Then
MsgBox("Could not delete the Group-Definition....Check the logfile!", MsgBoxStyle.Exclamation)
End If
Next
GridViewGroupInProfile.ClearSelection()
Refresh_Free_Groups(GUIDTextBox.Text)
Refresh_ProfileData()
Catch ex As Exception
MsgBox("Unexpected Error in deleting Group-Rights: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
End Class