Merge branch 'master' of http://scmadmin@172.24.11.74:90/scm/git/RecordOrganizer
This commit is contained in:
@@ -45,6 +45,7 @@ Public Class ClassControlBuilder
|
||||
Dim onRecordChangedHandler As EventHandler = CType(Me.Events(_onRecordChangedName), EventHandler)
|
||||
|
||||
If (onRecordChangedHandler IsNot Nothing) Then
|
||||
Console.WriteLine("RecordChanged")
|
||||
onRecordChangedHandler.Invoke(sender, e)
|
||||
End If
|
||||
End Sub
|
||||
@@ -806,37 +807,6 @@ Public Class ClassControlBuilder
|
||||
control.Size = New Size(vwidth, vheight)
|
||||
End If
|
||||
|
||||
'SQL-Command vorhanden also Ausführen des SQL
|
||||
|
||||
' TODO: ERST LADEN WENN EDIT MODE ENABLEDs
|
||||
'If sqlcommand.Length > 1 Then
|
||||
' Dim DT_Combobox As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
|
||||
' If DT_Combobox Is Nothing = False Then
|
||||
' If DT_Combobox.Rows.Count > 0 Then
|
||||
' control.DataSource = DT_Combobox
|
||||
' control.DisplayMember = DT_Combobox.Columns(1).ColumnName
|
||||
' control.ValueMember = DT_Combobox.Columns(0).ColumnName
|
||||
' control.AutoCompleteMode = AutoCompleteMode.SuggestAppend
|
||||
' control.AutoCompleteSource = AutoCompleteSource.ListItems
|
||||
' End If
|
||||
' Dim iWidestWidth As Integer = 300
|
||||
' For Each row As DataRow In DT_Combobox.Rows
|
||||
' 'Die BReite der DropDown-Lsit anpassen
|
||||
' Using g As Graphics = control.CreateGraphics
|
||||
' If g.MeasureString(row.Item(1).ToString, control.Font).Width + 30 > iWidestWidth Then
|
||||
' iWidestWidth = g.MeasureString(row.Item(1).ToString, control.Font).Width + 30
|
||||
' End If
|
||||
' g.Dispose()
|
||||
' End Using
|
||||
' ' control.Items.Add(row.Item(0).ToString)
|
||||
' Next
|
||||
' If iWidestWidth > 300 Then
|
||||
' control.DropDownWidth = Math.Max(iWidestWidth, control.Width)
|
||||
' End If
|
||||
|
||||
' End If
|
||||
'End If
|
||||
|
||||
' Wenn statische liste vorhanden, werte splitten und einfügen
|
||||
If static_list.Length > 0 Then
|
||||
Dim items() As String = static_list.Split(";")
|
||||
@@ -845,7 +815,6 @@ Public Class ClassControlBuilder
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
Me.SetEventHandlers(control)
|
||||
Me.CurrentControl = DirectCast(control, ComboBox)
|
||||
If Not IsNothing(parent) Then
|
||||
|
||||
@@ -31,7 +31,7 @@ Public Class ClassControlCommandsUI
|
||||
Dim SQL As String = "SELECT * FROM VWPMO_CONTROL_SCREEN WHERE FORM_ID = " & FormId & " and SCREEN_ID = 1"
|
||||
Dim DT As DataTable = ClassDatabase.Return_Datatable(SQL)
|
||||
|
||||
|
||||
_CtrlBuilder.MasterPanel.SuspendLayout()
|
||||
|
||||
For Each dr As DataRow In DT.Rows
|
||||
|
||||
@@ -249,6 +249,9 @@ Public Class ClassControlCommandsUI
|
||||
dr.Item("CONTROL_SQLCOMMAND_1"),
|
||||
parent)
|
||||
End Select
|
||||
|
||||
_CtrlBuilder.MasterPanel.ResumeLayout()
|
||||
|
||||
' ContextMenuStrip zuweisen
|
||||
' MasterDataID im ContextMenuStrip Speichern
|
||||
If dr.Item("CTRLSCR_MASTER_DATA_ID") <> 0 Then
|
||||
|
||||
@@ -11,6 +11,26 @@
|
||||
Return sqlCommand
|
||||
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
|
||||
|
||||
Public Class _ListControl : Inherits _BaseControl
|
||||
@@ -19,8 +39,7 @@
|
||||
Dim returnValue As DynamicValue
|
||||
|
||||
returnValue.StaticList = CheckForStaticList(controlId)
|
||||
returnValue.DataTable = GetSqlList(controlId, formId, SQLCommand)
|
||||
'returnValue.DataTable = CheckForSqlCommand(controlId, formId)
|
||||
returnValue.DataTable = GetSqlList(controlId, formId, sqlCommand)
|
||||
|
||||
Return returnValue
|
||||
End Function
|
||||
@@ -49,16 +68,16 @@
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
'Dim cached As DataTable = ClassControlValueCache.LoadFromCache(formId, controlId)
|
||||
Dim cached As DataTable = ClassControlValueCache.LoadFromCache(sqlCommand)
|
||||
Dim final As DataTable
|
||||
|
||||
If cached Is Nothing Then
|
||||
final = ClassDatabase.Return_Datatable(sqlCommand)
|
||||
'ClassControlValueCache.SaveToCache(formId, controlId, final)
|
||||
ClassControlValueCache.SaveToCache(sqlCommand, final)
|
||||
Console.WriteLine("CACHE MISS")
|
||||
Else
|
||||
final = cached
|
||||
Console.WriteLine("CACHE HIT")
|
||||
End If
|
||||
|
||||
Return final
|
||||
@@ -69,8 +88,11 @@
|
||||
End Function
|
||||
|
||||
Overloads Shared Sub SetDataSource(control As Windows.Forms.ComboBox, dt As DataTable)
|
||||
Dim sw As Stopwatch = Stopwatch.StartNew()
|
||||
Dim columnCount As Integer = dt.Columns.Count
|
||||
|
||||
control.BeginUpdate()
|
||||
|
||||
' Damit beim Setzen von DisplayMember und ValueMember kein Fehler auftritt,
|
||||
' muss die Datasource zunächst geleert werden und der selected index auf -1 gesetzt werden.
|
||||
control.DataSource = Nothing
|
||||
@@ -88,6 +110,11 @@
|
||||
|
||||
' Als letztes setzen wir die DataSource
|
||||
control.DataSource = dt
|
||||
|
||||
control.EndUpdate()
|
||||
|
||||
sw.Stop()
|
||||
Console.WriteLine("SetDataSource for {0} took {1}ms", control.Name, sw.ElapsedMilliseconds)
|
||||
End Sub
|
||||
|
||||
Overloads Shared Sub SetDataSource(control As DevExpress.XtraEditors.CheckedListBoxControl, dt As DataTable)
|
||||
@@ -143,33 +170,14 @@
|
||||
|
||||
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)
|
||||
Dim autoValue = LoadAutoValue(control, recordId, parentRecordId)
|
||||
|
||||
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
|
||||
control.Text = autoValue
|
||||
End If
|
||||
@@ -199,8 +207,14 @@
|
||||
|
||||
Public Class TextBox : Inherits _BaseControl
|
||||
|
||||
Public Shared Sub LoadValue(control As Windows.Forms.TextBox, value As String)
|
||||
control.Text = value
|
||||
Public Shared Sub LoadValue(control As Windows.Forms.TextBox, recordId As Integer, parentRecordId As Integer, value As String)
|
||||
Dim autoValue = LoadAutoValue(control, recordId, parentRecordId)
|
||||
|
||||
If IsNothing(autoValue) Then
|
||||
control.Text = value
|
||||
Else
|
||||
control.Text = autoValue
|
||||
End If
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -44,7 +44,7 @@ Public Class ClassControlValues
|
||||
Select Case control.GetType()
|
||||
Case GetType(TextBox)
|
||||
Dim textbox As TextBox = DirectCast(control, TextBox)
|
||||
ControlLoader.TextBox.LoadValue(textbox, value)
|
||||
ControlLoader.TextBox.LoadValue(textbox, recordId, parentRecordId, value)
|
||||
|
||||
Case GetType(Label)
|
||||
Dim label As Label = DirectCast(control, Label)
|
||||
@@ -97,17 +97,25 @@ Public Class ClassControlValues
|
||||
End If
|
||||
Dim SW As Stopwatch = Stopwatch.StartNew()
|
||||
|
||||
|
||||
Dim swsql As Stopwatch = Stopwatch.StartNew()
|
||||
|
||||
' Zuerst alle SQL Commands für FormID finden
|
||||
' CONTROL_SQLCOMMAND_1 wird als SQL gealiast
|
||||
Dim SQL As String = String.Format("SELECT CONTROL_ID, CONTROL_SQLCOMMAND_1 AS SQL FROM VWPMO_CONTROL_SCREEN WHERE FORM_ID = {0} AND CONTROL_SQLCOMMAND_1 <> '' AND CONTROL_SQLCOMMAND_1 NOT LIKE '%@%'", FormID)
|
||||
Dim dt As DataTable = ClassDatabase.Return_Datatable(SQL)
|
||||
|
||||
swsql.Stop()
|
||||
Console.WriteLine("LoadControlValuesList - Database took {0} milliseconds to load", swsql.ElapsedMilliseconds)
|
||||
|
||||
If dt.Rows.Count = 0 Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
For Each Ctrl As Control In controls
|
||||
|
||||
Dim swcontrol As Stopwatch = Stopwatch.StartNew()
|
||||
|
||||
Dim controlTagId = CInt(Ctrl.Tag)
|
||||
'If controlTagId = 474 Then
|
||||
' MsgBox("Thats it")
|
||||
@@ -135,6 +143,9 @@ Public Class ClassControlValues
|
||||
ControlLoader.CheckedListBox.LoadList(chlistbox, FormID, sqlcommand)
|
||||
|
||||
End Select
|
||||
|
||||
swcontrol.Stop()
|
||||
Console.WriteLine("LoadControlValuesList Loading {0} took {1} milliseconds to load", Ctrl.Name, swcontrol.ElapsedMilliseconds)
|
||||
Next
|
||||
|
||||
SW.Stop()
|
||||
|
||||
@@ -1653,7 +1653,7 @@
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>242</value>
|
||||
<value>150</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 13</value>
|
||||
|
||||
Reference in New Issue
Block a user