Merge branch 'master' of http://scmadmin@172.24.11.74:90/scm/git/record_organizer
This commit is contained in:
parent
9591db4bf9
commit
c83a77878c
@ -393,11 +393,16 @@ Public Class ClassControlValues
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Public Shared Sub LoadControlValuesList(RecordID As Integer, FormID As Integer, controls As Control.ControlCollection)
|
||||
Try
|
||||
For Each Ctrl As Control In controls
|
||||
|
||||
Dim SW As Stopwatch = Stopwatch.StartNew()
|
||||
|
||||
For Each Ctrl As Control In controls
|
||||
If TypeOf Ctrl Is ComboBox Then
|
||||
Dim swInner As Stopwatch = Stopwatch.StartNew()
|
||||
|
||||
Dim Combobox = DirectCast(Ctrl, ComboBox)
|
||||
|
||||
Dim SQL As String = String.Format("SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE FORM_ID = {0} AND NAME = '{1}'", CURRENT_FORM_ID, Ctrl.Name)
|
||||
@ -412,15 +417,26 @@ Public Class ClassControlValues
|
||||
SQL2 = SQL2.ToString.Replace("@PARENTRECORD_ID", CURRENT_PARENTID)
|
||||
' If LogErrorsOnly = False Then ClassLogger.Add(">> SQL Combobox: " & cmbSql, False)
|
||||
End If
|
||||
Dim DT_Combobox As DataTable = ClassDatabase.Return_Datatable(SQL2)
|
||||
|
||||
Dim controlId As Integer = GetControlID_for_Name(Combobox.Name, FormID)
|
||||
'Dim DT_Combobox As DataTable = ClassDatabase.Return_Datatable(SQL2)
|
||||
|
||||
' Zuerst versuchen, DataTable aus dem Cache zu laden
|
||||
Dim DT_Combobox As DataTable = ClassControlValueCache.LoadFromCache(FormID, controlId)
|
||||
' Wenn DataTable nicht im Cache vorhanden, aus der Datenbank laden
|
||||
If IsNothing(DT_Combobox) Then
|
||||
DT_Combobox = ClassDatabase.Return_Datatable(SQL2)
|
||||
End If
|
||||
|
||||
If DT_Combobox Is Nothing = False Then
|
||||
If DT_Combobox.Rows.Count > 0 Then
|
||||
Combobox.DataSource = DT_Combobox
|
||||
Combobox.DisplayMember = DT_Combobox.Columns(1).ColumnName
|
||||
Combobox.ValueMember = DT_Combobox.Columns(0).ColumnName
|
||||
Combobox.AutoCompleteMode = AutoCompleteMode.Append
|
||||
Combobox.AutoCompleteSource = AutoCompleteSource.ListItems
|
||||
|
||||
ClassControlValueCache.SaveToCache(FormID, controlId, DT_Combobox)
|
||||
End If
|
||||
|
||||
Dim iWidestWidth As Integer = 300
|
||||
For Each row As DataRow In DT_Combobox.Rows
|
||||
'Die BReite der DropDown-Lsit anpassen
|
||||
@ -432,20 +448,29 @@ Public Class ClassControlValues
|
||||
End Using
|
||||
' control.Items.Add(row.Item(0).ToString)
|
||||
Next
|
||||
|
||||
If iWidestWidth > 300 Then
|
||||
Combobox.DropDownWidth = Math.Max(iWidestWidth, Combobox.Width)
|
||||
End If
|
||||
LoadControlValue(RecordID, GetControlID_for_Name(Combobox.Name, FormID), Ctrl)
|
||||
|
||||
LoadControlValue(RecordID, controlId, Ctrl)
|
||||
|
||||
End If
|
||||
|
||||
swInner.Stop()
|
||||
Console.WriteLine("Loading List for Control {0} took {1} milliseconds", Ctrl.Name, swInner.ElapsedMilliseconds)
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
|
||||
SW.Stop()
|
||||
Console.WriteLine("LoadControlValuesList took {0} milliseconds to load", SW.ElapsedMilliseconds)
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in LoadControlValuesList:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user