Messpunkte integriert

This commit is contained in:
Developer01
2026-01-29 10:46:09 +01:00
parent f1984572b7
commit c249aa890d
5 changed files with 758 additions and 722 deletions

View File

@@ -93,7 +93,7 @@ Public Class ClassControlCreator
Public Attribute As String
Public [ReadOnly] As Boolean = False
Public BackColor As Color = Color.White
Public Property IsDirty As Boolean = False
End Class
Public Sub New(pLogConfig As LogConfig)

View File

@@ -73,6 +73,8 @@ Public Class ClassParamRefresh
ElseIf oMode = "PM.DEBUG_LOG" Then
DEBUG = True
LOGCONFIG.Debug = True
ElseIf oMode = "PM.LOG_HOTSPOTS" Then
LOG_HOTSPOTS = True
ElseIf oMode.StartsWith("OPERATION_MODE_FS") Then
OPERATION_MODE_FS = oMode.Replace("OPERATION_MODE_FS=", "")
If OPERATION_MODE_FS = ClassConstants.OpModeFS_IDBWM Then

View File

@@ -14,7 +14,7 @@
Public Property NO_DETAIL_PROFILES As Boolean = False
' Debug Settings
Public Property DEBUG As Boolean = False
Public Property LOG_HOTSPOTS As Boolean = False
Public Property INDEX_DMS_ERSTELLT = "DMS erstellt"
Public Property INDEX_DMS_ERSTELLT_ZEIT = "DMS erstellt (Zeit)"

View File

@@ -2544,10 +2544,10 @@ FROM VWPM_PROFILE_ACTIVE T WHERE T.GUID IN (SELECT PROFILE_ID FROM [dbo].[FNPM_G
Handling_DEBUG_USER()
Dim oSQL = $"SELECT * FROM TBDD_NOTIFICATIONS_SYSTEM NOTE
INNER JOIN (SELECT * FROM TBDD_NOTIFICATIONS_SYSTEM WHERE LANG_CODE = '{USER_LANGUAGE}' OR LANG_CODE = 'ALL') LANG ON NOTE.GUID = LANG.GUID
Dim oSQL = $"SELECT * FROM TBDD_NOTIFICATIONS_SYSTEM NOTE WITH (NOLOCK)
INNER JOIN (SELECT * FROM TBDD_NOTIFICATIONS_SYSTEM WITH (NOLOCK) WHERE LANG_CODE = '{USER_LANGUAGE}' OR LANG_CODE = 'ALL') LANG ON NOTE.GUID = LANG.GUID
where (CONVERT(DATE,GETDATE()) <= NOTE.DISPLAY_UNTIL or NOTE.DISPLAY_UNTIL IS NULL) AND NOTE.MODULE = 'PM'
AND NOTE.GUID NOT IN (SELECT NOTIFY_ID FROM TBDD_NOTIFICATIONS_USER_HISTORY WHERE USR_ID = {USER_ID})"
AND NOTE.GUID NOT IN (SELECT NOTIFY_ID FROM TBDD_NOTIFICATIONS_USER_HISTORY WITH (NOLOCK) WHERE USR_ID = {USER_ID})"
Dim oDT As DataTable = DatabaseFallback.GetDatatable("TBDD_NOTIFICATIONS_SYSTEM", New GetDatatableOptions(oSQL, DatabaseType.ECM))
If Not IsNothing(oDT) Then

View File

@@ -178,16 +178,15 @@ Public Class frmValidator
Return False ' Punkt ist außerhalb aller sichtbaren Bereiche
End Function
Private Sub frmValidation_Load(sender As Object, e As System.EventArgs) Handles Me.Load
' === MESSPUNKT 1: Start ===
Dim perfStart As DateTime = If(LOG_HOTSPOTS, DateTime.Now, Nothing)
Dim perfLastCheck As DateTime = perfStart
If LOG_HOTSPOTS Then MyValidationLogger.Info($"[PERF] frmValidation_Load START")
Try
If LOG_PERF Then PerformanceLogger.Info("frmValidation_Load")
MyValidationLogger.Debug("###frmValidation_Load###")
MyValidationLogger.Debug("Current User Language: [{0}]", USER_LANGUAGE)
' Operation mode is either guessed from service settings
' or explictly set from OperationModeOverride in Params
OperationMode = GetOperationMode()
DD_Documentloader = New Loader(LOGCONFIG, OperationMode, Environment.Service.Client, Environment.User)
@@ -198,18 +197,21 @@ Public Class frmValidator
SplitContainer1.Panel2Collapsed = True
first_control = Nothing
_FormClosing = False
_FormLoaded = False
If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF] Nach Initialisierung: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now
End If
Catch ex As Exception
MyValidationLogger.Warn($"Error in frmValidation_load1: {ex.Message}")
End Try
Try
' === MESSPUNKT 3: Form-Position wiederherstellen ===
If My.Settings.frmValidatorPosition.IsEmpty = False Then
If IsPositionVisible(My.Settings.frmValidatorPosition) Then
' Position ist sichtbar, das Formular wird dort angezeigt
Try
ScreenEx.RestoreFormPosition(Me, My.Settings.frmValidatorPosition)
Catch ex As Exception
@@ -222,17 +224,13 @@ Public Class frmValidator
Try
MyValidationLogger.Debug($"!! Invalid PositionData X({My.Settings.frmValidatorPosition.X}), Y({My.Settings.frmValidatorPosition.Y})")
Catch ex As Exception
End Try
End If
Else
' Position ist unsichtbar, Standardposition verwenden
Me.StartPosition = FormStartPosition.CenterScreen
End If
End If
End If
End If
If My.Settings.frmValidatorSize.IsEmpty = False Then
If My.Settings.frmValidatorSize.Width > 0 And My.Settings.frmValidatorSize.Height > 0 Then
If My.Settings.frmValidatorWindowState = "Normal" Then
@@ -242,12 +240,19 @@ Public Class frmValidator
End If
End If
End If
If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF] Nach Position/Size: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now
End If
Catch ex As Exception
MyValidationLogger.Info($"Error loading position: {ex.Message}")
End Try
Dim _step = 0
Try
' === MESSPUNKT 4: DocumentViewer Init ===
Dim oDVSettings As New DigitalData.Controls.DocumentViewer.DocumentViewer.ToolbarSettings() With {
.ShowPrintButton = True,
.ShowRotateButton = True,
@@ -256,27 +261,40 @@ Public Class frmValidator
}
DocumentViewer1.Init(LOGCONFIG, GDPICTURE_LICENSE, oDVSettings)
If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF] Nach DocumentViewer.Init: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now
End If
Catch ex As Exception
MyValidationLogger.Error(ex)
End Try
Try
_step = 1
_step = 2
' === MESSPUNKT 5: Profile Data laden (KRITISCH) ===
DTVWCONTROL_INDEX.Clear()
Dim oExpression = $"PROFIL_ID = {CURRENT_ProfilGUID}"
DTVWCONTROLS_INDEX.Select(oExpression, "Y_LOC, X_LOC").CopyToDataTable(DTVWCONTROL_INDEX, LoadOption.PreserveChanges)
If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF] Nach DTVWCONTROL_INDEX laden ({DTVWCONTROL_INDEX.Rows.Count} Rows): {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now
End If
_step = 3
MyValidationLogger.Debug("Profile Data loaded")
Catch ex As Exception
MyValidationLogger.Error(ex)
MsgBox("Error LOADING profile-data(" & _step.ToString & "):" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Attention:")
MyValidationLogger.Info(">> Error in LOADING profile-data: " & ex.Message, True)
Me.Close()
End Try
MyValidationLogger.Debug("frmValidation_Load finished till Step 3!")
MyValidationLogger.Debug("frmValidation_Load finished till Step 3!")
Try
If CURRENT_DT_PROFILE.Rows.Count = 0 Then
@@ -284,16 +302,21 @@ Public Class frmValidator
MsgBox("ProfileData could not be loaded - Profile: " & CURRENT_ProfilName, MsgBoxStyle.Critical, "Attention:")
Me.Close()
End If
_step = 4
MyValidationLogger.Debug("Step 4")
If CURRENT_DT_PROFILE.Rows.Count > 1 Then
MsgBox("More than 1 profile (" & CURRENT_DT_PROFILE.Rows.Count & ") returned!!", MsgBoxStyle.Critical, "Attention:")
Else
_step = 5
MyValidationLogger.Debug("Step 5")
If CURRENT_DT_PROFILE.Rows.Count = 1 Then
_step = 6
MyValidationLogger.Debug("Step 6")
' === MESSPUNKT 6: Profile-Properties verarbeiten ===
For Each oProfileRow As DataRow In CURRENT_DT_PROFILE.Rows
PROFIL_FINISH_SQL = oProfileRow.Item("SQL_BTN_FINISH")
PROFIL_VEKTORINDEX = oProfileRow.Item("PM_VEKTOR_INDEX")
@@ -305,6 +328,13 @@ Public Class frmValidator
REJECTION_ACTIVE = False
PROFIL_LOGINDEX = oProfileRow.Item("LOG_INDEX")
CURRENT_PROFILE_LOG_INDEX = PROFIL_LOGINDEX
If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF] Nach Profile-Properties: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now
End If
' === MESSPUNKT 7: Language-Strings laden (potentiell langsam) ===
Dim oProfileTitle As String = ""
Dim oProfileDescription As String = ""
@@ -327,6 +357,11 @@ Public Class frmValidator
End If
Next
If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF] Nach Language-Loop ({CURRENT_DT_PROFILE_LANGUAGE.Rows.Count} Rows): {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now
End If
If oProfileTitle = "" Then
oProfileTitle = oProfileRow.Item("TITLE")
End If
@@ -355,6 +390,8 @@ Public Class frmValidator
finalProfile = oProfileRow.Item("FINAL_PROFILE")
Move2Folder = IIf(IsDBNull(oProfileRow.Item("MOVE2Folder")), "", oProfileRow.Item("MOVE2Folder"))
' === MESSPUNKT 8: Button-Texte setzen ===
Try
If finalProfile = True Then
If oProfileFinalText = "" Then
@@ -362,41 +399,45 @@ Public Class frmValidator
Else
oProfileFinalText = $"{oProfileFinalText} (F2)"
End If
btnSave.Text = oProfileFinalText
Else
oProfileFinalText = IIf(IsDBNull(oProfileRow.Item("FINAL_TEXT")), "", oProfileRow.Item("FINAL_TEXT") & (" (F2)"))
'btnSave.Text = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.ValidationButton")
If oProfileFinalText = String.Empty Then
oProfileFinalText = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.ValidationButton")
End If
btnSave.Text = oProfileFinalText
End If
MyValidationLogger.Debug("Buttontext validation loaded")
If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF] Nach Button-Setup: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now
End If
Catch ex As Exception
MyValidationLogger.Error(ex)
MsgBox("Error loading final profile text:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Attention:")
MyValidationLogger.Info(">> Error loading final profile text: " & ex.Message, True)
End Try
' === MESSPUNKT 9: Rejection/NotResponsible-Buttons konfigurieren ===
Dim PROF_BTN_RE_CAPT = oProfileRow.Item("BTN_REJECT_CAPTION")
Dim PROF_SQL_BTN_REJECT = oProfileRow.Item("SQL_BTN_REJECT")
oProfile_REJECT_SQL_REASONS = oProfileRow.Item("REJECT_SQL_REASONS")
oProfile_NOT_RESP_SQL = oProfileRow.Item("NOT_RESP_SQL")
If oProfileRejectionText = String.Empty Then
oProfileRejectionText = PROF_BTN_RE_CAPT
End If
MyValidationLogger.Debug($"oProfileRejectionText: " + oProfileRejectionText)
MyValidationLogger.Debug($"oProfile_REJECT_SQL_REASONS: " + oProfile_REJECT_SQL_REASONS)
MyValidationLogger.Debug($"oProfileNotResponsibleText: " + oProfileNotResponsibleText)
MyValidationLogger.Debug($"oProfile_NOT_RESP_SQL: " + oProfile_NOT_RESP_SQL)
MyValidationLogger.Debug($"oProfileRejectionText: " + oProfileRejectionText)
Dim functBtnReject As Boolean = False
Dim functBtnNR As Boolean = False
If oProfileRejectionText <> String.Empty And oProfile_REJECT_SQL_REASONS <> String.Empty Then
functBtnReject = True
End If
@@ -405,6 +446,7 @@ Public Class frmValidator
functBtnNR = True
End If
End If
If functBtnReject = False And functBtnNR = False Then
MyValidationLogger.Debug($"!Keine Ablehnung und Nicht zuständig Funktion konfiguriert!")
SplitContainerReject_NotResp.Visible = False
@@ -454,16 +496,20 @@ Public Class frmValidator
End If
End If
If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF] Nach Rejection/NR-Setup: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now
End If
bbtniNext.Visibility = BarItemVisibility.Never
If CURRENT_JUMP_DOC_GUID <> 0 Then
Amount_Docs2Validate = 1
Else
Amount_Docs2Validate = 0
End If
Next
MyValidationLogger.Debug(" >> profiledata saved:")
MyValidationLogger.Debug(" >> finalProfile: " & finalProfile)
MyValidationLogger.Debug(" >> Move2Folder: " & Move2Folder)
@@ -471,38 +517,43 @@ Public Class frmValidator
PROFIL_sortbynewest = CURRENT_DT_PROFILE.Rows(0).Item("SORT_BY_LATEST")
MyValidationLogger.Debug("PROFIL_sortbynewest: " & PROFIL_sortbynewest.ToString)
'Delete Button anzeigen ja/nein
If USER_RIGHT_FILE_DELETE = True Then
bbtniDelete.Visibility = BarItemVisibility.Always
Else
bbtniDelete.Visibility = BarItemVisibility.Never
End If
If CBool(CURRENT_DT_PROFILE.Rows(0).Item("ANNOTATE_WORK_HISTORY_ENTRY")) = True Then
bbtniAnnotation.Visibility = BarItemVisibility.Always
Else
bbtniAnnotation.Visibility = BarItemVisibility.Never
End If
MyValidationLogger.Debug("Right_Delete: " & USER_RIGHT_FILE_DELETE.ToString)
' === MESSPUNKT 10: Create_Controls (KRITISCH - wahrscheinlich größter Hotspot) ===
If LOG_HOTSPOTS Then MyValidationLogger.Info($"[PERF] Vor Create_Controls")
Create_Controls()
If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF] Nach Create_Controls: {(DateTime.Now - perfLastCheck).TotalMilliseconds}ms")
perfLastCheck = DateTime.Now
End If
End If
End If
'oErrMsgMissingInput = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.MissingInput")
' oErrMsgMissingInput = S.Bitte_validieren_Sie_die_rot_markierten_Felder_
' frmError.ShowDialog()
MyValidationLogger.Debug("frmValidation_Load finished!")
' === MESSPUNKT 11: Gesamt-Zeit ===
If LOG_HOTSPOTS Then
MyValidationLogger.Info($"[PERF] GESAMT frmValidation_Load: {(DateTime.Now - perfStart).TotalMilliseconds}ms")
End If
Catch ex As Exception
MyValidationLogger.Error(ex)
MsgBox("Error LOADING Profile-Data1:" & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Attention:")
MyValidationLogger.Info("Unexpected error in LOADING Profile-Data1: " & ex.Message)
End Try
End Sub
@@ -936,6 +987,7 @@ Public Class frmValidator
AddHandler txt.GotFocus, AddressOf OnTextBoxFocus
AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus
AddHandler txt.KeyUp, AddressOf OnTextBoxKeyUp
AddHandler txt.EditValueChanged, AddressOf OnTextBoxEditValueChanged
oMyControl = txt
MyValidationLogger.Debug($"[{oControlInfo}] - TXT Created!!")
@@ -1144,7 +1196,8 @@ Public Class frmValidator
Dim oGrid = ControlCreator.CreateExistingGridControl(oControlRow, oFilteredDatatable, False, DocCurrency)
oMyControl = oGrid
'AddHandler oGrid.Views(0).c AddressOf GridView_CustomColumnDisplayText
' NEU: GridView Event registrieren
AddHandler DirectCast(oGrid.MainView, GridView).CellValueChanged, AddressOf GridView_CellValueChanged
Case "LINE"
oMyControl = ControlCreator.CreateExistingLine(oControlRow, False)
@@ -1243,13 +1296,19 @@ Public Class frmValidator
If oMeta.ReadOnly = False Then
oTextbox.BackColor = oMeta.BackColor
oTextbox.ForeColor = GraphicsEx.GetContrastedColor(oMeta.BackColor)
End If
' NEU: Dirty-Flag setzen - OHNE .Modified Property
' Stattdessen prüfen wir, ob das Control bereits als dirty markiert wurde
' oder setzen es bei jedem LostFocus (einfachste Lösung)
If Not oMeta.IsDirty Then
oMeta.IsDirty = True
MyValidationLogger.Debug($"Control [{oMeta.Name}] marked as dirty")
End If
SetControlValues_FromControl(oTextbox)
Controls2beEnabled(oTextbox.Name)
ControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER)
End Sub
Private Function GetControlID(ByVal PROFILEID As Integer, Controlname As String)
@@ -1257,7 +1316,19 @@ Public Class frmValidator
Next
End Function
Private Sub OnTextBoxEditValueChanged(sender As Object, e As EventArgs)
If _FormLoaded = False Or _Indexe_Loaded = False Then
Exit Sub
End If
Dim oTextbox As BaseEdit = sender
Dim oMeta As ClassControlCreator.ControlMetadata = oTextbox.Tag
If Not oMeta.IsDirty Then
oMeta.IsDirty = True
MyValidationLogger.Debug($"TextBox [{oMeta.Name}] marked as dirty")
End If
End Sub
Public Sub OnTextBoxKeyUp(sender As Object, e As KeyEventArgs)
If _ControlHandleStarted = True Then
@@ -1566,6 +1637,18 @@ Public Class frmValidator
Try
Dim oLookup As RepositoryItemLookupControl3 = sender
' NEU: Dirty-Flag setzen - Suche den zugehörigen LookupControl
For Each oControl In PanelValidatorControl.Controls
If TypeOf oControl Is LookupControl3 Then
Dim oLookupControl As LookupControl3 = DirectCast(oControl, LookupControl3)
If oLookupControl.Properties Is oLookup Then
Dim oMeta As ClassControlCreator.ControlMetadata = oLookupControl.Tag
oMeta.IsDirty = True
MyValidationLogger.Debug($"LookupControl [{oMeta.Name}] marked as dirty")
Exit For
End If
End If
Next
listChangedLookup.Add(oLookup.Name)
ControlCreator.GridTables_HandleControlValueChange(PanelValidatorControl, DT_COLUMNS_GRID_WITH_SQL_WITH_CTRL_PLACEHOLDER)
@@ -1589,7 +1672,14 @@ Public Class frmValidator
End Try
End Sub
Private Sub GridView_CellValueChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs)
Dim oView As GridView = sender
Dim oGrid As GridControl = oView.GridControl
Dim oMeta As ClassControlCreator.ControlMetadata = oGrid.Tag
oMeta.IsDirty = True
MyValidationLogger.Debug($"GridControl [{oMeta.Name}] marked as dirty (Row {e.RowHandle}, Col {e.Column.FieldName})")
End Sub
Public Sub onCheckBox_CheckedChange(sender As Object, e As EventArgs)
MyValidationLogger.Debug("onCheckBox_CheckedChange")
@@ -1597,6 +1687,11 @@ Public Class frmValidator
Exit Sub
End If
Dim oCheckbox As CheckBox = sender
' Dirty-Flag setzen
Dim oMeta As ClassControlCreator.ControlMetadata = oCheckbox.Tag
oMeta.IsDirty = True
MyValidationLogger.Debug($"CheckBox [{oMeta.Name}] marked as dirty")
Try
CheckBox_DependingControls(oCheckbox)
Checkbox_EnablingControls(oCheckbox)
@@ -2189,6 +2284,10 @@ Public Class frmValidator
Public Sub OnCmbselectedIndex(sender As System.Object, e As System.EventArgs)
Dim oCombobox As Windows.Forms.ComboBox = sender
If oCombobox.SelectedIndex <> -1 And _Indexe_Loaded = True Then
' Dirty-Flag setzen
Dim oMeta As ClassControlCreator.ControlMetadata = oCombobox.Tag
oMeta.IsDirty = True
MyValidationLogger.Debug($"ComboBox [{oMeta.Name}] marked as dirty")
If oCombobox.Name = last_control.Name Then
'Abschluss()
Else
@@ -4894,41 +4993,59 @@ Public Class frmValidator
Dim oControlId As String
Try
Dim oMissing As Boolean = False
'Jedes Control auf panel durchlaufen
' ========== OPTIMIERUNG: Nur geänderte Controls durchlaufen ==========
For Each oControl As Control In Me.PanelValidatorControl.Controls
'Der input der Box,Cmb muss jedes mal geleert werden
Dim oMyInput As String = ""
'Jedes Control in Konfig Tab durchlaufn
For Each oControlRow As DataRow In DTVWCONTROL_INDEX.Rows
Dim oMeta As ClassControlCreator.ControlMetadata = Nothing
Try
oMeta = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata)
Catch
Continue For ' Control ohne Metadata überspringen
End Try
' Suche die Control-Definition
Dim oControlRow = (From form In DTVWCONTROL_INDEX.AsEnumerable()
Where form.Item("GUID") = oMeta.Guid).SingleOrDefault()
If oControlRow Is Nothing Then Continue For
Dim oCtrlType = oControlRow.Item("CTRL_TYPE").ToString
'Den Indexnamen auslesen
Dim oIndexName As String = oControlRow.Item("INDEX_NAME")
Dim oIsRequired As Boolean = CBool(oControlRow.Item("VALIDATION"))
Dim oIsReadOnly As Boolean = CBool(oControlRow.Item("READ_ONLY"))
Dim oSaveChangeEnabledFalse As Boolean = CBool(oControlRow.Item("SAVE_CHANGE_ON_ENABLED"))
' Überspringe System-Controls
If oCtrlType = "LBL" Or oCtrlType = "LINE" Or oCtrlType = "BUTTON" Then
Continue For
End If
If oIndexName = "@@DISPLAY_ONLY" Then
'Logger.Debug($"Index [{oIndexName}] will be skipped")
Continue For
End If
' Überspringe ReadOnly-Controls (außer SAVE_CHANGE_ON_ENABLED)
If oIsReadOnly = True And oSaveChangeEnabledFalse = False Then
MyValidationLogger.Debug($"Skipping ReadOnly ControlName [{oControl.Name}]!")
Continue For
End If
Dim oDBControlName = oControlRow.Item("CTRL_NAME").ToString
Dim oIsRequired As Boolean = CBool(oControlRow.Item("VALIDATION"))
Dim oSQLCheckCommand As String = IIf(IsDBNull(oControlRow.Item("SQL_UEBERPRUEFUNG")), "", oControlRow.Item("SQL_UEBERPRUEFUNG"))
Dim oIsReadOnly As Boolean = CBool(oControlRow.Item("READ_ONLY"))
Dim oSaveChangeEnabledFalse As Boolean = CBool(oControlRow.Item("SAVE_CHANGE_ON_ENABLED"))
'Wenn eine Ablehnung aktiv ist und der Index identisch ist, dann skipping
' ========== KERN-OPTIMIERUNG: Dirty-Check ==========
' Überspringe unveränderte, nicht-required Controls
If Not oMeta.IsDirty And Not oIsRequired Then
MyValidationLogger.Debug($"Skipping unchanged control [{oMeta.Name}]")
Continue For
End If
' ========== ENDE OPTIMIERUNG ==========
' Rejection-Handling
If REJECTION_ACTIVE = True And (oIndexName = PROFIL_REJECT_ACTIONS_ATTRIBUTE Or oIndexName = PROFIL_REJECT_COMMENT_ATTRIBUTE) Then
MyValidationLogger.Debug($"Index [{oIndexName}] will be skipped as Rejection is in progress!")
Continue For
End If
'Readonly felder werden über finale indexe gefüllt, nicht mit SetControlData
If oIsReadOnly = True And oSaveChangeEnabledFalse = False Then
MyValidationLogger.Debug($"Skipping ReadOnly ControlName [{oDBControlName}] !")
Continue For
End If
' ========== AB HIER: Bestehender Validierungs-Code ==========
Dim oMyInput As String = ""
Dim oSQLCheckCommand As String = IIf(IsDBNull(oControlRow.Item("SQL_UEBERPRUEFUNG")), "", oControlRow.Item("SQL_UEBERPRUEFUNG"))
Dim oControlType As String = oControlRow.Item("CTRL_TYPE")
Dim oIDBTyp As Integer
If IDB_ACTIVE Then
@@ -4941,13 +5058,14 @@ Public Class frmValidator
oControlName = oControlRow.Item("CTRL_NAME")
Dim oOVERWRITE_DATA = oControlRow.Item("OVERWRITE_DATA")
'Nur wenn der Name der Zeile entspricht und der Index READ_ONLY FALSE ist
If oDBControlName = oControl.Name And Not {"@@DISPLAY_ONLY", "DD PM-ONLY FOR DISPLAY"}.Contains(oIndexName) Then
MyValidationLogger.Debug("Indexierung für Control (" & oControlId & ") '" & oControlName & "' gestartet. Indexname '" & oIndexName & "'")
If oIndexName = "" Then
MyValidationLogger.Info(">> Indexname is unexpected empty.")
Continue For
End If
' ========== SELECT CASE: Control-Type-Handling (wie bisher) ==========
Select Case True
Case oControl.GetType = GetType(LookupControl3)
Try
@@ -4960,27 +5078,19 @@ Public Class frmValidator
frmError.ShowDialog()
Exit For
Else
If lookup.Properties.MultiSelect = True Then
Dim oLookupRows As Integer = lookup.Properties.SelectedValues.Count
'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss
If oLookupRows > 0 Then
Dim ZeilenGrid As Integer = 0
Dim myVektorArr As String()
'Jeden Werte des Datagridviews durchlaufen
For Each value As String In lookup.Properties.SelectedValues
If value Is Nothing = False Then
'Das Array anpassen
ReDim Preserve myVektorArr(ZeilenGrid)
'Den Wert im Array speichern
myVektorArr(ZeilenGrid) = value
ZeilenGrid += 1
End If
Next
If IDB_ACTIVE = False Then
If Indexiere_File(CURRENT_WMFILE, oIndexName, myVektorArr) = False Then
oMissing = True
oErrMsgMissingInput = "Error while indexing von LookupGrid - ERROR: " & idxerr_message
@@ -4990,7 +5100,6 @@ Public Class frmValidator
End If
Else
Dim oMyDT = DT_FOR_ARRAY(myVektorArr)
If IDBData.SetVariableValue(oIndexName, oMyDT, oOVERWRITE_DATA, oIDBTyp) = False Then
oMissing = True
oErrMsgMissingInput = "Error while indexing IDB-Object LookupGrid"
@@ -5018,9 +5127,8 @@ Public Class frmValidator
Next
End If
End If
Else
' Single-Select Lookup
oMyInput = lookup.Properties.SelectedValues.FirstOrDefault()
If IsNothing(oMyInput) And oIsRequired = True Then
oMissing = True
@@ -5036,21 +5144,19 @@ Public Class frmValidator
Next
Continue For
End If
'den aktuellen Wert in windream auslesen
Dim oValueFromObject
Dim oValueFromObject
If oIndexName.StartsWith("[%VKT") Then
oValueFromObject = ReturnVektor_IndexValue(oIndexName)
Else
oValueFromObject = GetVariableValuefromSource(oIndexName, oIDBTyp)
Dim oValueIsIndifferent As Boolean = False
If Not IsNothing(oValueFromObject) Then
If IDB_ACTIVE = False Then
If oValueFromObject.ToString = "System.Object[]" Then
If oValueFromObject.Length = 1 Then
oValueFromObject = oValueFromObject(0)
Else '
Else
MyValidationLogger.Info(" >> Vectorfield " & oIndexName & "' contains more then one value - First value will be used")
oValueFromObject = oValueFromObject(0)
End If
@@ -5070,6 +5176,7 @@ Public Class frmValidator
oValueIsIndifferent = True
End If
End If
Dim oValueSourceIsDifferent As Boolean = False
If oValueIsIndifferent = False Then
MyValidationLogger.Debug($"CheckUpdateIndex.LookUpGrid: oValueFromObject is [{oValueFromObject}]")
@@ -5082,18 +5189,11 @@ Public Class frmValidator
oValueSourceIsDifferent = True
MyValidationLogger.Debug($"oValueFromObject <> oMyInput not possible as one object might be a multiple row object")
End Try
Else
End If
'wenn Wert in Windream <> der Eingabe darf indexiert werden
'IsNothing(oValueFromObject) Or oValueFromObject <> oMyInput
If (oValueIsIndifferent = True Or oValueSourceIsDifferent = True) Then
'Wenn der Wert in ein Vektorfeld geschrieben wird
If oIndexName.StartsWith("[%VKT") Then
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 Textbox as VEKTOR - ERROR: " & idxerr_message
@@ -5122,34 +5222,25 @@ Public Class frmValidator
If PROFIL_LOGINDEX <> "" Then
Dim oLogStr = Return_LOGString(oMyInput, oValueFromObject, oIndexName)
WMIndexVectofield(oLogStr, PROFIL_LOGINDEX)
'Else
' IDBData.SetVariableValue(PROFIL_LOGINDEX, oLogStr)
End If
End If
'Nun das Logging
End If
End If
End If
End If
End If
End If
End If
Catch ex As Exception
MyValidationLogger.Error(ex)
End Try
Case oControl.GetType = GetType(DevExpress.XtraEditors.TextEdit) Or oControl.GetType = GetType(MemoEdit)
Try
'Dim oWrongInputMessage = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.WrongInputControl")
Dim oWrongInputMessage = S.Falsche_Eingabe
Dim oDevexpressTextEdit As DevExpress.XtraEditors.TextEdit = oControl
MyValidationLogger.Debug("Validating Textbox..")
If oRegexMatch <> String.Empty AndAlso Not Regex.IsMatch(oDevexpressTextEdit.EditValue, oRegexMatch) Then
oMissing = True
oErrMsgMissingInput = oWrongInputMessage & " textbox '" & oControl.Name & "'"
MyValidationLogger.Warn(oErrMsgMissingInput)
If oRegexMessage <> String.Empty Then
@@ -5160,8 +5251,7 @@ Public Class frmValidator
Exit For
End If
'as erstes überprüfen ob überhaupt etwas eingetragen worden ist
If Check_Missing_Control_Value(oControl, "txt") = True And oIsRequired = True Then 'NICHTS EINGETRAGEN
If Check_Missing_Control_Value(oControl, "txt") = True And oIsRequired = True Then
oMissing = True
oErrMsgMissingInput = oWrongInputMessage & " textbox '" & oControl.Name & "'"
MyValidationLogger.Warn(oErrMsgMissingInput)
@@ -5170,26 +5260,21 @@ Public Class frmValidator
Exit For
Else
MyValidationLogger.Debug("Reading current value from Textbox")
Dim oTextEdit As BaseEdit = DirectCast(oControl, BaseEdit)
oMyInput = ClassFormat.GetStringValue(oTextEdit.EditValue)
MyValidationLogger.Debug("Form Value: [{0}]", oMyInput)
'den aktuellen Wert in windream auslesen
Dim oSourceValue = GetVariableValuefromSource(oIndexName, oIDBTyp)
MyValidationLogger.Debug("Current Value: [{0}]", oSourceValue)
If oIndexName.StartsWith("[%VKT") Then
oSourceValue = ReturnVektor_IndexValue(oIndexName)
Else
'wertWD = CURRENT_WMFILE.GetVariableValue(oIndexName)
If Not IsNothing(oSourceValue) Then
If oSourceValue.ToString = "System.Object[]" Then
If oSourceValue.Length = 1 Then
oSourceValue = oSourceValue(0)
Else '
Else
MyValidationLogger.Info(" >> Vectorfield " & oIndexName & "' contains more then one value - First value will be used")
oSourceValue = oSourceValue(0)
End If
@@ -5198,6 +5283,7 @@ Public Class frmValidator
oSourceValue = ""
End If
End If
Dim oSetValue As Boolean = False
If IsDBNull(oSourceValue) Then
oSetValue = True
@@ -5219,12 +5305,9 @@ Public Class frmValidator
MyValidationLogger.Debug("Preparing Indexing for Textbox")
'wenn Wert in Windream <> der Eingabe darf indexiert werden
If oSetValue = True Then
'Wenn der Wert in ein Vektorfeld geschrieben wird
If oIndexName.StartsWith("[%VKT") Then
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 Textbox {oControl} - Attribute {oIndexName} as VEKTOR - ERROR: " & idxerr_message
@@ -5237,9 +5320,7 @@ Public Class frmValidator
Dim result() As String
ReDim Preserve result(0)
result(0) = oMyInput
MyValidationLogger.Debug("Indexing Index [{0}] with value [{1}]", oMyInput, oIndexName)
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
oMissing = True
oErrMsgMissingInput = $"Error while indexing Textbox {oControl} - Attribute {oIndexName} - ERROR: " & idxerr_message
@@ -5256,8 +5337,6 @@ Public Class frmValidator
If PROFIL_LOGINDEX <> "" Then
Dim oMyLogString = Return_LOGString(oMyInput, oSourceValue, oIndexName)
WMIndexVectofield(oMyLogString, PROFIL_LOGINDEX)
'Else
'IDBData.SetVariableValue(PROFIL_LOGINDEX, oMyLogString)
End If
End If
End If
@@ -5270,26 +5349,27 @@ Public Class frmValidator
st = New StackTrace(ex, True)
MyValidationLogger.Warn("Unexpected error in Check_UpdateIndexe TextBox :" & ex.Message, True)
OpenfrmError(oErrMsgMissingInput)
' Nach Fehler: Dirty-Flag zurücksetzen
oMeta.IsDirty = False
Return False
End Try
Case oControl.GetType = GetType(System.Windows.Forms.ComboBox)
' ... (Dein bestehender ComboBox-Code bleibt gleich) ...
Try
MyValidationLogger.Debug($"Working on Combobox...")
Dim cmb As Windows.Forms.ComboBox = oControl
'Wenn kein Wert ausgewählt wurde und der Index aber gesetzt werden muss
If cmb.SelectedIndex = -1 And oIsRequired = True Then
oMissing = True
oErrMsgMissingInput = "Please Choose an entry out of ComboBox '" & cmb.Name & "'"
MyValidationLogger.Warn(oErrMsgMissingInput)
OpenfrmError(oErrMsgMissingInput)
Exit For
'ElseIf cmb.SelectedIndex <> -1 Then
Else 'Änderung 28.08.2018: Ein leerer Wert in der Combobox wird in den Index geschrieben
Else
oMyInput = cmb.Text
MyValidationLogger.Debug($"inputvalue Combobox: {cmb.Text}")
Dim oValue
'den aktuellen Wert in windream auslesen
If oIndexName.StartsWith("[%VKT") Then
oValue = ReturnVektor_IndexValue(oIndexName)
Else
@@ -5311,7 +5391,7 @@ Public Class frmValidator
MyValidationLogger.Debug($"Control with ID{oControlId} is a vectorfield...")
If oValue.Length = 1 Then
oValue = oValue(0).ToString
Else '
Else
MyValidationLogger.Info(" >> Vectorfield " & oIndexName & "' contains more then one value - First value will be used")
oValue = oValue(0).ToString
End If
@@ -5327,13 +5407,10 @@ Public Class frmValidator
MyValidationLogger.Error(ex.Message)
oitsadifference = True
End Try
'wenn Wert in Windream <> der Eingabe darf indexiert werden
If oitsadifference = True Then
MyValidationLogger.Debug($"Index with ID{oControlId} will now be indexed...")
'Wenn der Wert in ein Vektorfeld geschrieben wird
If oIndexName.StartsWith("[%VKT") Then
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 Combobox as VEKTOR - ERROR: " & idxerr_message
@@ -5368,22 +5445,13 @@ Public Class frmValidator
If PROFIL_LOGINDEX <> "" Then
Dim ologStr = Return_LOGString(oMyInput, oValue, oIndexName)
WMIndexVectofield(ologStr, PROFIL_LOGINDEX)
'Else
'IDBData.SetVariableValue(PROFIL_LOGINDEX, ologStr)
End If
End If
'Nun das Logging
End If
Else
MyValidationLogger.Debug($"oitsadifference = False...Index with ID {oControlId} will not be indexed...")
'Wenn der Wert in ein Vektorfeld geschrieben wird
End If
End If
End If
Catch ex As Exception
MyValidationLogger.Error(ex)
@@ -5391,13 +5459,14 @@ Public Class frmValidator
st = New StackTrace(ex, True)
MsgBox($"Unexpected error in Check_UpdateIndexe Combobox : ID{oControlId} " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Error:")
MyValidationLogger.Info($"Unexpected error in Check_UpdateIndexe Combobox : ID{oControlId}" & ex.Message)
oMeta.IsDirty = False
Return False
End Try
Case oControl.GetType = GetType(DateTimePicker)
' ... (Dein bestehender DateTimePicker-Code) ...
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 & "'"
@@ -5406,8 +5475,6 @@ Public Class frmValidator
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)
@@ -5417,13 +5484,9 @@ Public Class frmValidator
If IsNothing(oObjectValue) Or IsDBNull(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
@@ -5456,23 +5519,22 @@ Public Class frmValidator
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
MyValidationLogger.Debug("Value WD ('" & oObjectValue.ToString & "') = Input-value ('" & oMyInput.ToString & "')")
End If
Else
MyValidationLogger.Debug("DateValue is 01.01.0001 00:00:00")
End If
Catch ex As Exception
MyValidationLogger.Error(ex)
oMeta.IsDirty = False
End Try
Case oControl.GetType = GetType(CheckBox)
' ... (Dein bestehender CheckBox-Code) ...
Try
Dim chk As CheckBox = oControl
oMyInput = chk.Checked.ToString
@@ -5485,7 +5547,6 @@ Public Class frmValidator
Exit For
End If
'den aktuellen Wert in windream auslesen
Dim WertWD As String
Dim oBoolValue As Boolean
If oIndexName.StartsWith("[%VKT") Then
@@ -5498,14 +5559,13 @@ Public Class frmValidator
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 '
Else
MyValidationLogger.Info(" >> Vectorfield " & oIndexName & "' contains more then one value - First value will be used")
_Value = oObjectCheck(0)
End If
@@ -5514,13 +5574,8 @@ Public Class frmValidator
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)
@@ -5531,9 +5586,7 @@ Public Class frmValidator
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
@@ -5561,30 +5614,26 @@ Public Class frmValidator
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
Catch ex As Exception
MyValidationLogger.Error(ex)
oMeta.IsDirty = False
End Try
Case oControl.GetType = GetType(DataGridView)
' ... (Dein bestehender DataGridView-Code) ...
Try
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 & "'"
@@ -5594,15 +5643,12 @@ Public Class frmValidator
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
@@ -5611,24 +5657,17 @@ Public Class frmValidator
Case Else
str = str & PMDelimiter & row.Cells(i).Value
End Select
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
If IDB_ACTIVE = False Then
If Indexiere_File(CURRENT_WMFILE, oIndexName, myVektorArr) = False Then
@@ -5650,10 +5689,10 @@ Public Class frmValidator
End If
End If
End If
'Jetzt die Datei indexieren
End If
Catch ex As Exception
MyValidationLogger.Error(ex)
oMeta.IsDirty = False
End Try
Case oControl.GetType = GetType(GridControl)
@@ -5673,18 +5712,13 @@ Public Class frmValidator
If oResult = False Then
Exit For
End If
End Select
End If 'End If für Control und ReadOnly = False
Next
' If Error happened in inner For, exit the outer as well
If oMissing = True Then
MyValidationLogger.Info("oMissing = True...Exiting")
Exit For
End If
Next
' ========== NEU: Dirty-Flag nach erfolgreicher Indexierung zurücksetzen ==========
oMeta.IsDirty = False
Next ' End For Each oControl
If oMissing = True Then
MyValidationLogger.Warn("Check_UpdateIndexe: ERROR or Missing Indexing - returning False")
Return False