MS_29012016
This commit is contained in:
@@ -12,22 +12,28 @@
|
||||
End Function
|
||||
|
||||
Public Shared Function LoadAutoValue(control As Windows.Forms.Control, RecordId As Integer, ParentRecordId As Integer)
|
||||
Dim AutoValue As String = String.Empty
|
||||
Dim ControlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
|
||||
Dim SQL As String = ClassDatabase.Execute_Scalar(String.Format("SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE GUID = {0}", ControlId))
|
||||
SQL = ClassControlValues.ReplaceSqlCommandPlaceholders(SQL, RecordId, ParentRecordId)
|
||||
Try
|
||||
Dim AutoValue As String = String.Empty
|
||||
Dim ControlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
|
||||
Dim SQL As String = ClassDatabase.Execute_Scalar(String.Format("SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE GUID = {0}", ControlId))
|
||||
SQL = ClassControlValues.ReplaceSqlCommandPlaceholders(SQL, RecordId, ParentRecordId)
|
||||
|
||||
If SQL = "" Or IsDBNull(SQL) Then
|
||||
If SQL = "" Or IsDBNull(SQL) Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
AutoValue = ClassDatabase.Execute_Scalar(SQL)
|
||||
|
||||
If String.IsNullOrEmpty(AutoValue) Or IsDBNull(AutoValue) Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Return AutoValue
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Unexpected Error in LoadAutoValue: " & ex.Message, True)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
AutoValue = ClassDatabase.Execute_Scalar(SQL)
|
||||
|
||||
If String.IsNullOrEmpty(AutoValue) Or IsDBNull(AutoValue) Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Return AutoValue
|
||||
End Try
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
@@ -171,16 +177,27 @@
|
||||
Public Class Label : Inherits _BaseControl
|
||||
|
||||
Public Shared Sub LoadValue(control As Windows.Forms.Label, recordId As Integer, parentRecordId As Integer, value As String)
|
||||
Dim autoValue = LoadAutoValue(control, recordId, parentRecordId)
|
||||
Try
|
||||
Dim autoValue = LoadAutoValue(control, recordId, parentRecordId)
|
||||
|
||||
If IsNothing(autoValue) Then
|
||||
Dim ControlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
|
||||
Dim SQL = String.Format("SELECT CONTROL_TEXT FROM TBPMO_CONTROL_SCREEN WHERE CONTROL_ID = {0}", ControlId)
|
||||
Dim labelText As String = ClassDatabase.Execute_Scalar(SQL)
|
||||
control.Text = labelText
|
||||
Else
|
||||
control.Text = autoValue
|
||||
End If
|
||||
If IsNothing(autoValue) Then
|
||||
Dim ControlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
|
||||
Dim SQL = String.Format("SELECT GUID FROM TBPMO_CONTROL_SCREEN WHERE CONTROL_ID = {0} AND SCREEN_ID = {1}", ControlId, CURRENT_SCREEN_ID)
|
||||
Dim ctrl_screen_id = ClassDatabase.Execute_Scalar(SQL, True)
|
||||
If ctrl_screen_id > 0 Then
|
||||
SQL = String.Format("SELECT CAPTION FROM TBPMO_CONTROL_LANGUAGE WHERE CONTROL_SCREEN_ID = {0} AND LANGUAGE_TYPE = '{1}'", ctrl_screen_id, USER_LANGUAGE)
|
||||
Dim labelText As String = ClassDatabase.Execute_Scalar(SQL)
|
||||
control.Text = labelText
|
||||
End If
|
||||
|
||||
Else
|
||||
control.Text = autoValue
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in LoadValueMain:" & vbNewLine & ex.Message)
|
||||
ClassLogger.Add("Unexpected Error in LoadValueMain: " & ex.Message, True)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -188,9 +205,15 @@
|
||||
Public Class Checkbox : Inherits _BaseControl
|
||||
|
||||
Public Shared Sub LoadValue(control As Windows.Forms.CheckBox, value As String)
|
||||
Dim result As Boolean = False
|
||||
Boolean.TryParse(value, result)
|
||||
control.Checked = result
|
||||
Try
|
||||
Dim result As Boolean = False
|
||||
Boolean.TryParse(value, result)
|
||||
control.Checked = result
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in LoadValue1:" & vbNewLine & ex.Message)
|
||||
ClassLogger.Add("Unexpected Error in LoadValue1: " & ex.Message, True)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -198,9 +221,15 @@
|
||||
Public Class RadioButton : Inherits _BaseControl
|
||||
|
||||
Public Shared Sub LoadValue(control As Windows.Forms.RadioButton, value As String)
|
||||
Dim result As Boolean = False
|
||||
Boolean.TryParse(value, result)
|
||||
control.Checked = result
|
||||
Try
|
||||
Dim result As Boolean = False
|
||||
Boolean.TryParse(value, result)
|
||||
control.Checked = result
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in LoadValue2:" & vbNewLine & ex.Message)
|
||||
ClassLogger.Add("Unexpected Error in LoadValue2: " & ex.Message, True)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -208,13 +237,19 @@
|
||||
Public Class TextBox : Inherits _BaseControl
|
||||
|
||||
Public Shared Sub LoadValue(control As Windows.Forms.TextBox, recordId As Integer, parentRecordId As Integer, value As String)
|
||||
Dim autoValue = LoadAutoValue(control, recordId, parentRecordId)
|
||||
Try
|
||||
Dim autoValue = LoadAutoValue(control, recordId, parentRecordId)
|
||||
|
||||
If IsNothing(autoValue) Then
|
||||
control.Text = value
|
||||
Else
|
||||
control.Text = autoValue
|
||||
End If
|
||||
If IsNothing(autoValue) Then
|
||||
control.Text = value
|
||||
Else
|
||||
control.Text = autoValue
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in LoadValue3:" & vbNewLine & ex.Message)
|
||||
ClassLogger.Add("Unexpected Error in LoadValue3: " & ex.Message, True)
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user