Digital Data - Marlon Schreiber c987d877a3 MSBuildProblem_PM
2017-04-03 11:23:11 +02:00

268 lines
12 KiB
VB.net

Imports WINDREAMLib
Imports DLLLicenseManager
Imports System.Globalization
Public Class frmMain
Private _windreamPM As ClassPMWindream
Private UserLoggedin As Integer = 0
Private PROFILE_COUNT As Integer = 0
Private Sub frmProfiles_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Try
TBPM_USERTableAdapter.cmdLoginOut(False, Environment.MachineName, Environment.UserName)
ClassLogger.Add("## ProcessManager beendet - " & Now, False)
ClassLogger.Add("", False)
Catch ex As Exception
ClassLogger.Add("### Fehler bei LogOut")
ClassLogger.Add("### Fehler: " & ex.Message)
End Try
Try
' Position und Größe speichern
My.Settings.frmMainSize = Me.Size
My.Settings.frmMainPosition = Me.Location
My.Settings.Save()
Catch ex As Exception
ClassLogger.Add("Error in Save FormLayout: " & ex.Message)
End Try
End Sub
Private Sub frmProfiles_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
Select Case e.KeyCode
Case Keys.F12
frmLicense.ShowDialog()
End Select
End Sub
Private Sub frmProfiles_Load(sender As Object, e As System.EventArgs) Handles Me.Load
tslblVersion.Text = String.Format("Version {0}", My.Application.Info.Version.ToString)
If ERROR_STATE = "NO DB-CONNECTION" Or ERROR_STATE = "FAILED DBCONNECTION" Then
MsgBox("Bitte hinterlegen Sie die Datenbankverbindung in der Konfiguration!", MsgBoxStyle.Critical, "Fehlende Konfiguration:")
frmKonfig.ShowDialog()
End If
Try
If CultureInfo.CurrentUICulture.ThreeLetterISOLanguageName = "eng" Then
ClassLogger.Add("## CurrentUICulture.Name: " & CultureInfo.CurrentUICulture.Name, False)
IDX_DMS_ERSTELLT = "DMS Created"
IDX_DMS_ERSTELLT_ZEIT = "DMS Created Time"
My.Settings.Save()
End If
Catch ex As Exception
MessageBox.Show("Fehler bei Laden der CurrentUICulture-Info!", "Achtung:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try
If Refresh_ConnectionString() = True Then
Try
tslblLicenses.Text = "Anzahl Lizenzen: " & LICENSE_COUNT
'userexists = TBPM_USERTableAdapter.CmdUser_exists(Environment.UserName)
If ERROR_STATE = "NO USER" Then
MsgBox("Achtung: Sie sind nicht für die Nutzung von ProcessManager freigegeben!" & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!", MsgBoxStyle.Critical, "Achtung:")
Me.Close()
Else
ClassLogger.Add(">> Username: " & Environment.UserName, False)
'Wenn license abgelaufen und der User nicht admin ist!
If license_expired = True Then
If USER_IS_ADMIN = False Then
Me.Close()
End If
End If
If USER_IS_ADMIN = True Then
tstrpbtn_Config.Visible = True
Else
tstrpbtn_Config.Visible = False
End If
'Anzahl der eingeloggten User
'UserLoggedin = TBPM_USERTableAdapter.CmdGetAnzahl_loggedIn
tslblUserLoggedin.Text = "Anzahl User eingeloggt: " & USERCOUNT_LOGGED_IN
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Fehler bei User Check:")
End Try
Try
tsstlblUser.Text = Environment.UserName
LoadProfile_PM()
Catch ex As System.Exception
MsgBox("Fehler bei Laden des Formulars: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:")
End Try
If UniversalViewer = "" And Viewer = "uviewer" Then
MsgBox("Definieren Sie wo UniversalViewer abgelegt wurde!", MsgBoxStyle.Critical, "Fehlende Konfiguration")
frmKonfig.ShowDialog()
End If
Timer.Start()
Check_Timer_Notification()
End If
Try
' Sind Werte hinterlegt?
If My.Settings.frmMainPosition.IsEmpty = False Then
If My.Settings.frmMainPosition.X > 0 And My.Settings.frmMainPosition.Y > 0 Then
' Gespeicherte Werte verwenden
Me.Location = My.Settings.frmValidatorPosition
End If
End If
' Sind Werte hinterlegt?
If Not My.Settings.frmMainSize.IsEmpty Then
' Gespeicherte Werte verwenden
Me.Size = My.Settings.frmMainSize
End If
Catch ex As Exception
ClassLogger.Add("Error in Load FormLayout: " & ex.Message)
End Try
End Sub
Sub Check_Timer_Notification()
If My.Settings.IntervallReminder <> 0 Then
TimerReminder.Stop()
TimerReminder.Interval = My.Settings.IntervallReminder * 60000
TimerReminder.Start()
Else
TimerReminder.Enabled = False
TimerReminder.Stop()
End If
End Sub
Function Refresh_ConnectionString()
Try
TBPM_KONFIGURATIONTableAdapter.Connection.ConnectionString = MyConnectionString
Me.TBPM_PROFILETableAdapter.Connection.ConnectionString = MyConnectionString
Me.TBPM_USERTableAdapter.Connection.ConnectionString = MyConnectionString
Me.VWPM_PROFILE_USERTableAdapter.Connection.ConnectionString = MyConnectionString
Me.TBPM_PROFILE_FILESTableAdapter.Connection.ConnectionString = MyConnectionString
Return True
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Fehler bei Refresh_ConnectionString:")
Return False
End Try
End Function
Sub LoadProfile_PM()
Try
If Me.Visible = True And frmProfileDesigner.Visible = False Then
PROFILE_COUNT = 0
Me.VWPM_PROFILE_USERTableAdapter.FillByActive(Me.DD_DMSLiteDataSet.VWPM_PROFILE_USER, Environment.UserName)
Dim DT As DataTable = DD_DMSLiteDataSet.Tables("VWPM_PROFILE_USER")
If LogErrorsOnly = False Then ClassLogger.Add("", False)
ListViewProfile.Items.Clear()
If DT.Rows.Count > 0 Then
ListViewProfile.Visible = True
For Each row As DataRow In DT.Rows
' If LogErrorsOnly = False Then ClassLogger.Add("## Profil zugeordnet: " & row.Item("PROFIL_NAME"), False)
Dim anz As Integer = TBPM_PROFILE_FILESTableAdapter.cmdGet_Anzahl(row.Item("PROFIL_ID"))
If anz > 0 Then
Dim img As Integer
If CBool(row.Item("Active")) = True Then
img = 0
Else
img = 1
End If
ListViewProfile.Items.Add(row.Item("TITLE").ToString, img)
'ListViewProfile.Items(Count).SubItems.Add(row.Item("TITLE").ToString)
ListViewProfile.Items(PROFILE_COUNT).SubItems.Add(anz)
ListViewProfile.Items(PROFILE_COUNT).SubItems.Add(row.Item("PROFIL_ID").ToString)
PROFILE_COUNT += 1
Else
ClassLogger.Add(">> Keine Dateien für Profil '" & row.Item("TITLE").ToString & "' vorhanden!!", False)
End If
Next
Else
ClassLogger.Add(" >> KEINE PROFILE FÜR USER: '" & Environment.UserName & "' hinterlegt?!", False)
MsgBox("KEINE PROFILE FÜR USER: '" & Environment.UserName & "' hinterlegt", MsgBoxStyle.Exclamation, "Achtung:")
ListViewProfile.Visible = False
End If
End If
Catch ex As Exception
ClassLogger.Add("LoadProfile_PM - Fehler: " & ex.Message)
MsgBox("Fehler LoadProfile_PM - Fehler: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:")
End Try
End Sub
Private Function file_exists(ByVal _file As String)
Try
If System.IO.File.Exists(_file) Then
Return True
Else
Return False
End If
Catch ex As Exception
MsgBox("Fehler in Funktion bei file_exists - Fehler: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:")
Return False
End Try
End Function
Private Sub ListViewProfile_DoubleClick(sender As System.Object, e As System.EventArgs) Handles ListViewProfile.DoubleClick
Load_Profil()
End Sub
Sub Load_Profil()
Me.Visible = False
Dim I As Integer
For I = 0 To ListViewProfile.SelectedItems.Count - 1
CURRENT_ProfilGUID = ListViewProfile.SelectedItems(I).SubItems(2).Text
CURRENT_ProfilName = ClassDatabase.Execute_Scalar("SELECT NAME FROM TBPM_PROFILE WHERE GUID = " & CURRENT_ProfilGUID, MyConnectionString)
My.Settings.Save()
'frmValidation.ShowDialog()
frmValidator.ShowDialog()
Next
Me.Visible = True
LoadProfile_PM()
End Sub
Private Sub tsbtnStartValidation_Click(sender As System.Object, e As System.EventArgs) Handles tsbtnStartValidation.Click
Load_Profil()
End Sub
Private Sub ToolStripButton1_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripButton1.Click
Try
frmKonfig.ShowDialog()
Refresh_ConnectionString()
Load_Profil()
Check_Timer_Notification()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler beim Laden Grundeinstellungen:")
End Try
End Sub
Private Sub NotifyIcon1_MouseDoubleClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick
Me.BringToFront()
Me.Visible = True
End Sub
Private Sub Timer_Tick(sender As System.Object, e As System.EventArgs) Handles Timer.Tick
LoadProfile_PM()
End Sub
Private Sub NotifyIcon1_Click(sender As System.Object, e As System.EventArgs) Handles NotifyIcon1.Click
Me.BringToFront()
Me.Visible = True
End Sub
Private Sub ToolStripButton2_Click(sender As System.Object, e As System.EventArgs) Handles tstrpbtn_Config.Click
Dim AdminSecurity As Boolean = False
AdminSecurity = TBPM_KONFIGURATIONTableAdapter.cmdGetAdminSecurity()
If AdminSecurity = True Then
frmLoginAdmin.ShowDialog()
Else
frmProfileDesigner.ShowDialog()
End If
LoadProfile_PM()
End Sub
Private Sub ToolStripButton2_Click_1(sender As Object, e As EventArgs) Handles tsbtnrefresh.Click
LoadProfile_PM()
End Sub
Private Sub ToolStripButton2_Click_2(sender As Object, e As EventArgs)
frmAdminPasswort.ShowDialog()
End Sub
Private Sub ToolStripButton2_Click_3(sender As Object, e As EventArgs) Handles ToolStripButton2.Click
frmAbout.ShowDialog()
End Sub
Public Sub New()
Dim splash As New frmSplash()
splash.ShowDialog()
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
End Sub
Private Sub TimerReminder_Tick(sender As Object, e As EventArgs) Handles TimerReminder.Tick
If PROFILE_COUNT > 0 Then NotifyIcon1.ShowBalloonTip(30000, "Validation-Reminder", "Sie haben unerledigte Dokumente in Ihrem Verantwortungsbereich.", ToolTipIcon.Info)
End Sub
End Class