Version6: Bugfixing, Vektorindexing etc

This commit is contained in:
Digital Data - Marlon Schreiber
2019-08-23 10:37:13 +02:00
parent 560b2fa37b
commit 770fc8d159
24 changed files with 757 additions and 554 deletions

View File

@@ -446,7 +446,7 @@ Public Class frmValidator
If CURRENT_DT_PROFILE_SEARCHES_SQL.Rows.Count > 0 Or CURRENT_DT_PROFILE_SEARCHES_DOC.Rows.Count > 0 Then
frmValidatorSearch.Show()
_frmValidatorSearch = frmValidatorSearch
RefreshAdditionalSearchToolStripMenuItem.Enabled = True
ToolStripButtonSearchesReload.Visible = True
Dim oPnl1Collapsed As Boolean = True
Dim oPnl2Collapsed As Boolean = True
If CURRENT_DT_PROFILE_SEARCHES_SQL.Rows.Count > 0 Then
@@ -479,10 +479,10 @@ Public Class frmValidator
End If
Else
LOGGER.Info("Not loading AdditionalSearches...!")
RefreshAdditionalSearchToolStripMenuItem.Enabled = False
ToolStripButtonSearchesReload.Visible = False
End If
End Sub
Sub LoadSimpleData(control As Control, controlId As Integer)
Sub LoadSQLData(control As Control, controlId As Integer)
Try
If TypeOf control Is Label Then Exit Sub
@@ -520,6 +520,7 @@ Public Class frmValidator
If TypeOf control Is TextBox Then
Try
Dim firstRow As DataRow = dt.Rows(0)
Dim value = firstRow.Item(0)
control.Text = value
@@ -530,14 +531,18 @@ Public Class frmValidator
End Try
ElseIf TypeOf control Is ComboBox Then
Try
Dim comboxBox As ComboBox = control
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 dt.Rows
list.Add(_row.Item(0))
Next
comboxBox.DataSource = list
oMyComboBox.DataSource = list
oMyComboBox.SelectedIndex = oselectedIndex
Catch ex As Exception
LOGGER.Error(ex)
clsLogger.Add("Error in LoadSimpleData for Combobox: " & ex.Message)
@@ -598,7 +603,7 @@ Public Class frmValidator
Dim oCount As Integer = 0
For Each oControlRow As DataRow In DTCONTROLS.Rows
Dim ctrl As Control
Dim oMyControl As Control
Select Case oControlRow.Item("CTRL_TYPE").ToString.ToUpper
Case "TXT"
@@ -610,10 +615,10 @@ Public Class frmValidator
AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus
AddHandler txt.KeyUp, AddressOf OnTextBoxKeyUp
ctrl = txt
oMyControl = txt
Case "LBL"
LOGGER.Debug("Versuch LBL zu laden")
ctrl = ClassControlCreator.CreateExistingLabel(oControlRow, False)
oMyControl = ClassControlCreator.CreateExistingLabel(oControlRow, False)
Case "CMB"
LOGGER.Debug("Versuch CMB zu laden")
@@ -746,12 +751,12 @@ Public Class frmValidator
End Using
cmb.DropDownWidth = maxWith
ctrl = cmb
oMyControl = cmb
'add_ComboBox(dr.Item("GUID"), dr.Item("CTRL_NAME"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), CInt(dr.Item("WIDTH")), CInt(dr.Item("HEIGHT")), dr.Item("READ_ONLY"), dr.Item("LOAD_IDX_VALUE")) 'dr.Item("INDEX_NAME"),
Case "DTP"
LOGGER.Debug("Versuch DTP zu laden")
ctrl = ClassControlCreator.CreateExistingDatepicker(oControlRow, False)
oMyControl = ClassControlCreator.CreateExistingDatepicker(oControlRow, False)
'add_DTP(dr.Item("GUID"), dr.Item("NAME"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), CInt(dr.Item("WIDTH")), CInt(dr.Item("HEIGHT")), dr.Item("READ_ONLY"), dr.Item("LOAD_IDX_VALUE")) 'dr.Item("INDEX_NAME"),
Case "DGV"
@@ -760,7 +765,7 @@ Public Class frmValidator
AddHandler dgv.RowValidating, AddressOf onDGVRowValidating
ctrl = dgv
oMyControl = dgv
Case "LOOKUP"
LOGGER.Debug("Versuch LOOKUP zu laden")
@@ -774,11 +779,11 @@ Public Class frmValidator
lookup.SelectedValues = New List(Of String) From {oControlRow.Item("DEFAULT_VALUE")}
End If
ctrl = lookup
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#{ctrl.Name}%'"
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
@@ -793,7 +798,7 @@ Public Class frmValidator
Case "CHK"
LOGGER.Debug("Versuch Checkbox zu laden")
ctrl = ClassControlCreator.CreateExisingCheckbox(oControlRow, False)
oMyControl = ClassControlCreator.CreateExisingCheckbox(oControlRow, False)
'add_Checkbox(dr.Item("GUID"), dr.Item("CTRL_NAME"), dr.Item("CTRL_TEXT"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), dr.Item("READ_ONLY"), dr.Item("LOAD_IDX_VALUE"))
Case "TABLE"
LOGGER.Debug("Versuch Tabelle zu laden")
@@ -802,21 +807,22 @@ Public Class frmValidator
Where r.CONTROL_ID = oControlRow.Item("GUID")
Select r).ToList()
ctrl = ClassControlCreator.CreateExistingTable(oControlRow, columns, False)
oMyControl = ClassControlCreator.CreateExistingGridControl(oControlRow, columns, False)
Case "LINE"
LOGGER.Debug("Versuch Linie zu laden")
ctrl = ClassControlCreator.CreateExistingLine(oControlRow, False)
oMyControl = ClassControlCreator.CreateExistingLine(oControlRow, False)
End Select
If TypeOf ctrl IsNot Label Then
If TypeOf oMyControl IsNot Label Then
If first_control Is Nothing Then
first_control = ctrl
first_control = oMyControl
End If
last_control = ctrl
last_control = oMyControl
End If
pnldesigner.Controls.Add(ctrl)
pnldesigner.Controls.Add(oMyControl)
'LoadSimpleData(ctrl, oControlRow.Item("GUID"))
Next
@@ -1559,7 +1565,7 @@ Public Class frmValidator
FillIndexValues(first)
For Each oControl As Control In pnldesigner.Controls
LoadSimpleData(oControl, oControl.Tag)
LoadSQLData(oControl, oControl.Tag)
Next
LOGGER.Debug("Indexmaske geladen")
@@ -2076,26 +2082,37 @@ Public Class frmValidator
Else
If wertWD.ToString = "System.Object[]" Then
LOGGER.Debug("TextBox with VektorField: " & oWMIndexName)
Try
LOGGER.Debug($"Length of Vektorarray: {wertWD.length}")
Catch ex As Exception
LOGGER.Info($"Error in gettin the lenth of vektorfield {oWMIndexName} - {ex.Message}")
End Try
If wertWD.length = 1 Then
wertWD = wertWD(0)
_CURRENT_INDEX_ARRAY(oCount, 1) = wertWD(0)
Else '
LOGGER.Info(" >> Vectorfield " & oWMIndexName & "' contains more then one value - First value will be used")
wertWD = wertWD(0)
_CURRENT_INDEX_ARRAY(oCount, 1) = wertWD(0)
End If
LOGGER.Debug($"wertWD has been saved...")
End If
End If
End If
Try
oControl.Text = NotNull(wertWD, oDefaultValue)
_CURRENT_INDEX_ARRAY(oCount, 1) = NotNull(wertWD, oDefaultValue)
Catch ex As Exception
LOGGER.Info("ERROR while converting defaultValue [" & oDefaultValue & "]: " & ex.Message)
oControl.Text = ""
_CURRENT_INDEX_ARRAY(oCount, 1) = ""
End Try
oControl.Text = NotNull(wertWD, oDefaultValue)
_CURRENT_INDEX_ARRAY(oCount, 1) = NotNull(wertWD, oDefaultValue)
End If
Catch ex As Exception
LOGGER.Error(ex)
errormessage = "Unvorhergesehener Fehler bei FillIndexValues TextBox:" & vbNewLine & ex.Message & vbNewLine & "Check Logfile"
errormessage = $"Unvorhergesehener Fehler bei FillIndexValues TextBox [{oControl.Name}]:" & vbNewLine & ex.Message & vbNewLine & "Check Logfile"
My.Settings.Save()
frmError.ShowDialog()
LOGGER.Info(">> Unvorhergesehener Fehler bei FillIndexValuesTextBox: " & ex.Message, True)
@@ -2106,7 +2123,7 @@ Public Class frmValidator
Case "System.Windows.Forms.ComboBox"
oControlType = "ComboBox"
Dim cmb As ComboBox = oControl
Dim oMyCombobox As ComboBox = oControl
Try
If oWMIndexName = "" Then
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
@@ -2115,12 +2132,12 @@ Public Class frmValidator
If oWMIndexName Is Nothing = False Then
If oLoadIndex = False Or oWMIndexName = "DD PM-ONLY FOR DISPLAY" Then
If oDefaultValue = String.Empty Then
cmb.SelectedIndex = -1
oMyCombobox.SelectedIndex = -1
Else
cmb.Text = oDefaultValue
oMyCombobox.Text = oDefaultValue
_CURRENT_INDEX_ARRAY(oCount, 1) = oDefaultValue
End If
LOGGER.Debug("Indexwert soll nicht geladen werden.")
LOGGER.Debug($" oMyComboBox {oMyCombobox.Name}: Indexwert soll nicht geladen werden.")
Exit Select
End If
Dim wertWD
@@ -2131,39 +2148,58 @@ Public Class frmValidator
End If
If wertWD Is Nothing Then
LOGGER.Debug($"Indexwert aus index {oWMIndexName}: Nothing")
LOGGER.Debug($"oMyComboBox {oMyCombobox.Name} - Indexvalue from index {oWMIndexName}: Nothing")
If oDefaultValue = String.Empty Then
LOGGER.Debug($"Indexwert-defaultValue wurde nicht gefunden")
cmb.SelectedIndex = -1
LOGGER.Debug($"oMyComboBox {oMyCombobox.Name}-defaultValue wurde nicht gefunden")
oMyCombobox.SelectedIndex = -1
Else
LOGGER.Debug($"Indexwert-defaultValue wird geladen")
cmb.Text = oDefaultValue
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
LOGGER.Debug($"Indexwert aus index {oWMIndexName}: {wertWD}")
LOGGER.Debug($"Items in Combobox: {cmb.Items.Count}")
If wertWD.ToString = "System.Object[]" Then
LOGGER.Debug($"oMyComboBox {oMyCombobox.Name} - Combobox with VektorField: " & oWMIndexName)
Try
LOGGER.Debug($"Length of Vektorarray: {wertWD.length}")
Catch ex As Exception
LOGGER.Info($"Error in gettin the length of vektorfield {oWMIndexName} - {ex.Message}")
End Try
If wertWD.length = 1 Then
wertWD = wertWD(0)
Else '
LOGGER.Info(" >> Vectorfield " & oWMIndexName & "' contains more then one value - First value will be used")
wertWD = wertWD(0)
End If
LOGGER.Debug($"wertWD has been saved...")
Else
End If
LOGGER.Debug($"Indexwert from Index {oWMIndexName}: {wertWD}")
LOGGER.Debug($"Items in Combobox: {oMyCombobox.Items.Count}")
LOGGER.Debug($"Index Wert wurde gesetzt")
cmb.Text = wertWD
_CURRENT_INDEX_ARRAY(oCount, 1) = wertWD
'If cmb.Items.Count = 0 Then
' If LogErrorsOnly = False Then LOGGER.Info($"Index Wert wurde gesetzt")
' cmb.Text = wertWD
'Else
' If LogErrorsOnly = False Then LOGGER.Info($"Index Wert wurde ausgewählt")
' cmb.SelectedIndex = cmb.FindStringExact(wertWD)
'End If
LOGGER.Debug($"_CURRENT_INDEX_ARRAY set...")
If oMyCombobox.Items.Count = 0 Then
' If LogErrorsOnly = False Then LOGGER.Info($"Index Wert wurde gesetzt")
oMyCombobox.Text = wertWD
Else
' If LogErrorsOnly = False Then LOGGER.Info($"Index Wert wurde ausgewählt")
oMyCombobox.SelectedIndex = oMyCombobox.FindStringExact(wertWD)
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(">> Unvorhergesehener Fehler bei FillIndexValues(Combobox: " & cmb.Name & "): " & ex.Message, True)
LOGGER.Info(">> Unvorhergesehener Fehler bei FillIndexValues(Combobox: " & oMyCombobox.Name & "): " & ex.Message, True)
LOGGER.Info(">> Controltype: " & oControlType)
LOGGER.Info(">> Indexname windream: " & oIndexName)
errormessage = "Unvorhergesehener Fehler bei FillIndexValues(Combobox: " & cmb.Name & "): " & vbNewLine & ex.Message & vbNewLine & "Check Logfile"
errormessage = "Unvorhergesehener Fehler bei FillIndexValues(Combobox: " & oMyCombobox.Name & "): " & vbNewLine & ex.Message & vbNewLine & "Check Logfile"
My.Settings.Save()
frmError.ShowDialog()
@@ -2270,7 +2306,7 @@ Public Class frmValidator
Dim SpaltenWerte As String()
LOGGER.Debug($"{dt.Rows.Count} Columns configured for control {oControlId}.")
If dt.Rows.Count > 1 Then
If dt.Rows.Count >= 1 Then
Dim oDataSource As DataTable = dgv.DataSource
oDataSource.Rows.Clear()
@@ -2369,25 +2405,31 @@ Public Class frmValidator
_CURRENT_INDEX_ARRAY(oCount, 1) = oDefaultValue
If Boolean.TryParse(oDefaultValue, result) Then
chk.Checked = result
Exit Select
End If
End If
Exit Select
End If
LOGGER.Debug("Loading Index value from Windream.")
LOGGER.Debug("Loading Bool-Value from Windream.")
Dim wertWD
If oWMIndexName.StartsWith("[%VKT") And PROFIL_VEKTORINDEX <> "" Then
wertWD = ReturnVektor_IndexValue(oWMIndexName)
Else
wertWD = CURRENT_WMFILE.GetVariableValue(oWMIndexName)
Try
LOGGER.Debug($"..Now GetVariableValue({oWMIndexName})...")
wertWD = CURRENT_WMFILE.GetVariableValue(oWMIndexName)
Catch ex As Exception
LOGGER.Warn($"Could not get the windreamValue for CheckboxIndex: {oWMIndexName} [{ex.Message}]")
End Try
End If
If wertWD 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: " & wertWD.ToString)
@@ -2409,7 +2451,7 @@ Public Class frmValidator
Else
Dim _value
If wertWD.ToString = "System.Object[]" Then
LOGGER.Debug("CheckBoxValue with VektorField: " & oWMIndexName)
LOGGER.Debug("CheckBoxValue with VectorField: " & oWMIndexName)
If wertWD.length = 1 Then
_value = wertWD(0)
Else '
@@ -2417,6 +2459,7 @@ Public Class frmValidator
_value = wertWD(0)
End If
Else
LOGGER.Debug("Value is not nothing and also not System.Object[]...")
_value = wertWD
End If
Try
@@ -2606,7 +2649,7 @@ Public Class frmValidator
If Check_UpdateIndexe() = False Then
'lblerror.Visible = False
Try
Dim oHasError As Boolean = False
Dim oErrorOcurred As Boolean = False
TBPM_PROFILE_FINAL_INDEXINGTableAdapter.Fill(FinalIndexDataSet.TBPM_PROFILE_FINAL_INDEXING, CURRENT_ProfilName)
Dim dtfinal As DataTable = FinalIndexDataSet.TBPM_PROFILE_FINAL_INDEXING
@@ -2623,16 +2666,24 @@ Public Class frmValidator
LOGGER.Debug("SQL_COMMAND before ReplaceAllValues: " & oSQLCommand)
oSQLCommand = clsPatterns.ReplaceAllValues(oSQLCommand, pnldesigner, CURRENT_WMFILE, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, CURRENT_CLICKED_PROFILE_ID)
LOGGER.Debug("SQL_COMMAND after ReplaceAllValues: " & oSQLCommand)
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!")
If IsNothing(oSQLCommand) Then
errormessage = "Error while replacing Values in final indexing - Check the log"
My.Settings.Save()
frmError.ShowDialog()
oErrorOcurred = True
End If
If Not IsNothing(oSQLCommand) Then
LOGGER.Debug("SQL_COMMAND after ReplaceAllValues: " & oSQLCommand)
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 dr.Item("VALUE").ToString
@@ -2645,7 +2696,9 @@ Public Class frmValidator
End Select
End If
End If
If oErrorOcurred Then
Exit For
End If
Dim oResult() As String
ReDim Preserve oResult(0)
oResult(0) = oValue
@@ -2661,7 +2714,7 @@ Public Class frmValidator
errormessage = "Fehler beim finalen Indexieren:" & vbNewLine & idxerr_message
My.Settings.Save()
frmError.ShowDialog()
oHasError = True
oErrorOcurred = True
End If
Else
LOGGER.Debug("Jetzt das indexieren")
@@ -2677,17 +2730,17 @@ Public Class frmValidator
errormessage = "Fehler beim finalen Indexieren:" & vbNewLine & idxerr_message
My.Settings.Save()
frmError.ShowDialog()
oHasError = True
oErrorOcurred = True
End If
End If
If oHasError = True Then
If oErrorOcurred = True Then
Exit For
End If
Next
End If
''Wenn kein Fehler nach der finalen Indexierung gesetzt wurde
If oHasError = False Then
If oErrorOcurred = False Then
LOGGER.Debug("Tabelle updaten und co")
'Das Dokument freigeben und als editiert markieren
Dim sql = String.Format("UPDATE TBPM_PROFILE_FILES SET IN_WORK = 0, WORK_USER = '{0}', EDIT = 1 WHERE GUID = {1}", Environment.UserName, CURRENT_DOC_GUID)
@@ -2826,7 +2879,7 @@ Public Class frmValidator
errormessage = "Fehler bei Move2Folder:" & vbNewLine & idxerr_message
My.Settings.Save()
frmError.ShowDialog()
oHasError = True
oErrorOcurred = True
End If
End If
'Validierungsfile löschen wenn vorhanden
@@ -2942,9 +2995,12 @@ Public Class frmValidator
Return oMissing
End Function
Function Check_UpdateIndexe()
Dim oControlName
Dim oControlId As String
Try
Dim dt As DataTable = DD_DMSLiteDataSet.VWPM_CONTROL_INDEX
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
@@ -2961,10 +3017,10 @@ Public Class frmValidator
Dim oSQLCheckCommand As String = IIf(IsDBNull(dr.Item("SQL_UEBERPRUEFUNG")), "", dr.Item("SQL_UEBERPRUEFUNG"))
Dim oIsReadOnly As Boolean = CBool(dr.Item("READ_ONLY"))
Dim oControlType As String = dr.Item("CTRL_TYPE")
Dim oControlId As String = dr.Item("GUID")
oControlId = dr.Item("GUID")
Dim oRegexMatch As String = NotNull(dr.Item("REGEX_MATCH"), String.Empty)
Dim oRegexMessage As String = NotNull(dr.Item("REGEX_MESSAGE_DE"), String.Empty)
Dim oControlName = dr.Item("CTRL_NAME")
oControlName = dr.Item("CTRL_NAME")
'Nur wenn der Name der Zeile entspricht und der Index READ_ONLY FALSE ist
If dr.Item("CTRL_NAME") = oControl.Name And (oIsReadOnly = False Or oSQLCheckCommand <> "") And oIndexName <> "DD PM-ONLY FOR DISPLAY" Then
@@ -2978,7 +3034,9 @@ Public Class frmValidator
Case "DigitalData.Controls.LookupGrid.LookupControl2"
Try
Dim lookup As LookupControl2 = oControl
If oControl.Name = "DGV_ca94be19" Then
'MsgBox("attebt")
End If
If lookup.SelectedValues.Count = 0 And oIsRequired = True Then
oMissing = True
oErrorMessage = $"Kein Auswahl getroffen in LookupGrid '{oControl.Name}'"
@@ -3022,63 +3080,65 @@ Public Class frmValidator
Else
input = lookup.SelectedValues.FirstOrDefault()
If IsNothing(input) Then
If IsNothing(input) And oIsRequired = True Then
oMissing = True
oErrorMessage = "Could not get FirstOrDefault-Value of LookUpGrid!"
oErrorMessage = $"Could not get FirstOrDefault-Value of LookUpGrid! - LookUPGridName: {lookup.Name}"
Exit For
ElseIf IsNothing(input) And oIsRequired = False Then
Continue For
End If
'den aktuellen Wert in windream auslesen
Dim wertWD
If oIndexName.StartsWith("[%VKT") Then
wertWD = ReturnVektor_IndexValue(oIndexName)
If oIndexName.StartsWith("[%VKT") Then
wertWD = ReturnVektor_IndexValue(oIndexName)
Else
wertWD = CURRENT_WMFILE.GetVariableValue(oIndexName)
If Not IsNothing(wertWD) Then
If wertWD.ToString = "System.Object[]" Then
If wertWD.Length = 1 Then
wertWD = wertWD(0)
Else '
LOGGER.Info(" >> Vectorfield " & oIndexName & "' contains more then one value - First value will be used")
wertWD = wertWD(0)
End If
End If
Else
wertWD = CURRENT_WMFILE.GetVariableValue(oIndexName)
If Not IsNothing(wertWD) Then
If wertWD.ToString = "System.Object[]" Then
If wertWD.Length = 1 Then
wertWD = wertWD(0)
Else '
LOGGER.Info(" >> Vectorfield " & oIndexName & "' contains more then one value - First value will be used")
wertWD = wertWD(0)
End If
wertWD = ""
End If
'wenn Wert in Windream <> der Eingabe darf indexiert werden
If IsNothing(wertWD) Or wertWD <> input Then
'Wenn der Wert in ein Vektorfeld geschrieben wird
If oIndexName.StartsWith("[%VKT") Then
input = Return_PM_VEKTOR(input, oIndexName)
'Hier muss nun separat als Vektorfeld indexiert werden
If Indexiere_VektorfeldPM(input, PROFIL_VEKTORINDEX) = True Then
oMissing = True
oErrorMessage = "Fehler beim Indexieren Textbox als VEKTOR - ERROR: " & idxerr_message
Exit For
End If
Else
wertWD = ""
End If
'wenn Wert in Windream <> der Eingabe darf indexiert werden
If IsNothing(wertWD) Or wertWD <> input Then
'Wenn der Wert in ein Vektorfeld geschrieben wird
If oIndexName.StartsWith("[%VKT") Then
input = Return_PM_VEKTOR(input, oIndexName)
'Hier muss nun separat als Vektorfeld indexiert werden
If Indexiere_VektorfeldPM(input, PROFIL_VEKTORINDEX) = True Then
oMissing = True
oErrorMessage = "Fehler beim Indexieren Textbox als VEKTOR - ERROR: " & idxerr_message
Exit For
End If
Dim result() As String
ReDim Preserve result(0)
result(0) = input
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
oMissing = True
oErrorMessage = "Fehler beim Indexieren Textbox - ERROR: " & idxerr_message
Exit For
Else
Dim result() As String
ReDim Preserve result(0)
result(0) = input
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
oMissing = True
oErrorMessage = "Fehler beim Indexieren Textbox - ERROR: " & idxerr_message
Exit For
Else
'Nun das Logging
If PROFIL_LOGINDEX <> "" Then
input = Return_LOGString(input, wertWD, oIndexName)
Indexiere_VektorfeldPM(input, PROFIL_LOGINDEX)
End If
'Nun das Logging
If PROFIL_LOGINDEX <> "" Then
input = Return_LOGString(input, wertWD, oIndexName)
Indexiere_VektorfeldPM(input, PROFIL_LOGINDEX)
End If
End If
End If
End If
End If
End If
End If
Catch ex As Exception
LOGGER.Error(ex)
@@ -3178,53 +3238,105 @@ Public Class frmValidator
End Try
Case "System.Windows.Forms.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
input = cmb.Text
Dim wertWD As String
'den aktuellen Wert in windream auslesen
If oIndexName.StartsWith("[%VKT") Then
wertWD = ReturnVektor_IndexValue(oIndexName)
Else
wertWD = CURRENT_WMFILE.GetVariableValue(oIndexName)
End If
'wenn Wert in Windream <> der Eingabe darf indexiert werden
If wertWD <> input Then
'Wenn der Wert in ein Vektorfeld geschrieben wird
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
input = cmb.Text
LOGGER.Debug($"inputvalue Combobox: {cmb.Text}")
Dim oWMValue
'den aktuellen Wert in windream auslesen
If oIndexName.StartsWith("[%VKT") Then
input = Return_PM_VEKTOR(input, oIndexName)
'Hier muss nun separat als Vektorfeld indexiert werden
If Indexiere_VektorfeldPM(input, PROFIL_VEKTORINDEX) = True Then
oMissing = True
oErrorMessage = "Fehler beim Indexieren Combobox als VEKTOR - ERROR: " & idxerr_message
Exit For
oWMValue = ReturnVektor_IndexValue(oIndexName)
Else
oWMValue = CURRENT_WMFILE.GetVariableValue(oIndexName)
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
Dim result() As String
ReDim Preserve result(0)
result(0) = input
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
cmb.DroppedDown = True
oMissing = True
oErrorMessage = "Fehler beim Indexieren Combobox - ERROR: " & idxerr_message
Exit For
Else
'Nun das Logging
If PROFIL_LOGINDEX <> "" Then
input = Return_LOGString(input, wertWD, oIndexName)
Indexiere_VektorfeldPM(input, PROFIL_LOGINDEX)
LOGGER.Debug($"WMValue is a regular item...")
Dim oitsadifference As Boolean = False
Try
If oWMValue.ToString <> input.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
input = Return_PM_VEKTOR(input, oIndexName)
'Hier muss nun separat als Vektorfeld indexiert werden
If Indexiere_VektorfeldPM(input, PROFIL_VEKTORINDEX) = True Then
oMissing = True
oErrorMessage = "Fehler beim Indexieren Combobox als VEKTOR - ERROR: " & idxerr_message
Exit For
End If
Else
Dim result() As String
ReDim Preserve result(0)
result(0) = input
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
cmb.DroppedDown = True
oMissing = True
oErrorMessage = "Fehler beim Indexieren Combobox - ERROR: " & idxerr_message
Exit For
Else
'Nun das Logging
If PROFIL_LOGINDEX <> "" Then
input = Return_LOGString(input, oWMValue, oIndexName)
Indexiere_VektorfeldPM(input, PROFIL_LOGINDEX)
End If
End If
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
End If
Catch ex As Exception
LOGGER.Error(ex)
Dim st As New StackTrace(True)
st = New StackTrace(ex, True)
MsgBox($"Unvorhergesehener Fehler in Check_UpdateIndexe Combobox : ID{oControlId} " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Error:")
LOGGER.Info($"Unvorhergesehener Fehler 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
@@ -3285,11 +3397,11 @@ Public Class frmValidator
Dim chk As CheckBox = oControl
input = chk.Checked.ToString
If chk.Checked = False And oIsRequired = True Then
oMissing = True
oErrorMessage = "Option '" & chk.Name & "' is required."
Exit For
End If
'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
@@ -3506,10 +3618,11 @@ Public Class frmValidator
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("Unvorhergesehener Fehler in Check_UpdateIndexe: " & vbNewLine & ex.Message & vbNewLine & "Line: " & st.GetFrame(0).GetFileLineNumber().ToString, MsgBoxStyle.Critical, "Error:")
MsgBox($"Unvorhergesehener Fehler in Check_UpdateIndexe ControlID,Name: {oControlId},{oControlName}" & vbNewLine & ex.Message & vbNewLine & "Line: " & st.GetFrame(0).GetFileLineNumber().ToString, MsgBoxStyle.Critical, "Error:")
LOGGER.Info("Unvorhergesehener Fehler in Check_UpdateIndexe:" & ex.Message & " - Line: " & st.GetFrame(0).GetFileLineNumber().ToString, True)
Return True
End Try
@@ -3622,23 +3735,6 @@ Public Class frmValidator
navStep = Nothing
End If
End Sub
Private Sub DateiÖffnenToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles DateiÖffnenToolStripMenuItem.Click
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
Sub Datei_ueberspringen()
Try
LOGGER.Debug("Dokument überspringen")
@@ -3741,24 +3837,6 @@ Public Class frmValidator
Public hIcon As IntPtr
Public hProcess As IntPtr
End Structure
Private Sub DateieigenschaftenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DateieigenschaftenToolStripMenuItem.Click
If WMDocPathWindows <> "" Then
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("Fehler in Datei-Eigenschaften öffnen:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End If
End If
Cursor = Cursors.Default
End Sub
Private Sub frmValidation_ResizeEnd(sender As Object, e As EventArgs) Handles Me.ResizeEnd
If WMDocPathWindows Is Nothing = False Then
Select Case Path.GetExtension(WMDocPathWindows).ToLower
@@ -3851,11 +3929,44 @@ Public Class frmValidator
End Sub
Private Sub DateiInfoToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DateiInfoToolStripMenuItem.Click
Private Sub InfoToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles InfoToolStripMenuItem.Click
frmFileInfo.ShowDialog()
End Sub
Private Sub RefreshAdditionalSearchToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles RefreshAdditionalSearchToolStripMenuItem.Click
Private Sub EigenschaftenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EigenschaftenToolStripMenuItem.Click
If WMDocPathWindows <> "" Then
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("Fehler in Datei-Eigenschaften öffnen:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End If
End If
Cursor = Cursors.Default
End Sub
Private Sub DateiÖffnenToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles DateiÖffnenToolStripMenuItem1.Click
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 ToolStripButtonSearchesReload_Click(sender As Object, e As EventArgs) Handles ToolStripButtonSearchesReload.Click
Load_Additional_Searches()
End Sub
End Class