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

@@ -90,6 +90,12 @@
<ItemGroup>
<Compile Include="ApplicationEvents.vb" />
<Compile Include="ClassDatabase.vb" />
<Compile Include="frmCheckRightsRecords.Designer.vb">
<DependentUpon>frmCheckRightsRecords.vb</DependentUpon>
</Compile>
<Compile Include="frmCheckRightsRecords.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmUsersReworkRights.Designer.vb">
<DependentUpon>frmUsersReworkRights.vb</DependentUpon>
</Compile>
@@ -144,6 +150,9 @@
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="frmCheckRightsRecords.resx">
<DependentUpon>frmCheckRightsRecords.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmUsersReworkRights.resx">
<DependentUpon>frmUsersReworkRights.vb</DependentUpon>
</EmbeddedResource>

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

View File

@@ -0,0 +1,188 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmCheckRightsRecords
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
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.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label()
Me.cmbentity = New System.Windows.Forms.ComboBox()
Me.btnCheckRights = New System.Windows.Forms.Button()
Me.BW_RightsEntity = New System.ComponentModel.BackgroundWorker()
Me.ProgressBar1 = New System.Windows.Forms.ProgressBar()
Me.btncancel = New System.Windows.Forms.Button()
Me.chklogging = New System.Windows.Forms.CheckBox()
Me.lblstate = New System.Windows.Forms.Label()
Me.GridControlMain = New DevExpress.XtraGrid.GridControl()
Me.GridViewMain = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.Label2 = New System.Windows.Forms.Label()
CType(Me.GridControlMain, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GridViewMain, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(25, 9)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(147, 16)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Please choose an entity:"
'
'cmbentity
'
Me.cmbentity.FormattingEnabled = True
Me.cmbentity.Location = New System.Drawing.Point(28, 29)
Me.cmbentity.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.cmbentity.Name = "cmbentity"
Me.cmbentity.Size = New System.Drawing.Size(335, 24)
Me.cmbentity.TabIndex = 1
'
'btnCheckRights
'
Me.btnCheckRights.Location = New System.Drawing.Point(520, 59)
Me.btnCheckRights.Name = "btnCheckRights"
Me.btnCheckRights.Size = New System.Drawing.Size(335, 39)
Me.btnCheckRights.TabIndex = 2
Me.btnCheckRights.Text = "Renew rights for all selected records"
Me.btnCheckRights.UseVisualStyleBackColor = True
'
'BW_RightsEntity
'
'
'ProgressBar1
'
Me.ProgressBar1.Location = New System.Drawing.Point(520, 31)
Me.ProgressBar1.Name = "ProgressBar1"
Me.ProgressBar1.Size = New System.Drawing.Size(335, 22)
Me.ProgressBar1.TabIndex = 3
Me.ProgressBar1.Visible = False
'
'btncancel
'
Me.btncancel.Image = Global.RecordOrganizer_RightManager.My.Resources.Resources.cancel1
Me.btncancel.ImageAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btncancel.Location = New System.Drawing.Point(881, 25)
Me.btncancel.Name = "btncancel"
Me.btncancel.Size = New System.Drawing.Size(75, 31)
Me.btncancel.TabIndex = 4
Me.btncancel.Text = "Cancel"
Me.btncancel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btncancel.UseVisualStyleBackColor = True
Me.btncancel.Visible = False
'
'chklogging
'
Me.chklogging.AutoSize = True
Me.chklogging.Checked = True
Me.chklogging.CheckState = System.Windows.Forms.CheckState.Checked
Me.chklogging.Location = New System.Drawing.Point(379, 31)
Me.chklogging.Name = "chklogging"
Me.chklogging.Size = New System.Drawing.Size(113, 20)
Me.chklogging.TabIndex = 5
Me.chklogging.Text = "Log errors only"
Me.chklogging.UseVisualStyleBackColor = True
'
'lblstate
'
Me.lblstate.AutoSize = True
Me.lblstate.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblstate.Location = New System.Drawing.Point(517, 12)
Me.lblstate.Name = "lblstate"
Me.lblstate.Size = New System.Drawing.Size(38, 13)
Me.lblstate.TabIndex = 6
Me.lblstate.Text = "Label2"
'
'GridControlMain
'
Me.GridControlMain.AllowDrop = True
Me.GridControlMain.Location = New System.Drawing.Point(28, 105)
Me.GridControlMain.MainView = Me.GridViewMain
Me.GridControlMain.Name = "GridControlMain"
Me.GridControlMain.Size = New System.Drawing.Size(928, 196)
Me.GridControlMain.TabIndex = 9
Me.GridControlMain.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridViewMain})
'
'GridViewMain
'
Me.GridViewMain.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFullFocus
Me.GridViewMain.GridControl = Me.GridControlMain
Me.GridViewMain.Name = "GridViewMain"
Me.GridViewMain.OptionsClipboard.CopyColumnHeaders = DevExpress.Utils.DefaultBoolean.[False]
Me.GridViewMain.OptionsSelection.EnableAppearanceFocusedCell = False
Me.GridViewMain.OptionsSelection.EnableAppearanceFocusedRow = False
Me.GridViewMain.OptionsSelection.EnableAppearanceHideSelection = False
Me.GridViewMain.OptionsSelection.MultiSelect = True
Me.GridViewMain.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CellSelect
Me.GridViewMain.OptionsView.ColumnAutoWidth = False
Me.GridViewMain.OptionsView.EnableAppearanceEvenRow = True
Me.GridViewMain.OptionsView.ShowAutoFilterRow = True
Me.GridViewMain.OptionsView.ShowHorizontalLines = DevExpress.Utils.DefaultBoolean.[True]
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(25, 86)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(318, 16)
Me.Label2.TabIndex = 10
Me.Label2.Text = "Please select the records which files shall be checked:"
'
'frmCheckRightsRecords
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 16.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(970, 305)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.GridControlMain)
Me.Controls.Add(Me.lblstate)
Me.Controls.Add(Me.chklogging)
Me.Controls.Add(Me.btncancel)
Me.Controls.Add(Me.ProgressBar1)
Me.Controls.Add(Me.btnCheckRights)
Me.Controls.Add(Me.cmbentity)
Me.Controls.Add(Me.Label1)
Me.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmCheckRightsRecords"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Check Rights for Records"
CType(Me.GridControlMain, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridViewMain, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents cmbentity As System.Windows.Forms.ComboBox
Friend WithEvents btnCheckRights As System.Windows.Forms.Button
Friend WithEvents BW_RightsEntity As System.ComponentModel.BackgroundWorker
Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar
Friend WithEvents btncancel As System.Windows.Forms.Button
Friend WithEvents chklogging As System.Windows.Forms.CheckBox
Friend WithEvents lblstate As System.Windows.Forms.Label
Friend WithEvents GridControlMain As DevExpress.XtraGrid.GridControl
Friend WithEvents GridViewMain As DevExpress.XtraGrid.Views.Grid.GridView
Friend WithEvents Label2 As System.Windows.Forms.Label
End Class

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="BW_RightsEntity.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -0,0 +1,207 @@
Imports DD_Rights
Imports System.ComponentModel
Imports DevExpress.XtraEditors.Repository
Imports DevExpress.Utils
Public Class frmCheckRightsRecords
Private _formloaded As Boolean = False
Private DT_FILES As DataTable
Private _error As Boolean = False
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 DT_DATA As DataTable
Private Sub frmCheckRightsRecords_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
Dim sql = String.Format("SELECT T.FORM_ID, [dbo].[FNPMO_GETOBJECTCAPTION]('{0}','FORMVIEW_TITLE' + CONVERT(VARCHAR(5), T.[FORM_VIEW_ID]), 1) AS FORM_TITLE FROM VWPMO_CONSTRUCTOR_FORMS T WHERE DOCUMENT_VIEW = 1", USER_LANGUAGE)
Dim DT As DataTable = clsDatabase.Return_Datatable(sql)
cmbentity.DataSource = DT
cmbentity.ValueMember = DT.Columns(0).ColumnName
cmbentity.DisplayMember = DT.Columns(1).ColumnName
lblstate.Visible = False
Catch ex As Exception
MsgBox("Unexpected error in load form: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub btnCheckRights_Click(sender As Object, e As EventArgs) Handles btnCheckRights.Click
If cmbentity.SelectedIndex <> -1 And DT_DATA.Rows.Count > 0 Then
Try
DT_DATA.AcceptChanges()
righterrors = False
CURR_DOCID = 0
ENTITY_ID = cmbentity.SelectedValue
countfiles = 0
Me.ProgressBar1.Visible = True
'BackgroundWorker erstellen ...
BW_RightsEntity = New BackgroundWorker
BW_RightsEntity.WorkerReportsProgress = True
BW_RightsEntity.WorkerSupportsCancellation = True
Dim listRecords As New ArrayList
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
For Each row As DataRow In DT_DATA.Rows
If row.Item("Selection") = True Then
Dim recid = row.Item("Record-ID")
If Not IsNothing(recid) Then
listRecords.Add(recid)
End If
End If
Next
For Each Record As String In listRecords
Dim sqlfiles = String.Format("SELECT TRL.DOC_ID FROM TBPMO_DOC_RECORD_LINK TRL WHERE TRL.RECORD_ID = {0} ORDER BY TRL.DOC_ID", Record)
DT_FILES = clsDatabase.Return_Datatable(sqlfiles)
If DT_FILES.Rows.Count > 0 Then
countfiles += DT_FILES.Rows.Count
End If
Next
If countfiles = 0 Then
MsgBox("No files were found! Please check docsearch!", MsgBoxStyle.Critical)
Exit Sub
Else
clsLogger.Add(String.Format(">> {0} files must be Checked!", countfiles), False)
End If
btncancel.Visible = True
lblstate.Visible = True
lblstate.Text = "Starting Background Worker...."
WorkingFiles = 0
ProgressBar1.Maximum = countfiles
AddHandler BW_RightsEntity.DoWork, AddressOf bw_DoWork
'.. und starten
BW_RightsEntity.RunWorkerAsync()
Catch ex As Exception
MsgBox("Unexpected error in starting backgroundworker: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Me.ProgressBar1.Visible = False
End Try
End If
End Sub
Private Sub BW_RightsEntity_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles BW_RightsEntity.ProgressChanged
Dim state = "Working on file '" & WorkingFiles.ToString & "' of '" & countfiles.ToString & "'"
lblstate.Text = state
Me.ProgressBar1.Value = e.ProgressPercentage
End Sub
Private Sub bw_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs)
Dim worker As BackgroundWorker = CType(sender, BackgroundWorker)
_error = False
Dim i As Integer = 1
'Jede Datei einzeln verarbeiten
Dim listRecords As New ArrayList
For Each row As DataRow In DT_DATA.Rows
If row.Item("Selection") = True Then
Dim recid = row.Item("Record-ID")
If Not IsNothing(recid) Then
listRecords.Add(recid)
End If
End If
Next
For Each Record As String In listRecords
Dim sqlfiles = String.Format("SELECT T.DocID,T.FULL_FILENAME FROM VWPMO_DOC_SEARCH T, TBPMO_DOC_RECORD_LINK TRL where T.DocID = TRL.DOC_ID AND TRL.RECORD_ID = {0} ORDER BY DocID", Record)
DT_FILES = clsDatabase.Return_Datatable(sqlfiles)
If DT_FILES.Rows.Count > 0 Then
For Each row As DataRow In DT_FILES.Rows
If BW_RightsEntity.CancellationPending = True Then
MsgBox("Backgroundworker aborting - check log!", MsgBoxStyle.Critical)
e.Cancel = True
Exit For
Else
'###
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.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
BW_RightsEntity.ReportProgress(i)
i += 1
End If
Next
End If
Next
End Sub
Private Sub btncancel_Click(sender As Object, e As EventArgs) Handles btncancel.Click
' Cancel the asynchronous operation.
Me.BW_RightsEntity.CancelAsync()
End Sub
Private Sub BW_RightsEntity_RunWorkerCompleted(sender As Object, e As RunWorkerCompletedEventArgs) Handles BW_RightsEntity.RunWorkerCompleted
Try
btncancel.Visible = False
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")
If righterrors = True Then
MsgBox("All rights of files belonging to selected records 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 selected records were checked and refreshed!", MsgBoxStyle.Information)
End If
Else
MsgBox("Some errors occured while preparing and queuing rights...please check the log!", MsgBoxStyle.Exclamation)
End If
Catch ex As Exception
End Try
End Sub
Private Sub cmbentity_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbentity.SelectedIndexChanged
Try
If _formloaded = False Then Exit Sub
If cmbentity.SelectedIndex <> -1 Then
ENTITY_ID = cmbentity.SelectedValue
Dim ViewName As String = "VWTEMP_PMO_FORM" & cmbentity.SelectedValue.ToString
Dim EntitySQL As String = "SELECT CONVERT(BIT,0) as Selection, T.* FROM " & ViewName & " T where [file count] > 0"
Me.Cursor = Cursors.WaitCursor
DT_DATA = clsDatabase.Return_Datatable(EntitySQL)
GridControlMain.DataSource = Nothing
If GridViewMain.Columns.Count > 0 Then
GridViewMain.Columns.Clear()
End If
If Not IsNothing(DT_DATA) Then
GridControlMain.DataSource = DT_DATA
Dim checkboxEdit = New RepositoryItemCheckEdit()
Dim dateEdit As New RepositoryItemTimeEdit()
' checkboxEdit vor-formatieren
checkboxEdit.ValueChecked = True
checkboxEdit.ValueUnchecked = False
' dateEdit vor-formatieren
dateEdit.DisplayFormat.FormatType = FormatType.DateTime
dateEdit.Mask.UseMaskAsDisplayFormat = True
' Editoren zum Grid hinzufügen
GridViewMain.GridControl.RepositoryItems.AddRange({checkboxEdit, dateEdit})
End If
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
Finally
Me.Cursor = Cursors.Default
End Try
End Sub
Private Sub frmCheckRightsRecords_Shown(sender As Object, e As EventArgs) Handles Me.Shown
_formloaded = True
End Sub
End Class

View File

@@ -25,10 +25,11 @@ Partial Class frmStart
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmStart))
Me.Button1 = New System.Windows.Forms.Button()
Me.btnWorkUserRights = New System.Windows.Forms.Button()
Me.btnWorkUserRightsSV_ADD = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.XtraTabControl1 = New DevExpress.XtraTab.XtraTabControl()
Me.XtraTabPage1 = New DevExpress.XtraTab.XtraTabPage()
Me.btnCheckRenewRecordRights = New System.Windows.Forms.Button()
Me.btnCheckRenewUserRights = New System.Windows.Forms.Button()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.chkLogerrorsonly = New System.Windows.Forms.CheckBox()
Me.XtraTabPage2 = New DevExpress.XtraTab.XtraTabPage()
@@ -48,7 +49,6 @@ Partial Class frmStart
Me.Label1 = New System.Windows.Forms.Label()
Me.VWPMO_RIGHTS_2B_WORKEDTableAdapter = New RecordOrganizer_RightManager.MyDatasetTableAdapters.VWPMO_RIGHTS_2B_WORKEDTableAdapter()
Me.TableAdapterManager = New RecordOrganizer_RightManager.MyDatasetTableAdapters.TableAdapterManager()
Me.btnCheckRenewUserRights = New System.Windows.Forms.Button()
CType(Me.XtraTabControl1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.XtraTabControl1.SuspendLayout()
Me.XtraTabPage1.SuspendLayout()
@@ -67,31 +67,20 @@ Partial Class frmStart
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(312, 45)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Check Rights for documents belonging to entity"
Me.Button1.Text = "Check Rights for all documents " & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "belonging to entity"
Me.Button1.UseVisualStyleBackColor = True
'
'btnWorkUserRights
'
Me.btnWorkUserRights.Font = New System.Drawing.Font("Tahoma", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnWorkUserRights.ForeColor = System.Drawing.Color.DarkRed
Me.btnWorkUserRights.Location = New System.Drawing.Point(3, 114)
Me.btnWorkUserRights.Location = New System.Drawing.Point(-1, 158)
Me.btnWorkUserRights.Name = "btnWorkUserRights"
Me.btnWorkUserRights.Size = New System.Drawing.Size(312, 45)
Me.btnWorkUserRights.TabIndex = 2
Me.btnWorkUserRights.Text = "Work User"
Me.btnWorkUserRights.UseVisualStyleBackColor = True
'
'btnWorkUserRightsSV_ADD
'
Me.btnWorkUserRightsSV_ADD.Font = New System.Drawing.Font("Tahoma", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnWorkUserRightsSV_ADD.ForeColor = System.Drawing.Color.DarkRed
Me.btnWorkUserRightsSV_ADD.Location = New System.Drawing.Point(0, 164)
Me.btnWorkUserRightsSV_ADD.Name = "btnWorkUserRightsSV_ADD"
Me.btnWorkUserRightsSV_ADD.Size = New System.Drawing.Size(312, 45)
Me.btnWorkUserRightsSV_ADD.TabIndex = 3
Me.btnWorkUserRightsSV_ADD.Text = "Work User"
Me.btnWorkUserRightsSV_ADD.UseVisualStyleBackColor = True
'
'Button2
'
Me.Button2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
@@ -117,16 +106,36 @@ Partial Class frmStart
'
'XtraTabPage1
'
Me.XtraTabPage1.Controls.Add(Me.btnCheckRenewRecordRights)
Me.XtraTabPage1.Controls.Add(Me.btnCheckRenewUserRights)
Me.XtraTabPage1.Controls.Add(Me.GroupBox1)
Me.XtraTabPage1.Controls.Add(Me.Button1)
Me.XtraTabPage1.Controls.Add(Me.Button2)
Me.XtraTabPage1.Controls.Add(Me.btnWorkUserRightsSV_ADD)
Me.XtraTabPage1.Controls.Add(Me.btnWorkUserRights)
Me.XtraTabPage1.Name = "XtraTabPage1"
Me.XtraTabPage1.Size = New System.Drawing.Size(825, 222)
Me.XtraTabPage1.Text = "Jobs and Tools"
'
'btnCheckRenewRecordRights
'
Me.btnCheckRenewRecordRights.Font = New System.Drawing.Font("Tahoma", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnCheckRenewRecordRights.Location = New System.Drawing.Point(3, 114)
Me.btnCheckRenewRecordRights.Name = "btnCheckRenewRecordRights"
Me.btnCheckRenewRecordRights.Size = New System.Drawing.Size(312, 45)
Me.btnCheckRenewRecordRights.TabIndex = 8
Me.btnCheckRenewRecordRights.Text = "Check or Renew Rights for explicit records"
Me.btnCheckRenewRecordRights.UseVisualStyleBackColor = True
'
'btnCheckRenewUserRights
'
Me.btnCheckRenewUserRights.Font = New System.Drawing.Font("Tahoma", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnCheckRenewUserRights.Location = New System.Drawing.Point(3, 63)
Me.btnCheckRenewUserRights.Name = "btnCheckRenewUserRights"
Me.btnCheckRenewUserRights.Size = New System.Drawing.Size(312, 45)
Me.btnCheckRenewUserRights.TabIndex = 7
Me.btnCheckRenewUserRights.Text = "Check or Renew Rights for Users"
Me.btnCheckRenewUserRights.UseVisualStyleBackColor = True
'
'GroupBox1
'
Me.GroupBox1.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
@@ -155,7 +164,7 @@ Partial Class frmStart
Me.XtraTabPage2.Controls.Add(Me.GridControl1)
Me.XtraTabPage2.Controls.Add(Me.Label1)
Me.XtraTabPage2.Name = "XtraTabPage2"
Me.XtraTabPage2.Size = New System.Drawing.Size(825, 307)
Me.XtraTabPage2.Size = New System.Drawing.Size(825, 222)
Me.XtraTabPage2.Text = "Rights 2b worked"
'
'btnrefreshJobs
@@ -303,16 +312,6 @@ Partial Class frmStart
Me.TableAdapterManager.Connection = Nothing
Me.TableAdapterManager.UpdateOrder = RecordOrganizer_RightManager.MyDatasetTableAdapters.TableAdapterManager.UpdateOrderOption.InsertUpdateDelete
'
'btnCheckRenewUserRights
'
Me.btnCheckRenewUserRights.Font = New System.Drawing.Font("Tahoma", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnCheckRenewUserRights.Location = New System.Drawing.Point(3, 63)
Me.btnCheckRenewUserRights.Name = "btnCheckRenewUserRights"
Me.btnCheckRenewUserRights.Size = New System.Drawing.Size(312, 45)
Me.btnCheckRenewUserRights.TabIndex = 7
Me.btnCheckRenewUserRights.Text = "Check or Renew Rights for Users"
Me.btnCheckRenewUserRights.UseVisualStyleBackColor = True
'
'frmStart
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -341,7 +340,6 @@ Partial Class frmStart
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents btnWorkUserRights As System.Windows.Forms.Button
Friend WithEvents btnWorkUserRightsSV_ADD As System.Windows.Forms.Button
Friend WithEvents XtraTabControl1 As DevExpress.XtraTab.XtraTabControl
Friend WithEvents XtraTabPage1 As DevExpress.XtraTab.XtraTabPage
Friend WithEvents XtraTabPage2 As DevExpress.XtraTab.XtraTabPage
@@ -364,5 +362,6 @@ Partial Class frmStart
Friend WithEvents chkLogerrorsonly As System.Windows.Forms.CheckBox
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents btnCheckRenewUserRights As System.Windows.Forms.Button
Friend WithEvents btnCheckRenewRecordRights As System.Windows.Forms.Button
End Class

View File

@@ -1,7 +1,6 @@
Imports DD_Rights
Public Class frmStart
Private Sub frmStart_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
DD_Rights.clsLogger.Init(Application.UserAppDataPath() & "\Log", Environment.UserName)
If DD_Rights.clsDatabase.Init(My.Settings.MyConnectionString) = False Then
@@ -22,7 +21,7 @@ Public Class frmStart
If USER_DT.Rows.Count = 0 Then
clsLogger.Add(" - User '" & Environment.UserName & "' not listed in Useradminsitration!", False)
clsLogger.Add(" - User '" & Environment.UserName & "' not listed in Useradministration!", False)
'MsgBox("Achtung: Sie sind nicht in der Userverwaltung hinterlegt." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!", MsgBoxStyle.Critical, "Achtung:")
'Me.Close()
Dim msg = String.Format("You are not listed in the Useradministration." & vbNewLine & "Please contact the admin.")
@@ -89,13 +88,13 @@ Public Class frmStart
Else
btnWorkUserRights.Visible = False
End If
DT_WORK_USER_CONTROL_SUPERVISOR = clsDatabase.Return_Datatable(SQL_USER_RIGHTS_SUPERVISOR_ADDED)
If DT_WORK_USER_CONTROL_SUPERVISOR.Rows.Count > 0 And (Environment.UserName.ToLower = "windream" Or Environment.UserName.ToLower = "schreiberm") Then
btnWorkUserRightsSV_ADD.Text = "New Supervisor for Record/Entity added." & vbNewLine & "Amount: " & DT_WORK_USER_CONTROL_SUPERVISOR.Rows.Count.ToString
btnWorkUserRightsSV_ADD.Visible = True
Else
btnWorkUserRightsSV_ADD.Visible = False
End If
'DT_WORK_USER_CONTROL_SUPERVISOR = clsDatabase.Return_Datatable(SQL_USER_RIGHTS_SUPERVISOR_ADDED)
'If DT_WORK_USER_CONTROL_SUPERVISOR.Rows.Count > 0 And (Environment.UserName.ToLower = "windream" Or Environment.UserName.ToLower = "schreiberm") Then
' btnWorkUserRightsSV_ADD.Text = "New Supervisor for Record/Entity added." & vbNewLine & "Amount: " & DT_WORK_USER_CONTROL_SUPERVISOR.Rows.Count.ToString
' btnWorkUserRightsSV_ADD.Visible = True
'Else
' btnWorkUserRightsSV_ADD.Visible = False
'End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' Me.Visible = False
@@ -112,7 +111,7 @@ Public Class frmStart
Check_USER_REWORK()
End Sub
Private Sub btnWorkUserRightsSV_ADD_Click(sender As Object, e As EventArgs) Handles btnWorkUserRightsSV_ADD.Click
Private Sub btnWorkUserRightsSV_ADD_Click(sender As Object, e As EventArgs)
frmSupervisorEntity.ShowDialog()
Check_USER_REWORK()
End Sub
@@ -159,4 +158,8 @@ Public Class frmStart
Private Sub btnCheckRenewUserRights_Click(sender As Object, e As EventArgs) Handles btnCheckRenewUserRights.Click
frmUsersReworkRights.ShowDialog()
End Sub
Private Sub btnCheckRenewRecordRights_Click(sender As Object, e As EventArgs) Handles btnCheckRenewRecordRights.Click
frmCheckRightsRecords.ShowDialog()
End Sub
End Class