ms
This commit is contained in:
@@ -270,13 +270,16 @@ Public Class ClassControlBuilder
|
||||
End If
|
||||
For Each row As DataRow In TableResult.Rows
|
||||
Dim sqlcommand As String = row.Item("SQL_COMMAND_2")
|
||||
|
||||
Dim msg = String.Format(" >> Working on enabling control {0} - SQL: {1}", CONTROL_ID.ToString, sqlcommand)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
|
||||
If IsNothing(sqlcommand) Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
' Versuchen, die RecordId zu ersetzen, falls eine existiert
|
||||
sqlcommand = sqlcommand.ToUpper.Replace("@RECORD_ID", CURRENT_RECORD_ID)
|
||||
msg = String.Format(" >> sqlcommand-replaced1: {0}", sqlcommand)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
|
||||
' ControlId Platzhalter suchen und ersetzen
|
||||
Dim regex As New System.Text.RegularExpressions.Regex("(@(\d+)@)")
|
||||
Dim match As System.Text.RegularExpressions.Match = regex.Match(sqlcommand)
|
||||
@@ -291,14 +294,29 @@ Public Class ClassControlBuilder
|
||||
End Function).SingleOrDefault()
|
||||
' Wir ersetzen den platzhalter im sql command mit dem übergebenen wert
|
||||
sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> " & String.Format("Executing SQL_COMMAND: '{0}' for controlID '{1}'", sqlcommand, dependingControlId), False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> " & String.Format("Executing SQL_COMMAND: {0} for controlID {1}", sqlcommand, dependingControlId), False)
|
||||
|
||||
' Jetzt wird das SQL Command ausgeführt, es MUSS einen Boolschen Wert zurückgeben, True, False, 0, 1
|
||||
Dim dt_result As DataTable = Nothing
|
||||
dt_result = ClassDatabase.Return_Datatable(sqlcommand)
|
||||
|
||||
If dt_result.Rows.Count = 1 Then
|
||||
Dim enabled As Boolean = CBool(dt_result.Rows(0).Item(0))
|
||||
Dim enabled As Boolean = True
|
||||
|
||||
Try
|
||||
enabled = CBool(dt_result.Rows(0).Item(0))
|
||||
Catch ex As Exception
|
||||
msg = String.Format(">> Could not convert value of tablecontent to boolean!! SQL {0} # tablecontent: {1}" & vbNewLine, sqlcommand, dependingControlId)
|
||||
ClassLogger.Add(msg)
|
||||
End Try
|
||||
|
||||
If enabled = False Then
|
||||
msg = String.Format(" >> Control {0} will be disabled." & vbNewLine, dependingControlId.ToString)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
|
||||
Else
|
||||
msg = String.Format(" >> Control {0} will be enabled." & vbNewLine, dependingControlId.ToString)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(msg, False)
|
||||
End If
|
||||
dependingControl.Enabled = enabled
|
||||
Else
|
||||
ClassLogger.Add(" >> Attention: RowCount for enabling control (" & dependingControlId.ToString & ") was '" & dt_result.Rows.Count.ToString & "' and not 1 as expected - Check SQL: '" & sqlcommand & "'", False)
|
||||
|
||||
Reference in New Issue
Block a user