Allow checkboxes to be required
This commit is contained in:
parent
3cd2bad3fa
commit
a78845f02d
@ -3214,8 +3214,7 @@ Public Class frmValidator
|
|||||||
Exit Select
|
Exit Select
|
||||||
Else
|
Else
|
||||||
LOGGER.Debug("No Default Value for Checkbox - so using false!")
|
LOGGER.Debug("No Default Value for Checkbox - so using false!")
|
||||||
myCheckBox.Checked = False
|
myCheckBox.CheckState = CheckState.Indeterminate
|
||||||
myCheckBox.CheckState = CheckState.Unchecked
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
@ -4616,361 +4615,376 @@ Public Class frmValidator
|
|||||||
End Try
|
End Try
|
||||||
|
|
||||||
Case "System.Windows.Forms.DateTimePicker"
|
Case "System.Windows.Forms.DateTimePicker"
|
||||||
Dim dtp As DateTimePicker = oControl
|
Try
|
||||||
'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss
|
Dim dtp As DateTimePicker = oControl
|
||||||
If oIsRequired = True And dtp.Value.ToString = String.Empty Then
|
'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss
|
||||||
oMissing = True
|
If oIsRequired = True And dtp.Value.ToString = String.Empty Then
|
||||||
oErrMsgMissingInput = "Please Choose DateValue for field'" & dtp.Name & "'"
|
oMissing = True
|
||||||
LOGGER.Warn(oErrMsgMissingInput)
|
oErrMsgMissingInput = "Please Choose DateValue for field'" & dtp.Name & "'"
|
||||||
Exit For
|
LOGGER.Warn(oErrMsgMissingInput)
|
||||||
ElseIf dtp.Value.ToString <> "01.01.0001 00:00:00" Then
|
Exit For
|
||||||
oMyInput = CDate(dtp.Value)
|
ElseIf dtp.Value.ToString <> "01.01.0001 00:00:00" Then
|
||||||
'den aktuellen Wert in windream auslesen
|
oMyInput = CDate(dtp.Value)
|
||||||
' Dim wertWD As String = CURRENT_WMFILE.GetVariableValue(_IDXName)
|
'den aktuellen Wert in windream auslesen
|
||||||
Dim oObjectValue
|
' Dim wertWD As String = CURRENT_WMFILE.GetVariableValue(_IDXName)
|
||||||
If oIndexName.StartsWith("[%VKT") Then
|
Dim oObjectValue
|
||||||
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
|
If oIndexName.StartsWith("[%VKT") Then
|
||||||
'Input = die String komponente as String
|
oObjectValue = ReturnVektor_IndexValue(oIndexName)
|
||||||
oMyInput = Return_PM_VEKTOR(oMyInput, 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
|
'Hier muss nun separat as Vektorfeld indexiert werden
|
||||||
If WMIndexVectofield(oMyInput, PROFIL_VEKTORINDEX) = True Then
|
If WMIndexVectofield(oMyInput, PROFIL_VEKTORINDEX) = True Then
|
||||||
oMissing = True
|
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)
|
LOGGER.Warn(oErrMsgMissingInput)
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
If IDB_ACTIVE = False Then
|
If IDB_ACTIVE = False Then
|
||||||
Dim result()
|
|
||||||
ReDim Preserve result(0)
|
|
||||||
result(0) = CDate(oMyInput)
|
|
||||||
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
|
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
|
||||||
oMissing = True
|
oMissing = True
|
||||||
oErrMsgMissingInput = "Error while indexing DatePicker- ERROR: " & idxerr_message
|
oErrMsgMissingInput = "Error while indexing Checkbox - ERROR: " & idxerr_message
|
||||||
LOGGER.Warn(oErrMsgMissingInput)
|
LOGGER.Warn(oErrMsgMissingInput)
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
If IDBData.SetVariableValue(oIndexName, oObjectValue) = False Then
|
If IDBData.SetVariableValue(oIndexName, chk.Checked.ToString) Then
|
||||||
oMissing = True
|
oErrMsgMissingInput = "error indexing checkboxidb"
|
||||||
oErrMsgMissingInput = "Error indexing datepicker idb"
|
|
||||||
LOGGER.Warn(oErrMsgMissingInput)
|
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
If IDB_ACTIVE = False Then
|
If IDB_ACTIVE = False Then
|
||||||
If PROFIL_LOGINDEX <> "" 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)
|
WMIndexVectofield(oLogstr, PROFIL_LOGINDEX)
|
||||||
'Else
|
'Else
|
||||||
'IDBData.SetVariableValue(PROFIL_LOGINDEX, oLogstr)
|
'IDBData.SetVariableValue(PROFIL_LOGINDEX, oLogstr)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
Else
|
|
||||||
LOGGER.Debug("Value WD ('" & oObjectValue.ToString & "') = Input-value ('" & oMyInput.ToString & "')")
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
Else
|
Catch ex As Exception
|
||||||
LOGGER.Debug("DateValue is 01.01.0001 00:00:00")
|
LOGGER.Error(ex)
|
||||||
End If
|
End Try
|
||||||
Case "System.Windows.Forms.CheckBox"
|
|
||||||
Dim chk As CheckBox = oControl
|
|
||||||
oMyInput = chk.Checked.ToString
|
|
||||||
|
|
||||||
If chk.CheckState = CheckState.Indeterminate And oIsRequired = True Then
|
Case "System.Windows.Forms.DataGridView"
|
||||||
oMissing = True
|
Try
|
||||||
oErrMsgMissingInput = "Please set Checkbox value for field '" & chk.Name & "'"
|
Dim dgv As DataGridView = oControl
|
||||||
LOGGER.Warn(oErrMsgMissingInput)
|
|
||||||
Exit For
|
|
||||||
End If
|
|
||||||
|
|
||||||
'den aktuellen Wert in windream auslesen
|
Dim Zeilen As Integer = 0
|
||||||
Dim WertWD As String
|
For Each row As DataGridViewRow In dgv.Rows
|
||||||
Dim oBoolValue As Boolean
|
Dim exists = False
|
||||||
If oIndexName.StartsWith("[%VKT") Then
|
' MsgBox(row.Cells(0).Value.GetType.ToString)
|
||||||
WertWD = ReturnVektor_IndexValue(oIndexName)
|
If row.Cells(0).Value Is Nothing = False Then
|
||||||
If WertWD = "" Then
|
Zeilen += 1
|
||||||
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
|
End If
|
||||||
oBoolValue = CBool(_Value)
|
Next
|
||||||
End If
|
'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
|
||||||
|
|
||||||
|
Next
|
||||||
' 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
|
|
||||||
If IDB_ACTIVE = False Then
|
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
|
oMissing = True
|
||||||
oErrMsgMissingInput = "Error while indexing Checkbox - ERROR: " & idxerr_message
|
oErrMsgMissingInput = "Error while indexing Vektorfeld - ERROR: " & idxerr_message
|
||||||
LOGGER.Warn(oErrMsgMissingInput)
|
LOGGER.Warn(oErrMsgMissingInput)
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
If IDBData.SetVariableValue(oIndexName, chk.Checked.ToString) Then
|
Dim oDT As DataTable = DT_FOR_ARRAY(myVektorArr)
|
||||||
oErrMsgMissingInput = "error indexing checkboxidb"
|
If oDT.Rows.Count > 0 Then
|
||||||
Exit For
|
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
|
||||||
End If
|
End If
|
||||||
If IDB_ACTIVE = False Then
|
'Jetzt die Datei indexieren
|
||||||
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
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
ElseIf oRowCount > 0 Then
|
||||||
Case "System.Windows.Forms.DataGridView"
|
Dim ZeilenGrid As Integer = 0
|
||||||
Dim dgv As DataGridView = oControl
|
Dim myVektorArr As String()
|
||||||
|
'Jeden Werte des Datagridviews durchlaufen
|
||||||
Dim Zeilen As Integer = 0
|
For Each row As DataRow In dgv.DataSource.Rows
|
||||||
For Each row As DataGridViewRow In dgv.Rows
|
Dim exists = False
|
||||||
Dim exists = False
|
Select Case oControlType
|
||||||
' MsgBox(row.Cells(0).Value.GetType.ToString)
|
Case "TABLE"
|
||||||
If row.Cells(0).Value Is Nothing = False Then
|
Dim oRowValue = row.Item(0)
|
||||||
Zeilen += 1
|
If IsNothing(oRowValue) Then
|
||||||
End If
|
oRowValue = String.Empty
|
||||||
Next
|
ElseIf IsDBNull(oRowValue) Then
|
||||||
'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss
|
oRowValue = String.Empty
|
||||||
If oIsRequired = True And Zeilen = 0 Then
|
End If
|
||||||
oMissing = True
|
' MsgBox(row.Cells(0).Value.GetType.ToString)
|
||||||
oErrMsgMissingInput = "Fehlende Eingabe in Vektorfeld '" & dgv.Name & "'"
|
Dim str As String = String.Empty
|
||||||
LOGGER.Warn(oErrMsgMissingInput)
|
'If oRowValue <> String.Empty Then
|
||||||
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
|
'Das Array anpassen
|
||||||
ReDim Preserve myVektorArr(ZeilenGrid)
|
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
|
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
|
'Den Wert im Array speichern
|
||||||
myVektorArr(ZeilenGrid) = str
|
myVektorArr(ZeilenGrid) = str
|
||||||
ZeilenGrid += 1
|
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
|
Next
|
||||||
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 IDB_ACTIVE = False Then
|
||||||
If Indexiere_File(CURRENT_WMFILE, oIndexName, myVektorArr) = 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
|
|
||||||
oMissing = True
|
oMissing = True
|
||||||
oErrMsgMissingInput = "Error indexing Datagridview idb"
|
oErrMsgMissingInput = $"Error while indexing table (1) {dgv.Name} - ERROR: " & idxerr_message
|
||||||
LOGGER.Warn(oErrMsgMissingInput)
|
LOGGER.Warn(oErrMsgMissingInput)
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
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
|
Else
|
||||||
LOGGER.Debug("(String) User cleared the grid, so data needs to be erased!")
|
Dim oMyDT = DT_FOR_ARRAY(myVektorArr)
|
||||||
IDBData.Delete_AttributeData(CURRENT_DOC_ID, oIndexName)
|
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
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
End If
|
LOGGER.Error(ex)
|
||||||
|
End Try
|
||||||
End Select
|
End Select
|
||||||
End If 'End If für Control und ReadOnly = False
|
End If 'End If für Control und ReadOnly = False
|
||||||
Next
|
Next
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user