This commit is contained in:
SchreiberM
2016-11-30 10:19:28 +01:00
parent c2f8ddd1c3
commit 0f374eecb2
37 changed files with 20587 additions and 10843 deletions

View File

@@ -152,16 +152,16 @@ Public Class ClassDatabase
Return Nothing
End Try
End Function
Public Shared Function Execute_non_Query(ExecuteCMD As String, Optional Userinput As Boolean = False)
Public Shared Function Execute_non_Query(ExecuteCMD As String, Optional Userinput As Boolean = False, Optional timeout As Integer = 120)
Try
Dim SQLconnect As New SqlClient.SqlConnection
Dim SQLcommand As SqlClient.SqlCommand
SQLconnect.ConnectionString = ConnectionStringRM
SQLconnect.Open()
SQLcommand = SQLconnect.CreateCommand
SQLcommand.CommandTimeout = 120
SQLcommand.CommandTimeout = timeout
'Update Last Created Record in Foo
SQLcommand.CommandText = ExecuteCMD

View File

@@ -24,10 +24,8 @@ Partial Class frmUsersReworkRights
Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label()
Me.BW_RightsEntity = New System.ComponentModel.BackgroundWorker()
Me.ProgressBar1 = New System.Windows.Forms.ProgressBar()
Me.btncancel = New System.Windows.Forms.Button()
Me.btnCheckRights = New System.Windows.Forms.Button()
Me.lblstate = New System.Windows.Forms.Label()
Me.MyDataset = New RecordOrganizer_RightManager.MyDataset()
Me.TBAD_UsersBindingSource = New System.Windows.Forms.BindingSource()
Me.GridControlUsers2Menue = New DevExpress.XtraGrid.GridControl()
@@ -56,14 +54,6 @@ Partial Class frmUsersReworkRights
'BW_RightsEntity
'
'
'ProgressBar1
'
Me.ProgressBar1.Location = New System.Drawing.Point(28, 287)
Me.ProgressBar1.Name = "ProgressBar1"
Me.ProgressBar1.Size = New System.Drawing.Size(463, 31)
Me.ProgressBar1.TabIndex = 3
Me.ProgressBar1.Visible = False
'
'btncancel
'
Me.btncancel.Image = Global.RecordOrganizer_RightManager.My.Resources.Resources.cancel1
@@ -89,16 +79,6 @@ Partial Class frmUsersReworkRights
Me.btnCheckRights.TextAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnCheckRights.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(25, 271)
Me.lblstate.Name = "lblstate"
Me.lblstate.Size = New System.Drawing.Size(38, 13)
Me.lblstate.TabIndex = 7
Me.lblstate.Text = "Label2"
'
'MyDataset
'
Me.MyDataset.DataSetName = "MyDataset"
@@ -183,9 +163,9 @@ Partial Class frmUsersReworkRights
Me.ProgressPanel1.Appearance.BackColor = System.Drawing.Color.Transparent
Me.ProgressPanel1.Appearance.Options.UseBackColor = True
Me.ProgressPanel1.Description = "Collecting rights ..."
Me.ProgressPanel1.Location = New System.Drawing.Point(28, 324)
Me.ProgressPanel1.Location = New System.Drawing.Point(28, 287)
Me.ProgressPanel1.Name = "ProgressPanel1"
Me.ProgressPanel1.Size = New System.Drawing.Size(463, 45)
Me.ProgressPanel1.Size = New System.Drawing.Size(474, 45)
Me.ProgressPanel1.TabIndex = 90
Me.ProgressPanel1.Text = "ProgressPanel1"
Me.ProgressPanel1.Visible = False
@@ -197,9 +177,7 @@ Partial Class frmUsersReworkRights
Me.ClientSize = New System.Drawing.Size(528, 381)
Me.Controls.Add(Me.ProgressPanel1)
Me.Controls.Add(Me.GridControlUsers2Menue)
Me.Controls.Add(Me.lblstate)
Me.Controls.Add(Me.btncancel)
Me.Controls.Add(Me.ProgressBar1)
Me.Controls.Add(Me.btnCheckRights)
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))
@@ -222,9 +200,7 @@ Partial Class frmUsersReworkRights
Friend WithEvents Label1 As System.Windows.Forms.Label
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 lblstate As System.Windows.Forms.Label
Friend WithEvents MyDataset As RecordOrganizer_RightManager.MyDataset
Friend WithEvents TBAD_UsersBindingSource As System.Windows.Forms.BindingSource
Friend WithEvents GridControlUsers2Menue As DevExpress.XtraGrid.GridControl

View File

@@ -4,7 +4,7 @@ Imports System.ComponentModel
Public Class frmUsersReworkRights
Private _error As Boolean = False
Private Sub frmCheckRightsEntity_Load(sender As Object, e As EventArgs) Handles Me.Load
lblstate.Visible = False
'lblstate.Visible = False
Refresh_Users()
End Sub
Sub Refresh_Users()
@@ -55,21 +55,25 @@ Public Class frmUsersReworkRights
''BackgroundWorker erstellen ...
BW_RightsEntity = New BackgroundWorker
BW_RightsEntity.WorkerReportsProgress = True
ProgressBar1.Maximum = Count + 1
lblstate.Visible = True
lblstate.Text = "Background Worker started...."
'ProgressBar1.Maximum = Count + 1
'lblstate.Visible = True
'lblstate.Text = "Background Worker started...."
ProgressPanel1.Description = "Preparing Right-Collector...."
Me.ProgressBar1.Visible = True
' Me.ProgressBar1.Visible = True
ProgressPanel1.Visible = True
btnCheckRights.Enabled = False
btncancel.Visible = True
AddHandler BW_RightsEntity.DoWork, AddressOf bw_DoWork
BW_RightsEntity.ReportProgress(1)
System.Threading.Thread.Sleep(500)
Application.DoEvents()
DO_Work()
BW_RightsEntity_RunWorkerCompleted()
'AddHandler BW_RightsEntity.DoWork, AddressOf bw_DoWork
'BW_RightsEntity.ReportProgress(1)
'.. und starten
BW_RightsEntity.RunWorkerAsync()
'BW_RightsEntity.RunWorkerAsync()
Catch ex As Exception
MsgBox("Unexpected error in starting backgroundworker: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Me.ProgressBar1.Visible = False
'Me.ProgressBar1.Visible = False
End Try
End If
Me.Cursor = Cursors.Default
@@ -77,7 +81,7 @@ Public Class frmUsersReworkRights
End Sub
Private Sub BW_RightsEntity_ProgressChanged(sender As Object, e As ProgressChangedEventArgs) Handles BW_RightsEntity.ProgressChanged
Me.ProgressBar1.Value = e.ProgressPercentage
'Me.ProgressBar1.Value = e.ProgressPercentage
ProgressPanel1.Description = "Collecting rights for user...."
End Sub
Private Sub bw_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs)
@@ -101,17 +105,35 @@ Public Class frmUsersReworkRights
BW_RightsEntity.ReportProgress(+1)
Next
End Sub
Sub DO_Work()
For Each row As DataRow In MyDataset.TBAD_Users.Rows
If row.Item(0) = CBool(True) Then
ProgressPanel1.Description = "Collecting rights for user...." & row.Item("USERNAME")
Application.DoEvents()
' ProgressPanel1.Description = "Collecting rights for user: " & row.Item("USERNAME")
Dim proc = String.Format("EXEC PRPMO_RIGHTS_SERVICE_CHECK_USER {0}, '{1}'", row.Item(5), Environment.UserName)
If ClassDatabase.Execute_non_Query(proc, False, 240) = False Then
MsgBox("Unexpected Error in Executing rightprocedure - Check the log!", MsgBoxStyle.Critical)
_error = True
Exit For
Else
Dim del = String.Format("DELETE FROM TBPMO_USER_RIGHTS_JOBS WHERE USER_ID = {0}", row.Item(5))
ClassDatabase.Execute_non_Query(del)
End If
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
Private Sub BW_RightsEntity_RunWorkerCompleted() '(sender As Object, e As RunWorkerCompletedEventArgs) 'Handles BW_RightsEntity.RunWorkerCompleted
Try
btncancel.Visible = False
ProgressBar1.Visible = False
lblstate.Visible = False
'ProgressBar1.Visible = False
'lblstate.Visible = False
btnCheckRights.Enabled = True
btncancel.Visible = False
ProgressPanel1.Visible = False
@@ -120,7 +142,7 @@ Public Class frmUsersReworkRights
Else
MsgBox("Some errors occured while checking and transmitting the rights...please check the log!", MsgBoxStyle.Exclamation)
End If
Catch ex As Exception
btnCheckRights.Enabled = True
btncancel.Visible = False