jj__25_01_16

This commit is contained in:
JenneJ
2016-01-25 15:24:58 +01:00
parent c11f38f414
commit 60e54ef33b
4 changed files with 27 additions and 37 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -19,8 +19,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 +48,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 +68,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 +90,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)

View File

@@ -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()