Allow checkboxes to be required
This commit is contained in:
parent
3cd2bad3fa
commit
a78845f02d
@ -3214,8 +3214,7 @@ Public Class frmValidator
|
||||
Exit Select
|
||||
Else
|
||||
LOGGER.Debug("No Default Value for Checkbox - so using false!")
|
||||
myCheckBox.Checked = False
|
||||
myCheckBox.CheckState = CheckState.Unchecked
|
||||
myCheckBox.CheckState = CheckState.Indeterminate
|
||||
End If
|
||||
|
||||
|
||||
@ -4616,361 +4615,376 @@ Public Class frmValidator
|
||||
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
|
||||
oErrMsgMissingInput = "Please Choose DateValue for field'" & dtp.Name & "'"
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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
|
||||
Try
|
||||
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
|
||||
oErrMsgMissingInput = "Please Choose DateValue for field'" & dtp.Name & "'"
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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
|
||||
'Input = die String komponente as String
|
||||
oMyInput = Return_PM_VEKTOR(oMyInput, oIndexName)
|
||||
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
|
||||
oErrMsgMissingInput = "Error while indexing DatePicker as VEKTOR - ERROR: " & idxerr_message
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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
|
||||
oErrMsgMissingInput = "Error while indexing DatePicker- ERROR: " & idxerr_message
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
If IDBData.SetVariableValue(oIndexName, oObjectValue) = False Then
|
||||
oMissing = True
|
||||
oErrMsgMissingInput = "Error indexing datepicker idb"
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
|
||||
Case "System.Windows.Forms.CheckBox"
|
||||
Try
|
||||
Dim chk As CheckBox = oControl
|
||||
oMyInput = chk.Checked.ToString
|
||||
|
||||
If chk.CheckState = CheckState.Indeterminate And oIsRequired = True Then
|
||||
oMissing = True
|
||||
oErrMsgMissingInput = "Please set Checkbox value for field '" & chk.Name & "'"
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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) Or IsDBNull(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
|
||||
oErrMsgMissingInput = "Error while indexing DatePicker as VEKTOR - ERROR: " & idxerr_message
|
||||
oErrMsgMissingInput = "Error while indexing Checkbox as VEKTOR - ERROR: " & idxerr_message
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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
|
||||
oErrMsgMissingInput = "Error while indexing DatePicker- ERROR: " & idxerr_message
|
||||
oErrMsgMissingInput = "Error while indexing Checkbox - ERROR: " & idxerr_message
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
If IDBData.SetVariableValue(oIndexName, oObjectValue) = False Then
|
||||
oMissing = True
|
||||
oErrMsgMissingInput = "Error indexing datepicker idb"
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
If IDBData.SetVariableValue(oIndexName, chk.Checked.ToString) Then
|
||||
oErrMsgMissingInput = "error indexing checkboxidb"
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
If IDB_ACTIVE = False Then
|
||||
If PROFIL_LOGINDEX <> "" Then
|
||||
Dim oLogstr = Return_LOGString(oMyInput, oObjectValue, oIndexName)
|
||||
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
|
||||
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
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
|
||||
If chk.CheckState = CheckState.Indeterminate And oIsRequired = True Then
|
||||
oMissing = True
|
||||
oErrMsgMissingInput = "Please set Checkbox value for field '" & chk.Name & "'"
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
Exit For
|
||||
End If
|
||||
Case "System.Windows.Forms.DataGridView"
|
||||
Try
|
||||
Dim dgv As DataGridView = oControl
|
||||
|
||||
'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) Or IsDBNull(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
|
||||
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
|
||||
oBoolValue = CBool(_Value)
|
||||
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
|
||||
oErrMsgMissingInput = "Fehlende Eingabe in Vektorfeld '" & dgv.Name & "'"
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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 & PMDelimiter & row.Cells(i).Value
|
||||
End Select
|
||||
|
||||
End If
|
||||
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
|
||||
|
||||
|
||||
' 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
|
||||
oErrMsgMissingInput = "Error while indexing Checkbox as VEKTOR - ERROR: " & idxerr_message
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
Next
|
||||
If IDB_ACTIVE = False Then
|
||||
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
|
||||
If Indexiere_File(CURRENT_WMFILE, oIndexName, myVektorArr) = False Then
|
||||
oMissing = True
|
||||
oErrMsgMissingInput = "Error while indexing Checkbox - ERROR: " & idxerr_message
|
||||
oErrMsgMissingInput = "Error while indexing Vektorfeld - ERROR: " & idxerr_message
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
If IDBData.SetVariableValue(oIndexName, chk.Checked.ToString) Then
|
||||
oErrMsgMissingInput = "error indexing checkboxidb"
|
||||
Exit For
|
||||
Dim oDT As DataTable = DT_FOR_ARRAY(myVektorArr)
|
||||
If oDT.Rows.Count > 0 Then
|
||||
If IDBData.SetVariableValue(oIndexName, oDT, True) = False Then
|
||||
oMissing = True
|
||||
oErrMsgMissingInput = "Error indexing Datagridview idb"
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
Exit For
|
||||
End If
|
||||
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
|
||||
|
||||
'Jetzt die Datei indexieren
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
|
||||
Case "DevExpress.XtraGrid.GridControl"
|
||||
Try
|
||||
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
|
||||
oErrMsgMissingInput = "Fehlende Eingabe in Tabelle '" & dgv.Name & "'"
|
||||
oControl.BackColor = Color.Red
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
Exit For
|
||||
|
||||
|
||||
|
||||
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
|
||||
oErrMsgMissingInput = "Fehlende Eingabe in Vektorfeld '" & dgv.Name & "'"
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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
|
||||
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)
|
||||
For i = 0 To row.Cells.Count - 1
|
||||
Select Case i
|
||||
Case 0
|
||||
str = row.Cells(i).Value
|
||||
Case Else
|
||||
str = str & PMDelimiter & row.Cells(i).Value
|
||||
End Select
|
||||
|
||||
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(PMDelimiter, oValueList.ToArray)
|
||||
|
||||
' 22.10.2021 Attempt at fixing empty lines appearing in indexes
|
||||
If str.Trim.Length = 0 Or str.Trim.Replace(PMDelimiter, "").Length = 0 Then
|
||||
LOGGER.Debug("Empty line in Grid [{0}]. Skipping.", oControlName)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
'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
|
||||
|
||||
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
|
||||
|
||||
Next
|
||||
If IDB_ACTIVE = False Then
|
||||
If Indexiere_File(CURRENT_WMFILE, oIndexName, myVektorArr) = False Then
|
||||
oMissing = True
|
||||
oErrMsgMissingInput = "Error while indexing Vektorfeld - ERROR: " & idxerr_message
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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
|
||||
|
||||
If IDB_ACTIVE = False Then
|
||||
If Indexiere_File(CURRENT_WMFILE, oIndexName, myVektorArr) = False Then
|
||||
oMissing = True
|
||||
oErrMsgMissingInput = "Error indexing Datagridview idb"
|
||||
oErrMsgMissingInput = $"Error while indexing table (1) {dgv.Name} - ERROR: " & idxerr_message
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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
|
||||
oErrMsgMissingInput = "Fehlende Eingabe in Tabelle '" & dgv.Name & "'"
|
||||
oControl.BackColor = Color.Red
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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(PMDelimiter, oValueList.ToArray)
|
||||
|
||||
' 22.10.2021 Attempt at fixing empty lines appearing in indexes
|
||||
If str.Trim.Length = 0 Or str.Trim.Replace(PMDelimiter, "").Length = 0 Then
|
||||
LOGGER.Debug("Empty line in Grid [{0}]. Skipping.", oControlName)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
'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
|
||||
oErrMsgMissingInput = $"Error while indexing table (1) {dgv.Name} - ERROR: " & idxerr_message
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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
|
||||
oErrMsgMissingInput = $"Error while indexing table IDB (1) {dgv.Name} - ERROR: " & idxerr_message
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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
|
||||
oErrMsgMissingInput = $"Error while indexing table (2) {dgv.Name} - ERROR: " & idxerr_message
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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)
|
||||
Dim oMyDT = DT_FOR_ARRAY(myVektorArr)
|
||||
If oMyDT.Rows.Count > 0 Then
|
||||
If IDBData.SetVariableValue(oIndexName, oMyDT, True, oIDBTyp) = False Then
|
||||
oMissing = True
|
||||
oErrMsgMissingInput = $"Error while indexing table IDB (1) {dgv.Name} - ERROR: " & idxerr_message
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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
|
||||
oErrMsgMissingInput = $"Error while indexing table (2) {dgv.Name} - ERROR: " & idxerr_message
|
||||
LOGGER.Warn(oErrMsgMissingInput)
|
||||
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 If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
End Try
|
||||
End Select
|
||||
End If 'End If für Control und ReadOnly = False
|
||||
Next
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user