Compare commits
2 Commits
16de651395
...
b03e11937b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b03e11937b | ||
|
|
011aad712b |
@@ -1,4 +1,5 @@
|
|||||||
Imports System
|
Imports System.Resources
|
||||||
|
Imports System
|
||||||
Imports System.Reflection
|
Imports System.Reflection
|
||||||
Imports System.Runtime.InteropServices
|
Imports System.Runtime.InteropServices
|
||||||
|
|
||||||
@@ -33,3 +34,4 @@ Imports System.Runtime.InteropServices
|
|||||||
|
|
||||||
<Assembly: AssemblyVersion("2.4.6.0")>
|
<Assembly: AssemblyVersion("2.4.6.0")>
|
||||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||||
|
<Assembly: NeutralResourcesLanguage("")>
|
||||||
|
|||||||
@@ -533,6 +533,7 @@
|
|||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>frmValidator_Strings.resx</DependentUpon>
|
<DependentUpon>frmValidator_Strings.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Validator\Validator.vb" />
|
||||||
<Compile Include="XtraReport1.Designer.vb">
|
<Compile Include="XtraReport1.Designer.vb">
|
||||||
<DependentUpon>XtraReport1.vb</DependentUpon>
|
<DependentUpon>XtraReport1.vb</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
164
app/TaskFlow/Validator/Validator.vb
Normal file
164
app/TaskFlow/Validator/Validator.vb
Normal file
@@ -0,0 +1,164 @@
|
|||||||
|
Imports System.Text.RegularExpressions
|
||||||
|
Imports DigitalData.Modules.Base
|
||||||
|
Imports DigitalData.Modules.Logging
|
||||||
|
|
||||||
|
Public Class Validator
|
||||||
|
Inherits BaseClass
|
||||||
|
|
||||||
|
Public Sub New(pLogConfig As LogConfig)
|
||||||
|
MyBase.New(pLogConfig)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Class ControlRow
|
||||||
|
Public Id As Integer
|
||||||
|
Public IndexName As String
|
||||||
|
Public Validation As Boolean
|
||||||
|
Public [ReadOnly] As Boolean
|
||||||
|
Public ValidationSql As String
|
||||||
|
Public RegexMatch As String
|
||||||
|
Public RegexMessage As String
|
||||||
|
Public OverwriteData As Boolean
|
||||||
|
Public SaveChangeEnabled As Boolean
|
||||||
|
End Class
|
||||||
|
|
||||||
|
Public Function ConvertToControlRow(pDataRow As DataRow) As ControlRow
|
||||||
|
Return New ControlRow With {
|
||||||
|
.Id = pDataRow.ItemEx("GUID", 0),
|
||||||
|
.IndexName = pDataRow.ItemEx("INDEX_NAME", ""),
|
||||||
|
.Validation = pDataRow.ItemEx("VALIDATION", False),
|
||||||
|
.[ReadOnly] = pDataRow.ItemEx("READ_ONLY", False),
|
||||||
|
.ValidationSql = pDataRow.ItemEx("SQL_UEBERPRUEFUNG", ""),
|
||||||
|
.RegexMatch = pDataRow.ItemEx("REGEX_MATCH", ""),
|
||||||
|
.RegexMessage = pDataRow.ItemEx("REGEX_MESSAGE_DE", ""),
|
||||||
|
.OverwriteData = pDataRow.ItemEx("OVERWRITE_DATA", False),
|
||||||
|
.SaveChangeEnabled = pDataRow.ItemEx("SAVE_CHANGE_ON_ENABLED", True)
|
||||||
|
}
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Function CheckTextbox(oControl As Control, pControlRow As DataRow)
|
||||||
|
Try
|
||||||
|
Dim oControlRow = ConvertToControlRow(pControlRow)
|
||||||
|
|
||||||
|
'Dim oWrongInputMessage = ClassAllgemeineFunktionen.GUI_LANGUAGE_INFO("frmValidator.WrongInputControl")
|
||||||
|
Dim oWrongInputMessage = S.Falsche_Eingabe
|
||||||
|
|
||||||
|
If oControlRow.RegexMatch <> String.Empty AndAlso Not Regex.IsMatch(oControl.Text, oControlRow.RegexMatch) Then
|
||||||
|
oMissing = True
|
||||||
|
|
||||||
|
oErrMsgMissingInput = oWrongInputMessage & " textbox '" & oControl.Name & "'"
|
||||||
|
|
||||||
|
Logger.Warn(oErrMsgMissingInput)
|
||||||
|
If oControlRow.RegexMessage <> String.Empty Then
|
||||||
|
oErrMsgMissingInput &= ":" & vbCrLf & oControlRow.RegexMessage
|
||||||
|
End If
|
||||||
|
|
||||||
|
oControl.BackColor = Color.Red
|
||||||
|
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
|
||||||
|
oMissing = True
|
||||||
|
oErrMsgMissingInput = oWrongInputMessage & " textbox '" & oControl.Name & "'"
|
||||||
|
Logger.Warn(oErrMsgMissingInput)
|
||||||
|
oControl.BackColor = Color.Red
|
||||||
|
Exit For
|
||||||
|
Else
|
||||||
|
Dim oTextEdit As TextEdit = DirectCast(oControl, TextEdit)
|
||||||
|
oMyInput = ClassFormat.GetStringValue(oTextEdit.EditValue)
|
||||||
|
|
||||||
|
'den aktuellen Wert in windream auslesen
|
||||||
|
Dim oSourceValue = GetVariableValuefromSource(oIndexName, oIDBTyp)
|
||||||
|
|
||||||
|
|
||||||
|
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 '
|
||||||
|
Logger.Info(" >> Vectorfield " & oIndexName & "' contains more then one value - First value will be used")
|
||||||
|
oSourceValue = oSourceValue(0)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
oSourceValue = ""
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Dim oSetValue As Boolean = False
|
||||||
|
If IsDBNull(oSourceValue) Then
|
||||||
|
oSetValue = True
|
||||||
|
End If
|
||||||
|
If oSetValue = False Then
|
||||||
|
If IsNothing(oSourceValue) Then
|
||||||
|
oSetValue = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
If oSetValue = False Then
|
||||||
|
Try
|
||||||
|
If oSourceValue <> oMyInput Then
|
||||||
|
oSetValue = True
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
oSetValue = True
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End If
|
||||||
|
'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 as VEKTOR - ERROR: " & idxerr_message
|
||||||
|
Logger.Warn(oErrMsgMissingInput)
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
If IDB_ACTIVE = False Then
|
||||||
|
Dim result() As String
|
||||||
|
ReDim Preserve result(0)
|
||||||
|
result(0) = oMyInput
|
||||||
|
If Indexiere_File(CURRENT_WMFILE, oIndexName, result) = False Then
|
||||||
|
oMissing = True
|
||||||
|
oErrMsgMissingInput = "Error while indexing Textbox - ERROR: " & idxerr_message
|
||||||
|
Logger.Warn(oErrMsgMissingInput)
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
If IDBData.SetVariableValue(oIndexName, oMyInput) = False Then
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
If IDB_ACTIVE = False Then
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
oErrMsgMissingInput = "Unexpected error in Check_UpdateIndexe TextBox '" & oControl.Name & "' - Check the log"
|
||||||
|
Logger.Error(ex)
|
||||||
|
Dim st As New StackTrace(True)
|
||||||
|
st = New StackTrace(ex, True)
|
||||||
|
Logger.Warn("Unexpected error in Check_UpdateIndexe TextBox :" & ex.Message, True)
|
||||||
|
Return False
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
End Class
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user