MS V 3.1.3 Beta RightGroups und NodeConfig-Adding

This commit is contained in:
2024-05-23 17:14:14 +02:00
parent ae4032ea59
commit bd084a0072
22 changed files with 3398 additions and 1522 deletions

View File

@@ -1,6 +1,10 @@
Public Class frmRight_Management
Private Shared _Instance As frmRight_Management = Nothing
Private insert As Boolean = False
Private formloaded As Boolean = False
Private updateIP As Boolean = False
Private DGSelection As Boolean = False
Private ID_CURR As Integer = 0
Public Shared Function Instance() As frmRight_Management
If _Instance Is Nothing OrElse _Instance.IsDisposed = True Then
_Instance = New frmRight_Management
@@ -28,71 +32,14 @@
MsgBox("Error in Save_User_Rights_Data:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub Save_Group_Rights_Data()
Try
Me.Validate()
Me.TBPMO_RIGHT_GROUPBindingSource.EndEdit()
If DD_DMSDataSet.TBPMO_RIGHT_GROUP.GetChanges Is Nothing = False Then
Try
Me.TBPMO_RIGHT_GROUPDataGridView.CurrentRow.Cells("DataGridViewTextBoxColumn6").Value = USER_USERNAME
Catch ex As Exception
End Try
Me.TBPMO_RIGHT_GROUPBindingSource.EndEdit()
Me.TBPMO_RIGHT_GROUPTableAdapter.Update(DD_DMSDataSet.TBPMO_RIGHT_GROUP)
tschangedlabel.Text = "Right Group changed - " & Now
tschangedlabel.Visible = True
Else
tschangedlabel.Visible = False
End If
Catch ex As Exception
MsgBox("Error in Save_Group_Rights_Data:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Sub Load_Datagrid(ByVal _Datagrid As DataGridView, ByVal _settings_String As String)
Try
Dim settings() As String
If My.Settings(_settings_String) <> String.Empty Then
settings = My.Settings(_settings_String).Split("$"c)
For idx As Integer = 0 To _Datagrid.Columns.Count - 1
Dim sv() As String = settings(idx).Split("/"c)
_Datagrid.Columns(idx).DisplayIndex = CInt(sv(0))
_Datagrid.Columns(idx).Width = CInt(sv(1))
Next
End If
Catch ex As Exception
End Try
End Sub
Sub Save_Datagrid(ByVal _Datagrid As DataGridView, ByVal _settings_String As String)
Try
Dim settings As String = String.Empty
For idx As Integer = 0 To _Datagrid.Columns.Count - 1
settings += _Datagrid.Columns(idx).DisplayIndex.ToString()
settings += "/"
settings += _Datagrid.Columns(idx).Width.ToString
settings += "$"
Next
My.Settings(_settings_String) = settings
Catch ex As Exception
My.Settings(_settings_String) = String.Empty
End Try
End Sub
Private Sub frmRight_Management_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Save_Datagrid(TBPMO_RIGHT_GROUPDataGridView, "TBPMO_RIGHT_GROUPDataGridView")
If LICENSE_PROXY = True And DD_LIB_Standards.clsDatabase.DB_PROXY_INITIALIZED Then
MessageBox.Show("If You changed some data here, be aware that this data needs to be synchronized with Your proxy-data!" & vbNewLine & "The regualar processing-time are 30 minutes", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
'Save_Datagrid(TBPMO_RIGHT_USERDataGridView, "TBPMO_RIGHT_USERDataGridView")
End Sub
Private Sub frmGroup_Rights_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: Diese Codezeile lädt Daten in die Tabelle "DD_ECMAdmin.TBDD_GROUPS". Sie können sie bei Bedarf verschieben oder entfernen.
Refresh_Entities()
Try
Me.TBWH_USER_GROUPSTableAdapter.Connection.ConnectionString = MYDB_ECM.CurrentConnectionString
@@ -103,13 +50,14 @@
Me.TBDD_GROUPSTableAdapter.Fill(Me.DD_ECMAdmin.TBDD_GROUPS)
Me.TBDD_USERTableAdapter.Connection.ConnectionString = MYDB_ECM.CurrentConnectionString
Me.TBDD_USERTableAdapter.Fill(Me.DD_DMSDataSet.TBDD_USER)
VWPMO_RIGHT_GROUPTableAdapter.Connection.ConnectionString = MYDB_ECM.CurrentConnectionString
Catch ex As Exception
MsgBox("Error in Loading Form:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
Refresh_Rights_Groups()
Load_Datagrid(TBPMO_RIGHT_GROUPDataGridView, "TBPMO_RIGHT_GROUPDataGridView")
'Load_Datagrid(TBPMO_RIGHT_USERDataGridView, "TBPMO_RIGHT_USERDataGridView")
End Sub
Sub Refresh_Rights_Users(ENTITY_ID As Integer)
@@ -123,8 +71,7 @@
Sub Refresh_Rights_Groups()
Try
Me.TBPMO_RIGHT_GROUPTableAdapter.Connection.ConnectionString = MYDB_ECM.CurrentConnectionString
Me.TBPMO_RIGHT_GROUPTableAdapter.Fill(Me.DD_DMSDataSet.TBPMO_RIGHT_GROUP)
Me.VWPMO_RIGHT_GROUPTableAdapter.Fill(Me.DD_ECMAdmin.VWPMO_RIGHT_GROUP)
Catch ex As Exception
MsgBox("Error in Refresh_Rights_Groups:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
@@ -142,16 +89,15 @@
Me.DD_DMSDataSet.TBPMO_RIGHT_GROUP.ADDED_WHOColumn.DefaultValue = USER_USERNAME
Me.DD_DMSDataSet.TBPMO_RIGHT_GROUP.ENTITY_IDColumn.DefaultValue = MYDB_ECM.GetScalarValue("SELECT MIN(GUID) FROM TBPMO_FORM")
End Sub
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
Save_Group_Rights_Data()
End Sub
Private Sub TBPMO_RIGHT_GROUPBindingSource_CurrentChanged(sender As Object, e As EventArgs) Handles TBPMO_RIGHT_GROUPBindingSource.CurrentChanged
tschangedlabel.Visible = False
End Sub
Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click
updateIP = True
Refresh_Rights_Groups()
updateIP = False
End Sub
Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs)
@@ -301,4 +247,94 @@ WHERE T2.SHORT_NAME = 'ADDI' AND T.GUID NOT IN (SELECT USER_ID FROM TBPMO_RIGH
End Try
End Sub
Private Sub EDIT_RECCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles EDIT_RECCheckBox.CheckedChanged
If updateIP = False Then
Update_RightGroup_VALUE("EDIT_REC", EDIT_RECCheckBox.Checked, IDTextBox.Text)
End If
End Sub
Private Sub Update_RightGroup_VALUE(pItem As String, obit As Boolean, pID As String)
If formloaded = False Or pID = "" Or DGSelection = True Then
Exit Sub
End If
updateIP = True
ID_CURR = pID
Dim oupdate = $"UPDATE TBPMO_RIGHT_GROUP SET {pItem} = '{obit}', CHANGED_WHO = '{Environment.UserName}' WHERE GUID = {pID}
and {pItem} <> '{obit}'"
If MYDB_ECM.ExecuteNonQuery(oupdate) Then
InfoLabel.Text = $"{pItem} updated successfully - {Now.ToLongTimeString}"
Refresh_Rights_Groups()
VWPMO_RIGHT_GROUPBindingSource2.Position = VWPMO_RIGHT_GROUPBindingSource2.Find("ID", ID_CURR)
updateIP = False
End If
End Sub
Private Sub ADD_RECCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles ADD_RECCheckBox.CheckedChanged
If updateIP = False Then
Update_RightGroup_VALUE("ADD_REC", ADD_RECCheckBox.Checked, IDTextBox.Text)
End If
End Sub
Private Sub DELETE_RECCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles DELETE_RECCheckBox.CheckedChanged
If updateIP = False Then
Update_RightGroup_VALUE("DELETE_REC", DELETE_RECCheckBox.Checked, IDTextBox.Text)
End If
End Sub
Private Sub ADD_DOCCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles ADD_DOCCheckBox.CheckedChanged
If updateIP = False Then
Update_RightGroup_VALUE("ADD_DOC", ADD_DOCCheckBox.Checked, IDTextBox.Text)
End If
End Sub
Private Sub VIEW_DOCCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles VIEW_DOCCheckBox.CheckedChanged
If updateIP = False Then
Update_RightGroup_VALUE("VIEW_DOC", VIEW_DOCCheckBox.Checked, IDTextBox.Text)
End If
End Sub
Private Sub DELETE_DOCCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles DELETE_DOCCheckBox.CheckedChanged
If updateIP = False Then
Update_RightGroup_VALUE("DELETE_DOC", DELETE_DOCCheckBox.Checked, IDTextBox.Text)
End If
End Sub
Private Sub frmRight_Management_Shown(sender As Object, e As EventArgs) Handles Me.Shown
formloaded = True
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If cmbSicht.SelectedIndex <> -1 And cmbGroupNew.SelectedIndex <> -1 Then
Dim oinsert = $"INSERT INTO [dbo].[TBPMO_RIGHT_GROUP] ([ENTITY_ID],[GROUP_ID],[ADDED_WHO])
VALUES ({cmbSicht.SelectedValue},{cmbGroupNew.SelectedValue},'{Environment.UserName}')"
If MYDB_ECM.ExecuteNonQuery(oinsert) Then
InfoLabel.Text = $"New rightGroup Added successfully - {Now.ToLongTimeString}"
updateIP = True
Refresh_Rights_Groups()
updateIP = False
End If
End If
End Sub
Private Sub BindingNavigatorDeleteItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorDeleteItem.Click
If MessageBox.Show("Do You really want to delete this relation", "Question", MessageBoxButtons.YesNo) _
= Windows.Forms.DialogResult.Yes Then
Dim odelete = $"DELETE FROM [dbo].[TBPMO_RIGHT_GROUP] WHERE GUID = {IDTextBox.Text}"
If MYDB_ECM.ExecuteNonQuery(odelete) Then
updateIP = True
Refresh_Rights_Groups()
updateIP = False
End If
End If
End Sub
End Class