This commit is contained in:
SchreiberM
2017-03-07 16:51:36 +01:00
parent d821a07c18
commit dd721411f8
13 changed files with 681 additions and 120 deletions

View File

@@ -7,6 +7,7 @@ Public Class frmCheckRightsEntity
Private countfiles As Integer = 0
Private WorkingFiles As Integer = 0
Private CURR_DOCID As Integer
Private CURR_DOCPATH As String
Private ENTITY_ID As Integer
Dim righterrors As Boolean = False
Private Sub frmCheckRightsEntity_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -35,7 +36,7 @@ Public Class frmCheckRightsEntity
BW_RightsEntity.WorkerSupportsCancellation = True
Dim sqlfiles = String.Format("SELECT T.DocID,T.FULL_FILENAME,TRL.RECORD_ID,TR.FORM_ID AS [ENTITY_ID] FROM VWPMO_DOC_SEARCH T, TBPMO_DOC_RECORD_LINK TRL, TBPMO_RECORD TR where T.DocID = TRL.DOC_ID AND TRL.RECORD_ID = TR.GUID AND TR.FORM_ID = {0} ORDER BY DocID", ENTITY_ID)
DT_FILES = clsDatabase.Return_Datatable(sqlfiles)
If DD_Rights.ClassRights.Init(ENTITY_ID, chklogging.Checked, DT_FILES.Rows.Count) = False Then
If DD_Rights.ClassWDRights.Init(chklogging.Checked, ClassDatabase.ConnectionStringRM) = False Then
MsgBox("Could not init rights management. " & vbNewLine & "Check logfile", MsgBoxStyle.Critical)
Exit Sub
End If
@@ -43,9 +44,7 @@ Public Class frmCheckRightsEntity
MsgBox("No files were found! Please check docsearch!", MsgBoxStyle.Critical)
Exit Sub
Else
clsLogger.Add(String.Format(">> {0} files must be transferred!", DT_FILES.Rows.Count), False)
Dim del = "DELETE FROM TBPMO_USER_RIGHTS_JOBS WHERE ENTITY_ID = " & ENTITY_ID
clsDatabase.Execute_non_Query(del)
clsLogger.Add(String.Format(">> {0} files must be Checked!", DT_FILES.Rows.Count), False)
End If
btncancel.Visible = True
lblstate.Visible = True
@@ -79,33 +78,47 @@ Public Class frmCheckRightsEntity
e.Cancel = True
Exit For
Else
If DD_Rights.ClassRights.Collect_Users(row.Item("RECORD_ID"), row.Item("ENTITY_ID")) = True Then
WorkingFiles += 1
CURR_DOCID = row.Item("DocID")
If DD_Rights.ClassRights.TransferRights2Service(row.Item("DocID"), row.Item("FULL_FILENAME"), 1) Then
If DD_Rights.ClassRights.MSG_RESULT <> "" Then
righterrors = True
End If
Else
MsgBox("Unexpected Error in DD_Rights.ClassRights.TransferRights2Service - Check the log!", MsgBoxStyle.Exclamation)
If DD_Rights.ClassRights.MSG_RESULT <> "" Then
MsgBox(DD_Rights.ClassRights.MSG_RESULT, MsgBoxStyle.Information)
End If
_error = True
'###
WorkingFiles += 1
CURR_DOCID = row.Item("DocID")
CURR_DOCPATH = row.Item("FULL_FILENAME")
If DD_Rights.ClassWDRights.Doc_Renew_Rights(CURR_DOCID, CURR_DOCPATH, True) Then
If DD_Rights.ClassWDRights.MSG_RESULT <> "" Then
righterrors = True
End If
Else
MsgBox("Unexpected Error in DD_Rights.ClassRights.Collect_Users - Check the log!", MsgBoxStyle.Exclamation)
If DD_Rights.ClassRights.MSG_RESULT <> "" Then
MsgBox(DD_Rights.ClassRights.MSG_RESULT, MsgBoxStyle.Information)
MsgBox("Unexpected Error in DD_Rights.ClassWDRights.Doc_Renew_Rights - Check the log!", MsgBoxStyle.Exclamation)
If DD_Rights.ClassWDRights.MSG_RESULT <> "" Then
MsgBox(DD_Rights.ClassWDRights.MSG_RESULT, MsgBoxStyle.Information)
End If
_error = True
End If
'###
'If DD_Rights.ClassRights.Collect_Users(row.Item("RECORD_ID"), row.Item("ENTITY_ID")) = True Then
' WorkingFiles += 1
' CURR_DOCID = row.Item("DocID")
' If DD_Rights.ClassRights.TransferRights2Service(row.Item("DocID"), row.Item("FULL_FILENAME"), 1) Then
' If DD_Rights.ClassRights.MSG_RESULT <> "" Then
' righterrors = True
' End If
' Else
' MsgBox("Unexpected Error in DD_Rights.ClassRights.TransferRights2Service - Check the log!", MsgBoxStyle.Exclamation)
' If DD_Rights.ClassRights.MSG_RESULT <> "" Then
' MsgBox(DD_Rights.ClassRights.MSG_RESULT, MsgBoxStyle.Information)
' End If
' _error = True
' End If
'Else
' MsgBox("Unexpected Error in DD_Rights.ClassRights.Collect_Users - Check the log!", MsgBoxStyle.Exclamation)
' If DD_Rights.ClassRights.MSG_RESULT <> "" Then
' MsgBox(DD_Rights.ClassRights.MSG_RESULT, MsgBoxStyle.Information)
' End If
' _error = True
'End If
BW_RightsEntity.ReportProgress(i)
i += 1
End If
Next
DD_Rights.ClassRights.Finalize_SettingRights()
End Sub
Private Sub btncancel_Click(sender As Object, e As EventArgs) Handles btncancel.Click
@@ -118,15 +131,14 @@ Public Class frmCheckRightsEntity
lblstate.Visible = False
ProgressBar1.Visible = False
If _error = False Then
clsDatabase.Execute_non_Query("UPDATE TBPMO_SERVICE_RIGHT_CONFIG SET RUN_SERVICE = 1 WHERE GUID = 1")
'clsDatabase.Execute_non_Query("UPDATE TBPMO_SERVICE_RIGHT_CONFIG SET RUN_SERVICE = 1 WHERE GUID = 1")
If righterrors = True Then
MsgBox("All rights of files belonging to entity were checked and refreshed, " & vbNewLine & "BUT some Userrights could not be set. Check the logfile!", MsgBoxStyle.Exclamation, "Attention")
Else
MsgBox("All rights of files belonging to entity were queued for central rights service!" & vbNewLine & "Rights will be set within the next 5 minutes!", MsgBoxStyle.Information)
MsgBox("All rights of files belonging to entity were checked and refreshed!", MsgBoxStyle.Information)
End If
Else
MsgBox("Some errors occured while preparing and queuing rights...please check the log!" & vbNewLine & ">> " & ClassRights.COUNT_FILES.ToString & " files schould be worked." & _
">> " & ClassRights.WORKED_FILES.ToString & " were worked successfully.", MsgBoxStyle.Exclamation)
MsgBox("Some errors occured while preparing and queuing rights...please check the log!" , MsgBoxStyle.Exclamation)
End If
Catch ex As Exception