finish first pass of switching to TextEdit

This commit is contained in:
Jonathan Jenne 2023-06-07 09:46:06 +02:00
parent a2b051401b
commit d889bd7e28
2 changed files with 68 additions and 16 deletions

View File

@ -57,4 +57,26 @@ Public Class ClassFormat
Return oConvertedValue
End Function
Public Shared Function GetStringValue(pValue As Object) As String
Select Case pValue.GetType
Case GetType(Single)
Return DirectCast(pValue, Single).ToString(CultureInfo.InvariantCulture)
Case GetType(Double)
Return DirectCast(pValue, Double).ToString(CultureInfo.InvariantCulture)
Case GetType(Decimal)
Return DirectCast(pValue, Decimal).ToString(CultureInfo.InvariantCulture)
Case GetType(Date)
Return DirectCast(pValue, Date).ToString(CultureInfo.InvariantCulture)
Case GetType(DateTime)
Return DirectCast(pValue, DateTime).ToString(CultureInfo.InvariantCulture)
Case Else
Return pValue.ToString
End Select
End Function
End Class

View File

@ -21,6 +21,7 @@ Imports DevExpress.XtraBars
Imports DevExpress.XtraGrid.Columns
Imports DevExpress.XtraEditors
Imports DevExpress.Data
Imports DigitalData.Modules.Logging
Public Class frmValidator
Private Property Current_Document As DocumentResultList.Document = Nothing
@ -96,6 +97,8 @@ Public Class frmValidator
Private Documentloader As Loader
Private ControlCreator As ClassControlCreator
Private PerformanceLogger As Logger
Private Const LOG_PERF = True
Private Property OperationMode As OperationMode
Private ReadOnly Environment As Environment
@ -107,6 +110,9 @@ Public Class frmValidator
End Class
Public Sub New(pEnvironment As Environment)
PerformanceLogger = LOGCONFIG.GetLoggerFor("PERF")
If LOG_PERF Then PerformanceLogger.Info("New")
'MyBase.New
LOGGER.Debug("Initialize Components...")
InitializeComponent()
@ -119,6 +125,7 @@ Public Class frmValidator
LOGGER.Error(ex)
End Try
End Sub
Private Function GetOperationMode() As OperationMode
@ -141,8 +148,8 @@ Public Class frmValidator
End Function
Private Sub frmValidation_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Try
If LOG_PERF Then PerformanceLogger.Info("frmValidation_Load")
LOGGER.Debug("###frmValidation_Load###")
LOGGER.Debug("Current User Language: [{0}]", USER_LANGUAGE)
@ -704,8 +711,11 @@ Public Class frmValidator
End If
End Function
Sub Create_Controls()
If LOG_PERF Then PerformanceLogger.Info("Create_Controls")
Dim oControlInfo As String
Try
PanelValidatorControl.Controls.Clear()
Dim oSQL = $"SELECT [dbo].[FNPM_LANGUAGE_CONTROL_TEXT] (NAME,'{USER_LANGUAGE}',CTRL_TYPE,CTRL_TEXT) CTRL_CAPTION_LANG, * FROM TBPM_PROFILE_CONTROLS WHERE CONTROL_ACTIVE = 1 AND PROFIL_ID = {CURRENT_ProfilGUID} ORDER BY Y_LOC, X_LOC"
DT_CONTROLS = DatabaseFallback.GetDatatable("TBPM_PROFILE_CONTROLS_LANGUAGE", New GetDatatableOptions(oSQL, DatabaseType.ECM) With {
@ -763,6 +773,8 @@ Public Class frmValidator
Try
Select Case oControlRow.Item("CTRL_TYPE").ToString.ToUpper
Case ClassControlCreator.PREFIX_TEXTBOX
If LOG_PERF Then PerformanceLogger.Info("Create_Controls/Textbox")
Try
oControlInfo = ClassControlCreator.PREFIX_TEXTBOX & "#" & oControlInfo
LOGGER.Debug($"[{oControlInfo}] - TXT Try to create control...")
@ -781,6 +793,8 @@ Public Class frmValidator
oControlInfo = "LBL#" & oControlInfo
oMyControl = ControlCreator.CreateExistingLabel(oControlRow, False)
Case "CMB"
If LOG_PERF Then PerformanceLogger.Info("Create_Controls/ComboBox")
oControlInfo = "CMB#" & oControlInfo
LOGGER.Debug($"[{oControlInfo}] - CMB Try to create control...")
If oControlRow.Item("READ_ONLY") Then
@ -881,6 +895,8 @@ Public Class frmValidator
oMyControl = dgv
Case "LOOKUP"
If LOG_PERF Then PerformanceLogger.Info("Create_Controls/Lookup")
oControlInfo = "LOOKUP#" & oControlInfo
Dim oMultiselect = oControlRow.Item("MULTISELECT")
Dim oReadonly = oControlRow.Item("READ_ONLY")
@ -958,6 +974,8 @@ Public Class frmValidator
Case "TABLE"
If LOG_PERF Then PerformanceLogger.Info("Create_Controls/Table")
oControlInfo = "TABLE#" & oControlInfo
Dim oFilteredDatatable As DataTable = DT_COLUMNS_GRID.Clone()
@ -1047,7 +1065,8 @@ Public Class frmValidator
Dim Type As String = inctrl.GetType.ToString
Select Case inctrl.GetType
Case GetType(DevExpress.XtraEditors.TextEdit)
inctrl.Text = ""
'inctrl.Text = ""
DirectCast(inctrl, TextEdit).EditValue = Nothing
Case GetType(System.Windows.Forms.ComboBox)
Dim cmb As Windows.Forms.ComboBox = inctrl
cmb.SelectedIndex = -1
@ -1709,13 +1728,11 @@ Public Class frmValidator
Select Case oControl.GetType.ToString
Case GetType(TextEdit).ToString
Try
Dim oTEXT = oDTDEPENDING_RESULT.Rows(0).Item(0)
Dim oValue As Object = oDTDEPENDING_RESULT.Rows(0).Item(0)
oValue = Utils.NotNull(Of Object)(oValue, Nothing)
Try
If Not IsNothing(oTEXT) Then
If Not IsDBNull(oTEXT) Then
oControl.Text = oTEXT
End If
End If
'oControl.Text = oValue
DirectCast(oControl, TextEdit).EditValue = oValue
Catch ex As Exception
LOGGER.Warn($"Unexpected error in Checking oTEXT: {ex.Message}")
End Try
@ -1834,16 +1851,15 @@ Public Class frmValidator
Select Case oControl.GetType.ToString
Case GetType(TextEdit).ToString
Try
Dim oTEXT = oDTDEPENDING_RESULT.Rows(0).Item(0)
Dim oValue As Object = oDTDEPENDING_RESULT.Rows(0).Item(0)
oValue = Utils.NotNull(Of Object)(oValue, Nothing)
Try
If Not IsNothing(oTEXT) Then
If Not IsDBNull(oTEXT) Then
oControl.Text = oTEXT
End If
End If
'oControl.Text = oValue
DirectCast(oControl, TextEdit).EditValue = oValue
Catch ex As Exception
LOGGER.Warn($"Unexpected error in Checking oTEXT: {ex.Message}")
End Try
Catch ex As Exception
LOGGER.Warn($"Unexpected error in Dim oTEXT = oDTDEPENDING_RESULT.Rows(0).Item(0): {ex.Message}")
End Try
@ -2153,6 +2169,8 @@ Public Class frmValidator
' End Try
'End Sub
Private Sub Controls2B_EnDisabled_on_Load()
If LOG_PERF Then PerformanceLogger.Info("Controls2B_EnDisabled_on_Load")
Try
Dim oFilteredDatatable As DataTable = DT_CONTROLS.Clone()
Dim oExpression = $"LEN(SQL_ENABLE_ON_LOAD) > 0"
@ -2975,6 +2993,8 @@ Public Class frmValidator
End Function
Sub FillIndexValues(first As Boolean, Optional SingleAttribute As String = "")
If LOG_PERF Then PerformanceLogger.Info("FillIndexValues")
Dim oControlType As String
Dim oIndexName As String
Dim oControName As String
@ -3013,6 +3033,8 @@ Public Class frmValidator
LOGGER.Debug("INDEX: " & oSourceIndexName & " - CONTROLNAME: " & oControl.Name & " - LOAD IDXVALUES: " & oLoadIndex.ToString)
Select Case oControl.GetType()
Case GetType(DevExpress.XtraEditors.TextEdit)
If LOG_PERF Then PerformanceLogger.Info("FillIndexValues/TextEdit")
Try
oControlType = "Textbox"
Dim oTextBox As TextEdit = oControl
@ -3119,6 +3141,8 @@ Public Class frmValidator
End Try
Case GetType(System.Windows.Forms.ComboBox)
If LOG_PERF Then PerformanceLogger.Info("FillIndexValues/ComboBox")
oControlType = "ComboBox"
Dim oMyCombobox As Windows.Forms.ComboBox = oControl
Try
@ -3200,6 +3224,8 @@ Public Class frmValidator
Case GetType(DevExpress.XtraGrid.GridControl)
If LOG_PERF Then PerformanceLogger.Info("FillIndexValues/GridControl")
oControlType = "DevExpress.XtraGrid.GridControl"
Dim oMyGridControl As GridControl = oControl
Dim oDTColumnsPerDevExGrid As DataTable = DT_COLUMNS_GRID.Clone()
@ -3466,6 +3492,8 @@ Public Class frmValidator
End If
Case GetType(DigitalData.Controls.LookupGrid.LookupControl3)
If LOG_PERF Then PerformanceLogger.Info("FillIndexValues/LookupControl")
Try
Dim oLookup As LookupControl3 = oControl
oValueFromSource = GetVariableValuefromSource(oSourceIndexName, oIDBTyp, oIDBOverride)
@ -3605,7 +3633,7 @@ Public Class frmValidator
LOGGER.Warn($"FillIndexValues - Unexpected error in creating dropdown for Grid: " & ex.Message)
End Try
If LOG_PERF Then PerformanceLogger.Info("FillIndexValues/Postload")
If IDB_ACTIVE = True Then
Try
@ -4642,7 +4670,9 @@ Public Class frmValidator
oControl.BackColor = Color.Red
Exit For
Else
oMyInput = oControl.Text
Dim oTextEdit As TextEdit = DirectCast(oControl, TextEdit)
oMyInput = ClassFormat.GetStringValue(oTextEdit.EditValue)
'den aktuellen Wert in windream auslesen
Dim oSourceValue = GetVariableValuefromSource(oIndexName, oIDBTyp)