jj_26_01_16 sql command for textbox

This commit is contained in:
JenneJ 2016-01-26 11:03:15 +01:00
parent e41b0a27d9
commit a7b5fcfd75
3 changed files with 34 additions and 27 deletions

View File

@ -11,6 +11,26 @@
Return sqlCommand Return sqlCommand
End Function 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 = control.Tag
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
Return Nothing
End If
AutoValue = ClassDatabase.Execute_Scalar(SQL)
If String.IsNullOrEmpty(AutoValue) Or IsDBNull(AutoValue) Then
Return Nothing
End If
Return AutoValue
End Function
End Class End Class
Public Class _ListControl : Inherits _BaseControl Public Class _ListControl : Inherits _BaseControl
@ -150,33 +170,14 @@
Public Class Label : Inherits _BaseControl Public Class Label : Inherits _BaseControl
Private Shared Function LoadAutoValue(control As Windows.Forms.Control, RecordId As Integer, ParentRecordId As Integer)
Dim AutoValue As String = String.Empty
Dim ControlId As Integer = control.Tag
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
Return control.Text
End If
AutoValue = ClassDatabase.Execute_Scalar(SQL)
If String.IsNullOrEmpty(AutoValue) Or IsDBNull(AutoValue) Then
SQL = String.Format("SELECT CONTROL_TEXT FROM TBPMO_CONTROL_SCREEN WHERE CONTROL_ID = {0}", ControlId)
Dim value = ClassDatabase.Execute_Scalar(SQL)
Return value
Else
Return AutoValue
End If
End Function
Public Shared Sub LoadValue(control As Windows.Forms.Label, recordId As Integer, parentRecordId As Integer, value As String) Public Shared Sub LoadValue(control As Windows.Forms.Label, recordId As Integer, parentRecordId As Integer, value As String)
Dim autoValue = LoadAutoValue(control, recordId, parentRecordId) Dim autoValue = LoadAutoValue(control, recordId, parentRecordId)
If IsNothing(autoValue) Then If IsNothing(autoValue) Then
control.Text = value Dim ControlId As Integer = control.Tag
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 Else
control.Text = autoValue control.Text = autoValue
End If End If
@ -206,8 +207,14 @@
Public Class TextBox : Inherits _BaseControl Public Class TextBox : Inherits _BaseControl
Public Shared Sub LoadValue(control As Windows.Forms.TextBox, value As String) Public Shared Sub LoadValue(control As Windows.Forms.TextBox, recordId As Integer, parentRecordId As Integer, value As String)
control.Text = value Dim autoValue = LoadAutoValue(control, recordId, parentRecordId)
If IsNothing(autoValue) Then
control.Text = value
Else
control.Text = autoValue
End If
End Sub End Sub
End Class End Class

View File

@ -44,7 +44,7 @@ Public Class ClassControlValues
Select Case control.GetType() Select Case control.GetType()
Case GetType(TextBox) Case GetType(TextBox)
Dim textbox As TextBox = DirectCast(control, TextBox) Dim textbox As TextBox = DirectCast(control, TextBox)
ControlLoader.TextBox.LoadValue(textbox, value) ControlLoader.TextBox.LoadValue(textbox, recordId, parentRecordId, value)
Case GetType(Label) Case GetType(Label)
Dim label As Label = DirectCast(control, Label) Dim label As Label = DirectCast(control, Label)

View File

@ -304,6 +304,6 @@
<value>1222, 54</value> <value>1222, 54</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>242</value> <value>150</value>
</metadata> </metadata>
</root> </root>