MS_05042016
This commit is contained in:
@@ -200,69 +200,72 @@ Public Class ClassControlValues
|
||||
|
||||
Private Shared Sub LoadControlValue(recordId As Integer, parentRecordId As Integer, controlId As Integer, control As Control, values As List(Of Object))
|
||||
Try
|
||||
Dim sw As New Stopwatch
|
||||
sw.Start()
|
||||
Dim elapsed As Double
|
||||
' Für die meisten Controls wird nur das erste Element der Liste benötigt
|
||||
Dim value As String = Nothing
|
||||
|
||||
If values.Count > 0 Then
|
||||
value = values.Item(0)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Select Case control.GetType()
|
||||
Case GetType(TextBox)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValueNeu - GetType(TextBox) ", False)
|
||||
Dim textbox As TextBox = DirectCast(control, TextBox)
|
||||
ControlLoader.TextBox.LoadValue(textbox, recordId, parentRecordId, value)
|
||||
|
||||
elapsed = sw.Elapsed.TotalSeconds
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> LoadControlValue TextBox took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Case GetType(Label)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValueNeu - GetType(Label) ", False)
|
||||
Dim label As Label = DirectCast(control, Label)
|
||||
ControlLoader.Label.LoadValue(label, recordId, parentRecordId, value)
|
||||
|
||||
elapsed = sw.Elapsed.TotalSeconds
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> LoadControlValue Label took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Case GetType(ComboBox)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValueNeu - GetType(ComboBox) ", False)
|
||||
Dim combobox As ComboBox = DirectCast(control, ComboBox)
|
||||
ControlLoader.Combobox.LoadValue(combobox, recordId, parentRecordId, value)
|
||||
|
||||
elapsed = sw.Elapsed.TotalSeconds
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> LoadControlValue ComboBox took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Case GetType(CheckBox)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValueNeu - GetType(CheckBox) ", False)
|
||||
Dim checkbox As CheckBox = DirectCast(control, CheckBox)
|
||||
ControlLoader.Checkbox.LoadValue(checkbox, value)
|
||||
|
||||
elapsed = sw.Elapsed.TotalSeconds
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> LoadControlValue Checkbox took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Case GetType(RadioButton)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValueNeu - GetType(RadioButton) ", False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Sub LoadControlValueNeu - GetType(RadioButton) ", False)
|
||||
Dim radiobutton As RadioButton = DirectCast(control, RadioButton)
|
||||
ControlLoader.RadioButton.LoadValue(radiobutton, value)
|
||||
|
||||
elapsed = sw.Elapsed.TotalSeconds
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> LoadControlValue RadioButton took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Case GetType(DevExpress.XtraEditors.DateEdit)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValueNeu - GetType(DateEdit) ", False)
|
||||
Dim datepicker As DevExpress.XtraEditors.DateEdit = DirectCast(control, DevExpress.XtraEditors.DateEdit)
|
||||
ControlLoader.DateTimePicker.LoadValue(datepicker, value)
|
||||
|
||||
elapsed = sw.Elapsed.TotalSeconds
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> LoadControlValue DateEdit took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Case GetType(DevExpress.XtraEditors.ListBoxControl)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValueNeu - GetType(ListBoxControl) ", False)
|
||||
Dim listbox As DevExpress.XtraEditors.ListBoxControl = DirectCast(control, DevExpress.XtraEditors.ListBoxControl)
|
||||
ControlLoader.ListBox.LoadValue(listbox, value)
|
||||
|
||||
elapsed = sw.Elapsed.TotalSeconds
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> LoadControlValue ListBoxControl took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Case GetType(DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValueNeu - GetType(CheckedListBoxControl) ", False)
|
||||
Dim checkedlistbox As DevExpress.XtraEditors.CheckedListBoxControl = DirectCast(control, DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
ControlLoader.CheckedListBox.LoadValue(checkedlistbox, values)
|
||||
|
||||
elapsed = sw.Elapsed.TotalSeconds
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> LoadControlValue CheckedListBoxControl took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Case GetType(PictureBox)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValueNeu - GetType(PictureBox) ", False)
|
||||
Dim picturebox = DirectCast(control, PictureBox)
|
||||
LoadImage(recordId, controlId, picturebox)
|
||||
|
||||
elapsed = sw.Elapsed.TotalSeconds
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> LoadControlValue PictureBox took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Case GetType(DataGridView)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValueNeu - GetType(DataGridView) ", False)
|
||||
Dim gridview = DirectCast(control, DataGridView)
|
||||
ControlLoader.DataGridView.LoadValue(gridview, values)
|
||||
|
||||
elapsed = sw.Elapsed.TotalSeconds
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> LoadControlValue DataGridView took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Case Else
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValue - Control-Type nicht berücksichtigt: " & GetType(Control).ToString(), False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Sub LoadControlValue - Control-Type nicht berücksichtigt: " & GetType(Control).ToString(), False)
|
||||
End Select
|
||||
sw.Stop()
|
||||
sw.Reset()
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Unexpected Error in LoadControlValue: " & ex.Message, True)
|
||||
MsgBox("Error in LoadControlValue:" & vbNewLine & ex.Message)
|
||||
@@ -288,7 +291,7 @@ Public Class ClassControlValues
|
||||
Dim dt As DataTable = ClassDatabase.Return_Datatable(SQL)
|
||||
|
||||
swsql.Stop()
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(String.Format(">>LoadControlValuesList - Database took {0} milliseconds to load", swsql.ElapsedMilliseconds), False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(String.Format(">> LoadControlValuesList - Database took {0} milliseconds to load", swsql.ElapsedMilliseconds), False)
|
||||
|
||||
If dt.Rows.Count = 0 Then
|
||||
Exit Sub
|
||||
@@ -335,7 +338,7 @@ Public Class ClassControlValues
|
||||
elapsed = SW.Elapsed.TotalSeconds
|
||||
SW.Stop()
|
||||
SW.Reset()
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">> LoadControlValuesList took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> LoadControlValuesList took " & Format(elapsed, "0.000000000") & " seconds", False)
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Unexpected Error in LoadControlValuesList: " & ex.Message, True)
|
||||
MsgBox("Unexpected Error in LoadControlValuesList:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
|
||||
Reference in New Issue
Block a user