This commit is contained in:
JenneJ
2016-06-01 15:21:19 +02:00
parent a3bbbfa570
commit a434c83191
4 changed files with 56 additions and 23 deletions

View File

@@ -96,9 +96,10 @@
final = ClassDatabase.Return_Datatable(sqlCommand)
End If
ClassControlValueCache.SaveToCache(sqlCommand, final)
Console.WriteLine("CACHE MISS")
Else
final = cached
' Console.WriteLine("CACHE HIT")
Console.WriteLine("CACHE HIT")
End If
Return final
@@ -127,10 +128,11 @@
End Sub
Overloads Shared Sub SetDataSource(control As CustomComboBox, dt As DataTable)
Dim sw As Stopwatch = Stopwatch.StartNew()
Dim sw As New SW("SetDataSource CustomComboBox")
Dim columnCount As Integer = dt.Columns.Count
control.BeginUpdate()
PerfomanceHelper.SuspendDraw(control)
' 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.
@@ -150,10 +152,10 @@
' Als letztes setzen wir die DataSource
control.DataSource = dt
PerfomanceHelper.ResumeDraw(control)
control.EndUpdate()
sw.Stop()
' Console.WriteLine("SetDataSource for {0} took {1}ms", control.Name, sw.ElapsedMilliseconds)
sw.Done()
End Sub
Overloads Shared Sub SetDataSource(control As DevExpress.XtraEditors.CheckedListBoxControl, dt As DataTable)
@@ -367,7 +369,10 @@
Public Shared Sub LoadList(control As CustomComboBox, formId As Integer, connID As Object, SQLCommand As String)
Try
Dim sw As New SW("LoadList CustomComboBox")
Dim sw1 As New SW("GetDynamicValue CustomComboBox")
Dim dynamic As DynamicValue = GetDynamicValue(DirectCast(control.Tag, ClassControlMetadata).Id, formId, connID, SQLCommand)
sw1.Done()
If dynamic.StaticList IsNot Nothing Then
control.DataSource = dynamic.StaticList
@@ -377,6 +382,7 @@
SetDataSource(control, dynamic.DataTable)
CalculateDropdownWidth(control, dynamic.DataTable)
End If
sw.Done()
Catch ex As Exception
MsgBox("Error in Combobox.LoadList:" & vbNewLine & ex.Message)
End Try
@@ -444,6 +450,8 @@
Public Shared Sub LoadList(control As DevExpress.XtraEditors.CheckedListBoxControl, formId As Integer, conn_Id As Object, SQLCommand As String)
Try
Dim sw As New SW("LoadList CheckedListBoxControl")
Dim dynamic As DynamicValue = GetDynamicValue(DirectCast(control.Tag, ClassControlMetadata).Id, formId, conn_Id, SQLCommand)
If dynamic.StaticList IsNot Nothing Then
@@ -459,6 +467,7 @@
SetDataSource(control, dynamic.DataTable)
End If
sw.Done()
Catch ex As Exception
MsgBox("Error in CheckedListBox.LoadList:" & vbNewLine & ex.Message)
End Try
@@ -477,6 +486,8 @@
End Sub
Public Shared Sub LoadList(control As DevExpress.XtraEditors.ListBoxControl, formId As Integer, ConnId As Object, SQLCommand As String)
Dim sw As New SW("LoadList ListBoxControl")
Dim dynamic As DynamicValue = GetDynamicValue(DirectCast(control.Tag, ClassControlMetadata).Id, formId, ConnId, SQLCommand)
If dynamic.StaticList IsNot Nothing Then
@@ -486,6 +497,8 @@
If dynamic.DataTable IsNot Nothing AndAlso dynamic.DataTable.Rows.Count > 0 Then
SetDataSource(control, dynamic.DataTable)
End If
sw.Done()
End Sub
End Class
@@ -503,6 +516,8 @@
Public Class DataGridViewCheckable : Inherits _ListControl
Public Shared Sub LoadList(control As DevExpress.XtraGrid.GridControl, formId As Integer, ConnId As Object, SQLCommand As String)
Dim sw As New SW("LoadList GridControl")
Dim dynamic As DynamicValue = GetDynamicValue(DirectCast(control.Tag, ClassControlMetadata).Id, formId, ConnId, SQLCommand)
If dynamic.StaticList IsNot Nothing Then