Speichern Prüfen - 3164 - CheckUpdateIndices - Error BtnClick

This commit is contained in:
2021-01-26 16:01:13 +01:00
parent 2b1ec0f68a
commit a7061968a1
7 changed files with 237 additions and 180 deletions

View File

@@ -1295,11 +1295,12 @@ Public Class frmValidator
Dim oControlID = DirectCast(oButton.Tag, ClassControlCreator.ControlMetadata).Guid
Dim oSQL = ClassControlCreator.GET_CONTROL_PROPERTY(DTCONTROLS, oControlID, "SQL_UEBERPRUEFUNG")
If IsNothing(oSQL) Then
LOGGER.Warn("onCustomButtonClick - SQL_UEBERPRUEFUNG IS NOTHING")
Exit Sub
End If
If Check_UpdateIndexe() = False Then
LOGGER.Warn("onCustomButtonClick - Check_UpdateIndexe = False >> Exit Click")
Exit Sub
End If
Override_SQLCommand = ClassControlCreator.GET_CONTROL_PROPERTY(DTCONTROLS, oControlID, "SQL2")
@@ -1417,12 +1418,12 @@ Public Class frmValidator
End If
Case "Override_Direct".ToUpper
Override = True
If Check_UpdateIndexe() = False Then
If Check_UpdateIndexe() = True Then
Finish_WFStep(False)
End If
Case "Override incFinal".ToUpper
If Check_UpdateIndexe() = False Then
If Check_UpdateIndexe() = True Then
Finish_WFStep(False)
End If
Case Else
@@ -3863,7 +3864,7 @@ Public Class frmValidator
Dim oErrorOcurred As Boolean = False
If OverrideAll = False Then
'Eingaben auf Form überprüfen
If Check_UpdateIndexe() = False Then
If Check_UpdateIndexe() = True Then
If PROFIL_FINISH_SQL <> String.Empty Then
If btnFinish_continue() = False Then
Exit Sub
@@ -4287,7 +4288,7 @@ Public Class frmValidator
Next
Return odt
End Function
Function Check_UpdateIndexe()
Function Check_UpdateIndexe() As Boolean
Dim oControlName
Dim oControlId As String
Try
@@ -4298,7 +4299,8 @@ Public Class frmValidator
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
Dim oCtrlType = oControlRow.Item("CTRL_TYPE").ToString
If oCtrlType = "LBL" Or oCtrlType = "LINE" Or oCtrlType = "BUTTON" Then
Continue For
End If
@@ -4622,7 +4624,7 @@ Public Class frmValidator
Dim st As New StackTrace(True)
st = New StackTrace(ex, True)
LOGGER.Warn("Unexpected error in Check_UpdateIndexe TextBox :" & ex.Message, True)
Return True
Return False
End Try
Case "System.Windows.Forms.ComboBox"
@@ -4638,43 +4640,42 @@ Public Class frmValidator
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
Dim oValue
'den aktuellen Wert in windream auslesen
If oIndexName.StartsWith("[%VKT") Then
oWMValue = ReturnVektor_IndexValue(oIndexName)
oValue = ReturnVektor_IndexValue(oIndexName)
Else
oWMValue = GetVariableValuefromSource(oIndexName, oIDBTyp)
oValue = 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
If IsNothing(oValue) Then
LOGGER.Debug($"oValue is nothing...Value EmptyString will be used")
oValue = String.Empty
End If
Dim oIndexType As String = "Index"
Try
If oWMValue.ToString = "System.Object[]" Then
If oValue.ToString = "System.Object[]" Then
oIndexType = "Vector"
End If
Catch ex As Exception
LOGGER.Debug($"Exception while oWMValue.ToString = System.Object[]...")
LOGGER.Debug($"Exception while oValue.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
If oValue.Length = 1 Then
oValue = oValue(0).ToString
Else '
LOGGER.Info(" >> Vectorfield " & oIndexName & "' contains more then one value - First value will be used")
oWMValue = oWMValue(0).ToString
oValue = oValue(0).ToString
End If
Else
LOGGER.Debug($"WMValue is a regular item...")
LOGGER.Debug($"oValue is a regular item...")
Dim oitsadifference As Boolean = False
Try
If oWMValue.ToString <> oMyInput.ToString Then
If oValue.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.Warn($"Could not convert the oValue of Control with ID{oControlId}...")
LOGGER.Error(ex.Message)
oitsadifference = True
End Try
@@ -4711,7 +4712,7 @@ Public Class frmValidator
End If
If IDB_ACTIVE = False Then
If PROFIL_LOGINDEX <> "" Then
Dim ologStr = Return_LOGString(oMyInput, oWMValue, oIndexName)
Dim ologStr = Return_LOGString(oMyInput, oValue, oIndexName)
WMIndexVectofield(ologStr, PROFIL_LOGINDEX)
'Else
'IDBData.SetVariableValue(PROFIL_LOGINDEX, ologStr)
@@ -4722,7 +4723,7 @@ Public Class frmValidator
End If
Else
LOGGER.Debug($"oitsadifference = False...Index with ID{oControlId} will not be indexed...")
LOGGER.Debug($"oitsadifference = False...Index with ID {oControlId} will not be indexed...")
'Wenn der Wert in ein Vektorfeld geschrieben wird
End If
End If
@@ -4736,7 +4737,7 @@ Public Class frmValidator
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
Return False
End Try
Case "System.Windows.Forms.DateTimePicker"
@@ -5081,11 +5082,17 @@ Public Class frmValidator
' If Error happened in inner For, exit the outer as well
If oMissing = True Then
LOGGER.Warn("Error in Inner Check_updateIndexe - Exiting...")
Exit For
End If
Next
Return oMissing
If oMissing = True Then
LOGGER.Debug("Check_UpdateIndexe: ERROR or Missing Indexing - returning False")
Return False
Else
LOGGER.Debug("Check_UpdateIndexe: Everything OK - returning True")
Return True
End If
Catch ex As Exception
LOGGER.Warn($"Unexpected error in Check_UpdateIndexe - ControlID: {oControlId},{oControlName}")
@@ -5094,7 +5101,7 @@ Public Class frmValidator
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
Return False
End Try
End Function
@@ -5462,7 +5469,7 @@ Public Class frmValidator
Else
oRESULT = "Eingaben gespeichert"
End If
If Check_UpdateIndexe() = False Then
If Check_UpdateIndexe() = True Then
SetStatusLabel($"Data saved", "LimeGreen")
Else
SetStatusLabel($"Error while saving data!", "Red")