Compare commits
2 Commits
3cd2bad3fa
...
4f85a1b4a0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f85a1b4a0 | ||
|
|
a78845f02d |
@@ -13,6 +13,7 @@ Imports DevExpress.XtraGrid.Views.Grid
|
||||
Imports DigitalData.Controls.LookupGrid
|
||||
Imports DigitalData.Modules.Language.Utils
|
||||
Imports DigitalData.GUIs.Common
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class ClassControlCreator
|
||||
|
||||
@@ -48,6 +49,8 @@ Public Class ClassControlCreator
|
||||
Public Const AGGREGATE_TOTAL_AVG = "TOTAL_AVG"
|
||||
Public Const AGGREGATE_TOTAL_COUNT = "TOTAL_COUNT"
|
||||
|
||||
Public Shared Property Logger As Logger
|
||||
|
||||
''' <summary>
|
||||
''' Saves the column data for each grid and each column in that grid
|
||||
''' </summary>
|
||||
@@ -120,7 +123,7 @@ Public Class ClassControlCreator
|
||||
|
||||
Return ctrl
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
@@ -288,7 +291,7 @@ Public Class ClassControlCreator
|
||||
|
||||
Return control
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
End Function
|
||||
@@ -524,8 +527,8 @@ Public Class ClassControlCreator
|
||||
GridTables.Item(oControlId).Add(oColumnName, oRepositoryItem)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Warn("Could not load data for column {0} in control {1}", oRow.Item("SPALTENNAME"), oControl.Name)
|
||||
LOGGER.Error(ex)
|
||||
Logger.Warn("Could not load data for column {0} in control {1}", oRow.Item("SPALTENNAME"), oControl.Name)
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End If
|
||||
Next
|
||||
@@ -589,6 +592,8 @@ Public Class ClassControlCreator
|
||||
|
||||
AddHandler oView.InitNewRow, Sub(sender As Object, e As InitNewRowEventArgs)
|
||||
Try
|
||||
Logger.Debug("Initialzing new row")
|
||||
|
||||
For Each oColumnData As DataRow In DT_MY_COLUMNS.Rows
|
||||
For Each oGridColumn As GridColumn In oView.Columns
|
||||
If oGridColumn.FieldName <> oColumnData.Item("SPALTENNAME") Then
|
||||
@@ -598,12 +603,13 @@ Public Class ClassControlCreator
|
||||
Dim oDefaultValue = NotNull(oColumnData.Item("DEFAULT_VALUE"), String.Empty)
|
||||
|
||||
If oDefaultValue <> String.Empty Then
|
||||
Logger.Debug("Setting default value [{0}] for column [{0}]", oDefaultValue, oGridColumn.FieldName)
|
||||
oView.SetRowCellValue(e.RowHandle, oGridColumn.FieldName, oDefaultValue)
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
Logger.Error(ex)
|
||||
Finally
|
||||
newRowModified = False
|
||||
End Try
|
||||
@@ -611,34 +617,40 @@ Public Class ClassControlCreator
|
||||
|
||||
AddHandler oView.CustomRowCellEdit, Sub(sender As Object, e As CustomRowCellEditEventArgs)
|
||||
Try
|
||||
Logger.Debug("Assigning editors to cells.")
|
||||
|
||||
For Each oRow As DataRow In DT_MY_COLUMNS.Rows
|
||||
Dim oColumnName = oRow.Item("SPALTENNAME")
|
||||
Dim oEditorExists = GridTables_TestEditorExistsByControlAndColumn(oControlId, oColumnName)
|
||||
If oColumnName <> e.Column.FieldName Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
If oColumnName = e.Column.FieldName And oEditorExists Then
|
||||
If oEditorExists Then
|
||||
Dim oEditor = GridTables.Item(oControlId).Item(oColumnName)
|
||||
|
||||
Logger.Debug("Assigning Editor to Column [{0}]", oColumnName)
|
||||
e.RepositoryItem = oEditor
|
||||
Else
|
||||
Logger.Debug("Editor for Column [{0}] does not exist", oColumnName)
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
LOGGER.Warn("Error in CustomRowCellEdit for [{0}]", e.CellValue)
|
||||
LOGGER.Error(ex)
|
||||
Logger.Warn("Error in CustomRowCellEdit for [{0}]", e.CellValue)
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
AddHandler oView.ValidatingEditor, Sub(sender As Object, e As BaseContainerValidateEditorEventArgs)
|
||||
Dim oRow As DataRowView = oView.GetRow(oView.FocusedRowHandle)
|
||||
Dim oColumnName = oView.FocusedColumn.FieldName
|
||||
LOGGER.Debug("Validating Editor for Column [{0}]", oColumnName)
|
||||
Logger.Debug("Validating Editor for Column [{0}]", oColumnName)
|
||||
GridTables_ValidateColumn(oView, DT_MY_COLUMNS, oColumnName, e.Value, e.Valid, e.ErrorText)
|
||||
End Sub
|
||||
|
||||
AddHandler oView.InvalidRowException, AddressOf View_InvalidRowException
|
||||
AddHandler oView.ValidatingEditor, AddressOf View_ValidatingEditor
|
||||
|
||||
' These handlers are all used for the custom DefaultValue functionality
|
||||
' These handlers are all used for the custom DefaultValue functionality, additionally some code in the 'InitNewRow' event.
|
||||
' https://supportcenter.devexpress.com/ticket/details/t1035580/how-to-default-a-value-in-a-column-when-add-new-row-in-data-grid
|
||||
AddHandler oView.ShowingEditor, AddressOf View_ShowingEditor
|
||||
AddHandler oView.ShownEditor, AddressOf View_ShownEditor
|
||||
@@ -647,12 +659,13 @@ Public Class ClassControlCreator
|
||||
Return oControl
|
||||
End Function
|
||||
|
||||
Private Shared newRowModified As Boolean
|
||||
Private Shared newRowModified As Boolean = False
|
||||
|
||||
Private Shared Sub View_ShowingEditor(sender As Object, e As CancelEventArgs)
|
||||
Dim view As GridView = TryCast(sender, GridView)
|
||||
|
||||
Logger.Debug("Showing editor.")
|
||||
If view.IsNewItemRow(view.FocusedRowHandle) AndAlso Not newRowModified Then
|
||||
Logger.Debug("Adding new row.")
|
||||
view.AddNewRow()
|
||||
End If
|
||||
End Sub
|
||||
@@ -660,8 +673,9 @@ Public Class ClassControlCreator
|
||||
Private Shared Sub View_ShownEditor(sender As Object, e As EventArgs)
|
||||
Dim view As GridView = TryCast(sender, GridView)
|
||||
If view.IsNewItemRow(view.FocusedRowHandle) Then
|
||||
Logger.Debug("Attaching Modified Handler.")
|
||||
AddHandler view.ActiveEditor.Modified, Sub()
|
||||
LOGGER.Debug("Row was modified")
|
||||
Logger.Debug("Row was modified.")
|
||||
newRowModified = True
|
||||
End Sub
|
||||
End If
|
||||
@@ -670,12 +684,11 @@ Public Class ClassControlCreator
|
||||
Private Shared Sub View_ValidateRow(sender As Object, e As ValidateRowEventArgs)
|
||||
Dim view As GridView = TryCast(sender, GridView)
|
||||
If view.IsNewItemRow(e.RowHandle) AndAlso Not newRowModified Then
|
||||
LOGGER.Debug("Deleting unused row")
|
||||
Logger.Debug("Deleting unused row")
|
||||
view.DeleteRow(e.RowHandle)
|
||||
End If
|
||||
|
||||
LOGGER.Debug("Validating row. Resetting Modified.")
|
||||
|
||||
Logger.Debug("Validating row. Resetting Modified.")
|
||||
newRowModified = False
|
||||
End Sub
|
||||
|
||||
@@ -737,7 +750,7 @@ Public Class ClassControlCreator
|
||||
CURRENT_CONTROL_ID = row("GUID")
|
||||
CURR_CON_ID = IIf(IsDBNull(row("CONNECTION_ID")), 0, row("CONNECTION_ID"))
|
||||
If CURR_CON_ID = 0 Then
|
||||
LOGGER.Info("CONNECTION NOT DEFINED - CTRL_GUID:" & CURRENT_CONTROL_ID)
|
||||
Logger.Info("CONNECTION NOT DEFINED - CTRL_GUID:" & CURRENT_CONTROL_ID)
|
||||
End If
|
||||
|
||||
CURR_SELECT_CONTROL = IIf(IsDBNull(row("SQL_UEBERPRUEFUNG")), "", row("SQL_UEBERPRUEFUNG"))
|
||||
@@ -748,8 +761,8 @@ Public Class ClassControlCreator
|
||||
Return 0
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
LOGGER.Info("Unexpected Error in GET_CONTROL_PROPERTIES (" & ControlName & "):" & ex.Message)
|
||||
Logger.Error(ex)
|
||||
Logger.Info("Unexpected Error in GET_CONTROL_PROPERTIES (" & ControlName & "):" & ex.Message)
|
||||
Return 0
|
||||
End Try
|
||||
|
||||
@@ -775,8 +788,8 @@ Public Class ClassControlCreator
|
||||
Return Nothing
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
LOGGER.Info("Unexpected Error in GET_CONTROL_PROPERTY (" & ControlGUID & "#" & ColNAME & "):" & ex.Message)
|
||||
Logger.Error(ex)
|
||||
Logger.Info("Unexpected Error in GET_CONTROL_PROPERTY (" & ControlGUID & "#" & ColNAME & "):" & ex.Message)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
@@ -795,8 +808,8 @@ Public Class ClassControlCreator
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
LOGGER.Info("Unexpected Error in GET_DEPENDING_CONTROLS (" & ControlName & "):" & ex.Message)
|
||||
Logger.Error(ex)
|
||||
Logger.Info("Unexpected Error in GET_DEPENDING_CONTROLS (" & ControlName & "):" & ex.Message)
|
||||
Return 0
|
||||
End Try
|
||||
End Function
|
||||
@@ -816,8 +829,8 @@ Public Class ClassControlCreator
|
||||
Return Nothing
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
LOGGER.Info("Unexpected Error in GET_CONNECTION_INFO (" & CON_ID.ToString & "):" & ex.Message)
|
||||
Logger.Error(ex)
|
||||
Logger.Info("Unexpected Error in GET_CONNECTION_INFO (" & CON_ID.ToString & "):" & ex.Message)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
@@ -841,7 +854,7 @@ Public Class ClassControlCreator
|
||||
oColumnDictionary.Add(pColumnName, oRepositoryItem)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
@@ -914,15 +927,15 @@ Public Class ClassControlCreator
|
||||
Exit For
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
Next
|
||||
' === End
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
LOGGER.Info("Unexpected Error in Display SQL result for grid column: " & oRow.Item("CONTROL_ID") & " - ERROR: " & ex.Message)
|
||||
Logger.Error(ex)
|
||||
Logger.Info("Unexpected Error in Display SQL result for grid column: " & oRow.Item("CONTROL_ID") & " - ERROR: " & ex.Message)
|
||||
End Try
|
||||
Next
|
||||
End If
|
||||
@@ -967,7 +980,7 @@ Public Class ClassControlCreator
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
If oIsRequired And pValue.ToString = "" Then
|
||||
|
||||
@@ -763,6 +763,8 @@ Public Class frmValidator
|
||||
|
||||
Dim oTabIndexCounter As Integer = 0
|
||||
|
||||
ClassControlCreator.Logger = LOGCONFIG.GetLoggerFor("ControlCreator")
|
||||
|
||||
For Each oControlRow As DataRow In DT_CONTROLS.Rows
|
||||
Dim oMyControl As Control
|
||||
Dim oControlID = oControlRow.Item("GUID")
|
||||
@@ -3214,8 +3216,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 +4617,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
|
||||
|
||||
Reference in New Issue
Block a user