4779 lines
264 KiB
VB.net
4779 lines
264 KiB
VB.net
Imports WINDREAMLib
|
|
Imports System.Threading
|
|
Imports System.Runtime.InteropServices
|
|
Imports Oracle.ManagedDataAccess.Client
|
|
Imports Independentsoft
|
|
Imports System.IO
|
|
Imports System.Text.RegularExpressions
|
|
Imports System.ComponentModel
|
|
Imports DD_LIB_Standards
|
|
Imports DigitalData.Controls.LookupGrid
|
|
Imports DevExpress.XtraGrid
|
|
Imports System.Reflection
|
|
|
|
Public Class frmValidator
|
|
Dim strFileList()
|
|
Dim PROFIL_sortbynewest As Boolean
|
|
Dim PROFIL_VEKTORINDEX
|
|
Dim PROFIL_FINISH_SQL
|
|
Dim PROFIL_LOGINDEX
|
|
|
|
Dim Delimiter As String
|
|
|
|
Dim WD_Search As String
|
|
Dim finalProfile As Boolean
|
|
Dim Move2Folder As String
|
|
'Private _windreamPM As New ClassPMWindream
|
|
Private _windream As New ClassWindream_allgemein
|
|
Private allgFunk As New ClassAllgemeineFunktionen
|
|
|
|
'speichert die DocumentDaten
|
|
Private navStep As String = Nothing
|
|
|
|
Public Shared WMDocPathWindows As String
|
|
Public WMDocFileString As String
|
|
|
|
Dim OLD_Document_Path As String = ""
|
|
Dim ValueDTP As Date
|
|
Dim AnzDoks As Integer
|
|
Dim docCounter As Integer = 1
|
|
'Anzahl der Validierungsdokumente
|
|
Dim Anzahl_ValDoks As Integer
|
|
'Anzahl der validierten Dokumente
|
|
Dim Anzahl_validierte_Dok As Integer = 0
|
|
Dim me_closing As Boolean = False
|
|
Dim oErrorMessage As String = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.MissingInput")
|
|
Dim first_control As Control
|
|
Dim last_control As Control
|
|
Dim _Indexe_Loaded As Boolean = False
|
|
|
|
Public Shared idxerr_message As String = ""
|
|
Dim DocView
|
|
Private _CURRENT_INDEX_ARRAY(100, 250) As String
|
|
|
|
Private _frmValidatorSearch As frmValidatorSearch 'You need a reference to Form1
|
|
Private _dependingControl_in_action As Boolean = False
|
|
Private _dependingColumn_in_action As Boolean = False
|
|
Private _SetControlValue_in_action As Boolean = False
|
|
Private DTCONTROLS As DataTable
|
|
Private DTGRID_COLUMNS_WITH_SQL As DataTable
|
|
Private DTGRID_COLUMNS As DataTable
|
|
Private DTGRID_COLUMNS_TEXTBOX As DataTable
|
|
|
|
Public FormLoaded As Boolean = False
|
|
Private ItemWorked As Boolean = False
|
|
Private Override As Boolean = False
|
|
Private OverrideAll As Boolean = False
|
|
Private Override_SQLCommand As String = ""
|
|
|
|
Private ControlHandleStarted As Boolean = False
|
|
|
|
'<DllImport("user32.dll", CharSet:=CharSet.Ansi, SetLastError:=True, ExactSpelling:=True)>
|
|
'Public Shared Function SetForegroundWindow(ByVal hwnd As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean
|
|
'End Function
|
|
'Function set_foreground()
|
|
' Try
|
|
' Dim hwnd As IntPtr
|
|
' Dim prc() As Process = Process.GetProcessesByName("DD_ProcessManager")
|
|
|
|
' If Not prc Is Nothing AndAlso Not prc.Length = 0 Then
|
|
' hwnd = prc(0).MainWindowHandle
|
|
' SetForegroundWindow(hwnd)
|
|
' Else
|
|
' prc = Process.GetProcessesByName("DD_ProcessManager.vshost")
|
|
' If Not prc Is Nothing AndAlso Not prc.Length = 0 Then
|
|
' hwnd = prc(0).MainWindowHandle
|
|
' SetForegroundWindow(hwnd)
|
|
' End If
|
|
|
|
' End If
|
|
' Catch ex As Exception
|
|
' LOGGER.Error(ex)
|
|
' MsgBox("ERror in set_foreground: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "")
|
|
' End Try
|
|
|
|
'End Function
|
|
Private Sub frmValidation_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
Override = False
|
|
ItemWorked = False
|
|
SplitContainer1.Panel2Collapsed = True
|
|
docCounter = 1
|
|
OLD_Document_Path = ""
|
|
first_control = Nothing
|
|
me_closing = False
|
|
'pdfxchange = False
|
|
'sumatra = False
|
|
FormLoaded = False
|
|
If My.Settings.frmValidatorPosition.IsEmpty = False Then
|
|
If My.Settings.frmValidatorPosition.X > 0 And My.Settings.frmValidatorPosition.Y > 0 Then
|
|
Location = My.Settings.frmValidatorPosition
|
|
End If
|
|
End If
|
|
If My.Settings.frmValidatorSize.IsEmpty = False Then
|
|
If My.Settings.frmValidatorWindowState = "Normal" Then
|
|
Size = My.Settings.frmValidatorSize
|
|
Else
|
|
Me.WindowState = FormWindowState.Maximized
|
|
End If
|
|
|
|
End If
|
|
Dim _step = 0
|
|
Try
|
|
DocumentViewerValidator.Init(LOGCONFIG, GDPICTURE_LICENSE)
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
End Try
|
|
Try
|
|
_step = 1
|
|
TBDD_CONNECTIONTableAdapter.Connection.ConnectionString = CONNECTION_STRING
|
|
TBPM_PROFILE_FILESTableAdapter.Connection.ConnectionString = CONNECTION_STRING
|
|
TBPM_PROFILE_FINAL_INDEXINGTableAdapter.Connection.ConnectionString = CONNECTION_STRING
|
|
TBPM_PROFILETableAdapter.Connection.ConnectionString = CONNECTION_STRING
|
|
TBPM_KONFIGURATIONTableAdapter.Connection.ConnectionString = CONNECTION_STRING
|
|
|
|
_step = 2
|
|
|
|
DTVWCONTROL_INDEX.Clear()
|
|
Dim oExpression = $"PROFILE_ID = {CURRENT_ProfilGUID}"
|
|
DTVWCONTROLS_INDEX.Select(oExpression, "Y_LOC, X_LOC").CopyToDataTable(DTVWCONTROL_INDEX, LoadOption.PreserveChanges)
|
|
|
|
'Dim oSQL = $"SELECT * FROM VWPM_CONTROL_INDEX WHERE PROFIL_ID = {CURRENT_ProfilGUID} ORDER BY Y_LOC, X_LOC"
|
|
'DTVWCONTROL_INDEX = ClassDatabase.Return_Datatable(oSQL)
|
|
'VWPM_CONTROL_INDEXTableAdapter.Fill(DD_DMSLiteDataSet.VWPM_CONTROL_INDEX, CURRENT_ProfilName)
|
|
_step = 3
|
|
TBDD_CONNECTIONTableAdapter.Fill(DD_DMSLiteDataSet.TBDD_CONNECTION)
|
|
_step = 4
|
|
|
|
LOGGER.Debug("Profile Data loaded")
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Error LOADING profile-data(" & _step.ToString & "):" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Attention:")
|
|
allgFunk.Insert_LogEntry($"ERROR frmValidatorLoad>> {ex.Message}")
|
|
LOGGER.Info(">> Error in LOADING profile-data: " & ex.Message, True)
|
|
Me.Close()
|
|
End Try
|
|
|
|
Try
|
|
Delimiter = TBPM_KONFIGURATIONTableAdapter.cmdGetDelimiter
|
|
|
|
|
|
If CURRENT_DT_PROFILE.Rows.Count = 0 Then
|
|
LOGGER.Info(">> ProfileData could not be loaded - Profile: : " & CURRENT_ProfilName, True)
|
|
MsgBox("ProfileData could not be loaded - Profile: " & CURRENT_ProfilName, MsgBoxStyle.Critical, "Attention:")
|
|
Me.Close()
|
|
End If
|
|
If CURRENT_DT_PROFILE.Rows.Count > 1 Then
|
|
MsgBox("More than 1 profile (" & CURRENT_DT_PROFILE.Rows.Count & ") returned!!", MsgBoxStyle.Critical, "Attention:")
|
|
Else
|
|
If CURRENT_DT_PROFILE.Rows.Count = 1 Then
|
|
For Each oProfileRow As DataRow In CURRENT_DT_PROFILE.Rows
|
|
PROFIL_FINISH_SQL = oProfileRow.Item("SQL_BTN_FINISH")
|
|
PROFIL_VEKTORINDEX = oProfileRow.Item("PM_VEKTOR_INDEX")
|
|
PROFIL_LOGINDEX = oProfileRow.Item("LOG_INDEX")
|
|
CURRENT_PROFILE_LOG_INDEX = PROFIL_LOGINDEX
|
|
Me.Text = "Process Manager - " & oProfileRow.Item("TITLE")
|
|
|
|
TITLELabel1.Text = oProfileRow.Item("TITLE")
|
|
DESCRIPTIONLabel.Text = IIf(IsDBNull(oProfileRow.Item("DESCRIPTION")), "", oProfileRow.Item("DESCRIPTION"))
|
|
If PROFIL_VEKTORINDEX.GetType.ToString.ToLower = "system.dbnull" Then
|
|
PROFIL_VEKTORINDEX = ""
|
|
End If
|
|
If PROFIL_LOGINDEX.GetType.ToString.ToLower = "system.dbnull" Then
|
|
PROFIL_LOGINDEX = ""
|
|
End If
|
|
|
|
WD_Search = oProfileRow.Item("WD_SEARCH")
|
|
finalProfile = oProfileRow.Item("FINAL_PROFILE")
|
|
Move2Folder = IIf(IsDBNull(oProfileRow.Item("MOVE2Folder")), "", oProfileRow.Item("MOVE2Folder"))
|
|
Try
|
|
If finalProfile = True Then
|
|
|
|
Dim text As String = IIf(IsDBNull(oProfileRow.Item("FINAL_TEXT")), "", oProfileRow.Item("FINAL_TEXT") & (" (F2)"))
|
|
If text <> "" Then
|
|
btnSave.Text = text
|
|
Else
|
|
btnSave.Text = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.ValidationButton")
|
|
End If
|
|
Else
|
|
btnSave.Text = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.ValidationButton")
|
|
End If
|
|
LOGGER.Debug("Buttontext validation loaded")
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Error loading final profile text:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Attention:")
|
|
LOGGER.Info(">> Error loading final profile text: " & ex.Message, True)
|
|
End Try
|
|
bbtniNext.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
|
If CURRENT_JUMP_DOC_GUID <> 0 Then
|
|
bbtniNext.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
|
Anzahl_ValDoks = 1
|
|
Else
|
|
|
|
Anzahl_ValDoks = 0
|
|
End If
|
|
|
|
Next
|
|
If LOG_ERRORS_ONLY = False Then
|
|
LOGGER.Info(" >> profiledata saved:")
|
|
LOGGER.Info(" >> WD_Search: " & WD_Search)
|
|
LOGGER.Info(" >> finalProfile: " & finalProfile)
|
|
LOGGER.Info(" >> Move2Folder: " & Move2Folder)
|
|
LOGGER.Info(" >> Right_Delete: " & USER_RIGHT_FILE_DELETE)
|
|
End If
|
|
|
|
PROFIL_sortbynewest = CURRENT_DT_PROFILE.Rows(0).Item("SORT_BY_LATEST")
|
|
LOGGER.Debug("PROFIL_sortbynewest: " & PROFIL_sortbynewest.ToString)
|
|
'Delete Button anzeigen ja/nein
|
|
If USER_RIGHT_FILE_DELETE = True Then
|
|
bbtniDelete.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
|
Else
|
|
bbtniDelete.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
|
End If
|
|
|
|
If CBool(CURRENT_DT_PROFILE.Rows(0).Item("ANNOTATE_WORK_HISTORY_ENTRY")) = True Then
|
|
bbtniAnnotation.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
|
Else
|
|
bbtniAnnotation.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
|
End If
|
|
LOGGER.Debug("Right_Delete: " & USER_RIGHT_FILE_DELETE.ToString)
|
|
Create_Controls()
|
|
|
|
|
|
End If
|
|
End If
|
|
LOGGER.Debug("frmValidation_Load finished!")
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Error LOADING Profile-Data1:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Attention:")
|
|
allgFunk.Insert_LogEntry($"ERROR LOADING Profile-Data1 >> {ex.Message}")
|
|
LOGGER.Info(">> error in LOADING(2) Profile-Data: " & ex.Message, True)
|
|
End Try
|
|
|
|
End Sub
|
|
Private Sub frmValidation_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
|
|
Try
|
|
me_closing = True
|
|
Try
|
|
' Position und Größe speichern
|
|
My.Settings.frmValidatorSize = Me.Size
|
|
My.Settings.frmValidatorPosition = Me.Location
|
|
My.Settings.Save()
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("Error in Load FormLayout: " & ex.Message)
|
|
End Try
|
|
My.Settings.frmValidatorSize = Me.Size
|
|
My.Settings.Save()
|
|
Try
|
|
_frmValidatorSearch.Close()
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
|
|
|
|
End Try
|
|
Try
|
|
Dim oDel = $"DELETE FROM TBPM_FILES_USER_NOT_INDEXED WHERE UPPER(USR_NAME) = UPPER('{USER_USERNAME}')"
|
|
ClassDatabase.Execute_non_Query(oDel)
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Error in delete jumped files:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
|
|
If CURRENT_DOC_GUID <> 0 Then
|
|
Try
|
|
If ItemWorked = False Then
|
|
Free_File()
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
End Try
|
|
End If
|
|
Try
|
|
DocumentViewerValidator.Done()
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Unexpected error in DocumentViewerValidator.Done: {ex.Message}")
|
|
End Try
|
|
|
|
|
|
End Sub
|
|
|
|
Private Function Init_IDB()
|
|
Try
|
|
IDBData = New ClassIDBData
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Error Init_IDB:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Attention:")
|
|
End Try
|
|
End Function
|
|
Private Function Init_windream()
|
|
Try
|
|
WINDREAM = New ClassPMWindream()
|
|
WINDREAM.Create_Session()
|
|
LOGGER.Debug("windream initialized")
|
|
Return True
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Error Init_windream:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Attention:")
|
|
allgFunk.Insert_LogEntry($"ERROR Init_windream >> {ex.Message}")
|
|
LOGGER.Info(">> Error Init_windream: " & ex.Message, True)
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Sub Load_Additional_Searches()
|
|
If CURRENT_DT_PROFILE_SEARCHES_SQL.Rows.Count > 0 Or CURRENT_DT_PROFILE_SEARCHES_DOC.Rows.Count > 0 Then
|
|
Dim oDocResultCommand As String
|
|
Dim oDatatableDocResult As DataTable
|
|
Dim oDataResultCommand As String
|
|
Dim oDatatableDataResult As DataTable
|
|
If CURRENT_DT_PROFILE_SEARCHES_SQL.Rows.Count > 0 Then
|
|
'Check whether DocData is there
|
|
Dim oConID = CURRENT_DT_PROFILE_SEARCHES_SQL.Rows(0).Item("CONN_ID")
|
|
oDataResultCommand = CURRENT_DT_PROFILE_SEARCHES_SQL.Rows(0).Item("SQL_COMMAND")
|
|
oDataResultCommand = clsPatterns.ReplaceAllValues(oDataResultCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
oDatatableDataResult = ClassDatabase.Return_Datatable(oDataResultCommand)
|
|
End If
|
|
If CURRENT_DT_PROFILE_SEARCHES_DOC.Rows.Count > 0 Then
|
|
'Check whether DocData is there
|
|
Dim oConID = CURRENT_DT_PROFILE_SEARCHES_DOC.Rows(0).Item("CONN_ID")
|
|
oDocResultCommand = CURRENT_DT_PROFILE_SEARCHES_DOC.Rows(0).Item("SQL_COMMAND")
|
|
oDocResultCommand = clsPatterns.ReplaceAllValues(oDocResultCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
oDatatableDocResult = ClassDatabase.Return_Datatable(oDocResultCommand)
|
|
End If
|
|
|
|
Dim oDataResultsExist As Boolean = False
|
|
Dim oDocResultsExist As Boolean = False
|
|
|
|
If CURRENT_DT_PROFILE_SEARCHES_SQL.Rows.Count > 0 Then
|
|
If Not IsNothing(oDatatableDataResult) Then
|
|
If oDatatableDataResult.Rows.Count > 0 Then
|
|
oDataResultsExist = True
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
If CURRENT_DT_PROFILE_SEARCHES_DOC.Rows.Count > 0 Then
|
|
If Not IsNothing(oDatatableDocResult) Then
|
|
If oDatatableDocResult.Rows.Count > 0 Then
|
|
oDocResultsExist = True
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
If oDataResultsExist = True Or oDocResultsExist = True Then
|
|
bbtniRefreshSearches.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
|
_frmValidatorSearch.Show()
|
|
Dim oPnl1Collapsed As Boolean = True
|
|
Dim oPnl2Collapsed As Boolean = True
|
|
If oDataResultsExist = True Then
|
|
oPnl1Collapsed = False
|
|
Else
|
|
oPnl1Collapsed = True
|
|
End If
|
|
If oDocResultsExist = True Then
|
|
oPnl2Collapsed = False
|
|
Else
|
|
oPnl2Collapsed = True
|
|
End If
|
|
_frmValidatorSearch.TabPreload(oPnl1Collapsed, oPnl2Collapsed, CURRENT_DT_PROFILE_SEARCHES_SQL.Rows.Count, CURRENT_DT_PROFILE_SEARCHES_DOC.Rows.Count,
|
|
CURRENT_DT_PROFILE_SEARCHES_SQL, CURRENT_DT_PROFILE_SEARCHES_DOC)
|
|
If oDataResultsExist Then
|
|
_frmValidatorSearch._DTSQLSearches = CURRENT_DT_PROFILE_SEARCHES_SQL
|
|
Dim oConID = CURRENT_DT_PROFILE_SEARCHES_SQL.Rows(0).Item("CONN_ID")
|
|
Dim oCommand = CURRENT_DT_PROFILE_SEARCHES_SQL.Rows(0).Item("SQL_COMMAND")
|
|
oCommand = clsPatterns.ReplaceAllValues(oCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
|
|
_frmValidatorSearch.Refresh_Load_GridSQL(oConID, oCommand, 0, CURRENT_DT_PROFILE_SEARCHES_SQL.Rows(0).Item("TAB_TITLE"))
|
|
End If
|
|
If oDocResultsExist Then
|
|
_frmValidatorSearch._DTDocSearches = CURRENT_DT_PROFILE_SEARCHES_DOC
|
|
Dim oConID = CURRENT_DT_PROFILE_SEARCHES_DOC.Rows(0).Item("CONN_ID")
|
|
Dim oCommand = CURRENT_DT_PROFILE_SEARCHES_DOC.Rows(0).Item("SQL_COMMAND")
|
|
oCommand = clsPatterns.ReplaceAllValues(oCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
|
|
_frmValidatorSearch.RefreshTabDoc(oConID, oCommand, 0, CURRENT_DT_PROFILE_SEARCHES_DOC.Rows(0).Item("TAB_TITLE"))
|
|
End If
|
|
Else
|
|
LOGGER.Info("Not loading AdditionalSearches...!")
|
|
bbtniRefreshSearches.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
|
End If
|
|
Else
|
|
LOGGER.Info("Not loading AdditionalSearches...!")
|
|
bbtniRefreshSearches.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
|
End If
|
|
End Sub
|
|
Sub LoadSQLData(control As Control, controlId As Integer)
|
|
Try
|
|
If TypeOf control Is Label Then Exit Sub
|
|
LOGGER.Debug($"in LoadSQLData for ControlID [{controlId}]...")
|
|
Dim oSql As String = $"SELECT GUID,NAME, CONNECTION_ID, SQL_UEBERPRUEFUNG FROM TBPM_PROFILE_CONTROLS WHERE GUID = {controlId} AND PROFIL_ID = {CURRENT_ProfilGUID} AND LEN(ISNULL(SQL_UEBERPRUEFUNG,'')) > 0 AND CTRL_TYPE <> 'BUTTON'"
|
|
' And SQL_UEBERPRUEFUNG Not Like '%#WMI#%' AND SQL_UEBERPRUEFUNG NOT LIKE '%#CTRL#%'
|
|
Dim oDTforControl As DataTable = ClassDatabase.Return_Datatable(oSql)
|
|
|
|
|
|
If IsNothing(oDTforControl) Then Exit Sub
|
|
If oDTforControl.Rows.Count = 0 Then Exit Sub
|
|
|
|
For Each row As DataRow In oDTforControl.Rows
|
|
Dim name As String = row.Item("NAME")
|
|
Dim oGUID As String = row.Item("GUID")
|
|
'If clsPatterns.HasComplexPatterns(row.Item("SQL_UEBERPRUEFUNG")) Then
|
|
' LOGGER.Debug($"SQL [{row.Item("SQL_UEBERPRUEFUNG")}] has complex patterns - GUID: {oGUID}")
|
|
' Continue For
|
|
'End If
|
|
If IsDBNull(row.Item("CONNECTION_ID")) Then
|
|
LOGGER.Info($"No CONNECTION_ID for SQL-Data - oGUID: {oGUID}")
|
|
Continue For
|
|
End If
|
|
If IsDBNull(row.Item("SQL_UEBERPRUEFUNG")) Then Continue For
|
|
|
|
Dim oSQLStatement As String = row.Item("SQL_UEBERPRUEFUNG")
|
|
Dim oConnectionId As Integer = row.Item("CONNECTION_ID")
|
|
|
|
'If clsPatterns.HasComplexPatterns(sqlStatement) Then
|
|
' Continue For
|
|
'End If
|
|
If IsNothing(oSQLStatement) Then
|
|
Continue For
|
|
End If
|
|
'oSql = clsPatterns.ReplaceUserValues(sqlStatement, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
'oSql = clsPatterns.ReplaceInternalValues(oSql)
|
|
oSQLStatement = clsPatterns.ReplaceAllValues(oSQLStatement, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
If IsNothing(oSQLStatement) Then
|
|
Continue For
|
|
End If
|
|
If clsPatterns.HasComplexPatterns(oSQLStatement) Then
|
|
LOGGER.Warn($"Unexpected error LoadSQLData2 - sql Statement still has complex patterns! [{oSQLStatement}]")
|
|
Continue For
|
|
End If
|
|
'sql = ClassPatterns.ReplaceInternalValues(sqlStatement)
|
|
Dim oDTContent As DataTable = ClassDatabase.Return_Datatable_ConId(oSQLStatement, oConnectionId)
|
|
|
|
If IsNothing(oDTContent) Then
|
|
LOGGER.Warn($"SQL-Query [{oSQLStatement}] for control {control.Name} is invalid.")
|
|
Exit Sub
|
|
End If
|
|
Dim oValue
|
|
|
|
If TypeOf control Is TextBox Then
|
|
Try
|
|
Dim firstRow As DataRow = oDTContent.Rows(0)
|
|
|
|
Dim value = firstRow.Item(0)
|
|
|
|
control.Text = value
|
|
oValue = value
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
clsLogger.Add("Error in LoadSimpleData for TextBox: " & ex.Message)
|
|
End Try
|
|
ElseIf TypeOf control Is ComboBox Then
|
|
Try
|
|
Dim oMyComboBox As ComboBox = control
|
|
Dim oselectedIndex = oMyComboBox.SelectedIndex
|
|
LOGGER.Debug($"oMyComboBox {oMyComboBox.Name} - Saving selected index {oselectedIndex}")
|
|
Dim list As New List(Of String)
|
|
|
|
For Each _row As DataRow In oDTContent.Rows
|
|
list.Add(_row.Item(0))
|
|
Next
|
|
|
|
oMyComboBox.DataSource = list
|
|
oMyComboBox.SelectedIndex = oselectedIndex
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
clsLogger.Add("Error in LoadSimpleData for Combobox: " & ex.Message)
|
|
End Try
|
|
ElseIf TypeOf control Is LookupControl2 Then
|
|
Try
|
|
Dim lookup As LookupControl2 = control
|
|
|
|
lookup.DataSource = oDTContent
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
clsLogger.Add("Error in LoadSimpleData for LookupControl2: " & ex.Message)
|
|
End Try
|
|
ElseIf TypeOf control Is GridControl Then
|
|
Try
|
|
Dim dataGridView As GridControl = control
|
|
Dim oDataSource As DataTable = dataGridView.DataSource
|
|
|
|
If oDataSource Is Nothing OrElse oDataSource.Rows.Count = 0 Then
|
|
'dataGridView.DataSource = dt
|
|
|
|
Dim oDatatable As DataTable = oDTContent.Clone()
|
|
|
|
For Each oColumn As DataColumn In oDatatable.Columns
|
|
If oDataSource.Columns(oColumn.ColumnName) Is Nothing Then
|
|
'oDataSource.Columns.Add(oColumn)
|
|
oDataSource.Columns.Add(oColumn.ColumnName, oColumn.DataType)
|
|
End If
|
|
Next
|
|
|
|
For Each oRow As DataRow In oDTContent.Rows
|
|
oDataSource.ImportRow(oRow)
|
|
Next
|
|
|
|
dataGridView.DataSource = oDataSource
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
clsLogger.Add("Error in LoadSimpleData for DataGridView: " & ex.Message)
|
|
End Try
|
|
End If
|
|
Next
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Error in LoadSQLData: " & ex.Message, MsgBoxStyle.Critical, ADDITIONAL_TITLE)
|
|
clsLogger.Add("Error in LoadSQLData: " & ex.Message)
|
|
End Try
|
|
End Sub
|
|
Sub LoadSQLData2(control As Control, controlId As Integer)
|
|
Try
|
|
If TypeOf control Is Label Then Exit Sub
|
|
LOGGER.Debug($"in LoadSQLData2 for ControlID [{controlId}]...")
|
|
Dim oSql As String = $"SELECT GUID,NAME, CONNECTION_ID, SQL_UEBERPRUEFUNG FROM TBPM_PROFILE_CONTROLS WHERE GUID = {controlId} AND PROFIL_ID = {CURRENT_ProfilGUID} AND LEN(ISNULL(SQL_UEBERPRUEFUNG,'')) > 0 AND CTRL_TYPE <> 'BUTTON'"
|
|
' And SQL_UEBERPRUEFUNG Not Like '%#WMI#%' AND SQL_UEBERPRUEFUNG NOT LIKE '%#CTRL#%'
|
|
Dim oDTforControl As DataTable = ClassDatabase.Return_Datatable(oSql)
|
|
|
|
|
|
If IsNothing(oDTforControl) Then Exit Sub
|
|
If oDTforControl.Rows.Count = 0 Then Exit Sub
|
|
|
|
For Each row As DataRow In oDTforControl.Rows
|
|
Dim oControlName As String = row.Item("NAME")
|
|
Dim oControlID As String = row.Item("GUID")
|
|
If IsDBNull(row.Item("CONNECTION_ID")) Then
|
|
LOGGER.Info($"No CONNECTION_ID for SQL-Data - oGUID: {oControlID}")
|
|
Continue For
|
|
End If
|
|
If IsDBNull(row.Item("SQL_UEBERPRUEFUNG")) Then Continue For
|
|
|
|
Dim oSqlStatement As String = row.Item("SQL_UEBERPRUEFUNG")
|
|
Dim oConnectionId As Integer = row.Item("CONNECTION_ID")
|
|
oSql = clsPatterns.ReplaceAllValues(oSqlStatement, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
|
|
If clsPatterns.HasComplexPatterns(oSqlStatement) Then
|
|
LOGGER.Warn($"Unexpected error LoadSQLData2 - sql Statement still has complex patterns! [{oSql}]")
|
|
Continue For
|
|
End If
|
|
'sql = ClassPatterns.ReplaceInternalValues(sqlStatement)
|
|
oDTforControl = ClassDatabase.Return_Datatable_ConId(oSql, oConnectionId)
|
|
|
|
If IsNothing(oDTforControl) Then
|
|
MsgBox($"SQL-Query for control {control.Name} is invalid.", MsgBoxStyle.OkOnly, ADDITIONAL_TITLE)
|
|
Exit Sub
|
|
End If
|
|
Dim oValue
|
|
|
|
If TypeOf control Is TextBox Then
|
|
Try
|
|
Dim firstRow As DataRow = oDTforControl.Rows(0)
|
|
|
|
Dim value = firstRow.Item(0)
|
|
|
|
control.Text = value
|
|
oValue = value
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
clsLogger.Add("Error in LoadSimpleData for TextBox: " & ex.Message)
|
|
End Try
|
|
ElseIf TypeOf control Is ComboBox Then
|
|
Try
|
|
Dim oMyComboBox As ComboBox = control
|
|
Dim oselectedIndex = oMyComboBox.SelectedIndex
|
|
LOGGER.Debug($"oMyComboBox {oMyComboBox.Name} - Saving selected index {oselectedIndex}")
|
|
Dim list As New List(Of String)
|
|
|
|
For Each _row As DataRow In oDTforControl.Rows
|
|
list.Add(_row.Item(0))
|
|
Next
|
|
|
|
oMyComboBox.DataSource = list
|
|
oMyComboBox.SelectedIndex = oselectedIndex
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
clsLogger.Add("Error in LoadSimpleData for Combobox: " & ex.Message)
|
|
End Try
|
|
ElseIf TypeOf control Is LookupControl2 Then
|
|
Try
|
|
Dim lookup As LookupControl2 = control
|
|
|
|
lookup.DataSource = oDTforControl
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
clsLogger.Add("Error in LoadSimpleData for LookupControl2: " & ex.Message)
|
|
End Try
|
|
ElseIf TypeOf control Is GridControl Then
|
|
Try
|
|
Dim dataGridView As GridControl = control
|
|
Dim oDataSource As DataTable = dataGridView.DataSource
|
|
|
|
If oDataSource Is Nothing OrElse oDataSource.Rows.Count = 0 Then
|
|
'dataGridView.DataSource = dt
|
|
|
|
Dim oDatatable As DataTable = oDTforControl.Clone()
|
|
|
|
For Each oColumn As DataColumn In oDatatable.Columns
|
|
If oDataSource.Columns(oColumn.ColumnName) Is Nothing Then
|
|
'oDataSource.Columns.Add(oColumn)
|
|
oDataSource.Columns.Add(oColumn.ColumnName, oColumn.DataType)
|
|
End If
|
|
Next
|
|
|
|
For Each oRow As DataRow In oDTforControl.Rows
|
|
oDataSource.ImportRow(oRow)
|
|
Next
|
|
|
|
dataGridView.DataSource = oDataSource
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
clsLogger.Add("Error in LoadSimpleData for DataGridView: " & ex.Message)
|
|
End Try
|
|
End If
|
|
Next
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Error in LoadSQLData2: " & ex.Message, MsgBoxStyle.Critical, ADDITIONAL_TITLE)
|
|
clsLogger.Add("Error in LoadSQLData2: " & ex.Message)
|
|
End Try
|
|
End Sub
|
|
Private Function PreventNulletc(myObject As Object)
|
|
If IsDBNull(myObject) Then
|
|
Return String.Empty
|
|
ElseIf IsNothing(myObject) Then
|
|
Return String.Empty
|
|
Else
|
|
Return myObject
|
|
End If
|
|
End Function
|
|
Sub Create_Controls()
|
|
Dim oControlInfo As String
|
|
Try
|
|
pnldesigner.Controls.Clear()
|
|
Dim oSQL = $"SELECT [dbo].[FNPM_LANGUAGE_CONTROL_TEXT] (NAME,'{USER_LANGUAGE}',CTRL_TYPE,CTRL_TEXT) CTRL_CAPTION_LANG, * FROM TBPM_PROFILE_CONTROLS WHERE PROFIL_ID = {CURRENT_ProfilGUID} ORDER BY Y_LOC, X_LOC"
|
|
DTCONTROLS = ClassDatabase.Return_Datatable(oSQL)
|
|
oSQL = $"SELECT T1.GUID As CONTROL_ID, T1.PROFIL_ID, T.SQL_COMMAND, T.SPALTENNAME from TBPM_CONTROL_TABLE T, TBPM_PROFILE_CONTROLS T1 WHERE T.CONTROL_ID = T1.GUID AND T1.PROFIL_ID = {CURRENT_ProfilGUID} AND LEN(T.SQL_COMMAND) > 0 AND T.LOAD_AFT_LOAD_CONTROL = 0 ORDER BY T.SEQUENCE"
|
|
DTGRID_COLUMNS_WITH_SQL = ClassDatabase.Return_Datatable(oSQL)
|
|
oSQL = $"SELECT T.* from TBPM_CONTROL_TABLE T, TBPM_PROFILE_CONTROLS T1 WHERE T.CONTROL_ID = T1.GUID AND T1.PROFIL_ID = {CURRENT_ProfilGUID} ORDER BY T.SEQUENCE"
|
|
DTGRID_COLUMNS = ClassDatabase.Return_Datatable(oSQL)
|
|
|
|
oSQL = $"SELECT T1.GUID As CONTROL_ID, T1.PROFIL_ID, T.SQL_COMMAND, T.SPALTENNAME from TBPM_CONTROL_TABLE T, TBPM_PROFILE_CONTROLS T1 WHERE T.CONTROL_ID = T1.GUID AND T1.PROFIL_ID = {CURRENT_ProfilGUID} AND LEN(T.SQL_COMMAND) > 0 AND T.LOAD_AFT_LOAD_CONTROL = 1 ORDER BY T.SEQUENCE"
|
|
DTGRID_COLUMNS_TEXTBOX = ClassDatabase.Return_Datatable(oSQL)
|
|
|
|
Dim oCount As Integer = 0
|
|
|
|
For Each oControlRow As DataRow In DTCONTROLS.Rows
|
|
Dim oMyControl As Control
|
|
Dim oControlID = oControlRow.Item("GUID")
|
|
oControlInfo = $"CtrlName: {oControlRow.Item("NAME")} - CtrlIndex: {oControlRow.Item("INDEX_NAME")}"
|
|
Try
|
|
Select Case oControlRow.Item("CTRL_TYPE").ToString.ToUpper
|
|
Case "TXT"
|
|
Try
|
|
LOGGER.Debug($"[{oControlInfo}] - TXT Try to create control...")
|
|
Dim txt As TextBox = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
|
|
AddHandler txt.GotFocus, AddressOf OnTextBoxFocus
|
|
AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus
|
|
AddHandler txt.KeyUp, AddressOf OnTextBoxKeyUp
|
|
oMyControl = txt
|
|
LOGGER.Debug($"[{oControlInfo}] - TXT Created!!")
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Unexpected error in Create_Controls TXT [{oControlInfo}]: {ex.Message}")
|
|
End Try
|
|
Case "LBL"
|
|
oMyControl = ClassControlCreator.CreateExistingLabel(oControlRow, False)
|
|
Case "CMB"
|
|
LOGGER.Debug($"[{oControlInfo}] - CMB Try to create control...")
|
|
If oControlRow.Item("READ_ONLY") Then
|
|
Dim cmbReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
|
|
oMyControl = cmbReadonly
|
|
Else
|
|
Dim cmb = ClassControlCreator.CreateExistingCombobox(oControlRow, False)
|
|
|
|
AddHandler cmb.SelectedValueChanged, AddressOf OnCmbselectedIndex
|
|
AddHandler cmb.GotFocus, Sub(sender As Control, e As EventArgs)
|
|
If DirectCast(cmb.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
|
|
cmb.BackColor = Color.Lime
|
|
End If
|
|
End Sub
|
|
AddHandler cmb.LostFocus, Sub(sender As Control, e As EventArgs)
|
|
If DirectCast(cmb.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
|
|
cmb.BackColor = Color.White
|
|
End If
|
|
End Sub
|
|
#Region "CONTROL LIST"
|
|
|
|
Dim ControlID = DirectCast(cmb.Tag, ClassControlCreator.ControlMetadata).Guid ' TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(CURRENT_ProfilGUID, cmb.Name)
|
|
LOGGER.Debug("In add_ComboBox - GUID: " & ControlID)
|
|
If ControlID > 0 Then
|
|
Dim oCONID
|
|
Try
|
|
oCONID = PreventNulletc(oControlRow.Item("CONNECTION_ID"))
|
|
Catch ex As Exception
|
|
oCONID = 0
|
|
End Try
|
|
|
|
If oCONID > 0 Then
|
|
Dim commandsql
|
|
Try
|
|
commandsql = oControlRow.Item("SQL_UEBERPRUEFUNG")
|
|
Catch ex As Exception
|
|
commandsql = ""
|
|
End Try
|
|
'TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)
|
|
LOGGER.Debug("ConID <> String.Empty")
|
|
If oCONID > 0 And commandsql <> String.Empty Then
|
|
LOGGER.Debug("ConID > 0 And commandsql <> String.Empty")
|
|
Dim oConnectionString As String
|
|
TBDD_CONNECTIONTableAdapter.FillByID(DD_DMSLiteDataSet.TBDD_CONNECTION, oCONID)
|
|
Dim DTConnection As DataTable = DD_DMSLiteDataSet.TBDD_CONNECTION
|
|
|
|
For Each drConnection As DataRow In DTConnection.Rows
|
|
Select Case drConnection.Item("SQL_PROVIDER").ToString.ToLower
|
|
Case "ms-sql"
|
|
If drConnection.Item("USERNAME") = "WINAUTH" Then
|
|
oConnectionString = "Data Source=" & drConnection.Item("SERVER") & ";Initial Catalog=" & drConnection.Item("DATENBANK") & ";Trusted_Connection=True;"
|
|
Else
|
|
oConnectionString = "Data Source=" & drConnection.Item("SERVER") & ";Initial Catalog= " & drConnection.Item("DATENBANK") & ";User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";"
|
|
End If
|
|
LOGGER.Debug("ConnString Sql-Server: " & oConnectionString)
|
|
Case "oracle"
|
|
Dim conn As New OracleConnectionStringBuilder
|
|
Dim connstr As String
|
|
If drConnection.Item("SERVER") <> "" And drConnection.Item("DATENBANK").GetType.ToString <> "system.dbnull" Then
|
|
connstr = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" & drConnection.Item("SERVER") & ")(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" &
|
|
drConnection.Item("DATENBANK") & ")));User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";"
|
|
Else
|
|
conn.DataSource = drConnection.Item("SERVER")
|
|
conn.UserID = drConnection.Item("USERNAME")
|
|
conn.Password = drConnection.Item("PASSWORD")
|
|
conn.PersistSecurityInfo = True
|
|
conn.ConnectionTimeout = 120
|
|
connstr = conn.ConnectionString
|
|
End If
|
|
|
|
oConnectionString = connstr
|
|
Case Else
|
|
LOGGER.Info(" - ConnectionType nicht integriert")
|
|
MsgBox("ConnectionType nicht integriert", MsgBoxStyle.Critical, "Bitte Konfiguration Connection überprüfen!")
|
|
End Select
|
|
Next
|
|
If oConnectionString Is Nothing = False Then
|
|
Try
|
|
Dim sqlCnn As SqlClient.SqlConnection
|
|
Dim sqlCmd As SqlClient.SqlCommand
|
|
Dim adapter As New SqlClient.SqlDataAdapter
|
|
Dim NewDataset As New DataSet
|
|
Dim i As Integer
|
|
Dim sql As String
|
|
|
|
|
|
sql = PreventNulletc(oControlRow.Item("SQL_UEBERPRUEFUNG")) 'TBPM_PROFILE_CONTROLSTableAdapter.cmdGetSQL(ControlID)
|
|
|
|
'sql = ClassPatterns.ReplaceAllValues(sql, pnldesigner, CURRENT_WMFILE)
|
|
|
|
'If ClassPatterns.HasOnlySimplePatterns(sql) Then
|
|
If clsPatterns.HasOnlySimplePatterns(sql) Then
|
|
sql = clsPatterns.ReplaceInternalValues(sql)
|
|
sql = clsPatterns.ReplaceControlValues(sql, pnldesigner)
|
|
LOGGER.Debug(">>> sql after HasOnlySimplePatterns: " & sql)
|
|
sqlCnn = New SqlClient.SqlConnection(oConnectionString)
|
|
' Try
|
|
sqlCnn.Open()
|
|
sqlCmd = New SqlClient.SqlCommand(sql, sqlCnn)
|
|
adapter.SelectCommand = sqlCmd
|
|
adapter.Fill(NewDataset)
|
|
Dim msg As String
|
|
For i = 0 To NewDataset.Tables(0).Rows.Count - 1
|
|
cmb.Items.Add(NewDataset.Tables(0).Rows(i).Item(0))
|
|
Next
|
|
adapter.Dispose()
|
|
sqlCmd.Dispose()
|
|
sqlCnn.Close()
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info(" -Unexpected error in GetValues SQL - Fehler: " & vbNewLine & ex.Message)
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei GetValues SQL:")
|
|
End Try
|
|
End If
|
|
Else
|
|
LOGGER.Debug("Else Row 571")
|
|
End If
|
|
Else
|
|
LOGGER.Debug("AListe Handling")
|
|
Dim AListe As String = oControlRow.Item("CHOICE_LIST")
|
|
LOGGER.Debug("In add_ComboBox - AListe: " & AListe)
|
|
If AListe Is Nothing = False Then
|
|
'Dim liste = _windreamPM.GetValuesfromAuswahlliste(AListe)
|
|
Dim liste = WINDREAM.GetValuesfromAuswahlliste(AListe)
|
|
If liste IsNot Nothing Then
|
|
cmb.Items.Add("")
|
|
For Each index As String In liste
|
|
cmb.Items.Add(index)
|
|
Next
|
|
cmb.SelectedIndex = -1
|
|
Else
|
|
MsgBox("Resultliste windream is nothing!", MsgBoxStyle.Exclamation, AListe)
|
|
End If
|
|
Else
|
|
MsgBox("AListe from database is nothing!", MsgBoxStyle.Exclamation, AListe)
|
|
End If
|
|
End If
|
|
|
|
|
|
End If
|
|
#End Region
|
|
|
|
Dim maxWith As Integer = cmb.Width
|
|
Using g As Graphics = Me.CreateGraphics
|
|
For Each oItem As Object In cmb.Items 'Für alle Einträge...
|
|
Dim g1 As Graphics = cmb.CreateGraphics
|
|
If g1.MeasureString(Text, cmb.Font).Width + 30 > maxWith Then
|
|
maxWith = g1.MeasureString(Text, cmb.Font).Width + 30
|
|
End If
|
|
g1.Dispose()
|
|
Next oItem
|
|
End Using
|
|
cmb.DropDownWidth = maxWith
|
|
|
|
oMyControl = cmb
|
|
End If
|
|
|
|
LOGGER.Debug($"[{oControlInfo}] - CMB CONTROL created")
|
|
|
|
Case "DTP"
|
|
oMyControl = ClassControlCreator.CreateExistingDatepicker(oControlRow, False)
|
|
|
|
Case "DGV"
|
|
Dim dgv = ClassControlCreator.CreateExistingDataGridView(oControlRow, False)
|
|
|
|
AddHandler dgv.RowValidating, AddressOf onDGVRowValidating
|
|
|
|
oMyControl = dgv
|
|
|
|
Case "LOOKUP"
|
|
|
|
Dim oMultiselect = oControlRow.Item("MULTISELECT")
|
|
Dim oReadonly = oControlRow.Item("READ_ONLY")
|
|
|
|
If oMultiselect = False And oReadonly = True Then
|
|
Dim lookupReadonly = ClassControlCreator.CreateExistingTextbox(oControlRow, False)
|
|
oMyControl = lookupReadonly
|
|
Else
|
|
Dim lookup As LookupControl2 = ClassControlCreator.CreateExistingLookupControl(oControlRow, False)
|
|
|
|
lookup.PreventDuplicates = oControlRow.Item("VKT_PREVENT_MULTIPLE_VALUES")
|
|
lookup.AllowAddNewValues = oControlRow.Item("VKT_ADD_ITEM")
|
|
lookup.MultiSelect = oMultiselect
|
|
|
|
If NotNull(oControlRow.Item("DEFAULT_VALUE"), "") <> "" Then
|
|
lookup.SelectedValues = New List(Of String) From {oControlRow.Item("DEFAULT_VALUE")}
|
|
End If
|
|
|
|
oMyControl = lookup
|
|
'Wenn Multiselect false dann prüfen ob abhängiges Control
|
|
If CBool(oControlRow.Item("MULTISELECT")) = False Then
|
|
Dim filteredData As DataTable = DTCONTROLS.Clone()
|
|
Dim oExpression = $"SQL_UEBERPRUEFUNG like '%#CTRL#{oMyControl.Name}%'"
|
|
DTCONTROLS.Select(oExpression).CopyToDataTable(filteredData, LoadOption.PreserveChanges)
|
|
If filteredData.Rows.Count = 1 Then
|
|
'AddHandler lookup.EditValueChanged, AddressOf onLookUp1
|
|
AddHandler lookup.SelectedValuesChanged, AddressOf onLookUpselectedValue
|
|
End If
|
|
filteredData = DTCONTROLS.Clone()
|
|
oExpression = $"GUID = {oControlRow.Item("GUID")} and Len(SET_CONTROL_DATA) > 0"
|
|
DTCONTROLS.Select(oExpression).CopyToDataTable(filteredData, LoadOption.PreserveChanges)
|
|
If filteredData.Rows.Count = 1 Then
|
|
'AddHandler lookup.EditValueChanged, AddressOf onLookUp1
|
|
AddHandler lookup.SelectedValuesChanged, AddressOf onLookUpselectedValue_Control2Set
|
|
End If
|
|
filteredData = DTCONTROLS.Clone()
|
|
|
|
End If
|
|
|
|
AddHandler lookup.GotFocus, Sub(sender As Control, e As EventArgs)
|
|
If DirectCast(lookup.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
|
|
lookup.BackColor = Color.Lime
|
|
End If
|
|
End Sub
|
|
AddHandler lookup.LostFocus, Sub(sender As Control, e As EventArgs)
|
|
If DirectCast(lookup.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
|
|
lookup.BackColor = Color.White
|
|
End If
|
|
End Sub
|
|
End If
|
|
|
|
|
|
|
|
'Return filteredData
|
|
'AddHandler lookup.Leave, AddressOf onLookUp0
|
|
|
|
Case "CHK"
|
|
|
|
oMyControl = ClassControlCreator.CreateExisingCheckbox(oControlRow, False)
|
|
Case "TABLE"
|
|
|
|
'Dim columns As List(Of DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow) = (From r As DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow In DD_DMSLiteDataSet.TBPM_CONTROL_TABLE
|
|
' Where r.CONTROL_ID = oControlRow.Item("GUID")
|
|
' Select r).ToList()
|
|
|
|
Dim oFilteredDatatable As DataTable = DTGRID_COLUMNS.Clone()
|
|
Dim oExpression = $"CONTROL_ID = {oControlRow.Item("GUID")}"
|
|
DTGRID_COLUMNS.Select(oExpression, "SEQUENCE").CopyToDataTable(oFilteredDatatable, LoadOption.PreserveChanges)
|
|
If oFilteredDatatable.Rows.Count >= 1 Then
|
|
LOGGER.Debug($"We got a definition for DTGRID_COLUMNS!!")
|
|
Else
|
|
Continue For
|
|
End If
|
|
|
|
|
|
Dim oGrid = ClassControlCreator.CreateExistingGridControl(oControlRow, oFilteredDatatable, False)
|
|
|
|
|
|
AddHandler oGrid.ProcessGridKey, Sub(ByVal _sender As Object, ByVal e As KeyEventArgs)
|
|
|
|
|
|
If e.KeyCode = Keys.Tab Then
|
|
Dim gridControl = TryCast(_sender, GridControl)
|
|
Dim view = TryCast(gridControl.FocusedView, Views.Base.ColumnView)
|
|
|
|
If (e.Modifiers = Keys.None And view.IsNewItemRow(view.FocusedRowHandle) And view.FocusedColumn.VisibleIndex = view.VisibleColumns.Count - 1) Then
|
|
If view.IsEditing Then
|
|
view.CloseEditor()
|
|
Me.SelectNextControl(gridControl, e.Modifiers = Keys.None, True, True, True)
|
|
e.Handled = True
|
|
End If
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
oMyControl = oGrid
|
|
Case "LINE"
|
|
|
|
oMyControl = ClassControlCreator.CreateExistingLine(oControlRow, False)
|
|
Case "BUTTON"
|
|
Dim obutton = ClassControlCreator.CreateExistingButton(oControlRow, False)
|
|
|
|
AddHandler obutton.Click, AddressOf onCustomButtonClick
|
|
oMyControl = obutton
|
|
End Select
|
|
LOGGER.Debug($"[{oControlInfo}]: End of Select...")
|
|
If TypeOf oMyControl IsNot Label Then
|
|
If first_control Is Nothing Then
|
|
first_control = oMyControl
|
|
End If
|
|
last_control = oMyControl
|
|
|
|
oMyControl.TabIndex = oCount
|
|
End If
|
|
' oMyControl.Tag = CInt(oControlRow.Item("GUID"))
|
|
pnldesigner.Controls.Add(oMyControl)
|
|
|
|
oCount += 1
|
|
Catch ex As Exception
|
|
Dim st As New StackTrace(True)
|
|
st = New StackTrace(ex, True)
|
|
'LOGGER.Error(ex)
|
|
LOGGER.Warn($"Unexpected Error in Create_Controls (Select Case) [{oControlInfo}] Line: {st.GetFrame(0).GetFileLineNumber().ToString} - {ex.Message}")
|
|
If LOG_ERRORS_ONLY = False Then MsgBox("Error CreateControls (Select Case): " & ex.Message, MsgBoxStyle.Critical, "Attention:")
|
|
End Try
|
|
|
|
|
|
Next
|
|
LOGGER.Debug("Create_Controls finished!")
|
|
|
|
|
|
|
|
|
|
Catch ex As Exception
|
|
Dim st As New StackTrace(True)
|
|
st = New StackTrace(ex, True)
|
|
'LOGGER.Error(ex)
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in Create_Controls")
|
|
LOGGER.Warn($"Unexpected Error in Create_Controls [{oControlInfo}] Line: {st.GetFrame(0).GetFileLineNumber().ToString} - {ex.Message}")
|
|
If LOG_ERRORS_ONLY = False Then MsgBox("Error CreateControls: " & ex.Message, MsgBoxStyle.Critical, "Attention:")
|
|
allgFunk.Insert_LogEntry($"ERROR CreateControls >> {ex.Message}")
|
|
End Try
|
|
End Sub
|
|
Private Sub GridControlColumnWidthChanged(sender As System.Object, e As System.EventArgs)
|
|
Try
|
|
Dim oMyGridView As DevExpress.XtraGrid.Views.Grid.GridView = sender
|
|
Dim oControlID = DirectCast(oMyGridView.GridControl.Tag, ClassControlCreator.ControlMetadata).Guid
|
|
SaveDevExpressGridControl_Layout(CURRENT_ProfilGUID, oControlID, oMyGridView)
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
|
|
End Sub
|
|
Sub Clear_all_Input()
|
|
For Each inctrl As Control In Me.pnldesigner.Controls
|
|
Dim Type As String = inctrl.GetType.ToString
|
|
Select Case Type
|
|
Case "System.Windows.Forms.TextBox"
|
|
inctrl.Text = ""
|
|
Case "System.Windows.Forms.ComboBox"
|
|
Dim cmb As ComboBox = inctrl
|
|
cmb.SelectedIndex = -1
|
|
Case "System.Windows.Forms.DataGridView"
|
|
Dim dgv As DataGridView = inctrl
|
|
If dgv.Rows.Count > 0 Then
|
|
dgv.Rows.Clear()
|
|
End If
|
|
Case "System.Windows.Forms.CheckBox"
|
|
|
|
End Select
|
|
Next
|
|
|
|
'set_foreground()
|
|
If first_control Is Nothing = False Then
|
|
first_control.Focus()
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Public Sub OnTextBoxFocus(sender As Object, e As EventArgs)
|
|
Dim box As TextBox = sender
|
|
|
|
If DirectCast(box.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
|
|
box.BackColor = Color.Lime
|
|
box.SelectAll()
|
|
End If
|
|
End Sub
|
|
Public Sub OnTextBoxLostFocus(sender As System.Object, e As System.EventArgs)
|
|
Dim box As TextBox = sender
|
|
|
|
If DirectCast(box.Tag, ClassControlCreator.ControlMetadata).ReadOnly = False Then
|
|
box.BackColor = Color.White
|
|
End If
|
|
End Sub
|
|
Private Function GetControlID(ByVal PROFILEID As Integer, Controlname As String)
|
|
For Each oROW As DataRow In DTVWCONTROL_INDEX.Rows
|
|
|
|
Next
|
|
End Function
|
|
|
|
|
|
Public Sub OnTextBoxKeyUp(sender As Object, e As KeyEventArgs)
|
|
If ControlHandleStarted = True Then
|
|
ControlHandleStarted = False
|
|
Exit Sub
|
|
End If
|
|
Dim box As TextBox = sender
|
|
If box.Text <> String.Empty And me_closing = False And _Indexe_Loaded = True And box.Height < 25 Then
|
|
|
|
If (e.KeyCode = Keys.Return) Or (e.KeyCode = Keys.Tab) Or (e.KeyCode = Keys.Enter) Then
|
|
Try
|
|
Dim CONTROL_ID = DirectCast(box.Tag, ClassControlCreator.ControlMetadata).Guid 'VWPM_CONTROL_INDEXTableAdapter.cmdGetControlID(CURRENT_ProfilGUID, box.Name)
|
|
Dim sql = String.Format("select NAME,CONNECTION_ID,SQL_UEBERPRUEFUNG FROM TBPM_PROFILE_CONTROLS WHERE PROFIL_ID = {0} AND SQL_UEBERPRUEFUNG LIKE '%{1}%'", CURRENT_ProfilGUID, box.Name)
|
|
Dim DT As DataTable = ClassDatabase.Return_Datatable(sql)
|
|
If Not IsNothing(DT) And DT.Rows.Count > 0 Then
|
|
For Each ROW As DataRow In DT.Rows
|
|
Try
|
|
Dim displayboxname = ROW.Item(0).ToString
|
|
If Not IsDBNull(ROW.Item(1)) And Not IsDBNull(ROW.Item(2)) Then
|
|
Dim sql_Statement = ROW.Item(2)
|
|
|
|
|
|
sql_Statement = clsPatterns.ReplaceAllValues(sql_Statement, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
|
|
'' Regulären Ausdruck zum Auslesen der Indexe definieren
|
|
'Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
|
'' einen Regulären Ausdruck laden
|
|
'Dim regulärerAusdruck As Regex = New Regex(preg)
|
|
'' die Vorkommen im SQL-String auslesen
|
|
'Dim elemente As Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(sql_Statement)
|
|
''####
|
|
'' alle Vorkommen innerhalbd er Namenkonvention durchlaufen
|
|
'For Each element As Text.RegularExpressions.Match In elemente
|
|
' Try
|
|
' If LogErrorsOnly = False Then LOGGER.Info(" >> element in RegeX: " & element.Value)
|
|
' Dim MyPattern = element.Value.Substring(2, element.Value.Length - 3)
|
|
' Dim input_value
|
|
|
|
' If MyPattern.Contains(ClassControlCreator.PREFIX_TEXTBOX) Then
|
|
' Dim txt As TextBox = CType(pnldesigner.Controls(MyPattern), TextBox)
|
|
' input_value = txt.Text
|
|
' ElseIf MyPattern.Contains(ClassControlCreator.PREFIX_COMBOBOX) Then
|
|
' Dim cmb As ComboBox = CType(pnldesigner.Controls(MyPattern), ComboBox)
|
|
' input_value = cmb.Text
|
|
' End If
|
|
' sql_Statement = sql_Statement.ToString.Replace(element.Value, input_value)
|
|
' Catch ex As Exception
|
|
' LOGGER.Info("Unexpected Error in Checking control values for Variable SQL Result - ERROR: " & ex.Message)
|
|
' End Try
|
|
|
|
'Next
|
|
_dependingControl_in_action = True
|
|
Depending_Control_Set_Result(displayboxname, sql_Statement, ROW.Item(1))
|
|
_dependingControl_in_action = False
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("Unexpected Error in Display SQL result for control: " & ROW.Item(0).ToString & " - ERROR: " & ex.Message)
|
|
End Try
|
|
|
|
Next
|
|
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("Unexpected Error in Eventhandler Variable SQL Result - ERROR: " & ex.Message)
|
|
End Try
|
|
If box.Name = last_control.Name Then
|
|
' Abschluss()
|
|
Else
|
|
SendKeys.Send("{TAB}")
|
|
ControlHandleStarted = True
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
Private Sub onCustomButtonClick(sender As System.Object, e As System.EventArgs)
|
|
Dim oButton As Button = sender
|
|
Dim oControlID = DirectCast(oButton.Tag, ClassControlCreator.ControlMetadata).Guid
|
|
Dim oSQL = ClassControlCreator.GET_CONTROL_PROPERTY(DTCONTROLS, oControlID, "SQL_UEBERPRUEFUNG")
|
|
If IsNothing(oSQL) Then
|
|
Exit Sub
|
|
End If
|
|
Override_SQLCommand = ClassControlCreator.GET_CONTROL_PROPERTY(DTCONTROLS, oControlID, "SQL2")
|
|
If IsNothing(Override_SQLCommand) Then
|
|
Override_SQLCommand = ""
|
|
End If
|
|
' = $"select SQL_UEBERPRUEFUNG,SQL2 FROM TBPM_PROFILE_CONTROLS WHERE GUID = {oControlID}"
|
|
oSQL = clsPatterns.ReplaceAllValues(oSQL, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
Override_SQLCommand = clsPatterns.ReplaceAllValues(Override_SQLCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
Dim oDT_ACTIONS As DataTable = ClassDatabase.Return_Datatable(oSQL)
|
|
If IsNothing(oDT_ACTIONS) Then
|
|
MsgBox("Something went wrong in custom action - Please check Your log!", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
|
|
Exit Sub
|
|
ElseIf oDT_ACTIONS.Rows.Count = 0 Then
|
|
MsgBox("Something went wrong in custom action (No row) - Please check Your log!", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
|
|
Exit Sub
|
|
End If
|
|
'Select Case'Override' as Action_Type, 'Sind Sie sicher dass Sie nicht zuständig sind?' as Question,'Nicht Zuständig' as Caption,'Red' as Color
|
|
Dim oAction
|
|
Dim oControlName
|
|
Dim oQuestion
|
|
Dim oTitle
|
|
Dim oCaption
|
|
Dim oColor
|
|
Try
|
|
oAction = oDT_ACTIONS?.Rows(0).Item("ActionType")
|
|
Catch ex As Exception
|
|
oAction = ""
|
|
End Try
|
|
Try
|
|
oControlName = oDT_ACTIONS?.Rows(0).Item("Controlname")
|
|
Catch ex As Exception
|
|
oControlName = ""
|
|
End Try
|
|
Try
|
|
oQuestion = oDT_ACTIONS?.Rows(0).Item("Question")
|
|
Catch ex As Exception
|
|
oQuestion = ""
|
|
End Try
|
|
Try
|
|
oTitle = oDT_ACTIONS?.Rows(0).Item("Title")
|
|
Catch ex As Exception
|
|
oTitle = ""
|
|
End Try
|
|
Try
|
|
oCaption = oDT_ACTIONS?.Rows(0).Item("CaptionButton").ToString
|
|
Catch ex As Exception
|
|
oCaption = ""
|
|
End Try
|
|
Try
|
|
oColor = System.Drawing.Color.FromName(oDT_ACTIONS?.Rows(0).Item("Color"))
|
|
Catch ex As Exception
|
|
oColor = ""
|
|
End Try
|
|
Try
|
|
OverrideAll = oDT_ACTIONS?.Rows(0).Item("OverrideAll")
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Could not set OverrideAll {ex.Message}")
|
|
OverrideAll = False
|
|
End Try
|
|
If OverrideAll = True Then
|
|
LOGGER.Info($"CURRENT_DOC_ID: {CURRENT_DOC_ID} - OverrideAll will be in Action!")
|
|
End If
|
|
|
|
Select Case oAction.ToString.ToUpper
|
|
Case "SetButton".ToUpper
|
|
btnSave.Text = oCaption & " (F2)"
|
|
btnSave.BackColor = oColor
|
|
Case "Override_Question".ToUpper
|
|
If oQuestion <> "" Then
|
|
Dim result As MsgBoxResult
|
|
result = MessageBox.Show(oQuestion, oTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
|
|
If result = MsgBoxResult.Yes Then
|
|
Override = True
|
|
Finish_WFStep()
|
|
End If
|
|
End If
|
|
Case "Update_Single_Control".ToUpper
|
|
Dim oResult1 As Boolean = True
|
|
If oQuestion <> "" Then
|
|
Dim result As MsgBoxResult
|
|
result = MessageBox.Show(oQuestion, oTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
|
|
If result = MsgBoxResult.No Then
|
|
oResult1 = False
|
|
End If
|
|
Else
|
|
|
|
End If
|
|
If oResult1 = True Then
|
|
Dim oREsult As Boolean = True
|
|
If Override_SQLCommand <> "" Then
|
|
oREsult = ClassDatabase.Execute_non_Query(Override_SQLCommand)
|
|
End If
|
|
If oREsult = True Then
|
|
Reload_Controls(oControlName)
|
|
Else
|
|
MsgBox("Unexpected error in Button Refresh_Controls - Check Your log!", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
|
|
End If
|
|
End If
|
|
Case "Update_Controls".ToUpper
|
|
If oQuestion <> "" Then
|
|
Dim result As MsgBoxResult
|
|
result = MessageBox.Show(oQuestion, oTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
|
|
If result = MsgBoxResult.Yes Then
|
|
Dim oREsult As Boolean = True
|
|
If Override_SQLCommand <> "" Then
|
|
oREsult = ClassDatabase.Execute_non_Query(Override_SQLCommand)
|
|
End If
|
|
If oREsult = True Then
|
|
SetStatusLabel("Refreshed single control", "Yellow")
|
|
FillIndexValues(False)
|
|
Else
|
|
MsgBox("Unexpected error in Button Refresh_Controls - Check Your log!", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
Case "Override_Direct".ToUpper
|
|
Override = True
|
|
Finish_WFStep()
|
|
Case Else
|
|
MsgBox($"No configured action provided for onCustomButtonClick [{oAction}]", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
|
|
LOGGER.Warn($"No configured action provided for onCustomButtonClick [{oAction}]")
|
|
End Select
|
|
|
|
|
|
End Sub
|
|
|
|
Public Sub onDGVRowValidating(ByVal sender As Object, ByVal e As DataGridViewCellCancelEventArgs)
|
|
Dim dgv As DataGridView = sender
|
|
Try
|
|
Dim CONTROL_ID = DirectCast(dgv.Tag, ClassControlCreator.ControlMetadata).Guid ' VWPM_CONTROL_INDEXTableAdapter.cmdGetControlID(CURRENT_ProfilGUID, dgv.Name)
|
|
Dim sql = String.Format("select NAME,CONNECTION_ID,SQL_UEBERPRUEFUNG FROM TBPM_PROFILE_CONTROLS WHERE PROFIL_ID = {0} And SQL_UEBERPRUEFUNG Like '%{1}%'", CURRENT_ProfilGUID, dgv.Name)
|
|
Dim DT As DataTable = ClassDatabase.Return_Datatable(sql)
|
|
If Not IsNothing(DT) And DT.Rows.Count > 0 Then
|
|
For Each ROW As DataRow In DT.Rows
|
|
Try
|
|
Dim displayboxname = ROW.Item(0).ToString
|
|
If Not IsDBNull(ROW.Item(1)) And Not IsDBNull(ROW.Item(2)) Then
|
|
Dim sql_Statement = ROW.Item(2)
|
|
Dim cellvalue = dgv.Rows(dgv.Rows.Count - 2).Cells(0).Value.ToString()
|
|
sql_Statement = sql_Statement.ToString.Replace(dgv.Name, cellvalue)
|
|
Dim resultDT As DataTable = ClassDatabase.Return_Datatable_ConId(sql_Statement, ROW.Item(1))
|
|
If resultDT.Rows.Count >= 1 Then
|
|
'Nur dediziert einen Wert zurückerhalten
|
|
For Each row1 As DataRow In resultDT.Rows
|
|
Dim result = row1.Item(0)
|
|
If Not IsNothing(result) Then
|
|
pnldesigner.Controls(displayboxname).Text = result.ToString
|
|
|
|
Exit For
|
|
Else
|
|
pnldesigner.Controls(displayboxname).Text = "RESULT = NOTHING"
|
|
|
|
Exit For
|
|
End If
|
|
Next
|
|
Else
|
|
pnldesigner.Controls(displayboxname).Text = "NO RESULT"
|
|
|
|
End If
|
|
|
|
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("Unexpected Error in Display SQL result for control: " & ROW.Item(0).ToString & " - ERROR: " & ex.Message)
|
|
End Try
|
|
|
|
Next
|
|
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("Unexpected Error in Eventhandler Variable SQL Result - ERROR: " & ex.Message)
|
|
End Try
|
|
|
|
End Sub
|
|
Public Sub onLookUp0(sender As Object, e As System.EventArgs)
|
|
Dim oLookup As LookupControl2 = sender
|
|
Try
|
|
If Not IsNothing(oLookup.SelectedValues) Then
|
|
For Each ocont In oLookup.SelectedValues
|
|
Dim o = ocont
|
|
Next
|
|
End If
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
End Sub
|
|
Public Sub onLookUpselectedValue(sender As Object, SelectedValues As List(Of String))
|
|
LOGGER.Debug("onLookUpselectedValue")
|
|
If FormLoaded = False Then
|
|
Exit Sub
|
|
End If
|
|
Dim oLookup As LookupControl2 = sender
|
|
Try
|
|
If Not IsNothing(SelectedValues) Then
|
|
If SelectedValues.Count = 1 Then
|
|
LookupControl_DependingControls(oLookup, SelectedValues)
|
|
LookupControl_DependingColumn(oLookup, SelectedValues)
|
|
Else
|
|
LOGGER.Debug("Uups: SelectedValues.Count <> 1 ")
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
End Try
|
|
End Sub
|
|
Public Sub onLookUpselectedValue_Control2Set(sender As Object, SelectedValues As List(Of String))
|
|
LOGGER.Debug("onLookUpselectedValue_Control2Set")
|
|
If FormLoaded = False Then
|
|
Exit Sub
|
|
End If
|
|
Dim oLookup As LookupControl2 = sender
|
|
Try
|
|
If Not IsNothing(SelectedValues) Then
|
|
If SelectedValues.Count = 1 Then
|
|
SetControlValues(oLookup, SelectedValues)
|
|
Else
|
|
LOGGER.Debug("Uups2: SelectedValues.Count <> 1 ")
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
End Try
|
|
End Sub
|
|
Private Sub SetControlValues(LookupControl As LookupControl2, SelectedValues As List(Of String))
|
|
Dim oLOOKUPValue = SelectedValues.Item(0)
|
|
Dim oLOOKUPName = LookupControl.Name
|
|
LOGGER.Debug($"oLOOKUPValue is [{oLOOKUPValue}]!")
|
|
Dim oControlID = DirectCast(LookupControl.Tag, ClassControlCreator.ControlMetadata).Guid
|
|
Dim oFilteredDatatable As DataTable = DTCONTROLS.Clone()
|
|
Dim oExpression = $"GUID = {oControlID} and LEN(SET_CONTROL_DATA) > 0"
|
|
DTCONTROLS.Select(oExpression).CopyToDataTable(oFilteredDatatable, LoadOption.PreserveChanges)
|
|
If oFilteredDatatable.Rows.Count = 1 Then
|
|
LOGGER.Debug($"We got a definition for SetControlValues!!")
|
|
Else
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim oControl2Set
|
|
Dim oControlGUID2Set = oControlID
|
|
Dim oControlname2Set = oFilteredDatatable.Rows(0).Item("NAME")
|
|
LOGGER.Debug($"Workin on SetControLValue for {oControlname2Set} ...")
|
|
|
|
If _SetControlValue_in_action = True Then
|
|
LOGGER.Debug($"..but _SetControlValue_in_action = True ==> Exit Sub!")
|
|
Exit Sub
|
|
End If
|
|
If Not IsDBNull(oFilteredDatatable.Rows(0).Item("CONNECTION_ID")) And Not IsDBNull(oFilteredDatatable.Rows(0).Item("SET_CONTROL_DATA")) Then
|
|
Dim oSqlCommand = IIf(IsDBNull(oFilteredDatatable.Rows(0).Item("SET_CONTROL_DATA")), "", oFilteredDatatable.Rows(0).Item("SET_CONTROL_DATA"))
|
|
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
_SetControlValue_in_action = True
|
|
Dim oDTDEPENDING_RESULT As DataTable = ClassDatabase.Return_Datatable(oSqlCommand)
|
|
For Each oRowControl2Set As DataRow In oDTDEPENDING_RESULT.Rows
|
|
Try
|
|
oControl2Set = oRowControl2Set.Item("Control2Set")
|
|
If oControl2Set.ToString.ToUpper = "BTN_FINISH".ToUpper Then
|
|
Try
|
|
Try
|
|
Dim btntext = oRowControl2Set.Item("Caption")
|
|
btnSave.Text = btntext & " (F2)"
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
Try
|
|
Dim oColor1 = System.Drawing.Color.FromName(oRowControl2Set.Item("BackgroundColor"))
|
|
btnSave.BackColor = oColor1
|
|
Catch ex As Exception
|
|
btnSave.BackColor = Color.Transparent
|
|
End Try
|
|
Try
|
|
Dim oColor2 = System.Drawing.Color.FromName(oRowControl2Set.Item("FontColor"))
|
|
btnSave.ForeColor = oColor2
|
|
Catch ex As Exception
|
|
btnSave.ForeColor = Color.Black
|
|
End Try
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
_SetControlValue_in_action = False
|
|
Continue For
|
|
End If
|
|
Dim oFound As Boolean = False
|
|
If IsNumeric(oControl2Set) = False Then
|
|
LOGGER.Warn("Careful: the oControl2Set contains no CONTROL_GUID")
|
|
Exit Sub
|
|
End If
|
|
'Dim oDependingLookup As LookupControl2 = pnldesigner.Controls.Find(oDEPENDING_CtrlName, False).FirstOrDefault()
|
|
For Each oControl As Control In pnldesigner.Controls
|
|
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oControl2Set Then
|
|
oFound = True
|
|
LOGGER.Debug($"Got the Control22Set: {oControl2Set}..Setting the values..")
|
|
Select Case oControl.GetType.ToString
|
|
Case GetType(TextBox).ToString
|
|
Try
|
|
Dim oTEXT = oRowControl2Set.Item("Caption")
|
|
oControl.Text = oControl.Text & oTEXT
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
Dim oColor
|
|
Try
|
|
oColor = System.Drawing.Color.FromName(oRowControl2Set.Item("BackgroundColor"))
|
|
oControl.BackColor = oColor
|
|
Catch ex As Exception
|
|
oControl.BackColor = Color.White
|
|
End Try
|
|
Try
|
|
oColor = System.Drawing.Color.FromName(oRowControl2Set.Item("FontColor"))
|
|
oControl.ForeColor = oColor
|
|
Catch ex As Exception
|
|
oControl.ForeColor = Color.Black
|
|
End Try
|
|
Case GetType(LookupControl2).ToString
|
|
Dim oDependingLookup As LookupControl2 = oControl
|
|
oDependingLookup.DataSource = oDTDEPENDING_RESULT
|
|
Case GetType(GridControl).ToString
|
|
'ClassControlCreator.GridTables
|
|
|
|
End Select
|
|
_SetControlValue_in_action = False
|
|
Exit For
|
|
End If
|
|
|
|
Next
|
|
|
|
If oFound = False Then
|
|
LOGGER.Debug($"Could not find the Control2Set with ID {oControlGUID2Set} on panel!!!")
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Error while Control2Set for [{oControlname2Set}]: " & ex.Message)
|
|
_SetControlValue_in_action = False
|
|
End Try
|
|
Next
|
|
Else
|
|
LOGGER.Debug($"Error: Check CoNN ID and SQL on NULL VALUES!")
|
|
End If
|
|
End Sub
|
|
Private Sub LookupControl_DependingControls(LookupControl As LookupControl2, SelectedValues As List(Of String))
|
|
Dim oLOOKUPValue = SelectedValues.Item(0)
|
|
Dim oLOOKUPName = LookupControl.Name
|
|
LOGGER.Debug($"oLOOKUPValue is [{oLOOKUPValue}]!")
|
|
Dim oControlID = DirectCast(LookupControl.Tag, ClassControlCreator.ControlMetadata).Guid
|
|
Dim oFilteredDatatable As DataTable = DTCONTROLS.Clone()
|
|
Dim oExpression = $"SQL_UEBERPRUEFUNG like '%#CTRL#{oLOOKUPName}%'"
|
|
DTCONTROLS.Select(oExpression).CopyToDataTable(oFilteredDatatable, LoadOption.PreserveChanges)
|
|
If oFilteredDatatable.Rows.Count > 0 Then
|
|
LOGGER.Debug($"We got {oFilteredDatatable.Rows.Count} depending controls!!")
|
|
Else
|
|
LOGGER.Debug($"Sorry NO depending controls!!")
|
|
End If
|
|
For Each oRowDependingControl As DataRow In oFilteredDatatable.Rows
|
|
Dim oDEPENDING_GUID = oRowDependingControl.Item("GUID")
|
|
Dim oDEPENDING_CtrlName = oRowDependingControl.Item("NAME")
|
|
LOGGER.Debug($"Control {oDEPENDING_CtrlName} is depending on lookUp {oLOOKUPName}..")
|
|
If _dependingControl_in_action = True Then
|
|
LOGGER.Debug($"..but _dependingControl_in_action = True ==> Exit Sub!")
|
|
Exit Sub
|
|
End If
|
|
If Not IsDBNull(oRowDependingControl.Item("CONNECTION_ID")) And Not IsDBNull(oRowDependingControl.Item("SQL_UEBERPRUEFUNG")) Then
|
|
Dim oSqlCommand = IIf(IsDBNull(oRowDependingControl.Item("SQL_UEBERPRUEFUNG")), "", oRowDependingControl.Item("SQL_UEBERPRUEFUNG"))
|
|
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
_dependingControl_in_action = True
|
|
Dim oDTDEPENDING_RESULT As DataTable = ClassDatabase.Return_Datatable(oSqlCommand)
|
|
Try
|
|
Dim oFound As Boolean = False
|
|
'Dim oDependingLookup As LookupControl2 = pnldesigner.Controls.Find(oDEPENDING_CtrlName, False).FirstOrDefault()
|
|
For Each oControl As Control In pnldesigner.Controls
|
|
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_GUID Then
|
|
oFound = True
|
|
LOGGER.Debug($"Got the depending control ID:{oDEPENDING_GUID}..Setting the values..")
|
|
Select Case oControl.GetType.ToString
|
|
Case GetType(TextBox).ToString
|
|
Try
|
|
Dim oTEXT = oDTDEPENDING_RESULT.Rows(0).Item(0)
|
|
Try
|
|
If Not IsNothing(oTEXT) Then
|
|
If Not IsDBNull(oTEXT) Then
|
|
oControl.Text = oTEXT
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Unexpected error in Checking oTEXT: {ex.Message}")
|
|
End Try
|
|
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Unexpected error in Dim oTEXT = oDTDEPENDING_RESULT.Rows(0).Item(0): {ex.Message}")
|
|
End Try
|
|
|
|
Dim oColor
|
|
Try
|
|
oColor = System.Drawing.Color.FromName(oDTDEPENDING_RESULT.Rows(0).Item("BackgroundColor"))
|
|
oControl.BackColor = oColor
|
|
Catch ex As Exception
|
|
oControl.BackColor = Color.White
|
|
End Try
|
|
Try
|
|
Dim btntext = oDTDEPENDING_RESULT.Rows(0).Item("btnFinishCaption")
|
|
btnSave.Text = btntext & " (F2)"
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
Try
|
|
oColor = System.Drawing.Color.FromName(oDTDEPENDING_RESULT.Rows(0).Item("btnFinishColor"))
|
|
btnSave.BackColor = oColor
|
|
Catch ex As Exception
|
|
btnSave.BackColor = Color.Transparent
|
|
End Try
|
|
Case GetType(LookupControl2).ToString
|
|
Dim oDependingLookup As LookupControl2 = oControl
|
|
oDependingLookup.DataSource = oDTDEPENDING_RESULT
|
|
Case GetType(GridControl).ToString
|
|
'ClassControlCreator.GridTables
|
|
|
|
End Select
|
|
_dependingControl_in_action = False
|
|
Exit For
|
|
End If
|
|
|
|
Next
|
|
|
|
If oFound = False Then
|
|
LOGGER.Debug($"Could not find the depending Control with ID {oDEPENDING_GUID} on panel!!!")
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Error while setting depending control-value for [{oDEPENDING_CtrlName}]: " & ex.Message)
|
|
_dependingControl_in_action = False
|
|
End Try
|
|
SendKeys.Send("{TAB}")
|
|
ControlHandleStarted = True
|
|
Else
|
|
LOGGER.Debug($"Error: Check CoNN ID and SQL on NULL VALUES!")
|
|
End If
|
|
|
|
|
|
Next
|
|
If oFilteredDatatable.Rows.Count = 1 Then
|
|
|
|
|
|
End If
|
|
End Sub
|
|
Private Sub LookupControl_DependingColumn(LookupControl As LookupControl2, SelectedValues As List(Of String))
|
|
Dim oSQLColumnDatatable As DataTable = DTGRID_COLUMNS_WITH_SQL.Clone()
|
|
Dim oExpression = $"SQL_COMMAND like '%#CTRL#{LookupControl.Name}%'"
|
|
DTGRID_COLUMNS_WITH_SQL.Select(oExpression).CopyToDataTable(oSQLColumnDatatable, LoadOption.PreserveChanges)
|
|
If oSQLColumnDatatable.Rows.Count > 0 Then
|
|
For Each oRow As DataRow In oSQLColumnDatatable.Rows
|
|
Dim oDEPENDING_GUID = DTGRID_COLUMNS_WITH_SQL.Rows(0).Item("CONTROL_ID")
|
|
Dim oDEPENDING_COLUMN = DTGRID_COLUMNS_WITH_SQL.Rows(0).Item("SPALTENNAME")
|
|
Dim oSqlCommand = DTGRID_COLUMNS_WITH_SQL.Rows(0).Item("SQL_COMMAND")
|
|
If _dependingColumn_in_action = True Then
|
|
Exit Sub
|
|
End If
|
|
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
|
|
_dependingColumn_in_action = True
|
|
Try
|
|
Dim oDTDEPENDING_RESULT As DataTable = ClassDatabase.Return_Datatable(oSqlCommand)
|
|
For Each oControl As Control In pnldesigner.Controls
|
|
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_GUID Then
|
|
ClassControlCreator.GridTables.Add(oDEPENDING_COLUMN, oDTDEPENDING_RESULT)
|
|
_dependingColumn_in_action = False
|
|
Exit For
|
|
End If
|
|
Next
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
_dependingColumn_in_action = False
|
|
End Try
|
|
Next
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Public Sub OnCmbselectedIndex(sender As System.Object, e As System.EventArgs)
|
|
Dim cmb As ComboBox = sender
|
|
If cmb.SelectedIndex <> -1 And _Indexe_Loaded = True Then
|
|
If cmb.Name = last_control.Name Then
|
|
'Abschluss()
|
|
Else
|
|
Try
|
|
Dim CONTROL_ID = DirectCast(cmb.Tag, ClassControlCreator.ControlMetadata).Guid 'VWPM_CONTROL_INDEXTableAdapter.cmdGetControlID(CURRENT_ProfilGUID, cmb.Name)
|
|
Dim sql = String.Format("select NAME,CONNECTION_ID,SQL_UEBERPRUEFUNG FROM TBPM_PROFILE_CONTROLS WHERE PROFIL_ID = {0} AND SQL_UEBERPRUEFUNG LIKE '%{1}%'", CURRENT_ProfilGUID, cmb.Name)
|
|
Dim DT As DataTable = ClassDatabase.Return_Datatable(sql)
|
|
If Not IsNothing(DT) And DT.Rows.Count > 0 Then
|
|
If _dependingControl_in_action = True Then
|
|
Exit Sub
|
|
End If
|
|
Dim _Step = 0
|
|
For Each ROW As DataRow In DT.Rows
|
|
Try
|
|
Dim displayboxname = ROW.Item(0).ToString
|
|
_Step = 1
|
|
If Not IsDBNull(ROW.Item("CONNECTION_ID")) And Not IsDBNull(ROW.Item("SQL_UEBERPRUEFUNG")) Then
|
|
_Step = 2
|
|
Dim sql_Statement = IIf(IsDBNull(ROW.Item("SQL_UEBERPRUEFUNG")), "", ROW.Item("SQL_UEBERPRUEFUNG"))
|
|
|
|
sql_Statement = clsPatterns.ReplaceAllValues(sql_Statement, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
_Step = 3
|
|
|
|
'' Regulären Ausdruck zum Auslesen der Indexe definieren
|
|
'Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
|
'' einen Regulären Ausdruck laden
|
|
'Dim regulärerAusdruck As Text.RegularExpressions.Regex = New Text.RegularExpressions.Regex(preg)
|
|
'' die Vorkommen im SQL-String auslesen
|
|
'Dim elemente As Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(sql_Statement)
|
|
''####
|
|
'' alle Vorkommen innerhalbd er Namenkonvention durchlaufen
|
|
'For Each element As Text.RegularExpressions.Match In elemente
|
|
' Try
|
|
' If LogErrorsOnly = False Then LOGGER.Info(" >> element in RegeX: " & element.Value)
|
|
' Dim MyPattern = element.Value.Substring(2, element.Value.Length - 3)
|
|
' Dim input_value
|
|
|
|
' If MyPattern.Contains(ClassControlCreator.PREFIX_TEXTBOX) Then
|
|
' Dim txt As TextBox = CType(pnldesigner.Controls(MyPattern), TextBox)
|
|
' input_value = txt.Text
|
|
' ElseIf MyPattern.Contains(ClassControlCreator.PREFIX_COMBOBOX) Then
|
|
' Dim cmb1 As ComboBox = CType(pnldesigner.Controls(MyPattern), ComboBox)
|
|
' input_value = cmb1.Text
|
|
' End If
|
|
' sql_Statement = sql_Statement.ToString.Replace(element.Value, input_value)
|
|
|
|
' Catch ex As Exception
|
|
' LOGGER.Info("Unexpected Error in Checking control values for Variable SQL Result ComboBox - ERROR: " & ex.Message)
|
|
' End Try
|
|
|
|
'Next
|
|
'If LogErrorsOnly = False Then LOGGER.Info(">>> sql_Statement after replacement: " & sql_Statement)
|
|
|
|
_dependingControl_in_action = True
|
|
_Step = 4
|
|
Depending_Control_Set_Result(displayboxname, sql_Statement, ROW.Item(1))
|
|
_Step = 5
|
|
_dependingControl_in_action = False
|
|
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("Unexpected Error in Display SQL result (Combobox) for control: (" & _Step.ToString & ")" & ROW.Item(0).ToString & " - ERROR: " & ex.Message)
|
|
End Try
|
|
Next
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("Unexpected Error in Eventhandler Variable SQL Result ComboBox - ERROR: " & ex.Message)
|
|
End Try
|
|
|
|
SendKeys.Send("{TAB}")
|
|
ControlHandleStarted = True
|
|
|
|
End If
|
|
End If
|
|
End Sub
|
|
Private Sub Depending_Control_Set_Result(displayboxname As String, sqlCommand As String, sqlConnection As String)
|
|
Try
|
|
Dim resultDT As DataTable = ClassDatabase.Return_Datatable_ConStr(sqlCommand, sqlConnection)
|
|
If Not IsNothing(resultDT) Then
|
|
'Ist das Control ein Control was mehrfachwerte enthalten kann
|
|
If displayboxname.StartsWith(ClassControlCreator.PREFIX_COMBOBOX) Or displayboxname.StartsWith(ClassControlCreator.PREFIX_DATAGRIDVIEW) Or displayboxname.StartsWith(ClassControlCreator.PREFIX_TABLE) Then
|
|
If displayboxname.StartsWith(ClassControlCreator.PREFIX_COMBOBOX) Then
|
|
Dim cmbpanel As ComboBox = pnldesigner.Controls(displayboxname)
|
|
cmbpanel.DataSource = Nothing
|
|
cmbpanel.DataSource = resultDT
|
|
cmbpanel.DisplayMember = resultDT.Columns(0).ColumnName
|
|
cmbpanel.ValueMember = resultDT.Columns(0).ColumnName
|
|
|
|
Dim maxWith As Integer = cmbpanel.Width
|
|
Using g As Graphics = Me.CreateGraphics
|
|
For Each oItem As Object In cmbpanel.Items 'Für alle Einträge...
|
|
Dim g1 As Graphics = cmbpanel.CreateGraphics
|
|
If g1.MeasureString(Text, cmbpanel.Font).Width + 30 > maxWith Then
|
|
maxWith = g1.MeasureString(Text, cmbpanel.Font).Width + 30
|
|
End If
|
|
g1.Dispose()
|
|
Next oItem
|
|
End Using
|
|
cmbpanel.DropDownWidth = maxWith
|
|
|
|
ElseIf displayboxname.StartsWith(ClassControlCreator.PREFIX_DATAGRIDVIEW) Or displayboxname.StartsWith(ClassControlCreator.PREFIX_TABLE) Then
|
|
'not implemented
|
|
End If
|
|
Else
|
|
If resultDT.Rows.Count = 1 Then
|
|
pnldesigner.Controls(displayboxname).Text = resultDT.Rows(0).Item(0).ToString
|
|
Else
|
|
pnldesigner.Controls(displayboxname).Text = "RESULT = NOTHING or MORE THAN 1 ROW"
|
|
|
|
End If
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("Unexpected Error in Depending_Control_Set_Result - ERROR: " & ex.Message)
|
|
MsgBox("Unexpected error: " & ex.Message, MsgBoxStyle.Critical, ADDITIONAL_TITLE)
|
|
End Try
|
|
End Sub
|
|
Public Sub OnDTPValueChanged(sender As System.Object, e As System.EventArgs)
|
|
Dim dtp As DateTimePicker = sender
|
|
If _Indexe_Loaded = True Then
|
|
ValueDTP = dtp.Value
|
|
If dtp.Name = last_control.Name Then
|
|
' Abschluss()
|
|
Else
|
|
SendKeys.Send("{TAB}")
|
|
ControlHandleStarted = True
|
|
End If
|
|
End If
|
|
End Sub
|
|
Private Function CheckValueExists(ByVal control As Control)
|
|
Try
|
|
|
|
For Each dr As DataRow In DTVWCONTROL_INDEX.Rows
|
|
If dr.Item("PROFIL_ID") = CURRENT_ProfilGUID And dr.Item("CTRL_NAME") = control.Name Then
|
|
Dim check = dr.Item("SQL_UEBERPRUEFUNG")
|
|
If IsDBNull(check) Then
|
|
LOGGER.Debug("SQL Check is not configured!")
|
|
Return True
|
|
End If
|
|
If check.ToString.Length > 0 And dr.Item("INDEX_NAME") <> "DD PM-ONLY FOR DISPLAY" Then
|
|
Dim cs As String = GetConnectionString(dr.Item("CONNECTION_ID"))
|
|
If allgFunk.checkValue_Exists(dr.Item("SQL_UEBERPRUEFUNG"), "@Eingabe", control.Text, dr.Item("TYP"), cs, CURRENT_ProfilGUID) = True Then
|
|
Return True
|
|
Else
|
|
errormessage = "the input-value '" & control.Text & "' is not existing in database!"
|
|
My.Settings.Save()
|
|
Return False
|
|
End If
|
|
Else
|
|
Return True
|
|
End If
|
|
End If
|
|
Next
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("Unexpected error in CheckValueExists:" & ex.Message)
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Public Function IsProcessRunning(name As String) As Boolean
|
|
'here we're going to get a list of all running processes on
|
|
'the computer
|
|
For Each Process As Process In Process.GetProcesses()
|
|
If Process.ProcessName.StartsWith(name) Then
|
|
'process found so it's running so return true
|
|
Return True
|
|
End If
|
|
Next
|
|
'process not found, return false
|
|
Return False
|
|
End Function
|
|
|
|
|
|
Function ReplaceWindreamDriveLetter(Filepath As String) As String
|
|
Return Filepath.
|
|
Replace("W:", "\\windream\objects").
|
|
Replace("K:", "\\windream\objects")
|
|
End Function
|
|
Function Get_Next_GUID() As Integer
|
|
Try
|
|
LOGGER.Debug("Get_Next_GUID...")
|
|
Dim newGUID As Integer
|
|
|
|
LOGGER.Debug("Old Document_Path: " & OLD_Document_Path)
|
|
Dim oBIT As Integer = 0
|
|
If PROFIL_sortbynewest = True Then
|
|
oBIT = 1
|
|
End If
|
|
Dim oSQL = $"SELECT * from [dbo].[FNPM_GET_NEXT_DOC_INFO] ({CURRENT_ProfilGUID},{oBIT},{CURRENT_DOC_GUID},'{USER_USERNAME}')"
|
|
|
|
Dim oDT As DataTable = ClassDatabase.Return_Datatable(oSQL)
|
|
If oDT.Rows.Count > 0 Then
|
|
newGUID = oDT.Rows(0).Item(0)
|
|
CURRENT_DOC_ID = oDT.Rows(0).Item(1)
|
|
Else
|
|
LOGGER.Info(" >> Attention: in GetNextGUID - Could not get a GUID(1)")
|
|
newGUID = 0
|
|
Return newGUID
|
|
End If
|
|
'newGUID = ClassDatabase.Execute_Scalar(oSQL, CONNECTION_STRING, True)
|
|
|
|
WMDocPathWindows = ""
|
|
CURRENT_DOC_PATH = ""
|
|
CURRENT_WMFILE = Nothing
|
|
If newGUID > 0 Then
|
|
LOGGER.Debug("newGUID: " & newGUID.ToString)
|
|
|
|
ElseIf newGUID <> 0 Then
|
|
LOGGER.Info(" >> Attention: in GetNextGUID - Could not get a GUID(2)")
|
|
newGUID = 0
|
|
End If
|
|
|
|
Return newGUID
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
oErrorMessage = "Unexpected error in Get_Next_GUID: " & ex.Message
|
|
LOGGER.Info(">> Unexpected error in Get_Next_GUID:: " & ex.Message, True)
|
|
Return 0
|
|
End Try
|
|
|
|
End Function
|
|
|
|
|
|
|
|
Private Function CreateWMObject() As String
|
|
LOGGER.Debug($"in GetWMDocFileString...'")
|
|
Dim oWMRELPATH As String = CURRENT_DT_CONFIG.Rows.Item(0).Item("WM_REL_PATH")
|
|
If oWMRELPATH.EndsWith("\") = False Then
|
|
oWMRELPATH = oWMRELPATH & "\"
|
|
End If
|
|
Dim oWMOwnPath = WMDocPathWindows.Replace(oWMRELPATH, "")
|
|
LOGGER.Debug($"oWMOwnPath: {oWMOwnPath}")
|
|
Try
|
|
Dim oNormalizedPath = WINDREAM.NormalizePath(oWMOwnPath)
|
|
CURRENT_WMFILE = WINDREAM.oSession.GetWMObjectByPath(WMEntity.WMEntityDocument, oNormalizedPath)
|
|
WMDocFileString = oNormalizedPath
|
|
LOGGER.Debug("WMDocFileString: " & WMDocFileString)
|
|
Return True
|
|
Catch ex As Exception
|
|
Dim _err1 As Boolean = False
|
|
LOGGER.Error(ex)
|
|
allgFunk.Insert_LogEntry($"ERROR CreateWMObject >> {ex.Message}")
|
|
LOGGER.Info("Unexpected error creating WMObject(1) in GetWMDocFileString: " & ex.Message)
|
|
LOGGER.Info("Error Number: " & Err.Number.ToString)
|
|
errormessage = $"Could not create a WMObject(1) for [{oWMOwnPath}]!"
|
|
frmError.ShowDialog()
|
|
WMDocFileString = ""
|
|
Return False
|
|
|
|
End Try
|
|
|
|
End Function
|
|
Private Function GetWMDocPathWindows(_CheckStandard As Integer)
|
|
Try
|
|
Dim oResult As String
|
|
Dim oSQL = $"SELECT dbo.FNPM_GET_FILEPATH ({CURRENT_DOC_GUID},{_CheckStandard})"
|
|
oResult = ClassDatabase.Execute_Scalar(oSQL, CONNECTION_STRING)
|
|
LOGGER.Debug($"Checking file 0 [{oResult}] exists?...")
|
|
If File.Exists(oResult) = False Then
|
|
'If USER_USERNAME = "SchreiberM" Then
|
|
' oResult = "\\dd-gan.local.digitaldata.works\DD-DFSR01\UserObjects\UserFiles\schreiberm\Desktop\AANG-3302-swbn.pdf"
|
|
'ElseIf USER_USERNAME = "Administrator" Then
|
|
' 'oResult = "C:\Users\Administrator.DD-GAN\Desktop\test.pdf"
|
|
' oResult = "\\dd-gan.local.digitaldata.works\DD-DFSR01\UserObjects\UserFiles\schreiberm\Desktop\AANG-3302-swbn.pdf"
|
|
'Else
|
|
LOGGER.Debug($"GetWMDocPathWindows returned false - trying with standard again...")
|
|
oSQL = $"SELECT [dbo].[FNPM_GET_FILEPATH] ({CURRENT_DOC_GUID},1)"
|
|
oResult = ClassDatabase.Execute_Scalar(oSQL, CONNECTION_STRING)
|
|
LOGGER.Debug($"Checking file 1[{oResult}] exists?...")
|
|
If File.Exists(oResult) = False Then
|
|
LOGGER.Warn($"File {oResult} not existing!")
|
|
Return False
|
|
End If
|
|
'End If
|
|
End If
|
|
WMDocPathWindows = oResult
|
|
OLD_Document_Path = WMDocPathWindows
|
|
CURRENT_DOC_PATH = WMDocPathWindows
|
|
LOGGER.Debug($"CURRENT_DOC_PATH: {CURRENT_DOC_PATH}")
|
|
Return True
|
|
Catch ex As Exception
|
|
WMDocPathWindows = ""
|
|
OLD_Document_Path = ""
|
|
CURRENT_DOC_PATH = ""
|
|
errormessage = $"Unexpected error in GetWMDocPathWindows: [{ex.Message}]!"
|
|
frmError.ShowDialog()
|
|
Return False
|
|
End Try
|
|
|
|
|
|
End Function
|
|
Sub Load_IDB_DOC_DATA()
|
|
Dim oSQl As String = IDB_DOC_DATA_SQL
|
|
oSQl = oSQl.Replace("@DOC_GUID", CURRENT_DOC_GUID)
|
|
oSQl = oSQl.Replace("@DOC_ID", CURRENT_DOC_ID)
|
|
oSQl = oSQl.Replace("@DocID", CURRENT_DOC_ID)
|
|
IDB_DT_DOC_DATA = ClassDatabase.Return_Datatable(oSQl)
|
|
End Sub
|
|
|
|
|
|
Sub Load_Next_Document(first As Boolean)
|
|
|
|
CURRENT_WMFILE = Nothing
|
|
activate_controls(False)
|
|
oErrorMessage = ""
|
|
WMDocPathWindows = ""
|
|
WMDocFileString = ""
|
|
|
|
CURRENT_HTML_DOC = ""
|
|
|
|
'Me.lblerror.Visible = False
|
|
_Indexe_Loaded = False
|
|
LOGGER.Debug("In Load_Next_Document")
|
|
Try
|
|
If first = True Then
|
|
LOGGER.Debug("First Document")
|
|
CURRENT_WMFILE = Nothing
|
|
Else
|
|
LOGGER.Debug("Following Document ")
|
|
docCounter += 1
|
|
End If
|
|
|
|
' Controls nicht beim ersten Laden leeren
|
|
If first = False Then
|
|
Clear_all_Input()
|
|
End If
|
|
|
|
'Select Case navtype
|
|
' Case "next"
|
|
' Case "previous"
|
|
' Case "first"
|
|
' Case "last"
|
|
'End Select
|
|
LOGGER.Debug($"CURRENT_JUMP_DOC_GUID: {CURRENT_JUMP_DOC_GUID}'")
|
|
If CURRENT_JUMP_DOC_GUID = 0 Then
|
|
CURRENT_DOC_GUID = Get_Next_GUID()
|
|
ElseIf first = False Then
|
|
CURRENT_DOC_GUID = 0
|
|
End If
|
|
LOGGER.Debug("Dokument-GUID: '" & CURRENT_DOC_GUID.ToString & "'")
|
|
If CURRENT_DOC_GUID > 0 Then
|
|
If GetWMDocPathWindows(0) = False Then
|
|
MsgBox("Could not access the file! Check the log!", MsgBoxStyle.Critical, ADDITIONAL_TITLE)
|
|
Exit Sub
|
|
End If
|
|
If IDB_ACTIVE = False Then
|
|
If CreateWMObject() = False Then
|
|
Exit Sub
|
|
End If
|
|
Else
|
|
Load_IDB_DOC_DATA()
|
|
|
|
If IDB_DT_DOC_DATA.Rows.Count = 1 Then
|
|
LOGGER.Debug("Got one IDB DocData Result")
|
|
End If
|
|
End If
|
|
'Beschriftung des Navigators
|
|
'lblNavigator_anzDok.Text = position & " of " & Anzahl_ValDoks & " files"
|
|
If WMDocPathWindows <> String.Empty Then
|
|
' >> >> >> >> >> >>##### Das Dokument in Bearbeitung nehmen ###########################
|
|
Dim sql = $"UPDATE TBPM_PROFILE_FILES SET IN_WORK = 1, IN_WORK_WHEN = GETDATE(), WORK_USER = '{USER_USERNAME}' WHERE GUID = {CURRENT_DOC_GUID}"
|
|
ClassDatabase.Execute_non_Query(sql)
|
|
|
|
' ############ Infos eintragen #################
|
|
' txtDateipfad.Text = Document_Path
|
|
bsiInformation.Caption = "Datei " & docCounter.ToString & " von " & Anzahl_ValDoks.ToString
|
|
LOGGER.Info(">> Validierung für Dokument '" & WMDocPathWindows & "' gestartet")
|
|
bsiDocID.Caption = "Document-ID: " & CURRENT_DOC_ID & " - GUID: " & CURRENT_DOC_GUID
|
|
|
|
LOGGER.Debug("AllDocInfo created...")
|
|
If IDB_ACTIVE = False Then
|
|
oErrorMessage = Windream_get_Doc_info()
|
|
Else
|
|
' oErrorMessage = IDB_GetDocInfo()
|
|
End If
|
|
|
|
|
|
|
|
If oErrorMessage = "" Then
|
|
|
|
load_viewer()
|
|
LOGGER.Debug("Viewer loaded!")
|
|
If WMDocPathWindows.ToLower.EndsWith(".pdf") = False Then
|
|
bbtniAnnotation.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
FillIndexValues(first)
|
|
|
|
For Each oControl As Control In pnldesigner.Controls
|
|
LoadSQLData(oControl, DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid)
|
|
Next
|
|
|
|
LOGGER.Debug("Indexmask loaded")
|
|
|
|
'Nun im Vektoprindex loggen das das Profil geladen wurde
|
|
'If PROFIL_VEKTORINDEX <> "" Then
|
|
' Dim Profilstring = "DD-PM" & Delimiter & "Profil: '" & PROFIL_NAME & "'" & Delimiter & USER_NAME & Delimiter & Now.ToString
|
|
' If Indexiere_VektorfeldPM(Profilstring, PROFIL_VEKTORINDEX) = False Then
|
|
' If LogErrorsOnly = False Then LOGGER.Info(" >> Profilname erfolgreich in Vektorfeld PM geschrieben")
|
|
' 'Else
|
|
' ' errormessage = "Fehler beim finalen Indexieren:" & vbNewLine & idxerr_message
|
|
' ' My.Settings.Save()
|
|
' ' frmError.ShowDialog()
|
|
' ' _error = True
|
|
' End If
|
|
'End If
|
|
'Nun loggen das das Profil geladen wurde
|
|
If PROFIL_LOGINDEX <> "" Then
|
|
Dim oLogString = $"PMProfile loaded: [{CURRENT_ProfilGUID}-{CURRENT_ProfilName}]{Delimiter}{USER_USERNAME}{Delimiter}{Now.ToString}"
|
|
If IDB_ACTIVE = False Then
|
|
WMIndexVectofield(oLogString, PROFIL_LOGINDEX)
|
|
Else
|
|
oLogString = $"PMProfile loaded: [{CURRENT_ProfilGUID}-{CURRENT_ProfilName}]"
|
|
IDBData.SetVariableValue(PROFIL_LOGINDEX, oLogString)
|
|
'LOGGER.Debug("Profilname erfolgreich in Vektorfeld LOG geschrieben")
|
|
'Else
|
|
' errormessage = "Fehler beim finalen Indexieren:" & vbNewLine & idxerr_message
|
|
' My.Settings.Save()
|
|
' frmError.ShowDialog()
|
|
' _error = True
|
|
|
|
|
|
End If
|
|
End If
|
|
activate_controls(True)
|
|
Else
|
|
errormessage = oErrorMessage
|
|
frmError.ShowDialog()
|
|
End If
|
|
Else
|
|
errormessage = oErrorMessage
|
|
frmError.ShowDialog()
|
|
End If
|
|
Else
|
|
If oErrorMessage <> "" Then
|
|
errormessage = oErrorMessage
|
|
frmError.ShowDialog()
|
|
Else
|
|
LOGGER.Info("End of profile - no more documents!")
|
|
Dim oROW As DataRow = ClassAllgemeineFunktionen.GUI_LANGUAGE_MSGBOX("frmValidator.NoMoreDocument")
|
|
Try
|
|
MsgBox(oROW.Item("STRING1"), MsgBoxStyle.Information, oROW.Item("STRING2"))
|
|
Catch ex As Exception
|
|
MsgBox("No more documents!" & vbNewLine & "Form will be closed now!", MsgBoxStyle.Information, ADDITIONAL_TITLE)
|
|
End Try
|
|
activate_controls(True)
|
|
Me.Close()
|
|
End If
|
|
End If
|
|
LOGGER.Debug("frmValidator: LoadNextDocument finished!")
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
allgFunk.Insert_LogEntry($"ERROR LoadNextDocument >> {ex.Message}")
|
|
errormessage = "unexpected error in Load_Next_Document:" & ex.Message
|
|
My.Settings.Save()
|
|
LOGGER.Info("unexpected error in Load_Next_Document: " & ex.Message)
|
|
frmError.ShowDialog()
|
|
End Try
|
|
End Sub
|
|
Sub load_viewer()
|
|
DocumentViewerValidator.LoadFile(WMDocPathWindows)
|
|
DocumentViewerValidator.RightOnlyView(USER_RIGHT_VIEW_ONLY)
|
|
If USER_RIGHT_VIEW_ONLY = True Then
|
|
RibbonPageFile.Visible = False
|
|
Else
|
|
RibbonPageFile.Visible = True
|
|
End If
|
|
SplitContainer1.Panel2Collapsed = False
|
|
|
|
End Sub
|
|
Sub activate_controls(status As Boolean)
|
|
Me.pnldesigner.Enabled = status
|
|
Me.btnSave.Enabled = status
|
|
End Sub
|
|
Private Function Windream_get_Doc_info()
|
|
Try
|
|
|
|
'If CultureInfo.CurrentUICulture.ThreeLetterISOLanguageName = "eng" Then
|
|
' My.Settings.vIDX_DMS_ERSTELLT = "DMS Created"
|
|
' dmsCreated = "DMS Created"
|
|
' My.Settings.vIDX_DMS_ERSTELLT_Zeit = "DMS Created Time"
|
|
' dmscreatedtime = "DMS Created Time"
|
|
' My.Settings.Save()
|
|
'Else
|
|
|
|
'End If
|
|
Try
|
|
LOGGER.Debug($"GetVariableValue [{INDEX_DMS_ERSTELLT}]...")
|
|
CURRENT_DOC_CREATION_DATE = CURRENT_WMFILE.GetVariableValue(INDEX_DMS_ERSTELLT)
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
If ex.Message.Contains("Variable: " & INDEX_DMS_ERSTELLT & " not found!") Then
|
|
LOGGER.Info("1. Ausnahme in Windream_get_Doc_info: Variable: " & INDEX_DMS_ERSTELLT & " not found", True)
|
|
LOGGER.Info("1. Ausnahme-Fehler: " & ex.Message)
|
|
If INDEX_DMS_ERSTELLT = "DMS Created" Then
|
|
|
|
INDEX_DMS_ERSTELLT = "DMS erstellt"
|
|
INDEX_DMS_ERSTELLT_ZEIT = "DMS erstellt (Zeit)"
|
|
CONFIG.Config.IndexDmsErstellt = INDEX_DMS_ERSTELLT
|
|
CONFIG.Config.IndexDmsErstelltZeit = INDEX_DMS_ERSTELLT_ZEIT
|
|
CONFIG.Save()
|
|
|
|
'SaveMySettingsValue("IDX_DMS_ERSTELLT_ZEIT", "DMS erstellt (Zeit)")
|
|
'SaveMySettingsValue("IDX_DMS_ERSTELLT", "DMS erstellt")
|
|
Else
|
|
INDEX_DMS_ERSTELLT = "DMS Created"
|
|
INDEX_DMS_ERSTELLT_ZEIT = "DMS Created Time"
|
|
CONFIG.Config.IndexDmsErstellt = INDEX_DMS_ERSTELLT
|
|
CONFIG.Config.IndexDmsErstelltZeit = INDEX_DMS_ERSTELLT_ZEIT
|
|
'SaveMySettingsValue("IDX_DMS_ERSTELLT", "DMS Created")
|
|
'SaveMySettingsValue("IDX_DMS_ERSTELLT_ZEIT", "DMS erstellt Time")
|
|
End If
|
|
|
|
CURRENT_DOC_CREATION_DATE = CURRENT_WMFILE.GetVariableValue(INDEX_DMS_ERSTELLT)
|
|
Else
|
|
LOGGER.Info("error in Windream_get_Doc_info 1: " & ex.Message)
|
|
Return "error in Windream_get_Doc_info 1: " & ex.Message
|
|
End If
|
|
End Try
|
|
|
|
LOGGER.Debug("DMS-Erstellt aus WD: " & CURRENT_DOC_CREATION_DATE)
|
|
|
|
Try
|
|
LOGGER.Debug($"GetVariableValue [{INDEX_DMS_ERSTELLT_ZEIT}]...")
|
|
CURRENT_DOC_CREATION_TIME = CURRENT_WMFILE.GetVariableValue(INDEX_DMS_ERSTELLT_ZEIT)
|
|
Catch ex As Exception
|
|
|
|
If ex.Message.Contains("Variable: " & INDEX_DMS_ERSTELLT_ZEIT & " not found!") Then
|
|
LOGGER.Info("1. Ausnahme in Windream_get_Doc_info: Variable: " & INDEX_DMS_ERSTELLT_ZEIT & " not found", True)
|
|
If INDEX_DMS_ERSTELLT = "DMS Created" Then
|
|
|
|
INDEX_DMS_ERSTELLT = "DMS erstellt"
|
|
INDEX_DMS_ERSTELLT_ZEIT = "DMS erstellt (Zeit)"
|
|
|
|
CONFIG.Config.IndexDmsErstellt = INDEX_DMS_ERSTELLT
|
|
CONFIG.Config.IndexDmsErstelltZeit = INDEX_DMS_ERSTELLT_ZEIT
|
|
CONFIG.Save()
|
|
|
|
'SaveMySettingsValue("IDX_DMS_ERSTELLT_ZEIT", "DMS erstellt (Zeit)")
|
|
Else
|
|
INDEX_DMS_ERSTELLT = "DMS Created"
|
|
INDEX_DMS_ERSTELLT_ZEIT = "DMS Created Time"
|
|
|
|
CONFIG.Config.IndexDmsErstellt = INDEX_DMS_ERSTELLT
|
|
CONFIG.Config.IndexDmsErstelltZeit = INDEX_DMS_ERSTELLT_ZEIT
|
|
CONFIG.Save()
|
|
|
|
'SaveMySettingsValue("IDX_DMS_ERSTELLT", "DMS Created")
|
|
'SaveMySettingsValue("IDX_DMS_ERSTELLT_ZEIT", "DMS Created Time")
|
|
End If
|
|
LOGGER.Debug($"GetVariableValue (2) [{INDEX_DMS_ERSTELLT_ZEIT}]...")
|
|
CURRENT_DOC_CREATION_TIME = CURRENT_WMFILE.GetVariableValue(INDEX_DMS_ERSTELLT_ZEIT)
|
|
Else
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("error in Windream_get_Doc_info 3: " & ex.Message)
|
|
Return "error in Windream_get_Doc_info 3: " & ex.Message
|
|
End If
|
|
End Try
|
|
|
|
LOGGER.Debug("DMSErstelltZeit aus WD: " & CURRENT_DOC_CREATION_TIME)
|
|
|
|
If CURRENT_DOC_CREATION_TIME.Length > 11 Then
|
|
CURRENT_DOC_CREATION_DATE = CURRENT_DOC_CREATION_DATE & " " & CURRENT_DOC_CREATION_TIME.Substring(10)
|
|
Else
|
|
CURRENT_DOC_CREATION_DATE = CURRENT_DOC_CREATION_DATE & " " & CURRENT_DOC_CREATION_TIME
|
|
End If
|
|
|
|
Return ""
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("error in Windream_get_Doc_info (GENERELL): " & ex.Message)
|
|
Return "error in Windream_get_Doc_info (GENERELL): " & ex.Message
|
|
End Try
|
|
|
|
End Function
|
|
Private Function Return_VektorArray(ByVal oDocument As WMObject, vktIndexName As String, NIIndexe As Object, CheckDuplikat As Boolean, vType As Object)
|
|
Dim ValueArray()
|
|
|
|
' Try
|
|
Dim missing As Boolean = False
|
|
Dim Anzahl As Integer = 0
|
|
|
|
'Jeden Wert des Vektorfeldes durchlaufen
|
|
Dim wertWD = oDocument.GetVariableValue(vktIndexName)
|
|
If wertWD Is Nothing = False Then
|
|
'Nochmals prüfen ob wirklich Array
|
|
If wertWD.GetType.ToString.Contains("System.Object") Then
|
|
'Keine Duplikatprüfung also einfach neues Array füllen
|
|
If CheckDuplikat = False Then
|
|
For Each value As Object In wertWD
|
|
'Das Array anpassen
|
|
ReDim Preserve ValueArray(Anzahl)
|
|
'Den Wert im Array speichern
|
|
ValueArray(Anzahl) = ConvertVectorType(vType, value)
|
|
Anzahl += 1
|
|
Next
|
|
'Und jetzt den/die Neuen Wert(e) anfügen
|
|
For Each NewValue As Object In NIIndexe
|
|
If NewValue Is Nothing = False Then
|
|
'Das Array anpassen
|
|
ReDim Preserve ValueArray(Anzahl)
|
|
'Den Wert im Array speichern
|
|
ValueArray(Anzahl) = ConvertVectorType(vType, NewValue)
|
|
Anzahl += 1
|
|
|
|
End If
|
|
Next
|
|
Else
|
|
|
|
'Duplikat Prüfung an, also nur anhängen wenn Wert <>
|
|
For Each WDValue As Object In wertWD
|
|
If WDValue Is Nothing = False Then
|
|
'Erst einmal die ALten Werte schreiben
|
|
ReDim Preserve ValueArray(Anzahl)
|
|
'Den Wert im Array speichern
|
|
ValueArray(Anzahl) = ConvertVectorType(vType, WDValue)
|
|
Anzahl += 1
|
|
End If
|
|
Next
|
|
'Jetzt die Neuen Werte auf Duplikate überprüfen
|
|
For Each NewValue As Object In NIIndexe
|
|
If NewValue Is Nothing = False Then
|
|
If ValueArray.Contains(NewValue) = False Then
|
|
'Das Array anpassen
|
|
ReDim Preserve ValueArray(Anzahl)
|
|
'Den Wert im Array speichern
|
|
ValueArray(Anzahl) = ConvertVectorType(vType, NewValue)
|
|
Anzahl += 1
|
|
Else
|
|
End If
|
|
End If
|
|
Next
|
|
End If
|
|
End If
|
|
Else
|
|
'Den/die Neuen Wert(e) anfügen
|
|
For Each NewValue As Object In NIIndexe
|
|
If NewValue Is Nothing = False Then
|
|
If CheckDuplikat = True Then
|
|
If ValueArray Is Nothing = False Then
|
|
If ValueArray.Contains(NewValue) = False Then
|
|
'Das Array anpassen
|
|
ReDim Preserve ValueArray(Anzahl)
|
|
'Den Wert im Array speichern
|
|
ValueArray(Anzahl) = ConvertVectorType(vType, NewValue)
|
|
Anzahl += 1
|
|
Else
|
|
End If
|
|
Else 'Dererste Wert, also hinzufügen
|
|
'Das Array anpassen
|
|
ReDim Preserve ValueArray(Anzahl)
|
|
'Den Wert im Array speichern
|
|
ValueArray(Anzahl) = ConvertVectorType(vType, NewValue)
|
|
Anzahl += 1
|
|
|
|
End If
|
|
|
|
Else
|
|
'Das Array anpassen
|
|
ReDim Preserve ValueArray(Anzahl)
|
|
'Den Wert im Array speichern
|
|
ValueArray(Anzahl) = ConvertVectorType(vType, NewValue)
|
|
Anzahl += 1
|
|
End If
|
|
End If
|
|
Next
|
|
End If
|
|
|
|
Return ValueArray
|
|
'Catch ex As Exception
|
|
' Return ValueArray
|
|
'End Try
|
|
|
|
|
|
End Function
|
|
|
|
Public Function ConvertVectorType(vType As Object, value As String)
|
|
Select Case vType
|
|
Case 36865 ' 36865
|
|
'Umwandeln in String
|
|
Return value
|
|
Case 4097 '4097
|
|
'Umwandeln in String
|
|
Return value
|
|
Case 4098 '4098
|
|
'Umwandeln in Integer
|
|
value = value.Replace(" ", "")
|
|
Return CInt(value)
|
|
Case 4099 '4099
|
|
value = value.
|
|
Replace(" ", "").
|
|
Replace(".", ",")
|
|
'Umwandeln in Double
|
|
Return CDbl(value)
|
|
Case 4100 '4100
|
|
'Umwandeln in Boolean
|
|
Return CBool(value)
|
|
Case 4101 '4101
|
|
'Umwandeln in Date
|
|
Return CDate(value)
|
|
Case 4107 '4107
|
|
Return Convert.ToInt64(value)
|
|
Case 4103 '4103
|
|
'Umwandeln in Datum Uhrzeit
|
|
Return value
|
|
Case Else
|
|
'Umwandeln in String
|
|
Return value
|
|
End Select
|
|
End Function
|
|
|
|
Private Function ReturnVektor_IndexValue(VKTBezeichner As String)
|
|
Try
|
|
Dim value
|
|
Dim name = VKTBezeichner.Replace("[%VKT", "")
|
|
Dim Sort_Arr() As String
|
|
Dim i As Integer = 0
|
|
'Jetzt im Vektorfeld des Profils nachsehen ob der WErt bereits vorhanden ist
|
|
Dim wertWD = CURRENT_WMFILE.GetVariableValue(PROFIL_VEKTORINDEX)
|
|
If wertWD Is Nothing = False Then
|
|
'Es wird gegen ein Vektorfeld nachindexiert
|
|
If wertWD.GetType.ToString.Contains("System.Object") Then
|
|
'es handelt sich um ein Vektorfeld - Zuweisen der Indexwerte des Vektorfeldes zu Array
|
|
For Each obj As Object In wertWD
|
|
If obj Is Nothing = False Then
|
|
ReDim Preserve Sort_Arr(i)
|
|
Sort_Arr(i) = obj.ToString()
|
|
i += 1
|
|
End If
|
|
Next
|
|
'Das Ergebnis-Array nun Rückwärts sortieren, um die letzte Änderung zu finden
|
|
For Each _string As Object In Sort_Arr.Reverse()
|
|
Dim DDPM_String As String = _string.ToString()
|
|
'
|
|
Dim VektorArray() = Split(DDPM_String, Delimiter)
|
|
If VektorArray(1).ToString.ToLower = name.ToLower Then
|
|
value = VektorArray(2)
|
|
Exit For
|
|
End If
|
|
|
|
Next
|
|
|
|
End If
|
|
End If
|
|
If value Is Nothing Then value = ""
|
|
Return value
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("error in ReturnVektor_IndexValue: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, ADDITIONAL_TITLE)
|
|
LOGGER.Info("error in ReturnVektor_IndexValue: " & ex.Message)
|
|
Return ""
|
|
End Try
|
|
|
|
|
|
|
|
|
|
End Function
|
|
Private Function GetVariableValuefromSource(oSourceIndexName As String, Optional oIDBTyp As Integer = 0, Optional FromIDB As Boolean = False) As Object
|
|
Try
|
|
Dim oValuefromSource
|
|
If IDB_ACTIVE = False Then
|
|
oValuefromSource = CURRENT_WMFILE.GetVariableValue(oSourceIndexName)
|
|
Else
|
|
oValuefromSource = IDBData.GetVariableValue(oSourceIndexName, oIDBTyp, FromIDB)
|
|
End If
|
|
Return oValuefromSource
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
Return Nothing
|
|
End Try
|
|
|
|
End Function
|
|
|
|
Sub FillIndexValues(first As Boolean, Optional SingleAttribute As String = "")
|
|
Dim oControlType As String
|
|
Dim oIndexName As String
|
|
Dim oControName As String
|
|
Dim oIDBOverride As Boolean = False
|
|
Try
|
|
If DTVWCONTROL_INDEX.Rows.Count > 0 Then
|
|
Dim oCount As Integer = 0
|
|
For Each oControl As Control In Me.pnldesigner.Controls
|
|
If SingleAttribute <> "" Then
|
|
oIDBOverride = True
|
|
If SingleAttribute <> oControl.Name Then
|
|
Continue For
|
|
End If
|
|
End If
|
|
|
|
Dim oValueFromSource
|
|
Dim oControlId = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid
|
|
Dim oControlRow = (From form In DTVWCONTROL_INDEX.AsEnumerable()
|
|
Select form
|
|
Where form.Item("GUID") = oControlId).Single()
|
|
|
|
Dim oType As String = oControl.GetType.ToString
|
|
Dim oTyp As String = oControlRow.Item("CTRL_TYPE")
|
|
Dim oIDBTyp As String
|
|
If IDB_ACTIVE Then
|
|
oIDBTyp = oControlRow.Item("IDB_TYP")
|
|
End If
|
|
|
|
Dim oSourceIndexName As String = oControlRow.Item("INDEX_NAME")
|
|
' Wenn kein defaultValue existiert, leeren String setzen
|
|
Dim oDefaultValue As String = NotNull(oControlRow.Item("DEFAULT_VALUE"), String.Empty)
|
|
oIndexName = oSourceIndexName
|
|
oControName = oControl.Name
|
|
Dim oLoadIndex As Boolean = oControlRow.Item("LOAD_IDX_VALUE")
|
|
|
|
|
|
|
|
LOGGER.Debug("INDEX: " & oSourceIndexName & " - CONTROLNAME: " & oControl.Name & " - LOAD IDXVALUES: " & oLoadIndex.ToString)
|
|
_CURRENT_INDEX_ARRAY(oCount, 0) = oSourceIndexName
|
|
Select Case oType
|
|
Case "System.Windows.Forms.TextBox"
|
|
Try
|
|
oControlType = "Textbox"
|
|
If oSourceIndexName = "" Then
|
|
MsgBox("Attention wrong configuration:" & vbNewLine & "for control " & oControl.Name & " no INDEX configured!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
|
|
Exit For
|
|
End If
|
|
If oSourceIndexName Is Nothing = False Then
|
|
If oLoadIndex = False Or oSourceIndexName = "DD PM-ONLY FOR DISPLAY" Then
|
|
' Wenn kein Index exisitiert, defaultValue laden
|
|
oControl.Text = oDefaultValue
|
|
_CURRENT_INDEX_ARRAY(oCount, 1) = oDefaultValue
|
|
LOGGER.Debug("Indexwert soll nicht geladen werden.")
|
|
Exit Select
|
|
End If
|
|
|
|
|
|
If oSourceIndexName.StartsWith("[%VKT") And PROFIL_VEKTORINDEX <> "" Then
|
|
oValueFromSource = ReturnVektor_IndexValue(oSourceIndexName)
|
|
Else
|
|
|
|
oValueFromSource = GetVariableValuefromSource(oSourceIndexName, oIDBTyp, oIDBOverride)
|
|
|
|
If oValueFromSource Is Nothing Then
|
|
oValueFromSource = ""
|
|
Else
|
|
If oValueFromSource.ToString = "System.Object[]" Then
|
|
LOGGER.Debug("TextBox with VektorField: " & oSourceIndexName)
|
|
Try
|
|
LOGGER.Debug($"Length of Vektorarray: {oValueFromSource.length}")
|
|
Catch ex As Exception
|
|
LOGGER.Info($"Error in gettin the lenth of vektorfield {oSourceIndexName} - {ex.Message}")
|
|
End Try
|
|
If oValueFromSource.length = 1 Then
|
|
oValueFromSource = oValueFromSource(0)
|
|
Else '
|
|
LOGGER.Info(" >> Vectorfield " & oSourceIndexName & "' contains more then one value - First value will be used")
|
|
oValueFromSource = oValueFromSource(0)
|
|
End If
|
|
LOGGER.Debug($"wertWD has been saved...")
|
|
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
Try
|
|
oControl.Text = NotNull(oValueFromSource, oDefaultValue)
|
|
_CURRENT_INDEX_ARRAY(oCount, 1) = NotNull(oValueFromSource, oDefaultValue)
|
|
Catch ex As Exception
|
|
LOGGER.Info("ERROR while converting defaultValue [" & oDefaultValue & "]: " & ex.Message)
|
|
oControl.Text = ""
|
|
_CURRENT_INDEX_ARRAY(oCount, 1) = ""
|
|
End Try
|
|
|
|
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
errormessage = $"Unvorhergesehener Fehler bei FillIndexValues TextBox [{oControl.Name}]:" & vbNewLine & ex.Message & vbNewLine & "Check Logfile"
|
|
My.Settings.Save()
|
|
frmError.ShowDialog()
|
|
LOGGER.Info("Unexpected error in FillIndexValuesTextBox: " & ex.Message, True)
|
|
LOGGER.Info(">> Controltype: " & oControlType)
|
|
LOGGER.Info(">> Indexname windream: " & oIndexName)
|
|
Exit Sub
|
|
End Try
|
|
|
|
Case "System.Windows.Forms.ComboBox"
|
|
oControlType = "ComboBox"
|
|
Dim oMyCombobox As ComboBox = oControl
|
|
Try
|
|
If oSourceIndexName = "" Then
|
|
MsgBox("Attention wrong configuration:" & vbNewLine & "for control " & oControl.Name & " no INDEX configured!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
|
|
Exit For
|
|
End If
|
|
If oSourceIndexName Is Nothing = False Then
|
|
If oLoadIndex = False Or oSourceIndexName = "DD PM-ONLY FOR DISPLAY" Then
|
|
If oDefaultValue = String.Empty Then
|
|
oMyCombobox.SelectedIndex = -1
|
|
Else
|
|
oMyCombobox.Text = oDefaultValue
|
|
_CURRENT_INDEX_ARRAY(oCount, 1) = oDefaultValue
|
|
End If
|
|
LOGGER.Debug($" oMyComboBox {oMyCombobox.Name}: Indexwert soll nicht geladen werden.")
|
|
Exit Select
|
|
End If
|
|
|
|
If oSourceIndexName.StartsWith("[%VKT") And PROFIL_VEKTORINDEX <> "" Then
|
|
oValueFromSource = ReturnVektor_IndexValue(oSourceIndexName)
|
|
Else
|
|
oValueFromSource = GetVariableValuefromSource(oSourceIndexName, oIDBTyp, oIDBOverride)
|
|
End If
|
|
|
|
If oValueFromSource Is Nothing Then
|
|
|
|
LOGGER.Debug($"oMyComboBox {oMyCombobox.Name} - Indexvalue from index {oSourceIndexName}: Nothing")
|
|
If oDefaultValue = String.Empty Then
|
|
LOGGER.Debug($"oMyComboBox {oMyCombobox.Name}-defaultValue wurde nicht gefunden")
|
|
oMyCombobox.SelectedIndex = -1
|
|
Else
|
|
LOGGER.Debug($"oMyComboBox {oMyCombobox.Name}-defaultValue wird geladen")
|
|
oMyCombobox.Text = oDefaultValue
|
|
_CURRENT_INDEX_ARRAY(oCount, 1) = oDefaultValue
|
|
'cmb.SelectedIndex = cmb.FindStringExact(defaultValue)
|
|
End If
|
|
Else
|
|
If oValueFromSource.ToString = "System.Object[]" Then
|
|
LOGGER.Debug($"oMyComboBox {oMyCombobox.Name} - Combobox with VektorField: " & oSourceIndexName)
|
|
Try
|
|
LOGGER.Debug($"Length of Vektorarray: {oValueFromSource.length}")
|
|
Catch ex As Exception
|
|
LOGGER.Info($"Error in gettin the length of vektorfield {oSourceIndexName} - {ex.Message}")
|
|
End Try
|
|
If oValueFromSource.length = 1 Then
|
|
oValueFromSource = oValueFromSource(0)
|
|
Else '
|
|
LOGGER.Info(" >> Vectorfield " & oSourceIndexName & "' contains more then one value - First value will be used")
|
|
oValueFromSource = oValueFromSource(0)
|
|
End If
|
|
LOGGER.Debug($"wertWD has been saved...")
|
|
Else
|
|
|
|
End If
|
|
LOGGER.Debug($"Indexwert from Index {oSourceIndexName}: {oValueFromSource}")
|
|
LOGGER.Debug($"Items in Combobox: {oMyCombobox.Items.Count}")
|
|
|
|
_CURRENT_INDEX_ARRAY(oCount, 1) = oValueFromSource
|
|
LOGGER.Debug($"_CURRENT_INDEX_ARRAY set...")
|
|
If oMyCombobox.Items.Count = 0 Then
|
|
' If LogErrorsOnly = False Then LOGGER.Info($"Index Wert wurde gesetzt")
|
|
oMyCombobox.Text = oValueFromSource
|
|
Else
|
|
' If LogErrorsOnly = False Then LOGGER.Info($"Index Wert wurde ausgewählt")
|
|
oMyCombobox.SelectedIndex = oMyCombobox.FindStringExact(oValueFromSource)
|
|
LOGGER.Debug($"oMyComboBox {oMyCombobox.Name} .SelectedIndex: {oMyCombobox.SelectedIndex}")
|
|
|
|
End If
|
|
End If
|
|
End If
|
|
LOGGER.Debug("")
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info(">> Unexpected error in FillIndexValues(Combobox: " & oMyCombobox.Name & "): " & ex.Message, True)
|
|
LOGGER.Info(">> Controltype: " & oControlType)
|
|
LOGGER.Info(">> Indexname windream: " & oIndexName)
|
|
errormessage = "Unexpected error in FillIndexValues(Combobox: " & oMyCombobox.Name & "): " & vbNewLine & ex.Message & vbNewLine & "Check Logfile"
|
|
My.Settings.Save()
|
|
frmError.ShowDialog()
|
|
|
|
End Try
|
|
|
|
|
|
Case "DevExpress.XtraGrid.GridControl"
|
|
oControlType = "DevExpress.XtraGrid.GridControl"
|
|
Dim oMyGridControl As GridControl = oControl
|
|
Dim oDTColumnsPerDevExGrid As DataTable = DTGRID_COLUMNS.Clone()
|
|
If oSourceIndexName = "" Then
|
|
MsgBox("Attention wrong configuration:" & vbNewLine & "for control " & oControl.Name & " no INDEX configured!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical, ADDITIONAL_TITLE)
|
|
Exit For
|
|
End If
|
|
If oSourceIndexName Is Nothing = False Then
|
|
If oLoadIndex = False Then
|
|
LOGGER.Debug("Indexwert soll nicht geladen werden.")
|
|
Exit Select
|
|
End If
|
|
LOGGER.Debug($"getting wmValue for Index {oSourceIndexName}...")
|
|
' Dim wertWD = CURRENT_WMFILE.GetVariableValue(oSourceIndexName)
|
|
oValueFromSource = GetVariableValuefromSource(oSourceIndexName, oIDBTyp, oIDBOverride)
|
|
|
|
If oValueFromSource Is Nothing = False Then
|
|
Dim omytype = oValueFromSource.GetType.ToString
|
|
LOGGER.Debug($"omytype is [{omytype}]!")
|
|
'Es wird gegen ein Vektorfeld nachindexiert
|
|
If omytype.Contains("System.Object") Or omytype = "System.Data.DataTable" Or omytype = "System.String" Then
|
|
Select Case oTyp
|
|
'Tabellendarstellung
|
|
Case "TABLE"
|
|
Dim oExpression = $"CONTROL_ID = {oControlId}"
|
|
DTGRID_COLUMNS.Select(oExpression, "SEQUENCE").CopyToDataTable(oDTColumnsPerDevExGrid, LoadOption.PreserveChanges)
|
|
|
|
'Dim oDTColumnsPerDevExGrid As DataTable = ClassDatabase.Return_Datatable($"SELECT * FROM TBPM_CONTROL_TABLE WHERE CONTROL_ID = {oControlId} ORDER BY [SEQUENCE]")
|
|
'Dim oColCount = oDTColumnsPerDevExGrid.Rows.Count
|
|
Dim oColValuesfromSource As String()
|
|
LOGGER.Debug($"DevExpressGrid: {oDTColumnsPerDevExGrid.Rows.Count} Columns configured for control {oControlId}.")
|
|
If oDTColumnsPerDevExGrid.Rows.Count >= 1 Then
|
|
Dim oDataSource As DataTable = oMyGridControl.DataSource
|
|
oDataSource.Rows.Clear()
|
|
If IDB_ACTIVE = False Then
|
|
For Each Zeile As Object In oValueFromSource
|
|
LOGGER.Debug($"vektorrow Value {Zeile.ToString}...")
|
|
oColValuesfromSource = Split(Zeile, Delimiter)
|
|
|
|
Select Case oDTColumnsPerDevExGrid.Rows.Count
|
|
Case 1
|
|
oDataSource.Rows.Add(New String() {Zeile.ToString})
|
|
|
|
'dgv.Rows.Add(New String() {Zeile.ToString})
|
|
Case 2
|
|
If oColValuesfromSource.Length = 2 Then
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1)})
|
|
'dgv.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1)})
|
|
Else
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), ""})
|
|
'dgv.Rows.Add(New String() {SpaltenWerte(0), ""})
|
|
End If
|
|
Case 3
|
|
If oColValuesfromSource.Length = 3 Then
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2)})
|
|
'dgv.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), SpaltenWerte(2)})
|
|
ElseIf oColValuesfromSource.Length = 2 Then
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), ""})
|
|
'dgv.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), ""})
|
|
Else
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), "", ""})
|
|
'dgv.Rows.Add(New String() {SpaltenWerte(0), "", ""})
|
|
End If
|
|
Case 4
|
|
If oColValuesfromSource.Length = 4 Then
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), oColValuesfromSource(3)})
|
|
'dgv.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), SpaltenWerte(2), SpaltenWerte(3)})
|
|
ElseIf oColValuesfromSource.Length = 3 Then
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), ""})
|
|
'dgv.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), SpaltenWerte(2), ""})
|
|
ElseIf oColValuesfromSource.Length = 2 Then
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), "", ""})
|
|
'dgv.Rows.Add(New String() {SpaltenWerte(0), SpaltenWerte(1), "", ""})
|
|
Else
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), "", "", ""})
|
|
'dgv.Rows.Add(New String() {SpaltenWerte(0), "", "", ""})
|
|
End If
|
|
|
|
End Select
|
|
Next
|
|
Else
|
|
If omytype = "System.String" Then
|
|
oColValuesfromSource = Split(oValueFromSource.ToString, Delimiter)
|
|
Select Case oColValuesfromSource.Length
|
|
Case 2
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1)})
|
|
Case 3
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2)})
|
|
Case 4
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), oColValuesfromSource(3)})
|
|
End Select
|
|
ElseIf omytype = "System.Data.DataTable" Then
|
|
Dim oMyDatatable As DataTable = oValueFromSource
|
|
For Each oRow As DataRow In oMyDatatable.Rows
|
|
LOGGER.Debug($"IDB ROW Vector {oRow.Item(0).ToString}...")
|
|
oColValuesfromSource = Split(oRow.Item(0).ToString, Delimiter)
|
|
|
|
Select Case oColValuesfromSource.Length
|
|
Case 1
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0)})
|
|
Case 2
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1)})
|
|
Case 3
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2)})
|
|
Case 4
|
|
oDataSource.Rows.Add(New String() {oColValuesfromSource(0), oColValuesfromSource(1), oColValuesfromSource(2), oColValuesfromSource(3)})
|
|
End Select
|
|
|
|
Next
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
Case Else
|
|
'es handelt sich um ein einfaches Vektorfeld mit einem Wert
|
|
Dim oDataSource As DataTable = oMyGridControl.DataSource
|
|
For Each obj As Object In oValueFromSource
|
|
If obj Is Nothing = False Then
|
|
oDataSource.Rows.Add(New String() {obj.ToString})
|
|
'dgv.Rows.Add(New String() {obj.ToString})
|
|
|
|
End If
|
|
|
|
Next
|
|
End Select
|
|
Else
|
|
LOGGER.Warn($"Could not load Devexpress.Grid [{oControl.Name }] as omytype is [{omytype}]!")
|
|
|
|
End If
|
|
|
|
Else
|
|
If first = False Then
|
|
Dim oDataSource As DataTable = oMyGridControl.DataSource
|
|
|
|
If oDataSource.Rows.Count > 0 Then
|
|
oDataSource.Rows.Clear()
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
Try
|
|
'Dim oFilteredDatatable As DataTable = DTGRID_COLUMNS.Clone()
|
|
'Dim oExpression = $"CONTROL_ID = {oControlRow.Item("GUID")}"
|
|
'DTGRID_COLUMNS.Select(oExpression, "SEQUENCE").CopyToDataTable(oFilteredDatatable, LoadOption.PreserveChanges)
|
|
Dim oMyGridView As DevExpress.XtraGrid.Views.Grid.GridView = oMyGridControl.MainView
|
|
oMyGridView.OptionsView.ColumnAutoWidth = False
|
|
'AddHandler oMyGridView.ColumnWidthChanged, AddressOf GridControlColumnWidthChanged
|
|
For Each oRow As DataRow In oDTColumnsPerDevExGrid.Rows
|
|
For Each oActGridColumn As DevExpress.XtraGrid.Columns.GridColumn In oMyGridView.Columns
|
|
Dim oGridDXFieldName = oActGridColumn.FieldName
|
|
Dim GridDXColumnEditName = oActGridColumn.ColumnEditName
|
|
If oRow.Item("SPALTENNAME") = oGridDXFieldName Then
|
|
oActGridColumn.Width = oRow.Item("SPALTENBREITE")
|
|
Exit For
|
|
End If
|
|
|
|
Next
|
|
Next
|
|
Dim i = 0
|
|
|
|
' RestoreDevExpressGridControl_Layout(CURRENT_CLICKED_PROFILE_ID, oControlId, oMyGridView)
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
End If
|
|
Case "System.Windows.Forms.CheckBox"
|
|
LOGGER.Debug("Loading checkbox.")
|
|
oControlType = "CheckBox"
|
|
If oSourceIndexName = "" Then
|
|
MsgBox("Attention wrong configuration:" & vbNewLine & "for control " & oControl.Name & " no INDEX configured!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical, ADDITIONAL_TITLE)
|
|
Exit For
|
|
End If
|
|
If oSourceIndexName Is Nothing = False Then
|
|
|
|
Dim chk As CheckBox = oControl
|
|
|
|
If oLoadIndex = False Or oSourceIndexName = "DD PM-ONLY FOR DISPLAY" Then
|
|
LOGGER.Debug("Indexwert soll nicht geladen werden.")
|
|
Else
|
|
|
|
If oDefaultValue <> String.Empty Then
|
|
Dim result = False
|
|
_CURRENT_INDEX_ARRAY(oCount, 1) = oDefaultValue
|
|
If Boolean.TryParse(oDefaultValue, result) Then
|
|
chk.Checked = result
|
|
Exit Select
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
LOGGER.Debug("Loading Bool-Value from Windream.")
|
|
|
|
If oSourceIndexName.StartsWith("[%VKT") And PROFIL_VEKTORINDEX <> "" Then
|
|
oValueFromSource = ReturnVektor_IndexValue(oSourceIndexName)
|
|
Else
|
|
Try
|
|
LOGGER.Debug($"..Now GetVariableValue({oSourceIndexName})...")
|
|
oValueFromSource = GetVariableValuefromSource(oSourceIndexName, oIDBTyp, oIDBOverride)
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Could not get the windreamValue for CheckboxIndex: {oSourceIndexName} [{ex.Message}]")
|
|
End Try
|
|
|
|
End If
|
|
|
|
|
|
If oValueFromSource Is Nothing Then
|
|
LOGGER.Info(">> Zurückgegebener Wert des Wertes für Checkbox mit Indexname '" & oIndexName & "' ist nothing. Check defaultvalue")
|
|
|
|
chk.Checked = False
|
|
Else
|
|
LOGGER.Debug("Index value loaded: " & oValueFromSource.ToString)
|
|
_CURRENT_INDEX_ARRAY(oCount, 1) = oValueFromSource.ToString
|
|
If oValueFromSource.ToString = "" Then
|
|
LOGGER.Info(">> Versuch, default Value zu laden")
|
|
If oDefaultValue <> String.Empty Then
|
|
Dim result = False
|
|
If Boolean.TryParse(oDefaultValue, result) Then
|
|
LOGGER.Info(">> defaultValue wurde geladen")
|
|
chk.Checked = result
|
|
Else
|
|
chk.Checked = False
|
|
End If
|
|
Else
|
|
LOGGER.Info(">> defaultValue war leer")
|
|
chk.Checked = False
|
|
End If
|
|
Else
|
|
Dim _value
|
|
If oValueFromSource.ToString = "System.Object[]" Then
|
|
LOGGER.Debug("CheckBoxValue with VectorField: " & oSourceIndexName)
|
|
If oValueFromSource.length = 1 Then
|
|
_value = oValueFromSource(0)
|
|
Else '
|
|
LOGGER.Info(" >> Vectorfield " & oSourceIndexName & "' contains more then one value - First value will be used")
|
|
_value = oValueFromSource(0)
|
|
End If
|
|
Else
|
|
LOGGER.Debug("Value is not nothing and also not System.Object[]...")
|
|
_value = oValueFromSource
|
|
End If
|
|
Try
|
|
Select Case CBool(_value)
|
|
Case True
|
|
LOGGER.Info(">> CBool(_value) = True")
|
|
chk.Checked = True
|
|
Case Else
|
|
LOGGER.Info(">> CBool(_value) = False")
|
|
chk.Checked = False
|
|
End Select
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("Unexpected error in CBool(wertWD) - CheckBox: " & ex.Message & vbNewLine & "Wert WD: " & oValueFromSource.ToString, True)
|
|
chk.Checked = False
|
|
End Try
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
Case "DigitalData.Controls.LookupGrid.LookupControl2"
|
|
Try
|
|
Dim oLookup As LookupControl2 = oControl
|
|
oValueFromSource = GetVariableValuefromSource(oSourceIndexName, oIDBTyp, oIDBOverride)
|
|
'Dim oWindreamValue = CURRENT_WMFILE.GetVariableValue(oSourceIndexName)
|
|
Try
|
|
oLookup.SelectedValues = Nothing
|
|
oLookup.SelectedValues = New List(Of String)
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
If Not IsNothing(oValueFromSource) Then
|
|
Dim oMyType = oValueFromSource.GetType.ToString
|
|
If oMyType.Contains("System.Object") Or oMyType = "System.Data.DataTable" Then
|
|
Dim oArrlist As New List(Of String)
|
|
If IDB_ACTIVE = False Then
|
|
For Each oVectorRow As Object In oValueFromSource
|
|
Dim Ocontent = oVectorRow.ToString
|
|
oArrlist.Add(Ocontent)
|
|
Next
|
|
Else
|
|
Dim myDT As DataTable = oValueFromSource
|
|
For Each oVectorRow As DataRow In myDT.Rows
|
|
Dim Ocontent = oVectorRow.Item(0)
|
|
oArrlist.Add(Ocontent)
|
|
Next
|
|
End If
|
|
|
|
oLookup.SelectedValues = oArrlist
|
|
_CURRENT_INDEX_ARRAY(oCount, 1) = oValueFromSource.ToString
|
|
Else
|
|
Dim oArrlist As New List(Of String)
|
|
oArrlist.Add(oValueFromSource.ToString)
|
|
oLookup.SelectedValues = oArrlist
|
|
_CURRENT_INDEX_ARRAY(oCount, 1) = oValueFromSource.ToString
|
|
End If
|
|
Else
|
|
If Not IsNothing(oLookup.SelectedValues) Then
|
|
If oLookup.SelectedValues.Count = 0 And oDefaultValue <> String.Empty Then
|
|
Dim oValues As List(Of String) = oDefaultValue.Split(",").ToList()
|
|
oLookup.SelectedValues = oValues
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info(" - Unvorhergesehener Unexpected error in AddVorschlag_ComboBox - Indexname: " & oIndexName & " - Fehler: " & vbNewLine & ex.Message)
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Unexpected error in Add LookupControl2:")
|
|
End Try
|
|
|
|
Case "System.Windows.Forms.DateTimePicker"
|
|
oControlType = "DateTimePicker"
|
|
Dim DTP As DateTimePicker = oControl
|
|
If oSourceIndexName = "" Then
|
|
MsgBox("Attention wrong configuration:" & vbNewLine & "for control " & oControl.Name & " no INDEX configured!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical, ADDITIONAL_TITLE)
|
|
Exit For
|
|
End If
|
|
If oSourceIndexName Is Nothing = False Then
|
|
|
|
Try
|
|
If oSourceIndexName.StartsWith("[%VKT") And PROFIL_VEKTORINDEX <> "" Then
|
|
LOGGER.Debug("DATE über PM-Vektor holen")
|
|
|
|
oValueFromSource = ReturnVektor_IndexValue(oSourceIndexName)
|
|
LOGGER.Info(">> DTP is """)
|
|
Else
|
|
oValueFromSource = GetVariableValuefromSource(oSourceIndexName, oIDBTyp, oIDBOverride)
|
|
|
|
End If
|
|
|
|
If oValueFromSource Is Nothing Then oValueFromSource = ""
|
|
Dim tempdate As Date = CDate("01.01.0001 00:00:00")
|
|
If oValueFromSource.ToString.Length > 0 Then
|
|
Try
|
|
tempdate = CDate(oValueFromSource)
|
|
LOGGER.Debug("DATE konnte umgewandelt werden")
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
ValueDTP = tempdate
|
|
LOGGER.Debug("DATE wurde auf heute gesetzt")
|
|
End Try
|
|
DTP.Text = tempdate
|
|
Else
|
|
LOGGER.Debug("DATE ist leer")
|
|
ValueDTP = tempdate
|
|
DTP.Text = tempdate
|
|
End If
|
|
_CURRENT_INDEX_ARRAY(oCount, 1) = oValueFromSource.ToString
|
|
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
errormessage = "Unvorhergesehener Fehler bei DTP: " & vbNewLine & ex.Message
|
|
|
|
LOGGER.Info("Unexpected error in FillIndex DTP: " & ex.Message & vbNewLine & "Wert WD: " & oValueFromSource.ToString & vbNewLine & "Indexname: " & oSourceIndexName, True)
|
|
frmError.ShowDialog()
|
|
LOGGER.Info("Unexpected error in FillIndex DTP: " & ex.Message, True)
|
|
End Try
|
|
|
|
|
|
|
|
|
|
End If
|
|
'Case Else
|
|
' MsgBox(Type)
|
|
End Select
|
|
oCount += 1
|
|
Next
|
|
' set_foreground()
|
|
If first_control Is Nothing = False Then first_control.Focus()
|
|
Try
|
|
For Each oRow As DataRow In DTGRID_COLUMNS_TEXTBOX.Rows
|
|
Dim oDEPENDING_GUID = oRow.Item("CONTROL_ID")
|
|
Dim oDEPENDING_COLUMN = oRow.Item("SPALTENNAME")
|
|
Dim oSqlCommand = oRow.Item("SQL_COMMAND")
|
|
oSqlCommand = clsPatterns.ReplaceAllValues(oSqlCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
|
|
|
|
Try
|
|
Dim oDTDEPENDING_RESULT As DataTable = ClassDatabase.Return_Datatable(oSqlCommand)
|
|
If Not IsNothing(oDTDEPENDING_RESULT) Then
|
|
For Each oControl As Control In pnldesigner.Controls
|
|
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_GUID Then
|
|
ClassControlCreator.GridTables.Add(oDEPENDING_COLUMN, oDTDEPENDING_RESULT)
|
|
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Unexpected error in creating dropdown for oDEPENDING_GUID {oDEPENDING_GUID} an Column {oDEPENDING_COLUMN} " & ex.Message)
|
|
|
|
End Try
|
|
Next
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Unexpected error in creating dropdown for Grid: " & ex.Message)
|
|
End Try
|
|
|
|
|
|
|
|
If IDB_ACTIVE = True Then
|
|
Try
|
|
Dim oSQL = $"select Attribut, TERM_VALUE from VWIDB_VALUE_TEXT WHERE LANG_CODE = '{USER_LANGUAGE}' AND IDB_OBJ_ID = {CURRENT_DOC_ID} AND Attribut in ('PM_Info1','PM_Info2') ORDER BY Attribut"
|
|
Dim oDTINFO As DataTable = ClassDatabase.Return_Datatable_ConStr(oSQL, CONNECTION_STRING_IDB)
|
|
If Not IsNothing(oDTINFO) Then
|
|
Dim oColor As System.Drawing.Color
|
|
If oDTINFO.Rows.Count > 0 Then
|
|
Dim oColumns As String()
|
|
If oDTINFO.Rows.Count = 1 Then
|
|
oColumns = Split(oDTINFO.Rows(0).Item("TERM_VALUE"), "#")
|
|
If oColumns.Length = 1 Then
|
|
bsiInfo1.Caption = oDTINFO.Rows(0).Item("TERM_VALUE")
|
|
ElseIf oColumns.Length = 2 Then
|
|
bsiInfo1.Caption = oColumns(0)
|
|
Try
|
|
oColor = System.Drawing.Color.FromName(oColumns(1))
|
|
bsiInfo1.ItemAppearance.Normal.ForeColor = oColor
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
End If
|
|
|
|
bsiInfo2.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
|
ElseIf oDTINFO.Rows.Count = 2 Then
|
|
'ITEM 1
|
|
oColumns = Split(oDTINFO.Rows(0).Item("TERM_VALUE"), "#")
|
|
If oColumns.Length = 1 Then
|
|
bsiInfo1.Caption = oDTINFO.Rows(0).Item("TERM_VALUE")
|
|
ElseIf oColumns.Length = 2 Then
|
|
bsiInfo1.Caption = oColumns(0)
|
|
Try
|
|
oColor = System.Drawing.Color.FromName(oColumns(1))
|
|
bsiInfo1.ItemAppearance.Normal.ForeColor = oColor
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
End If
|
|
'ITEM 1
|
|
oColumns = Split(oDTINFO.Rows(1).Item("TERM_VALUE"), "#")
|
|
If oColumns.Length = 1 Then
|
|
bsiInfo2.Caption = oDTINFO.Rows(1).Item("TERM_VALUE")
|
|
ElseIf oColumns.Length = 2 Then
|
|
bsiInfo2.Caption = oColumns(0)
|
|
Try
|
|
oColor = System.Drawing.Color.FromName(oColumns(1))
|
|
bsiInfo2.ItemAppearance.Normal.ForeColor = oColor
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
End If
|
|
bsiInfo2.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
|
End If
|
|
RibbonPageGroup2.Visible = True
|
|
Else
|
|
LOGGER.Debug($"No PM_Info-Configuration!!")
|
|
RibbonPageGroup2.Visible = False
|
|
End If
|
|
Else
|
|
LOGGER.Warn($"oDTINFO is nothing!!")
|
|
RibbonPageGroup2.Visible = False
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Unexpected error in Setting PMINFO - ERROR: {ex.Message}")
|
|
RibbonPageGroup2.Visible = False
|
|
End Try
|
|
|
|
Else
|
|
RibbonPageGroup2.Visible = False
|
|
End If
|
|
|
|
|
|
'Flag setzen das Indexe geladen sind
|
|
_Indexe_Loaded = True
|
|
Load_Additional_Searches()
|
|
Else
|
|
MsgBox("Für dieses Profil wurde noch keine Eingabemaske definiert!" & vbNewLine & "Informieren Sie Ihren PM-Administrator!" & vbNewLine & "Das Fenster wird geschlossen!", MsgBoxStyle.Exclamation, "Achtung:")
|
|
Me.Close()
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Unexpected error in FillIndexValues: [{oControName} -TYPE: {oControlType}-INDEXNAME: {oIndexName}] ERROR: {ex.Message}")
|
|
errormessage = "Unvorhergesehener Fehler bei FillIndexValues:" & vbNewLine & ex.Message & vbNewLine & "Check Logfile"
|
|
My.Settings.Save()
|
|
frmError.ShowDialog()
|
|
End Try
|
|
|
|
|
|
End Sub
|
|
Private Sub frmValidation_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown
|
|
' Refresh_FileList()
|
|
Load_Next_Document(True)
|
|
_dependingControl_in_action = False
|
|
_dependingColumn_in_action = False
|
|
BringToFront()
|
|
FormLoaded = True
|
|
LOGGER.Debug("frmValidation_Shown finished!")
|
|
End Sub
|
|
Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click
|
|
btnSave.Enabled = False
|
|
Finish_WFStep()
|
|
btnSave.Enabled = True
|
|
End Sub
|
|
Private Function btnFinish_continue()
|
|
Try
|
|
Dim oSQL = PROFIL_FINISH_SQL
|
|
oSQL = clsPatterns.ReplaceAllValues(oSQL, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
|
|
Dim oDT_ACTIONS As DataTable = ClassDatabase.Return_Datatable(oSQL)
|
|
If IsNothing(oDT_ACTIONS) Then
|
|
MsgBox("Something went wrong in btnFinish_continue - Please check Your log and inform the workflow-team!", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
|
|
Return False
|
|
ElseIf oDT_ACTIONS.Rows.Count = 0 Then
|
|
MsgBox("Something went wrong in btnFinish_continue (No row) - Please check Your log and inform the workflow-team!", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
|
|
Return False
|
|
End If
|
|
'Select Case'Override' as Action_Type, 'Sind Sie sicher dass Sie nicht zuständig sind?' as Question,'Nicht Zuständig' as Caption,'Red' as Color
|
|
Dim oMsgType
|
|
Dim oQuestion
|
|
Dim oTitle
|
|
|
|
Try
|
|
oMsgType = oDT_ACTIONS?.Rows(0).Item("MsgType")
|
|
Catch ex As Exception
|
|
oMsgType = ""
|
|
End Try
|
|
|
|
Try
|
|
oQuestion = oDT_ACTIONS?.Rows(0).Item("Question")
|
|
Catch ex As Exception
|
|
oQuestion = ""
|
|
End Try
|
|
Try
|
|
oTitle = oDT_ACTIONS?.Rows(0).Item("Title")
|
|
Catch ex As Exception
|
|
oTitle = ""
|
|
End Try
|
|
|
|
Select Case oMsgType.ToString.ToUpper
|
|
|
|
Case "MsgboxResult".ToUpper
|
|
If oQuestion <> "" Then
|
|
Dim result As MsgBoxResult
|
|
result = MessageBox.Show(oQuestion, oTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
|
|
If result = MsgBoxResult.Yes Then
|
|
Return True
|
|
Else
|
|
Return False
|
|
End If
|
|
End If
|
|
Case "Msgbox".ToUpper
|
|
MessageBox.Show(oQuestion, oTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
|
|
Return True
|
|
Case "Continue".ToUpper
|
|
Return True
|
|
Case Else
|
|
MsgBox($"No valid action provided [{oMsgType}] in btnFinishContinue - Check Your log and inform the WorkflowTeam", MsgBoxStyle.Exclamation, "")
|
|
LOGGER.Warn($"No valid action provided [{oMsgType}] in btnFinishContinue - Check Your log and inform the WorkflowTeam")
|
|
Return False
|
|
End Select
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("An unhandled exeception occured in btnFinish Procedure! Please inform Your WorkflowTeam and Check Your log!" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
Return False
|
|
End Try
|
|
End Function
|
|
Sub Finish_WFStep()
|
|
btnSave.Enabled = False
|
|
LOGGER.Debug("Abschluss für Dok: " & CURRENT_DOC_PATH & " gestartet")
|
|
ItemWorked = True
|
|
Dim oErrorOcurred As Boolean = False
|
|
If OverrideAll = False Then
|
|
'Eingaben auf Form überprüfen
|
|
If Check_UpdateIndexe() = False Then
|
|
If PROFIL_FINISH_SQL <> String.Empty Then
|
|
If btnFinish_continue() = False Then
|
|
Exit Sub
|
|
|
|
End If
|
|
End If
|
|
|
|
'lblerror.Visible = False
|
|
Try
|
|
TBPM_PROFILE_FINAL_INDEXINGTableAdapter.Fill(FinalIndexDataSet.TBPM_PROFILE_FINAL_INDEXING, CURRENT_ProfilName)
|
|
Dim oDTFinalIndexes As DataTable = FinalIndexDataSet.TBPM_PROFILE_FINAL_INDEXING
|
|
If oDTFinalIndexes?.Rows.Count > 0 Then
|
|
'Jetzt finale Indexe setzen
|
|
LOGGER.Debug("FINAL INDEXING STARTING...")
|
|
For Each oFinalIndexRow As DataRow In oDTFinalIndexes.Rows
|
|
Dim oValue As String = oFinalIndexRow.Item("VALUE").ToString
|
|
Dim oIndexType = 0
|
|
If IDB_ACTIVE = False Then
|
|
oIndexType = WINDREAM.GetTypeOfIndex(oFinalIndexRow.Item("INDEXNAME"))
|
|
End If
|
|
If oValue.ToUpper = "SQL-Command".ToUpper Then '###### Indexierung mit variablen SQL ###
|
|
LOGGER.Debug("Indexing wih dynamic sql...")
|
|
Dim oSQLCommand = oFinalIndexRow.Item("SQL_COMMAND")
|
|
|
|
oSQLCommand = clsPatterns.ReplaceAllValues(oSQLCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
|
|
If IsNothing(oSQLCommand) Then
|
|
errormessage = "Error while replacing Values in final indexing - Check the log"
|
|
My.Settings.Save()
|
|
frmError.ShowDialog()
|
|
oErrorOcurred = True
|
|
ItemWorked = False
|
|
End If
|
|
If Not IsNothing(oSQLCommand) Then
|
|
Dim dynamic_value = ClassDatabase.Execute_Scalar(oSQLCommand, CONNECTION_STRING, True)
|
|
|
|
If Not IsNothing(dynamic_value) Then
|
|
LOGGER.Debug("DYNAMIC VALUE IS: " & dynamic_value.ToString)
|
|
oValue = dynamic_value
|
|
Else
|
|
LOGGER.Info("ATTENTION: DYNAMIC VALUE IS NOTHING!")
|
|
End If
|
|
End If
|
|
|
|
Else
|
|
If oValue.StartsWith("v") Then
|
|
Select Case oFinalIndexRow.Item("VALUE").ToString
|
|
Case "vDate"
|
|
oValue = Now.ToShortDateString
|
|
Case "vUserName"
|
|
oValue = USER_USERNAME
|
|
Case Else
|
|
oValue = oFinalIndexRow.Item("VALUE")
|
|
End Select
|
|
End If
|
|
End If
|
|
If oErrorOcurred Then
|
|
Exit For
|
|
End If
|
|
Dim oResult() As String
|
|
ReDim Preserve oResult(0)
|
|
oResult(0) = oValue
|
|
|
|
LOGGER.Debug($"oIndexType {oIndexType.ToString}")
|
|
If oIndexType > 4000 And oIndexType < 5000 Then
|
|
'If dr.Item("INDEXNAME").ToString.StartsWith("[%VKT") Then
|
|
' Dim PM_String = Return_PM_VEKTOR(value, dr.Item("INDEXNAME"))
|
|
'Hier muss nun separat as Vektorfeld indexiert werden
|
|
If WMIndexVectofield(oValue, oFinalIndexRow.Item("INDEXNAME"), oFinalIndexRow.Item("PREVENT_DUPLICATES"), oFinalIndexRow.Item("ALLOW_NEW_VALUES")) = False Then
|
|
LOGGER.Debug("FINALER Vektorindex '" & oFinalIndexRow.Item("INDEXNAME").ToString & "' WURDE ERFOLGREICH GESETZT")
|
|
Else
|
|
errormessage = "Error in final indexing:" & vbNewLine & idxerr_message
|
|
My.Settings.Save()
|
|
frmError.ShowDialog()
|
|
oErrorOcurred = True
|
|
ItemWorked = False
|
|
End If
|
|
Else
|
|
LOGGER.Debug("Now the final indexing...")
|
|
Dim oFIResult As Boolean = False
|
|
If IDB_ACTIVE = False Then
|
|
If Indexiere_File(CURRENT_WMFILE, oFinalIndexRow.Item("INDEXNAME"), oResult) = True Then
|
|
oFIResult = True
|
|
LOGGER.Debug("FINALER INDEX '" & oFinalIndexRow.Item("INDEXNAME") & "' WURDE ERFOLGREICH GESETZT")
|
|
|
|
'Nun das Logging
|
|
If PROFIL_LOGINDEX <> "" Then
|
|
Dim logstr = Return_LOGString(oValue, "DDFINALINDEX", oFinalIndexRow.Item("INDEXNAME"))
|
|
WMIndexVectofield(logstr, PROFIL_LOGINDEX)
|
|
End If
|
|
End If
|
|
Else
|
|
If IDBData.SetVariableValue(oFinalIndexRow.Item("INDEXNAME"), oValue) = True Then
|
|
oFIResult = True
|
|
LOGGER.Debug("Final index IDB '" & oFinalIndexRow.Item("INDEXNAME") & "' was updated.")
|
|
End If
|
|
End If
|
|
If oFIResult = False Then
|
|
errormessage = "Error in final indexing:" & vbNewLine & idxerr_message
|
|
My.Settings.Save()
|
|
frmError.ShowDialog()
|
|
oErrorOcurred = True
|
|
ItemWorked = False
|
|
End If
|
|
|
|
End If
|
|
If oErrorOcurred = True Then
|
|
ItemWorked = False
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
''Wenn kein Fehler nach der finalen Indexierung gesetzt wurde
|
|
If Override = True And Override_SQLCommand <> "" Then
|
|
ClassDatabase.Execute_non_Query(Override_SQLCommand)
|
|
End If
|
|
If oErrorOcurred = False Then
|
|
|
|
'TBPM_PROFILE_FILESTableAdapter.CmdSETWORK(False, "", Document_ID)
|
|
''Das Dokument
|
|
'TBPM_PROFILE_FILESTableAdapter.CmdSetEdit(Document_ID)
|
|
Dim WORK_HISTORY_ENTRY = Nothing
|
|
|
|
Try
|
|
WORK_HISTORY_ENTRY = CURRENT_DT_PROFILE.Rows(0).Item("WORK_HISTORY_ENTRY")
|
|
If IsDBNull(WORK_HISTORY_ENTRY) Then
|
|
WORK_HISTORY_ENTRY = Nothing
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
WORK_HISTORY_ENTRY = Nothing
|
|
End Try
|
|
|
|
|
|
If Not IsNothing(WORK_HISTORY_ENTRY) Then
|
|
If WORK_HISTORY_ENTRY <> String.Empty Then
|
|
Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
|
' einen Regulären Ausdruck laden
|
|
Dim regulärerAusdruck As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex(preg)
|
|
' die Vorkommen im SQL-String auslesen
|
|
Dim elemente As System.Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(WORK_HISTORY_ENTRY)
|
|
'####
|
|
' alle Vorkommen innerhalbd er Namenkonvention durchlaufen
|
|
For Each element As System.Text.RegularExpressions.Match In elemente
|
|
Try
|
|
LOGGER.Debug("element in RegeX WORK_HISTORY_ENTRY: " & element.Value)
|
|
Dim CTRL_ID = element.Value.Substring(2, element.Value.Length - 3)
|
|
CTRL_ID = CTRL_ID.Replace("CTRLID", "")
|
|
Dim value_from_control
|
|
If IsNumeric(CTRL_ID) Then
|
|
For Each oControl As Control In Me.pnldesigner.Controls
|
|
Try
|
|
If IsNothing(DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid) Then
|
|
Continue For
|
|
End If
|
|
Catch ex As Exception
|
|
Continue For
|
|
End Try
|
|
|
|
If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = CTRL_ID Then
|
|
'######
|
|
Dim Type As String = oControl.GetType.ToString
|
|
Select Case Type
|
|
Case "System.Windows.Forms.TextBox"
|
|
Try
|
|
value_from_control = oControl.Text
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
value_from_control = String.Empty
|
|
End Try
|
|
|
|
Case "System.Windows.Forms.ComboBox"
|
|
Dim cmb As ComboBox = oControl
|
|
Try
|
|
value_from_control = cmb.Text
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
value_from_control = String.Empty
|
|
End Try
|
|
Case "System.Windows.Forms.DateTimePicker"
|
|
Dim dtp As DateTimePicker = oControl
|
|
Try
|
|
value_from_control = dtp.Value.ToString
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
value_from_control = String.Empty
|
|
End Try
|
|
|
|
Case "System.Windows.Forms.CheckBox"
|
|
Dim chk As CheckBox = oControl
|
|
Try
|
|
value_from_control = chk.Checked
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
value_from_control = String.Empty
|
|
End Try
|
|
End Select
|
|
|
|
End If
|
|
Next
|
|
End If
|
|
|
|
If Not IsNothing(value_from_control) And value_from_control <> String.Empty Then
|
|
WORK_HISTORY_ENTRY = WORK_HISTORY_ENTRY.ToString.Replace(element.Value, value_from_control)
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("Unexpected Error in Checking control values for WORK_HISTORY_ENTRY - ERROR: " & ex.Message)
|
|
End Try
|
|
Next
|
|
If WORK_HISTORY_ENTRY.ToString.Contains("@DATE") Then
|
|
WORK_HISTORY_ENTRY = WORK_HISTORY_ENTRY.ToString.Replace("@DATE", Now.ToShortDateString)
|
|
End If
|
|
If WORK_HISTORY_ENTRY.ToString.Contains("@USERNAME") Then
|
|
WORK_HISTORY_ENTRY = WORK_HISTORY_ENTRY.ToString.Replace("@USERNAME", USER_USERNAME)
|
|
End If
|
|
Else
|
|
WORK_HISTORY_ENTRY = ""
|
|
End If
|
|
End If
|
|
Dim ins = String.Format("INSERT INTO TBPM_FILES_WORK_HISTORY (PROFIL_ID, DOC_ID,WORKED_BY,WORKED_WHERE,STATUS_COMMENT) VALUES ({0},{1},'{2}','{3}','{4}')", CURRENT_ProfilGUID, CURRENT_DOC_ID, USER_USERNAME, Environment.MachineName, WORK_HISTORY_ENTRY)
|
|
ClassDatabase.Execute_non_Query(ins)
|
|
Dim oFIsql As String
|
|
'Close_document_viewer()
|
|
If WMDocPathWindows.ToLower.EndsWith(".pdf") Then
|
|
If Not IsNothing(WORK_HISTORY_ENTRY) Then
|
|
If CBool(CURRENT_DT_PROFILE.Rows(0).Item("ANNOTATE_WORK_HISTORY_ENTRY")) = True Then
|
|
oFIsql = String.Format("SELECT * FROM TBPM_FILES_WORK_HISTORY WHERE GUID = (SELECT MAX(GUID) FROM TBPM_FILES_WORK_HISTORY WHERE PROFIL_ID = {0} AND DOC_ID = {1})", CURRENT_ProfilGUID, CURRENT_DOC_ID)
|
|
Dim DT_ENTRY As DataTable = ClassDatabase.Return_Datatable(oFIsql, True)
|
|
If Not IsNothing(DT_ENTRY) Then
|
|
If DT_ENTRY.Rows.Count = 1 Then
|
|
Dim AnnotationString = DT_ENTRY.Rows(0).Item("WORKED_WHEN") & " " & DT_ENTRY.Rows(0).Item("WORKED_BY") & ": " & DT_ENTRY.Rows(0).Item("STATUS_COMMENT")
|
|
ClassAnnotation.Annotate_PDF("Workflow-State:", AnnotationString, 0, False)
|
|
End If
|
|
End If
|
|
End If
|
|
Dim value = CURRENT_DT_PROFILE.Rows(0).Item("ANNOTATE_ALL_WORK_HISTORY_ENTRIES")
|
|
If CBool(value) = True Then
|
|
oFIsql = String.Format("SELECT * FROM TBPM_FILES_WORK_HISTORY WHERE DOC_ID = {1} ORDER BY GUID", CURRENT_ProfilGUID, CURRENT_DOC_ID)
|
|
Dim DT_ENTRIES As DataTable = ClassDatabase.Return_Datatable(oFIsql, True)
|
|
If Not IsNothing(DT_ENTRIES) Then
|
|
If DT_ENTRIES.Rows.Count > 0 Then
|
|
Dim AnnotationString As String = ""
|
|
For Each rw As DataRow In DT_ENTRIES.Rows
|
|
AnnotationString = AnnotationString & rw.Item("WORKED_WHEN") & " " & rw.Item("WORKED_BY") & ": " & rw.Item("STATUS_COMMENT") & vbNewLine
|
|
Next
|
|
ClassAnnotation.Annotate_PDF("Workflow History:", AnnotationString, 0, False, 10, 40)
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
'wenn Move2Folder aktiviert wurde
|
|
If Move2Folder <> "" Then
|
|
idxerr_message = allgFunk.Move2Folder(WMDocPathWindows, Move2Folder, CURRENT_ProfilGUID, _windream)
|
|
If idxerr_message <> "" Then
|
|
errormessage = "Fehler bei Move2Folder:" & vbNewLine & idxerr_message
|
|
My.Settings.Save()
|
|
frmError.ShowDialog()
|
|
oErrorOcurred = True
|
|
ItemWorked = False
|
|
End If
|
|
End If
|
|
'Validierungsfile löschen wenn vorhanden
|
|
'allgFunk.Delete_xffres(WMDocPathWindows, _windream)
|
|
'LOGGER.Debug("Delete_xffres ausgeführt")
|
|
|
|
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
errormessage = "Unexpected error in Finish:" & ex.Message
|
|
My.Settings.Save()
|
|
frmError.ShowDialog()
|
|
oErrorOcurred = True
|
|
ItemWorked = False
|
|
LOGGER.Info("Unexpected error in Finish: " & ex.Message, True)
|
|
Exit Sub
|
|
End Try
|
|
Else
|
|
'lblerror.Visible = True
|
|
'lblerror.Text = errmessage
|
|
errormessage = oErrorMessage
|
|
frmError.ShowDialog()
|
|
oErrorOcurred = True
|
|
ItemWorked = False
|
|
Exit Sub
|
|
End If
|
|
Else
|
|
LOGGER.Info($"Overriding all in action for DocID: {CURRENT_DOC_ID} - ProfileID: {CURRENT_ProfilGUID}")
|
|
If Override_SQLCommand <> "" Then
|
|
If ClassDatabase.Execute_non_Query(Override_SQLCommand) = False Then
|
|
oErrorOcurred = True
|
|
End If
|
|
End If
|
|
End If
|
|
If oErrorOcurred = True Then
|
|
MsgBox("Unhandled error occured ... please check your log!", MsgBoxStyle.Exclamation, ADDITIONAL_TITLE)
|
|
ItemWorked = False
|
|
Else
|
|
'Das Dokument freigeben und as editiert markieren
|
|
'Dim sql = String.Format("UPDATE TBPM_PROFILE_FILES SET IN_WORK = 0, IN_WORK_WHEN = NULL, WORK_USER = '{0}', EDIT = 1 WHERE GUID = {1}", USER_USERNAME, CURRENT_DOC_GUID)
|
|
'ClassDatabase.Execute_non_Query(sql)
|
|
Anzahl_validierte_Dok += 1
|
|
'tstrlbl_Info.Text = "Anzahl Dateien: " & TBPM_PROFILE_FILESTableAdapter.cmdGet_Anzahl(PROFIL_ID)
|
|
LOGGER.Debug("Validation of document ended successfully!")
|
|
Dim oPROCSQL = $"EXEC PRPM_CHECK_NEXT_WF {CURRENT_DOC_GUID}"
|
|
ClassDatabase.Execute_non_Query(oPROCSQL)
|
|
End If
|
|
|
|
If CURRENT_JUMP_DOC_GUID <> 0 Then
|
|
Me.Close()
|
|
Else
|
|
'Das nächste Dokument laden
|
|
Load_Next_Document(False)
|
|
|
|
' set_foreground()
|
|
If first_control Is Nothing = False Then first_control.Focus()
|
|
End If
|
|
|
|
btnSave.Enabled = True
|
|
End Sub
|
|
Function Check_Missing(control As Control, typ As String)
|
|
Select Case typ
|
|
Case "txt"
|
|
If control.Text = String.Empty Then
|
|
Return True
|
|
End If
|
|
Return False
|
|
End Select
|
|
End Function
|
|
Function Return_PM_VEKTOR(input As String, VKTBezeichner As String)
|
|
Dim PM_String As String
|
|
Try
|
|
Dim Bezeichner As String = VKTBezeichner.Replace("[%VKT", "")
|
|
PM_String = "DD-PM" & Delimiter & Bezeichner & Delimiter & input & Delimiter & USER_USERNAME & Delimiter & Now.ToString
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info(">> error in Return_PM_VEKTOR: " & ex.Message, True)
|
|
PM_String = "DD-PM ERROR: " & ex.Message
|
|
End Try
|
|
Return PM_String
|
|
|
|
End Function
|
|
Function Return_LOGString(input As String, old As String, indexname As String)
|
|
Dim PM_String As String
|
|
Try
|
|
If old = "DDFINALINDEX" Then
|
|
PM_String = $"DD-PMLog-FINAL{Delimiter}{indexname}{Delimiter}{input}{Delimiter}{USER_USERNAME}{Delimiter}{Now.ToString}"
|
|
Else
|
|
PM_String = $"DD-PMLog-CHG{Delimiter}{indexname}{Delimiter}NEW: [{input}] - OLD: [{old}]{Delimiter}{USER_USERNAME}{Delimiter}{Now.ToString}"
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info(">> error in Return_LOGString: " & ex.Message, True)
|
|
PM_String = "DD-PM ERROR: " & ex.Message
|
|
End Try
|
|
Return PM_String
|
|
|
|
End Function
|
|
Private Function WMIndexVectofield(input As String, NameVKTIndex As String, Optional PreventDuplicates As Boolean = False, Optional AllowAddNewValues As Boolean = True, Optional IndexBehaviour As String = "Add")
|
|
Dim oOldValue As Object = CURRENT_WMFILE.GetVariableValue(NameVKTIndex)
|
|
Dim oValueList As New List(Of Object)
|
|
Dim oNewValue As Object()
|
|
Dim oMissing As Boolean = False
|
|
|
|
If oOldValue IsNot Nothing AndAlso TypeOf oOldValue Is Object Then
|
|
|
|
' If new values are allowed, add the old values first
|
|
If AllowAddNewValues Then
|
|
oValueList = DirectCast(oOldValue, Object()).ToList()
|
|
End If
|
|
|
|
' Add the new value
|
|
oValueList.Add(input)
|
|
Else
|
|
' Just add input as the only value
|
|
oValueList.Add(input)
|
|
End If
|
|
|
|
If PreventDuplicates Then
|
|
oValueList = oValueList.
|
|
Distinct().
|
|
ToList()
|
|
End If
|
|
|
|
oNewValue = oValueList.ToArray()
|
|
|
|
If oNewValue.Length > 0 Then
|
|
'Jetzt die Datei indexieren
|
|
If Indexiere_File(CURRENT_WMFILE, NameVKTIndex, oNewValue) = False Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing Vektorfeld '" & NameVKTIndex & "' - ERROR: " & idxerr_message
|
|
End If
|
|
End If
|
|
|
|
Return oMissing
|
|
End Function
|
|
Function DT_FOR_ARRAY(pArr As String()) As DataTable
|
|
Dim odt As New DataTable
|
|
odt.Columns.Add("ID", GetType(Integer))
|
|
odt.Columns.Add("Result", GetType(String))
|
|
Dim N As Integer = odt.Columns("ID").AutoIncrement
|
|
|
|
For Each oStr In pArr
|
|
odt.Rows.Add(N, oStr)
|
|
Next
|
|
Return odt
|
|
End Function
|
|
Function Check_UpdateIndexe()
|
|
Dim oControlName
|
|
Dim oControlId As String
|
|
Try
|
|
Dim oMissing As Boolean = False
|
|
'Jedes Control auf panel durchlaufen
|
|
For Each oControl As Control In Me.pnldesigner.Controls
|
|
'Der input der Box,Cmb muss jedes mal geleert werden
|
|
Dim oMyInput As String = ""
|
|
'Jedes Control in Konfig Tab durchlaufn
|
|
For Each oControlRow As DataRow In DTVWCONTROL_INDEX.Rows
|
|
If oControlRow.Item("CTRL_TYPE") = "LBL" Or oControlRow.Item("CTRL_TYPE") = "LINE" Then
|
|
Continue For
|
|
End If
|
|
|
|
'Den Indexnamen auslesen
|
|
Dim oIndexName As String = oControlRow.Item("INDEX_NAME")
|
|
|
|
Dim oIsRequired As Boolean = CBool(oControlRow.Item("VALIDATION"))
|
|
Dim oSQLCheckCommand As String = IIf(IsDBNull(oControlRow.Item("SQL_UEBERPRUEFUNG")), "", oControlRow.Item("SQL_UEBERPRUEFUNG"))
|
|
Dim oIsReadOnly As Boolean = CBool(oControlRow.Item("READ_ONLY"))
|
|
Dim oControlType As String = oControlRow.Item("CTRL_TYPE")
|
|
Dim oIDBTyp As Integer
|
|
If IDB_ACTIVE Then
|
|
oIDBTyp = oControlRow.Item("IDB_TYP")
|
|
End If
|
|
|
|
oControlId = oControlRow.Item("GUID")
|
|
Dim oRegexMatch As String = NotNull(oControlRow.Item("REGEX_MATCH"), String.Empty)
|
|
Dim oRegexMessage As String = NotNull(oControlRow.Item("REGEX_MESSAGE_DE"), String.Empty)
|
|
oControlName = oControlRow.Item("CTRL_NAME")
|
|
Dim oOVERWRITE_DATA = oControlRow.Item("OVERWRITE_DATA")
|
|
|
|
'Nur wenn der Name der Zeile entspricht und der Index READ_ONLY FALSE ist
|
|
If oControlRow.Item("CTRL_NAME") = oControl.Name And (oIsReadOnly = False Or oSQLCheckCommand <> "") And oIndexName <> "DD PM-ONLY FOR DISPLAY" Then
|
|
LOGGER.Debug("Indexierung für Control (" & oControlId & ") '" & oControlName & "' gestartet. Indexname '" & oIndexName & "'")
|
|
If oIndexName = "" Then
|
|
LOGGER.Info(" >> Indexname is unexpected empty.")
|
|
Continue For
|
|
End If
|
|
Dim Type As String = oControl.GetType.ToString
|
|
Select Case Type
|
|
Case "DigitalData.Controls.LookupGrid.LookupControl2"
|
|
Try
|
|
Dim lookup As LookupControl2 = oControl
|
|
If lookup.SelectedValues.Count = 0 And oIsRequired = True Then
|
|
oMissing = True
|
|
oErrorMessage = $"Kein Auswahl getroffen in LookupGrid '{oControl.Name}'"
|
|
oControl.BackColor = Color.Red
|
|
Exit For
|
|
Else
|
|
|
|
If lookup.MultiSelect = True Then
|
|
Dim Zeilen As Integer = lookup.SelectedValues.Count
|
|
|
|
'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss
|
|
If Zeilen > 0 Then
|
|
Dim ZeilenGrid As Integer = 0
|
|
Dim myVektorArr As String()
|
|
'Jeden Werte des Datagridviews durchlaufen
|
|
For Each value As String In lookup.SelectedValues
|
|
If value Is Nothing = False Then
|
|
'Das Array anpassen
|
|
ReDim Preserve myVektorArr(ZeilenGrid)
|
|
'Den Wert im Array speichern
|
|
myVektorArr(ZeilenGrid) = value
|
|
ZeilenGrid += 1
|
|
End If
|
|
|
|
Next
|
|
If IDB_ACTIVE = False Then
|
|
|
|
If Indexiere_File(CURRENT_WMFILE, oIndexName, myVektorArr) = False Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing von LookupGrid - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
Dim oMyDT = DT_FOR_ARRAY(myVektorArr)
|
|
|
|
If IDBData.SetVariableValue(oIndexName, oMyDT, oOVERWRITE_DATA, oIDBTyp) = False Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing IDB-Object LookupGrid"
|
|
Exit For
|
|
End If
|
|
End If
|
|
Else
|
|
Dim oValues As New List(Of Object) From {String.Empty}
|
|
If IDB_ACTIVE = False Then
|
|
If Indexiere_File(CURRENT_WMFILE, oIndexName, oValues.ToArray) = False Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing von LookupGrid - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
Else
|
|
oMyInput = lookup.SelectedValues.FirstOrDefault()
|
|
If IsNothing(oMyInput) And oIsRequired = True Then
|
|
oMissing = True
|
|
oErrorMessage = $"Could not get FirstOrDefault-Value of LookUpGrid! - LookUPGridName: {lookup.Name}"
|
|
Exit For
|
|
ElseIf IsNothing(oMyInput) And oIsRequired = False Then
|
|
Continue For
|
|
End If
|
|
'den aktuellen Wert in windream auslesen
|
|
Dim oValueFromObject
|
|
|
|
If oIndexName.StartsWith("[%VKT") Then
|
|
oValueFromObject = ReturnVektor_IndexValue(oIndexName)
|
|
Else
|
|
oValueFromObject = GetVariableValuefromSource(oIndexName, oIDBTyp)
|
|
Dim oValueIsIndifferent As Boolean = False
|
|
If Not IsNothing(oValueFromObject) Then
|
|
|
|
If IDB_ACTIVE = False Then
|
|
If oValueFromObject.ToString = "System.Object[]" Then
|
|
If oValueFromObject.Length = 1 Then
|
|
oValueFromObject = oValueFromObject(0)
|
|
Else '
|
|
LOGGER.Info(" >> Vectorfield " & oIndexName & "' contains more then one value - First value will be used")
|
|
oValueFromObject = oValueFromObject(0)
|
|
End If
|
|
End If
|
|
End If
|
|
Else
|
|
oValueFromObject = ""
|
|
End If
|
|
|
|
If IsNothing(oValueFromObject) Then
|
|
LOGGER.Debug($"CheckUpdateIndex.LookUpGrid: oValueFromObject is NOTHING!")
|
|
oValueIsIndifferent = True
|
|
End If
|
|
If oValueIsIndifferent = False Then
|
|
If IsDBNull(oValueFromObject) Then
|
|
LOGGER.Debug($"CheckUpdateIndex.LookUpGrid: oValueFromObject is DBNULL!")
|
|
oValueIsIndifferent = True
|
|
End If
|
|
End If
|
|
Dim oValueSourceIsDifferent As Boolean = False
|
|
If oValueIsIndifferent = False Then
|
|
LOGGER.Debug($"CheckUpdateIndex.LookUpGrid: oValueFromObject is [{oValueFromObject}]")
|
|
Try
|
|
If oValueFromObject <> oMyInput Then
|
|
oValueSourceIsDifferent = True
|
|
LOGGER.Debug($"CheckUpdateIndex.LookUpGrid: There is a difference between oValueFromObject and [{oValueFromObject}]")
|
|
End If
|
|
Catch ex As Exception
|
|
oValueSourceIsDifferent = True
|
|
LOGGER.Debug($"oValueFromObject <> oMyInput not possible as one object might be a multiple row object")
|
|
End Try
|
|
|
|
Else
|
|
|
|
End If
|
|
|
|
'wenn Wert in Windream <> der Eingabe darf indexiert werden
|
|
'IsNothing(oValueFromObject) Or oValueFromObject <> oMyInput
|
|
If (oValueIsIndifferent = True Or oValueSourceIsDifferent = True) Then
|
|
'Wenn der Wert in ein Vektorfeld geschrieben wird
|
|
If oIndexName.StartsWith("[%VKT") Then
|
|
oMyInput = Return_PM_VEKTOR(oMyInput, oIndexName)
|
|
'Hier muss nun separat as Vektorfeld indexiert werden
|
|
If WMIndexVectofield(oMyInput, PROFIL_VEKTORINDEX) = True Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing Textbox as VEKTOR - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
If IDB_ACTIVE = False Then
|
|
Dim result() As String
|
|
ReDim Preserve result(0)
|
|
result(0) = oMyInput
|
|
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing Textbox - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
If IDBData.SetVariableValue(oIndexName, oMyInput) = False Then
|
|
Exit For
|
|
End If
|
|
End If
|
|
If IDB_ACTIVE = False Then
|
|
If PROFIL_LOGINDEX <> "" Then
|
|
Dim oLogStr = Return_LOGString(oMyInput, oValueFromObject, oIndexName)
|
|
WMIndexVectofield(oLogStr, PROFIL_LOGINDEX)
|
|
'Else
|
|
' IDBData.SetVariableValue(PROFIL_LOGINDEX, oLogStr)
|
|
End If
|
|
End If
|
|
'Nun das Logging
|
|
|
|
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
|
|
End Try
|
|
|
|
Case "System.Windows.Forms.TextBox"
|
|
Try
|
|
Dim oWrongInputMessage = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.WrongInputControl")
|
|
If oRegexMatch <> String.Empty AndAlso Not Regex.IsMatch(oControl.Text, oRegexMatch) Then
|
|
oMissing = True
|
|
|
|
oErrorMessage = oWrongInputMessage & " textbox '" & oControl.Name & "'"
|
|
|
|
|
|
If oRegexMessage <> String.Empty Then
|
|
oErrorMessage &= ":" & vbCrLf & oRegexMessage
|
|
End If
|
|
|
|
oControl.BackColor = Color.Red
|
|
Exit For
|
|
End If
|
|
|
|
'as erstes überprüfen ob überhaupt etwas eingetragen worden ist
|
|
If Check_Missing(oControl, "txt") = True And oIsRequired = True Then 'NICHTS EINGETRAGEN
|
|
oMissing = True
|
|
oErrorMessage = oWrongInputMessage & " textbox '" & oControl.Name & "'"
|
|
|
|
oControl.BackColor = Color.Red
|
|
Exit For
|
|
Else
|
|
oMyInput = oControl.Text
|
|
'den aktuellen Wert in windream auslesen
|
|
Dim oSourceValue = GetVariableValuefromSource(oIndexName, oIDBTyp)
|
|
|
|
|
|
If oIndexName.StartsWith("[%VKT") Then
|
|
oSourceValue = ReturnVektor_IndexValue(oIndexName)
|
|
Else
|
|
'wertWD = CURRENT_WMFILE.GetVariableValue(oIndexName)
|
|
If Not IsNothing(oSourceValue) Then
|
|
If oSourceValue.ToString = "System.Object[]" Then
|
|
If oSourceValue.Length = 1 Then
|
|
oSourceValue = oSourceValue(0)
|
|
Else '
|
|
LOGGER.Info(" >> Vectorfield " & oIndexName & "' contains more then one value - First value will be used")
|
|
oSourceValue = oSourceValue(0)
|
|
End If
|
|
End If
|
|
Else
|
|
oSourceValue = ""
|
|
End If
|
|
End If
|
|
Dim oSetValue As Boolean = False
|
|
If IsDBNull(oSourceValue) Then
|
|
oSetValue = True
|
|
End If
|
|
If oSetValue = False Then
|
|
If IsNothing(oSourceValue) Then
|
|
oSetValue = True
|
|
End If
|
|
End If
|
|
If oSetValue = False Then
|
|
If oSourceValue <> oMyInput Then
|
|
oSetValue = True
|
|
End If
|
|
End If
|
|
'wenn Wert in Windream <> der Eingabe darf indexiert werden
|
|
If oSetValue = True Then
|
|
'Wenn der Wert in ein Vektorfeld geschrieben wird
|
|
If oIndexName.StartsWith("[%VKT") Then
|
|
oMyInput = Return_PM_VEKTOR(oMyInput, oIndexName)
|
|
'Hier muss nun separat as Vektorfeld indexiert werden
|
|
If WMIndexVectofield(oMyInput, PROFIL_VEKTORINDEX) = True Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing textbox as VEKTOR - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
If IDB_ACTIVE = False Then
|
|
Dim result() As String
|
|
ReDim Preserve result(0)
|
|
result(0) = oMyInput
|
|
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing Textbox - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
If IDBData.SetVariableValue(oIndexName, oMyInput) = False Then
|
|
Exit For
|
|
End If
|
|
End If
|
|
If IDB_ACTIVE = False Then
|
|
If PROFIL_LOGINDEX <> "" Then
|
|
Dim oMyLogString = Return_LOGString(oMyInput, oSourceValue, oIndexName)
|
|
WMIndexVectofield(oMyLogString, PROFIL_LOGINDEX)
|
|
'Else
|
|
'IDBData.SetVariableValue(PROFIL_LOGINDEX, oMyLogString)
|
|
|
|
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
oErrorMessage = "Unexpected error in Check_UpdateIndexe TextBox '" & oControl.Name & "' - Check the log"
|
|
LOGGER.Error(ex)
|
|
Dim st As New StackTrace(True)
|
|
st = New StackTrace(ex, True)
|
|
LOGGER.Warn("Unexpected error in Check_UpdateIndexe TextBox :" & ex.Message, True)
|
|
Return True
|
|
End Try
|
|
|
|
Case "System.Windows.Forms.ComboBox"
|
|
Try
|
|
LOGGER.Debug($"Working on Combobox...")
|
|
Dim cmb As ComboBox = oControl
|
|
'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss
|
|
If cmb.SelectedIndex = -1 And oIsRequired = True Then
|
|
oMissing = True
|
|
oErrorMessage = "Please Choose an entry out of ComboBox '" & cmb.Name & "'"
|
|
Exit For
|
|
'ElseIf cmb.SelectedIndex <> -1 Then
|
|
Else 'Änderung 28.08.2018: Ein leerer Wert in der Combobox wird in den Index geschrieben
|
|
oMyInput = cmb.Text
|
|
LOGGER.Debug($"inputvalue Combobox: {cmb.Text}")
|
|
Dim oWMValue
|
|
'den aktuellen Wert in windream auslesen
|
|
If oIndexName.StartsWith("[%VKT") Then
|
|
oWMValue = ReturnVektor_IndexValue(oIndexName)
|
|
Else
|
|
oWMValue = GetVariableValuefromSource(oIndexName, oIDBTyp)
|
|
End If
|
|
LOGGER.Debug($"Got a WMValue...")
|
|
If IsNothing(oWMValue) Then
|
|
LOGGER.Debug($"WMValue is nothing...Value EmptyString will be used")
|
|
oWMValue = String.Empty
|
|
End If
|
|
Dim oIndexType As String = "Index"
|
|
Try
|
|
If oWMValue.ToString = "System.Object[]" Then
|
|
oIndexType = "Vector"
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Debug($"Exception while oWMValue.ToString = System.Object[]...")
|
|
End Try
|
|
If oIndexType = "Vector" Then
|
|
LOGGER.Debug($"Control with ID{oControlId} is a vectorfield...")
|
|
If oWMValue.Length = 1 Then
|
|
oWMValue = oWMValue(0).ToString
|
|
Else '
|
|
LOGGER.Info(" >> Vectorfield " & oIndexName & "' contains more then one value - First value will be used")
|
|
oWMValue = oWMValue(0).ToString
|
|
End If
|
|
Else
|
|
LOGGER.Debug($"WMValue is a regular item...")
|
|
Dim oitsadifference As Boolean = False
|
|
Try
|
|
If oWMValue.ToString <> oMyInput.ToString Then
|
|
oitsadifference = True
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Could not convert the WMValue of Control with ID{oControlId}...")
|
|
LOGGER.Error(ex.Message)
|
|
oitsadifference = True
|
|
End Try
|
|
'wenn Wert in Windream <> der Eingabe darf indexiert werden
|
|
If oitsadifference = True Then
|
|
LOGGER.Debug($"Index with ID{oControlId} will now be indexed...")
|
|
'Wenn der Wert in ein Vektorfeld geschrieben wird
|
|
If oIndexName.StartsWith("[%VKT") Then
|
|
oMyInput = Return_PM_VEKTOR(oMyInput, oIndexName)
|
|
'Hier muss nun separat as Vektorfeld indexiert werden
|
|
If WMIndexVectofield(oMyInput, PROFIL_VEKTORINDEX) = True Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing Combobox as VEKTOR - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
If IDB_ACTIVE = False Then
|
|
Dim result() As String
|
|
ReDim Preserve result(0)
|
|
result(0) = oMyInput
|
|
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
|
|
cmb.DroppedDown = True
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing Combobox - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
If IDBData.SetVariableValue(oIndexName, oMyInput) = False Then
|
|
cmb.DroppedDown = True
|
|
oMissing = True
|
|
oErrorMessage = "Error indexing combobox idb"
|
|
Exit For
|
|
End If
|
|
End If
|
|
If IDB_ACTIVE = False Then
|
|
If PROFIL_LOGINDEX <> "" Then
|
|
Dim ologStr = Return_LOGString(oMyInput, oWMValue, oIndexName)
|
|
WMIndexVectofield(ologStr, PROFIL_LOGINDEX)
|
|
'Else
|
|
'IDBData.SetVariableValue(PROFIL_LOGINDEX, ologStr)
|
|
End If
|
|
|
|
End If
|
|
'Nun das Logging
|
|
|
|
End If
|
|
Else
|
|
LOGGER.Debug($"oitsadifference = False...Index with ID{oControlId} will not be indexed...")
|
|
'Wenn der Wert in ein Vektorfeld geschrieben wird
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
Dim st As New StackTrace(True)
|
|
st = New StackTrace(ex, True)
|
|
MsgBox($"Unexpected error in Check_UpdateIndexe Combobox : ID{oControlId} " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Error:")
|
|
LOGGER.Info($"Unexpected error in Check_UpdateIndexe Combobox : ID{oControlId}" & ex.Message)
|
|
Return True
|
|
End Try
|
|
|
|
Case "System.Windows.Forms.DateTimePicker"
|
|
Dim dtp As DateTimePicker = oControl
|
|
'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss
|
|
If oIsRequired = True And dtp.Value.ToString = String.Empty Then
|
|
oMissing = True
|
|
oErrorMessage = "Please Choose DateValue for field'" & dtp.Name & "'"
|
|
Exit For
|
|
ElseIf dtp.Value.ToString <> "01.01.0001 00:00:00" Then
|
|
oMyInput = CDate(dtp.Value)
|
|
'den aktuellen Wert in windream auslesen
|
|
' Dim wertWD As String = CURRENT_WMFILE.GetVariableValue(_IDXName)
|
|
Dim oObjectValue
|
|
If oIndexName.StartsWith("[%VKT") Then
|
|
oObjectValue = ReturnVektor_IndexValue(oIndexName)
|
|
Else
|
|
oObjectValue = GetVariableValuefromSource(oIndexName, oIDBTyp)
|
|
End If
|
|
If IsNothing(oObjectValue) Then
|
|
oObjectValue = CDate("01.01.1900")
|
|
End If
|
|
'wenn Wert in Windream <> der Eingabe darf indexiert werden
|
|
If oObjectValue <> oMyInput Then
|
|
'Wenn der WErt in ein Vektorfeld geschrieben wird
|
|
If oIndexName.StartsWith("[%VKT") Then
|
|
'Input = die String komponente as String
|
|
oMyInput = Return_PM_VEKTOR(oMyInput, oIndexName)
|
|
'Hier muss nun separat as Vektorfeld indexiert werden
|
|
If WMIndexVectofield(oMyInput, PROFIL_VEKTORINDEX) = True Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing DatePicker as VEKTOR - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
If IDB_ACTIVE = False Then
|
|
Dim result()
|
|
ReDim Preserve result(0)
|
|
result(0) = CDate(oMyInput)
|
|
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing DatePicker- ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
If IDBData.SetVariableValue(oIndexName, oObjectValue) = False Then
|
|
oMissing = True
|
|
oErrorMessage = "Error indexing datepicker idb"
|
|
Exit For
|
|
End If
|
|
End If
|
|
If IDB_ACTIVE = False Then
|
|
If PROFIL_LOGINDEX <> "" Then
|
|
Dim oLogstr = Return_LOGString(oMyInput, oObjectValue, oIndexName)
|
|
WMIndexVectofield(oLogstr, PROFIL_LOGINDEX)
|
|
'Else
|
|
'IDBData.SetVariableValue(PROFIL_LOGINDEX, oLogstr)
|
|
End If
|
|
End If
|
|
End If
|
|
Else
|
|
LOGGER.Debug("Value WD ('" & oObjectValue.ToString & "') = Input-value ('" & oMyInput.ToString & "')")
|
|
|
|
End If
|
|
Else
|
|
LOGGER.Debug("DateValue is 01.01.0001 00:00:00")
|
|
End If
|
|
Case "System.Windows.Forms.CheckBox"
|
|
Dim chk As CheckBox = oControl
|
|
oMyInput = chk.Checked.ToString
|
|
|
|
'If chk.Checked = False And oIsRequired = True Then
|
|
' oMissing = True
|
|
' oErrorMessage = "Option '" & chk.Name & "' is required."
|
|
' Exit For
|
|
'End If
|
|
|
|
'den aktuellen Wert in windream auslesen
|
|
Dim WertWD As String
|
|
Dim oBoolValue As Boolean
|
|
If oIndexName.StartsWith("[%VKT") Then
|
|
WertWD = ReturnVektor_IndexValue(oIndexName)
|
|
If WertWD = "" Then
|
|
oBoolValue = False
|
|
Else
|
|
oBoolValue = CBool(WertWD)
|
|
End If
|
|
Else
|
|
Dim _Value
|
|
Dim oObjectCheck = GetVariableValuefromSource(oIndexName, oIDBTyp)
|
|
|
|
If IsNothing(oObjectCheck) Then
|
|
oBoolValue = False
|
|
Else
|
|
If oObjectCheck.ToString = "System.Object[]" Then
|
|
If oObjectCheck.Length = 1 Then
|
|
_Value = oObjectCheck(0)
|
|
Else '
|
|
LOGGER.Info(" >> Vectorfield " & oIndexName & "' contains more then one value - First value will be used")
|
|
_Value = oObjectCheck(0)
|
|
End If
|
|
Else
|
|
_Value = oObjectCheck
|
|
End If
|
|
oBoolValue = CBool(_Value)
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
' Dim Bool_WD = CBool(CURRENT_WMFILE.GetVariableValue(_IDXName))
|
|
'wenn Wert in Windream <> der Eingabe darf indexiert werden
|
|
If oBoolValue <> chk.Checked Then
|
|
Dim result() As String
|
|
ReDim Preserve result(0)
|
|
If chk.Checked Then
|
|
result(0) = 1
|
|
Else
|
|
result(0) = 0
|
|
End If
|
|
|
|
If oIndexName.StartsWith("[%VKT") Then
|
|
'Input = die String komponente mit Boolean as String
|
|
oMyInput = Return_PM_VEKTOR(chk.Checked.ToString, oIndexName)
|
|
'Hier muss nun separat as Vektorfeld indexiert werden
|
|
If WMIndexVectofield(oMyInput, PROFIL_VEKTORINDEX) = True Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing Checkbox as VEKTOR - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
If IDB_ACTIVE = False Then
|
|
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing Checkbox - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
If IDBData.SetVariableValue(oIndexName, chk.Checked.ToString) Then
|
|
oErrorMessage = "error indexing checkboxidb"
|
|
Exit For
|
|
End If
|
|
End If
|
|
If IDB_ACTIVE = False Then
|
|
If PROFIL_LOGINDEX <> "" Then
|
|
Dim oLogstr = Return_LOGString(CBool(result(0)).ToString, WertWD, oIndexName)
|
|
WMIndexVectofield(oLogstr, PROFIL_LOGINDEX)
|
|
'Else
|
|
'IDBData.SetVariableValue(PROFIL_LOGINDEX, oLogstr)
|
|
End If
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
Case "System.Windows.Forms.DataGridView"
|
|
Dim dgv As DataGridView = oControl
|
|
|
|
Dim Zeilen As Integer = 0
|
|
For Each row As DataGridViewRow In dgv.Rows
|
|
Dim exists = False
|
|
' MsgBox(row.Cells(0).Value.GetType.ToString)
|
|
If row.Cells(0).Value Is Nothing = False Then
|
|
Zeilen += 1
|
|
End If
|
|
Next
|
|
'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss
|
|
If oIsRequired = True And Zeilen = 0 Then
|
|
oMissing = True
|
|
oErrorMessage = "Fehlende Eingabe in Vektorfeld '" & dgv.Name & "'"
|
|
Exit For
|
|
ElseIf Zeilen > 0 Then
|
|
Dim ZeilenGrid As Integer = 0
|
|
Dim myVektorArr As String()
|
|
'Jeden Werte des Datagridviews durchlaufen
|
|
For Each row As DataGridViewRow In dgv.Rows
|
|
Dim exists = False
|
|
Select Case oControlType
|
|
Case "TABLE"
|
|
' MsgBox(row.Cells(0).Value.GetType.ToString)
|
|
Dim str As String
|
|
If row.Cells(0).Value Is Nothing = False Then
|
|
'Das Array anpassen
|
|
ReDim Preserve myVektorArr(ZeilenGrid)
|
|
For i = 0 To row.Cells.Count - 1
|
|
Select Case i
|
|
Case 0
|
|
str = row.Cells(i).Value
|
|
Case Else
|
|
str = str & Delimiter & row.Cells(i).Value
|
|
End Select
|
|
|
|
Next
|
|
'Den Wert im Array speichern
|
|
myVektorArr(ZeilenGrid) = str
|
|
ZeilenGrid += 1
|
|
|
|
End If
|
|
Case Else
|
|
' MsgBox(row.Cells(0).Value.GetType.ToString)
|
|
If row.Cells(0).Value Is Nothing = False Then
|
|
'Das Array anpassen
|
|
ReDim Preserve myVektorArr(ZeilenGrid)
|
|
'Den Wert im Array speichern
|
|
myVektorArr(ZeilenGrid) = row.Cells(0).Value.ToString
|
|
ZeilenGrid += 1
|
|
End If
|
|
End Select
|
|
|
|
Next
|
|
If IDB_ACTIVE = False Then
|
|
If Indexiere_File(CURRENT_WMFILE, oIndexName, myVektorArr) = False Then
|
|
oMissing = True
|
|
oErrorMessage = "Error while indexing Vektorfeld - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
Dim oDT As DataTable = DT_FOR_ARRAY(myVektorArr)
|
|
If oDT.Rows.Count > 0 Then
|
|
If IDBData.SetVariableValue(oIndexName, oDT, True) = False Then
|
|
oMissing = True
|
|
oErrorMessage = "Error indexing Datagridview idb"
|
|
Exit For
|
|
End If
|
|
End If
|
|
End If
|
|
'Jetzt die Datei indexieren
|
|
End If
|
|
|
|
Case "DevExpress.XtraGrid.GridControl"
|
|
Dim dgv As GridControl = oControl
|
|
|
|
Dim oRowCount As Integer = dgv.DataSource.Rows.Count
|
|
|
|
'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss
|
|
If oIsRequired = True And oRowCount = 0 Then
|
|
oMissing = True
|
|
oErrorMessage = "Fehlende Eingabe in Tabelle '" & dgv.Name & "'"
|
|
oControl.BackColor = Color.Red
|
|
Exit For
|
|
|
|
|
|
ElseIf oRowCount > 0 Then
|
|
Dim ZeilenGrid As Integer = 0
|
|
Dim myVektorArr As String()
|
|
'Jeden Werte des Datagridviews durchlaufen
|
|
For Each row As DataRow In dgv.DataSource.Rows
|
|
Dim exists = False
|
|
Select Case oControlType
|
|
Case "TABLE"
|
|
Dim oRowValue = row.Item(0)
|
|
If IsNothing(oRowValue) Then
|
|
oRowValue = String.Empty
|
|
ElseIf IsDBNull(oRowValue) Then
|
|
oRowValue = String.Empty
|
|
End If
|
|
' MsgBox(row.Cells(0).Value.GetType.ToString)
|
|
Dim str As String = String.Empty
|
|
'If oRowValue <> String.Empty Then
|
|
'Das Array anpassen
|
|
ReDim Preserve myVektorArr(ZeilenGrid)
|
|
|
|
Dim oValueList As New List(Of String)
|
|
|
|
For Each item In row.ItemArray
|
|
item = NotNull(item, String.Empty)
|
|
If TypeOf item IsNot String Then item.ToString()
|
|
oValueList.Add(item)
|
|
Next
|
|
|
|
str = String.Join(Delimiter, oValueList.ToArray)
|
|
|
|
'Den Wert im Array speichern
|
|
myVektorArr(ZeilenGrid) = str
|
|
ZeilenGrid += 1
|
|
'End If
|
|
Case Else
|
|
' MsgBox(row.Cells(0).Value.GetType.ToString)
|
|
If row.Item(0) Is Nothing = False Then
|
|
'Das Array anpassen
|
|
ReDim Preserve myVektorArr(ZeilenGrid)
|
|
'Den Wert im Array speichern
|
|
myVektorArr(ZeilenGrid) = row.Item(0).Value.ToString
|
|
ZeilenGrid += 1
|
|
End If
|
|
End Select
|
|
|
|
Next
|
|
|
|
|
|
If IDB_ACTIVE = False Then
|
|
If Indexiere_File(CURRENT_WMFILE, oIndexName, myVektorArr) = False Then
|
|
oMissing = True
|
|
oErrorMessage = $"Error while indexing table (1) {dgv.Name} - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
Dim oMyDT = DT_FOR_ARRAY(myVektorArr)
|
|
If oMyDT.Rows.Count > 0 Then
|
|
If IDBData.SetVariableValue(oIndexName, oMyDT, True, oIDBTyp) = False Then
|
|
oMissing = True
|
|
oErrorMessage = $"Error while indexing table IDB (1) {dgv.Name} - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
|
|
Else
|
|
Dim oValue As New List(Of Object) From {String.Empty}
|
|
|
|
If IDB_ACTIVE = False Then
|
|
If Indexiere_File(CURRENT_WMFILE, oIndexName, oValue.ToArray) = False Then
|
|
oMissing = True
|
|
'oErrorMessage = "Error while indexing der Tabelle - ERROR: " & idxerr_message
|
|
oErrorMessage = $"Error while indexing table (2) {dgv.Name} - ERROR: " & idxerr_message
|
|
Exit For
|
|
End If
|
|
Else
|
|
Dim oOldAttributeResult = IDBData.GetVariableValue(oIndexName, oIDBTyp)
|
|
Dim oTypeOldResult = oOldAttributeResult.GetType.ToString
|
|
If oTypeOldResult = "System.Data.DataTable" Then
|
|
Dim oDT As DataTable = IDBData.GetVariableValue(oIndexName, oIDBTyp)
|
|
If oDT.Rows.Count > 0 Then
|
|
LOGGER.Debug("User cleared the grid, so data needs to be erased!")
|
|
IDBData.Delete_AttributeData(CURRENT_DOC_ID, oIndexName)
|
|
End If
|
|
Else
|
|
LOGGER.Debug("(String) User cleared the grid, so data needs to be erased!")
|
|
IDBData.Delete_AttributeData(CURRENT_DOC_ID, oIndexName)
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
End Select
|
|
End If 'End If für Control und ReadOnly = False
|
|
Next
|
|
|
|
' If Error happened in inner For, exit the outer as well
|
|
If oMissing = True Then
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
Return oMissing
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Warn($"Unexpected error in Check_UpdateIndexe - ControlID: {oControlId},{oControlName}")
|
|
LOGGER.Error(ex)
|
|
Dim st As New StackTrace(True)
|
|
st = New StackTrace(ex, True)
|
|
MsgBox($"Unexpected error in Check_UpdateIndexe ControlID,Name: {oControlId},{oControlName}" & vbNewLine & ex.Message & vbNewLine & "Line: " & st.GetFrame(0).GetFileLineNumber().ToString, MsgBoxStyle.Critical, "Error:")
|
|
LOGGER.Info("Unexpected error in Check_UpdateIndexe:" & ex.Message & " - Line: " & st.GetFrame(0).GetFileLineNumber().ToString, True)
|
|
Return True
|
|
End Try
|
|
|
|
End Function
|
|
Private Function Indexiere_File(_dok As WINDREAMLib.WMObject, idxxname As String, idxvalue As Object) As Boolean
|
|
Dim File_indexiert As Boolean = False
|
|
idxerr_message = ""
|
|
Try
|
|
'Die Arrays vorbereiten
|
|
Dim arrIndex() As String = Nothing
|
|
Dim arrValue() As String = Nothing
|
|
arrIndex = Nothing
|
|
arrValue = Nothing
|
|
'Den Indexnamen übergeben
|
|
ReDim Preserve arrIndex(0)
|
|
arrIndex(0) = idxxname
|
|
'Das Array der Idnexwerte überprüfen
|
|
If idxvalue Is Nothing = False Then
|
|
If idxvalue.Length() > 1 Then
|
|
LOGGER.Debug("Indexing Index '" & idxxname & "' with Arrayvalue")
|
|
Dim anzahl As Integer = 0
|
|
For Each indexvalue As String In idxvalue
|
|
ReDim Preserve arrValue(anzahl)
|
|
arrValue(anzahl) = indexvalue
|
|
anzahl += 1
|
|
Next
|
|
Else
|
|
LOGGER.Debug("Indexing Index '" & idxxname & "' with value '" & idxvalue(0) & "'")
|
|
ReDim Preserve arrValue(0)
|
|
arrValue(0) = idxvalue(0).ToString
|
|
End If
|
|
'Jetzt das eigentliche Indexieren der Datei
|
|
'File_indexiert = Me._windreamPM.RunIndexing(_dok, arrIndex, arrValue)
|
|
File_indexiert = WINDREAM.RunIndexing(_dok, arrIndex, arrValue)
|
|
Return File_indexiert
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
allgFunk.Insert_LogEntry($"ERROR Indexiere_File Validator >> {ex.Message}")
|
|
idxerr_message = "Unexpected error in Indexiere_File: " & ex.Message.ToString
|
|
LOGGER.Info("Unexpected error in Indexiere_File: " & ex.Message.ToString, True)
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Private Sub btnfinal_Click(sender As System.Object, e As System.EventArgs)
|
|
Finish_WFStep()
|
|
End Sub
|
|
Function GetConnectionString(id As Integer)
|
|
Try
|
|
Dim oConnectionString As String
|
|
Dim DTConnection As DataTable
|
|
DTConnection = DD_DMSLiteDataSet.TBDD_CONNECTION
|
|
Dim drConnection As DataRow
|
|
For Each drConnection In DTConnection.Rows
|
|
If drConnection.Item("GUID") = id Then
|
|
Select Case drConnection.Item("SQL_PROVIDER")
|
|
Case "SqlClient.SqlConnection"
|
|
oConnectionString = "%MSData Source=" & drConnection.Item("SERVER") & ";Initial Catalog= " & drConnection.Item("DATENBANK") & ";User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";"
|
|
|
|
Case "Oracle"
|
|
oConnectionString = "%ORProvider=OraOLEDB.Oracle;Data Source=" & drConnection.Item("SERVER") & ";User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";OLEDB.NET=True;"
|
|
' connectionString = "%ORData Source=" & drConnection.Item("SERVER") & ";Persist Security Info=True;User Id=" & drConnection.Item("USERNAME") & ";Password=" & drConnection.Item("PASSWORD") & ";Unicode=True"
|
|
Case Else
|
|
LOGGER.Info(" - ConnectionType '" & drConnection.Item("SQL_PROVIDER") & "' nicht integriert")
|
|
MsgBox("ConnectionType '" & drConnection.Item("SQL_PROVIDER") & "' nicht integriert", MsgBoxStyle.Critical, "Bitte Konfiguration Connection überprüfen!")
|
|
|
|
End Select
|
|
End If
|
|
Next
|
|
Return oConnectionString
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info(" -Unexpected error in GetConnectionString - Fehler: " & vbNewLine & ex.Message)
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei GetConnectionString:")
|
|
Return ""
|
|
End Try
|
|
End Function
|
|
Private Sub btnNavigatorfirst_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs)
|
|
If e.Button = Windows.Forms.MouseButtons.Left Then
|
|
navStep = "first"
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btnNavigatorprevious_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs)
|
|
If e.Button = Windows.Forms.MouseButtons.Left Then
|
|
navStep = "previous"
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btnNavigatornext_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs)
|
|
If e.Button = Windows.Forms.MouseButtons.Left Then
|
|
navStep = "next"
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub btnNavigatorlast_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs)
|
|
If e.Button = Windows.Forms.MouseButtons.Left Then
|
|
navStep = "last"
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub frmValidation_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
|
|
If e.Button = Windows.Forms.MouseButtons.Left Then
|
|
navStep = Nothing
|
|
End If
|
|
End Sub
|
|
Sub Datei_ueberspringen()
|
|
Try
|
|
LOGGER.Debug("Dokument überspringen")
|
|
'Das Dokument freigeben
|
|
Free_File()
|
|
|
|
Dim oSQL = $"EXECUTE PRPM_FILES_NOT_INDEXED '{USER_USERNAME}',{CURRENT_ProfilGUID},'{WMDocPathWindows}',{CURRENT_DOC_GUID}"
|
|
ClassDatabase.Execute_non_Query(oSQL)
|
|
|
|
LOGGER.Debug($"Skipped DocGUID {CURRENT_DOC_GUID}")
|
|
Load_Next_Document(False)
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Fehler bei Überspringen:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
End Sub
|
|
Private Function Free_File()
|
|
Try
|
|
Dim sql = $"UPDATE TBPM_PROFILE_FILES SET EDIT = 0, IN_WORK = 0, IN_WORK_WHEN = NULL, WORK_USER = NULL WHERE GUID = {CURRENT_DOC_GUID}"
|
|
Return ClassDatabase.Execute_non_Query(sql)
|
|
Catch ex As Exception
|
|
allgFunk.Insert_LogEntry($"ERROR Free_File >> {ex.Message}")
|
|
LOGGER.Error(ex)
|
|
Return False
|
|
End Try
|
|
End Function
|
|
Private Sub delete_active_File()
|
|
Try
|
|
Dim result As MsgBoxResult
|
|
result = MessageBox.Show("Sind Sie sicher dass Sie dieses Dokument unwiderruflich löschen wollen?" & vbNewLine & "Danach wird die nächste Datei angezeigt!", "Bestätigung erforderlich:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
|
If result = MsgBoxResult.Yes Then
|
|
' Close_document_viewer()
|
|
'Aus der Tabelle löschen
|
|
TBPM_PROFILE_FILESTableAdapter.CmdDelete(CURRENT_DOC_GUID)
|
|
Dim resul = allgFunk.Delete_xffres(WMDocPathWindows, _windream)
|
|
If resul = Nothing Or resul = True Then
|
|
If Delete_File() = True Then
|
|
'MsgBox("Die Datei wurde erfolgreich aus windream gelöscht!" & vbNewLine & "Es wird nun die nächste Datei angezeigt!", MsgBoxStyle.Information, "Erfolgsmeldung:")
|
|
Load_Next_Document(False)
|
|
End If
|
|
End If
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Fehler bei Löschen windream-Datei:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
End Try
|
|
|
|
End Sub
|
|
Private Function Delete_File()
|
|
Try
|
|
If CURRENT_WMFILE Is Nothing = False Then
|
|
'Close_document_viewer()
|
|
'Me.PdfViewer1.DocumentFilePath = ""
|
|
Try
|
|
If CURRENT_WMFILE.aLocked Then
|
|
' unlock the windream object
|
|
CURRENT_WMFILE.unlock()
|
|
End If
|
|
CURRENT_WMFILE.Delete()
|
|
LOGGER.Info(">> Manuelles Löschen: Datei " & CURRENT_WMFILE.aName & " erfolgreich gelöscht")
|
|
Return True
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Das windream-Objekt konnte nicht gelöscht werden!" & vbNewLine & vbNewLine & "Fehlermeldung:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
LOGGER.Info(" windream-Objekt konnte nicht gelöscht werden - Fehlermeldung: " & ex.Message, True)
|
|
Return False
|
|
End Try
|
|
End If
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info(" Fehler bei Delete_File", True)
|
|
LOGGER.Info(">> Fehlermeldung: " & ex.Message)
|
|
Return False
|
|
End Try
|
|
End Function
|
|
Private Const SEE_MASK_INVOKEIDLIST = &HC
|
|
Private Const SEE_MASK_NOCLOSEPROCESS = &H40
|
|
Private Const SEE_MASK_FLAG_NO_UI = &H400
|
|
Public Const SW_SHOW As Short = 5
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
_frmValidatorSearch = New frmValidatorSearch
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
End Sub
|
|
|
|
<DllImport("Shell32", CharSet:=CharSet.Auto, SetLastError:=True)>
|
|
Public Shared Function ShellExecuteEx(ByRef lpExecInfo As SHELLEXECUTEINFO) As Boolean
|
|
End Function
|
|
Public Structure SHELLEXECUTEINFO
|
|
Public cbSize As Integer
|
|
Public fMask As Integer
|
|
Public hwnd As IntPtr
|
|
<MarshalAs(UnmanagedType.LPTStr)> Public lpVerb As String
|
|
<MarshalAs(UnmanagedType.LPTStr)> Public lpFile As String
|
|
<MarshalAs(UnmanagedType.LPTStr)> Public lpParameters As String
|
|
<MarshalAs(UnmanagedType.LPTStr)> Public lpDirectory As String
|
|
Dim nShow As Integer
|
|
Dim hInstApp As IntPtr
|
|
Dim lpIDList As IntPtr
|
|
<MarshalAs(UnmanagedType.LPTStr)> Public lpClass As String
|
|
Public hkeyClass As IntPtr
|
|
Public dwHotKey As Integer
|
|
Public hIcon As IntPtr
|
|
Public hProcess As IntPtr
|
|
End Structure
|
|
Private Sub frmValidation_ResizeEnd(sender As Object, e As EventArgs) Handles Me.ResizeEnd
|
|
If WMDocPathWindows Is Nothing = False Then
|
|
My.Settings.frmValidatorSize = Me.Size
|
|
My.Settings.Save()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub Splitter1_LocationChanged(sender As Object, e As EventArgs)
|
|
My.Settings.Save()
|
|
End Sub
|
|
|
|
Private Sub frmValidator_KeyUp(sender As Object, e As KeyEventArgs) Handles MyBase.KeyUp
|
|
If e.KeyCode = Keys.F4 Then
|
|
Datei_ueberspringen()
|
|
ElseIf e.KeyCode = Keys.F2 Then
|
|
btnSave.Enabled = False
|
|
Finish_WFStep()
|
|
btnSave.Enabled = True
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub frmValidator_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
|
|
|
|
End Sub
|
|
|
|
Private Sub frmValidator_Resize(sender As Object, e As EventArgs) Handles Me.Resize
|
|
If FormLoaded = False Then
|
|
Exit Sub
|
|
End If
|
|
|
|
If WindowState = FormWindowState.Maximized Then
|
|
My.Settings.frmValidatorWindowState = "Maximized"
|
|
ElseIf WindowState = FormWindowState.Normal Then
|
|
My.Settings.frmValidatorWindowState = "Normal"
|
|
End If
|
|
My.Settings.Save()
|
|
End Sub
|
|
Private Sub btnSave_MouseHover(sender As Object, e As EventArgs) Handles btnSave.MouseHover
|
|
Dim msg = "F2 für Speichern"
|
|
If USER_LANGUAGE <> "de-DE" Then
|
|
msg = "F2 for saving"
|
|
End If
|
|
ToolTip1.Show(msg, btnSave)
|
|
End Sub
|
|
|
|
Private Sub frmValidator_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
|
|
|
|
End Sub
|
|
|
|
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs)
|
|
|
|
End Sub
|
|
Sub Reload_Controls(SingleAttribute As String)
|
|
Load_IDB_DOC_DATA()
|
|
FillIndexValues(False)
|
|
|
|
End Sub
|
|
|
|
Sub SetStatusLabel(infotext As String, Optional pColor As String = "")
|
|
bsiInformation.Caption = infotext & " " & Now.ToString
|
|
If pColor <> String.Empty Then
|
|
bsiInformation.ItemAppearance.Normal.BackColor = System.Drawing.Color.FromName(pColor)
|
|
Else
|
|
bsiInformation.ItemAppearance.Normal.BackColor = Color.Transparent
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemFileView.ItemClick
|
|
Try
|
|
Dim Proc As New System.Diagnostics.Process
|
|
Dim psi As New ProcessStartInfo(WMDocPathWindows)
|
|
Proc.EnableRaisingEvents = True
|
|
Proc.StartInfo = psi
|
|
Proc.Start()
|
|
LOGGER.Info(" - Datei wurde geöffnet!")
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox("Fehler bei Datei öffnen:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
LOGGER.Info("Fehler bei Datei öffnen: " & ex.Message, True)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem3.ItemClick
|
|
frmFileInfo.ShowDialog()
|
|
End Sub
|
|
|
|
Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick
|
|
If WMDocPathWindows <> "" Then
|
|
Try
|
|
Cursor = Cursors.WaitCursor
|
|
Dim oShellExecuteInfo As New SHELLEXECUTEINFO
|
|
oShellExecuteInfo.cbSize = Marshal.SizeOf(oShellExecuteInfo)
|
|
oShellExecuteInfo.lpVerb = "properties"
|
|
oShellExecuteInfo.lpFile = WMDocPathWindows
|
|
oShellExecuteInfo.nShow = SW_SHOW
|
|
oShellExecuteInfo.fMask = SEE_MASK_INVOKEIDLIST
|
|
If Not ShellExecuteEx(oShellExecuteInfo) Then
|
|
Dim ex As New System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error())
|
|
MsgBox("error in Datei-Eigenschaften öffnen:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
|
End If
|
|
Catch ex As Exception
|
|
End Try
|
|
Cursor = Cursors.Default
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub BarButtonItem6_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniRefreshSearches.ItemClick
|
|
Load_Additional_Searches()
|
|
End Sub
|
|
|
|
Private Sub bbtniRefresh_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniRefresh.ItemClick
|
|
Reload_Controls("")
|
|
Try
|
|
btnSave.Text = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.ValidationButton")
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
SetStatusLabel("All Data refreshed", "Yellow")
|
|
End Sub
|
|
|
|
Private Sub bbtniNext_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniNext.ItemClick
|
|
Datei_ueberspringen()
|
|
End Sub
|
|
|
|
Private Sub bbtniDelete_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniDelete.ItemClick
|
|
delete_active_File()
|
|
End Sub
|
|
|
|
Private Sub bbtniAnnotation_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles bbtniAnnotation.ItemClick
|
|
Application.DoEvents()
|
|
|
|
frmAnnotations.ShowDialog()
|
|
|
|
load_viewer()
|
|
End Sub
|
|
|
|
Private Sub BbtnItm_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BbtnItm.ItemClick
|
|
Dim oRESULT As String
|
|
If USER_LANGUAGE = "de-DE" Then
|
|
oRESULT = "Eingaben gespeichert"
|
|
Else
|
|
oRESULT = "Eingaben gespeichert"
|
|
End If
|
|
If Check_UpdateIndexe() = False Then
|
|
SetStatusLabel($"Data saved", "LimeGreen")
|
|
Else
|
|
SetStatusLabel($"Error while saving data!", "Red")
|
|
End If
|
|
End Sub
|
|
Private Sub SaveDevExpressGridControl_Layout(pProfilID As Integer, pControlID As Integer, pGridView As DevExpress.XtraGrid.Views.Grid.GridView)
|
|
Try
|
|
Dim xml As String = GetXML_OverviewLayoutName(pProfilID, pControlID)
|
|
pGridView.SaveLayoutToXml(xml)
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("Error while saving GridLayout: " & ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub RestoreDevExpressGridControl_Layout(pProfilID As Integer, pControlID As Integer, pGridView As DevExpress.XtraGrid.Views.Grid.GridView)
|
|
|
|
Try
|
|
Dim oXml As String = GetXML_OverviewLayoutName(pProfilID, pControlID)
|
|
If File.Exists(oXml) Then
|
|
pGridView.RestoreLayoutFromXml(oXml)
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
LOGGER.Info("Error while restoring layout: " & ex.Message)
|
|
End Try
|
|
End Sub
|
|
Private Function GetXML_OverviewLayoutName(pProfilID As Integer, pControlID As Integer)
|
|
Dim Filename As String = String.Format($"DevExpressValidatorGridControl_{pProfilID}-{pControlID}.xml")
|
|
Return System.IO.Path.Combine(Application.UserAppDataPath(), Filename)
|
|
End Function
|
|
End Class |