This commit is contained in:
Digital Data - Marlon Schreiber
2018-01-05 14:59:32 +01:00
parent 27abfd0b74
commit ef06120f13
13 changed files with 470 additions and 784 deletions

View File

@@ -153,17 +153,13 @@ Public Class ClassControlValues
Public Shared Sub LoadControlValues(RecordId As Integer, ParentRecordId As Integer, FormId As Integer, controls As Control.ControlCollection, Entity_ID As Integer, Optional isGroupbox As Boolean = False)
Try
Dim sw As New Stopwatch
sw.Start()
Dim sw As New SW("LoadControlValues1")
'Dim SQL As String = String.Format("SELECT * FROM VWPMO_VALUES WHERE VALUE <> '' AND RECORD_ID = {0}", RecordId)
Dim SQL As String = String.Format("SELECT * FROM VWPMO_VALUES WHERE RECORD_ID = {0}", RecordId)
Dim DT_ControlValues As DataTable = ClassDatabase.Return_Datatable(SQL, True)
CURRENT_CONTROL_VALUES = DT_ControlValues
Dim elapsed As Double
elapsed = sw.Elapsed.TotalSeconds
sw.Stop()
If LogErrorsOnly = False Then ClassLogger.Add(String.Format(" >> Load VWPMO_VALUES via SQL took {0} to load", Format(elapsed, "0.000000000") & " seconds"), False)
sw.Done()
If controls.Count = 0 Then
ClassLogger.Add("the control-Collection in LoadControlValuesNeu is empty!", True)
@@ -175,7 +171,7 @@ Public Class ClassControlValues
' Zuerst alle Controls leeren
ClearControlValues(controls)
sw.Start()
sw = New SW("LoadControlValues2")
' Load all Hints for controls
Dim SQLHint = "SELECT * FROM VWPMO_CONTROL_HINT WHERE FORM_ID = " & FormId
Dim DT_Hints As DataTable = ClassDatabase.Return_Datatable(SQLHint, True)
@@ -184,10 +180,8 @@ Public Class ClassControlValues
ClassControlValueCache.SaveHint(row.Item(1), row.Item(2))
Next
' LoadControlHints(controls)
elapsed = sw.Elapsed.TotalSeconds
sw.Stop()
If LogErrorsOnly = False Then ClassLogger.Add(String.Format(" >> LoadControlHints took {0} to load", Format(elapsed, "0.000000000") & " seconds"), False)
sw.Start()
sw.Done()
sw = New SW("LoadControlValues3")
For Each control As Control In controls
PerfomanceHelper.SuspendDraw(control)
@@ -206,9 +200,7 @@ Public Class ClassControlValues
PerfomanceHelper.ResumeDraw(control)
Next
elapsed = sw.Elapsed.TotalSeconds
sw.Stop()
If LogErrorsOnly = False Then ClassLogger.Add(String.Format(" >> Loop LoadControlValue took {0} to load", Format(elapsed, "0.000000000") & " seconds"), False)
sw.Done()
Catch ex As Exception
ClassLogger.Add("Unexpected Error in LoadControlValuesNeu: " & ex.Message, True)
MsgBox("Error in LoadControlValuesNeu:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
@@ -323,29 +315,26 @@ Public Class ClassControlValues
Public Shared Sub LoadControlValuesList(FormID As Integer, controls As Control.ControlCollection)
Try
Dim sw As New Stopwatch
sw.Start()
Dim sw As New SW("LoadControlValuesList - Database")
If controls.Count = 0 Then
'MsgBox("LoadControlValuesList: Control.ControlCollection is unexpected empty!", MsgBoxStyle.Exclamation)
ClassLogger.Add("LoadControlValuesList: Control.ControlCollection is unexpected empty!")
Exit Sub
End If
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_CONNID_1,CONTROL_SQLCOMMAND_1 AS SQL FROM VWPMO_CONTROL_SCREEN WHERE FORM_ID = {0} AND CONTROL_SQLCOMMAND_1 NOT LIKE '%@%'", FormID)
Dim dt As DataTable = ClassDatabase.Return_Datatable(SQL, True)
Dim elapsed As Double
elapsed = swsql.Elapsed.TotalSeconds
swsql.Stop()
If LogErrorsOnly = False Then ClassLogger.Add(String.Format(" >> LoadControlValuesList - Database took {0} to load", Format(elapsed, "0.000000000") & " seconds"), False)
sw.Done()
If dt.Rows.Count = 0 Then
Exit Sub
End If
sw = New SW("LoadControlValuesList")
For Each Ctrl As Control In controls
Dim controlTagId = DirectCast(Ctrl.Tag, ClassControlMetadata).Id
@@ -384,11 +373,7 @@ Public Class ClassControlValues
PerfomanceHelper.ResumeDraw(Ctrl)
Next
sw.Stop()
elapsed = sw.Elapsed.TotalSeconds
sw.Stop()
sw.Reset()
If LogErrorsOnly = False Then ClassLogger.Add(" >> LoadControlValuesList took " & Format(elapsed, "0.000000000") & " seconds", False)
sw.Done()
Catch ex As Exception
ClassLogger.Add("Unexpected Error in LoadControlValuesList: " & ex.Message, True)
MsgBox("Unexpected Error in LoadControlValuesList:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
@@ -406,7 +391,7 @@ Public Class ClassControlValues
End If
Dim SQL As String = String.Format("SELECT CONTROL_ID, CONTROL_CONNID_1, CONTROL_SQLCOMMAND_1 AS SQL FROM VWPMO_CONTROL_SCREEN WHERE FORM_ID = {0} AND CONTROL_SQLCOMMAND_1 <> '' AND CONTROL_SQLCOMMAND_1 LIKE '%@%'", FormId)
Dim SW As Stopwatch = Stopwatch.StartNew()
Dim sw As New SW("LoadControlValuesListWithPlaceholders")
Dim commands As New List(Of String)
Dim dt As DataTable = ClassDatabase.Return_Datatable(SQL, True)
@@ -465,10 +450,7 @@ Public Class ClassControlValues
PerfomanceHelper.ResumeDraw(Ctrl)
Next
Dim elapsed As Double
elapsed = SW.Elapsed.TotalSeconds
SW.Stop()
If LogErrorsOnly = False Then ClassLogger.Add(String.Format(" >> LoadControlValuesListWithPlaceholders took {0} to load", Format(elapsed, "0.000000000") & " seconds"), False)
sw.Done()
Catch ex As Exception
ClassLogger.Add("Unexpected Error in LoadControlValuesListWithPlaceholders: " & ex.Message, True)
MsgBox("Unexpected Error in LoadControlValuesListWithPlaceholders:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
@@ -491,7 +473,7 @@ Public Class ClassControlValues
' Alle Controls finden, die Abhängigkeiten haben
Dim SQL As String = String.Format("select GUID,NAME,SQL_COMMAND_2 from TBPMO_CONTROL where FORM_ID = {0} AND SQL_COMMAND_2 IS NOT NULL " _
& "AND LEN(SQL_COMMAND_2) > 10 AND SQL_COMMAND_2 LIKE '%@%@%'", FormId)
Dim SW As Stopwatch = Stopwatch.StartNew()
Dim sw As New SW("Enable_Depending_Controls")
Dim commands As New List(Of String)
Dim dt As DataTable = ClassDatabase.Return_Datatable(SQL)
@@ -553,10 +535,7 @@ Public Class ClassControlValues
End If
Next
Dim elapsed As Double
elapsed = SW.Elapsed.TotalSeconds
SW.Stop()
If LogErrorsOnly = False Then ClassLogger.Add(String.Format(" >> Enable_Depending_Controls took {0} to load", Format(elapsed, "0.000000000") & " seconds"), False)
SW.done
Catch ex As Exception
ClassLogger.Add("Unexpected Error in Enable_Depending_Controls: " & ex.Message, True)
MsgBox("Unexpected Error in Enable_Depending_Controls:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
@@ -687,8 +666,7 @@ Public Class ClassControlValues
Public Shared Sub LoadDefaultValues(FormID As Integer, RecordID As Integer, controls As Control.ControlCollection, parentRecordID As Integer, EntityID As Integer)
Try
Dim sw As New Stopwatch()
sw.Start()
Dim sw As New SW("LoadDefaultValues")
' Alle Controls leeren
ClearControlValues(controls)
@@ -714,8 +692,7 @@ Public Class ClassControlValues
Next
sw.Stop()
Console.WriteLine("LoadDefaultValues took {0} milliseconds to load", sw.ElapsedMilliseconds)
sw.Done()
'Den Focus auf das erste Steuerelement setzen
For Each c As Control In controls