This commit is contained in:
SchreiberM
2017-01-20 10:16:04 +01:00
parent 3d78578381
commit 0d59a9613a
30 changed files with 7513 additions and 6350 deletions

View File

@@ -80,6 +80,9 @@
Private Sub frmRight_Management_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Save_Datagrid(TBPMO_RIGHT_GROUPDataGridView, "TBPMO_RIGHT_GROUPDataGridView")
If LICENSE_SITE_PROXY = True And ClassProxy.MyPROXYConnectionString <> String.Empty 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
@@ -100,10 +103,10 @@
'Load_Datagrid(TBPMO_RIGHT_USERDataGridView, "TBPMO_RIGHT_USERDataGridView")
End Sub
Sub Refresh_Rights_Users()
Sub Refresh_Rights_Users(ENTITY_ID As Integer)
Try
USER_RIGHTSTableAdapter.Connection.ConnectionString = MyConnectionString
Me.USER_RIGHTSTableAdapter.Fill(Me.DD_ECMAdmin.USER_RIGHTS, USER_LANGUAGE)
Me.USER_RIGHTSTableAdapter.Fill(Me.DD_ECMAdmin.USER_RIGHTS, USER_LANGUAGE, ENTITY_ID)
Catch ex As Exception
MsgBox("Error loading users:" & vbNewLine & ex.Message)
End Try
@@ -142,18 +145,140 @@
Refresh_Rights_Groups()
End Sub
Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs) Handles ToolStripButton3.Click
Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs)
Save_User_Rights_Data()
End Sub
Private Sub ToolStripButton4_Click(sender As Object, e As EventArgs) Handles ToolStripButton4.Click
Refresh_Rights_Users()
Refresh_Rights_Users(cmbEntity.SelectedValue)
End Sub
Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged
Select Case TabControl1.SelectedIndex
Case 1
Refresh_Rights_Users()
Dim sql = String.Format("select T1.FORM_ID, [dbo].[FNPMO_GETOBJECTCAPTION]('{0}','FORMVIEW_TITLE' + CONVERT(VARCHAR(5), T1.GUID), 1) AS 'FORM_TITLE' FROM TBPMO_FORM_VIEW T1 " & _
"WHERE T1.SCREEN_ID = 1 ORDER BY T1.FORM_TITLE", USER_LANGUAGE)
Dim DT As DataTable = ClassDatabase.Return_Datatable(sql, True)
If Not IsNothing(DT) Then
cmbEntity.DataSource = DT
cmbEntity.DisplayMember = DT.Columns(1).ColumnName
cmbEntity.ValueMember = DT.Columns(0).ColumnName
End If
Refresh_Free_Users()
Refresh_Rights_Users(cmbEntity.SelectedValue)
End Select
End Sub
Sub Refresh_Free_Users()
Dim Sql = String.Format("SELECT * FROM TBDD_USER WHERE MODULE_RECORD_ORG = 1 AND GUID NOT IN (SELECT USER_ID FROM TBPMO_RIGHT_USER WHERE ENTITY_ID = {0}) ORDER BY USERNAME", cmbEntity.SelectedValue)
Dim DT_USER = ClassDatabase.Return_Datatable(Sql)
Try
DD_ECMAdmin.TBAD_Users.Clear()
For Each row As DataRow In DT_USER.Rows
Dim newUserRow As DD_ECMAdmin.TBAD_UsersRow
newUserRow = DD_ECMAdmin.TBAD_Users.NewTBAD_UsersRow
newUserRow.Username = row.Item("USERNAME")
newUserRow.Surname = row.Item("NAME")
newUserRow.Prename = row.Item("PRENAME")
Try
newUserRow.Email = row.Item("EMAIL")
Catch ex As Exception
newUserRow.Email = ""
End Try
newUserRow.ID = row.Item("GUID")
DD_ECMAdmin.TBAD_Users.Rows.Add(newUserRow)
' chklbxUserForGroup.Items.Add(New MyListBoxItem() With {.Text = row.Item(1), .ExtraData = row.Item(0)})
Next
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Error Refresh_Free_Users:", ex.Message)
End Try
End Sub
Private Sub cmbEntity_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbEntity.SelectedIndexChanged
If cmbEntity.SelectedIndex <> -1 Then
Try
Dim i As Integer = cmbEntity.SelectedValue
Catch ex As Exception
Exit Sub
End Try
Refresh_Free_Users()
Refresh_Rights_Users(cmbEntity.SelectedValue)
End If
End Sub
Private Sub btnAddUser2ConstructorREL_Click(sender As Object, e As EventArgs) Handles btnAddUser2ConstructorREL.Click
Try
Try
Dim i As Integer = cmbEntity.SelectedValue
Catch ex As Exception
Exit Sub
End Try
For Each row As DataRow In DD_ECMAdmin.TBAD_Users.Rows
If row.Item(0) = CBool(True) Then
Dim insert = String.Format("INSERT INTO TBPMO_RIGHT_USER (USER_ID,ENTITY_ID) VALUES ({0},{1})", row.Item(5), cmbEntity.SelectedValue)
If ClassDatabase.Execute_non_Query(insert) = False Then
MsgBox("Could not insert the User-Definition....Check the logfile!", MsgBoxStyle.Exclamation)
End If
End If
Next
For Each row As DataRow In DD_ECMAdmin.TBAD_Users.Rows
row.Item(0) = CBool(False)
Next
Refresh_Free_Users()
Refresh_Rights_Users(cmbEntity.SelectedValue)
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Error while adding user-rights:", ex.Message)
End Try
End Sub
Private Sub btndeleteUserRight_Click(sender As Object, e As EventArgs) Handles btndeleteUserRight.Click
Try
Dim ID = GridView1.GetFocusedRowCellValue(GridView1.Columns("GUID"))
Try
Dim I As Integer = CInt(ID)
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Error while deleting rights:", ex.Message)
Exit Sub
End Try
Dim del = String.Format("DELETE FROM TBPMO_RIGHT_USER WHERE GUID = {0}", ID)
If ClassDatabase.Execute_non_Query(del) = True Then
Refresh_Rights_Users(cmbEntity.SelectedValue)
Refresh_Free_Users()
End If
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected error in deleting rights:", ex.Message)
End Try
End Sub
Private Sub GridView1_CellValueChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs) Handles GridView1.CellValueChanged
Try
GridView1.EndSelection()
Dim column = e.Column.FieldName
Dim ID = GridView1.GetFocusedRowCellValue(GridView1.Columns("GUID"))
Try
Dim I As Integer = CInt(ID)
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Error getting row-ID:", ex.Message)
Exit Sub
End Try
Dim int_bool As Integer
If e.Value.ToString = "True" Then
int_bool = 1
Else
int_bool = 0
End If
Dim upd = String.Format("UPDATE TBPMO_RIGHT_USER SET {0} = {1} WHERE GUID = {2}", column, int_bool, ID)
If ClassDatabase.Execute_non_Query(upd) = False Then
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Could not Update Right-details!")
statelbl.Text = ""
Else
statelbl.Text = "ID: " & ID.ToString & " - '" & e.Column.Caption.ToString & "' updated. - " & Now.ToString
End If
Catch ex As Exception
ClassHelper.MSGBOX_Handler("ERROR", "Unexpected Error", "Error in grvwGridPos_CellValueChanged: ", ex.Message)
End Try
End Sub
End Class