jj 09.03.2016 übersetzung & mehrere abhängigkeiten

This commit is contained in:
JenneJ
2016-03-09 15:45:08 +01:00
parent 5c09ce1034
commit c3965e6243
5 changed files with 147 additions and 118 deletions

View File

@@ -81,45 +81,89 @@ Public Class ClassControlBuilder
Public Sub OnComboBoxValueChanged(sender As Object, ByVal e As EventArgs) Public Sub OnComboBoxValueChanged(sender As Object, ByVal e As EventArgs)
Try Try
Dim control As ComboBox = DirectCast(sender, ComboBox) Dim control As Control = DirectCast(sender, Control)
Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id
Dim SQL As String = String.Format("SELECT GUID, SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE SQL_COMMAND_1 LIKE '%@{0}@%'", controlId) Dim SQL As String = String.Format("SELECT GUID, SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE SQL_COMMAND_1 LIKE '%@{0}@%'", controlId)
Dim value As String = control.SelectedValue Dim value
Select Case control.GetType()
Case GetType(ComboBox)
value = DirectCast(control, ComboBox).SelectedValue
Case Else
Exit Sub
End Select
If String.IsNullOrEmpty(value) Then
Exit Sub
End If
Dim datatable As DataTable = ClassDatabase.Return_Datatable(SQL) Dim datatable As DataTable = ClassDatabase.Return_Datatable(SQL)
If datatable.Rows.Count = 0 Then If datatable.Rows.Count = 0 Then
Exit Sub Exit Sub
End If End If
Dim sqlcommand As String = datatable.Rows(0).Item("SQL_COMMAND_1") For Each row As DataRow In datatable.Rows
Dim sqlcommand As String = row.Item("SQL_COMMAND_1")
If IsNothing(sqlcommand) Then If IsNothing(sqlcommand) Then
Exit Sub Continue For
End If End If
If String.IsNullOrEmpty(value) Then Dim regex As New System.Text.RegularExpressions.Regex("(@(\d+)@)")
Exit Sub Dim match As System.Text.RegularExpressions.Match = regex.Match(sqlcommand)
End If
If match.Success Then
' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält
Dim dependingControlId As Integer = row.Item("GUID")
Dim panel As Panel = DirectCast(control.Parent, Panel)
' Über die Id das Control finden
Dim dependingControl As Control = panel.Controls.OfType(Of Control)().Where(Function(c As Control)
Return DirectCast(c.Tag, ClassControlMetadata).Id = dependingControlId
End Function).SingleOrDefault()
sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value)
Console.WriteLine("Executing SQL_COMMAND: {0} for controlID {1}", sqlcommand, dependingControlId)
Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
Select Case control.GetType()
Case GetType(ComboBox)
ControlLoader.Combobox.SetDataSource(DirectCast(dependingControl, ComboBox), dt)
End Select
End If
Next
'Dim sqlcommand As String = datatable.Rows(0).Item("SQL_COMMAND_1")
'If IsNothing(sqlcommand) Then
' Exit Sub
'End If
'If String.IsNullOrEmpty(value) Then
' Exit Sub
'End If
Dim regex As New System.Text.RegularExpressions.Regex("(@(\d+)@)") 'Dim regex As New System.Text.RegularExpressions.Regex("(@(\d+)@)")
Dim match As System.Text.RegularExpressions.Match = regex.Match(sqlcommand) 'Dim match As System.Text.RegularExpressions.Match = regex.Match(sqlcommand)
If match.Success Then 'If match.Success Then
' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält ' ' DependingControlId bezeichnet das Control, das die Abhängigkeit enthält
Dim dependingControlId As Integer = datatable.Rows(0).Item("GUID") ' Dim dependingControlId As Integer = datatable.Rows(0).Item("GUID")
Dim panel As Panel = DirectCast(control.Parent, Panel) ' Dim panel As Panel = DirectCast(control.Parent, Panel)
' Über die Id das Control finden ' ' Über die Id das Control finden
Dim dependingControl As ComboBox = Panel.Controls.OfType(Of ComboBox)().Where(Function(c As ComboBox) ' Dim dependingControl As ComboBox = panel.Controls.OfType(Of ComboBox)().Where(Function(c As ComboBox)
Return DirectCast(c.Tag, ClassControlMetadata).Id = dependingControlId ' Return DirectCast(c.Tag, ClassControlMetadata).Id = dependingControlId
End Function).SingleOrDefault() ' End Function).SingleOrDefault()
sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value) ' sqlcommand = sqlcommand.Replace(match.Groups(1).Value, value)
Console.WriteLine("Executing SQL_COMMAND: {0}", sqlcommand) ' Console.WriteLine("Executing SQL_COMMAND: {0}", sqlcommand)
Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand) ' Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
ControlLoader.Combobox.SetDataSource(dependingControl, dt) ' ControlLoader.Combobox.SetDataSource(dependingControl, dt)
End If 'End If
Console.WriteLine("value changed") Console.WriteLine("value changed")
Catch ex As Exception Catch ex As Exception

View File

@@ -230,7 +230,7 @@ Module ClassControlProperties
<Browsable(False)> <Browsable(False)>
<LocalizedCategoryAttribute("category_view")> <LocalizedCategoryAttribute("category_view")>
<LocalizedDescriptionAttribute("desc_columntitle")> <LocalizedDescriptionAttribute("desc_col_title")>
Public Overloads Property ColumnTitle() As String Public Overloads Property ColumnTitle() As String
Get Get
Return "" Return ""

View File

@@ -83,7 +83,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Database Configurations ähnelt. ''' Sucht eine lokalisierte Zeichenfolge, die Datenbank Einstellungen ähnelt.
'''</summary> '''</summary>
Friend Shared ReadOnly Property category_database() As String Friend Shared ReadOnly Property category_database() As String
Get Get
@@ -101,7 +101,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Font Configurations ähnelt. ''' Sucht eine lokalisierte Zeichenfolge, die Schrift Einstellungen ähnelt.
'''</summary> '''</summary>
Friend Shared ReadOnly Property category_font() As String Friend Shared ReadOnly Property category_font() As String
Get Get
@@ -128,7 +128,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Other Configurations ähnelt. ''' Sucht eine lokalisierte Zeichenfolge, die Andere Einstellungen ähnelt.
'''</summary> '''</summary>
Friend Shared ReadOnly Property category_other() As String Friend Shared ReadOnly Property category_other() As String
Get Get
@@ -137,7 +137,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die ViewConfigurations ähnelt. ''' Sucht eine lokalisierte Zeichenfolge, die Ansichts Einstellungen ähnelt.
'''</summary> '''</summary>
Friend Shared ReadOnly Property category_view() As String Friend Shared ReadOnly Property category_view() As String
Get Get
@@ -172,15 +172,6 @@ Namespace My.Resources
End Get End Get
End Property End Property
'''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Gibt den Spaltentitel des Elements an. ähnelt.
'''</summary>
Friend Shared ReadOnly Property desc_columntitle() As String
Get
Return ResourceManager.GetString("desc_columntitle", resourceCulture)
End Get
End Property
'''<summary> '''<summary>
''' Sucht eine lokalisierte Zeichenfolge, die Gibt den Standardwert dieses Elements an. ähnelt. ''' Sucht eine lokalisierte Zeichenfolge, die Gibt den Standardwert dieses Elements an. ähnelt.
'''</summary> '''</summary>

View File

@@ -118,114 +118,111 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="category_appointment" xml:space="preserve"> <data name="category_appointment" xml:space="preserve">
<value>Termin Einstellungen</value> <value>Scheduler Configuration</value>
</data> </data>
<data name="category_data" xml:space="preserve"> <data name="category_data" xml:space="preserve">
<value>Daten</value> <value>Data</value>
</data> </data>
<data name="category_database" xml:space="preserve"> <data name="category_database" xml:space="preserve">
<value>Database Configurations</value> <value>Database Configuration</value>
</data> </data>
<data name="category_date" xml:space="preserve"> <data name="category_date" xml:space="preserve">
<value>Datums Einstellungen</value> <value>Date Configuration</value>
</data> </data>
<data name="category_font" xml:space="preserve"> <data name="category_font" xml:space="preserve">
<value>Font Configurations</value> <value>Font Configuration</value>
</data> </data>
<data name="category_form" xml:space="preserve"> <data name="category_form" xml:space="preserve">
<value>Form Einstellungen</value> <value>Form Configuration</value>
</data> </data>
<data name="category_id" xml:space="preserve"> <data name="category_id" xml:space="preserve">
<value>ID</value> <value>ID</value>
</data> </data>
<data name="category_other" xml:space="preserve"> <data name="category_other" xml:space="preserve">
<value>Other Configurations</value> <value>Other Configuration</value>
</data> </data>
<data name="category_view" xml:space="preserve"> <data name="category_view" xml:space="preserve">
<value>ViewConfigurations</value> <value>View Configuration</value>
</data> </data>
<data name="desc_backcolor" xml:space="preserve"> <data name="desc_backcolor" xml:space="preserve">
<value>Gibt die Hintergrundfarbe des Elements an.</value> <value>The element's background color.</value>
</data> </data>
<data name="desc_caption" xml:space="preserve"> <data name="desc_caption" xml:space="preserve">
<value>Gibt den Beschreibungstext dieses Elements an.</value> <value>The element's caption.</value>
</data>
<data name="desc_columntitle" xml:space="preserve">
<value>Gibt den Spaltentitel des Elements an.</value>
</data> </data>
<data name="desc_col_title" xml:space="preserve"> <data name="desc_col_title" xml:space="preserve">
<value>Gibt den Spaltentitel des Elements an.</value> <value>The element's colum title.</value>
</data> </data>
<data name="desc_defaultvalue" xml:space="preserve"> <data name="desc_defaultvalue" xml:space="preserve">
<value>Gibt den Standardwert dieses Elements an.</value> <value>The element's default value.</value>
</data> </data>
<data name="desc_description" xml:space="preserve"> <data name="desc_description" xml:space="preserve">
<value>Gibt die Beschreibung des Termins an. Dynamische Werte aus anderen Controls können mit der Syntax [%controlname] eingefügt werden</value> <value>The appointment's description. Dynamic values from other controls can be inserted with the syntax [%controlname].</value>
</data> </data>
<data name="desc_fontcolor" xml:space="preserve"> <data name="desc_fontcolor" xml:space="preserve">
<value>Gibt die Schriftfarbe an.</value> <value>The element's font color.</value>
</data> </data>
<data name="desc_fontstyle" xml:space="preserve"> <data name="desc_fontstyle" xml:space="preserve">
<value>Gibt die Schriftart an.</value> <value>The element's font style.</value>
</data> </data>
<data name="desc_format" xml:space="preserve"> <data name="desc_format" xml:space="preserve">
<value>Gibt das Format des Textes an.</value> <value>The element's number format.</value>
</data> </data>
<data name="desc_formid" xml:space="preserve"> <data name="desc_formid" xml:space="preserve">
<value>Gibt die Form-ID der zu öffnenden Form an.</value> <value>The form-ID of the form that will be opened.</value>
</data> </data>
<data name="desc_fromdate" xml:space="preserve"> <data name="desc_fromdate" xml:space="preserve">
<value>Der Name eines Elements von dem das End-Datum gelesen wird.</value> <value>The appointment's start-date. Dynamic values from other controls can be inserted with the syntax [%controlname].</value>
</data> </data>
<data name="desc_id" xml:space="preserve"> <data name="desc_id" xml:space="preserve">
<value>Gibt die eindeutige ID des Elements an.</value> <value>The element's unique identifier.</value>
</data> </data>
<data name="desc_location" xml:space="preserve"> <data name="desc_location" xml:space="preserve">
<value>Gibt die Position des Elements an.</value> <value>The element's location</value>
</data> </data>
<data name="desc_multiline" xml:space="preserve"> <data name="desc_multiline" xml:space="preserve">
<value>Gibt an, ob das Feld mehrzeilig sein soll.</value> <value>Should the element be a multiline field?</value>
</data> </data>
<data name="desc_name" xml:space="preserve"> <data name="desc_name" xml:space="preserve">
<value>Gibt den internen Namen des Elements an.</value> <value>The element's internal name</value>
</data> </data>
<data name="desc_place" xml:space="preserve"> <data name="desc_place" xml:space="preserve">
<value>Gibt den Ort des Termins an. Dynamische Werte aus anderen Controls können mit der Syntax [%controlname] eingefügt werden</value> <value>The appointment's location. Dynamic values from other controls can be inserted with the syntax [%controlname].</value>
</data> </data>
<data name="desc_readonly" xml:space="preserve"> <data name="desc_readonly" xml:space="preserve">
<value>Gibt an, ob dieses Element nur lesbar ist.</value> <value>Is the element read-only?</value>
</data> </data>
<data name="desc_required" xml:space="preserve"> <data name="desc_required" xml:space="preserve">
<value>Gibt an ob dieses Element benötigt wird um die Eingabe abzuschließen.</value> <value>Is the element required to be filled to complete the input?</value>
</data> </data>
<data name="desc_screenid" xml:space="preserve"> <data name="desc_screenid" xml:space="preserve">
<value>Gibt die Screen-ID der zu öffnenden Form an.</value> <value>The screen-ID of the form that will be opened.</value>
</data> </data>
<data name="desc_showcolumn" xml:space="preserve"> <data name="desc_showcolumn" xml:space="preserve">
<value>Gibt an, ob das Feld als Spalte im Grid angezeigt wird.</value> <value>Should the element be show as a column?</value>
</data> </data>
<data name="desc_size" xml:space="preserve"> <data name="desc_size" xml:space="preserve">
<value>Gibt die Größe des Elements an</value> <value>The element's size</value>
</data> </data>
<data name="desc_sqlcommand" xml:space="preserve"> <data name="desc_sqlcommand" xml:space="preserve">
<value>Gibt die Datenbank-Abfrage für dieses Element an. Es können @RECORD_ID und @FORM_ID als Platzhalter verwendet werden.</value> <value>Gibt die Datenbank-Abfrage für dieses Element an. Es können @RECORD_ID und @FORM_ID als Platzhalter verwendet werden. The database query for this element. @RECORD_ID and @FORM_ID can be used as placeholders. Dynamic values from other controls can be inserted with the Syntax @controlid@.</value>
</data> </data>
<data name="desc_staticlist" xml:space="preserve"> <data name="desc_staticlist" xml:space="preserve">
<value>Eine Liste von statischen Werten, die durch ';' getrennt sind. Überschreibt die Daten aus 'Datenbank-Einstellungen'</value> <value>A list of static values seperated by a semicolon (;)</value>
</data> </data>
<data name="desc_subject" xml:space="preserve"> <data name="desc_subject" xml:space="preserve">
<value>Gibt den Betreff des Termins an. Dynamische Werte aus anderen Controls können mit der Syntax [%controlname] eingefügt werden</value> <value>The appointment's subject. Dynamic values from other controls can be inserted with the syntax [%controlname].</value>
</data> </data>
<data name="desc_subject2" xml:space="preserve"> <data name="desc_subject2" xml:space="preserve">
<value>Gibt den optionalen zweiten Betreff des Termins an. Dynamische Werte aus anderen Controls können mit der Syntax [%controlname] eingefügt werden</value> <value>The appointment's optional secondary subject. Dynamic values from other controls can be inserted with the syntax [%controlname].</value>
</data> </data>
<data name="desc_tabindex" xml:space="preserve"> <data name="desc_tabindex" xml:space="preserve">
<value>Gibt die Reihenfolge an, in der das Element durch die Tabulatortaste aktiviert wird.</value> <value>The order in which this element should be activated by the tab key.</value>
</data> </data>
<data name="desc_tabstop" xml:space="preserve"> <data name="desc_tabstop" xml:space="preserve">
<value>Gibt an, ob das Element durch die Tabulartortaste aktiviert werden soll.</value> <value>Should this element be activated by the tab key?</value>
</data> </data>
<data name="desc_todate" xml:space="preserve"> <data name="desc_todate" xml:space="preserve">
<value>Der Name eines Elements von dem das Start-Datum gelesen wird.</value> <value>The appointment's end-date. Dynamic values from other controls can be inserted with the syntax [%controlname].</value>
</data> </data>
</root> </root>

View File

@@ -124,13 +124,13 @@
<value>Daten</value> <value>Daten</value>
</data> </data>
<data name="category_database" xml:space="preserve"> <data name="category_database" xml:space="preserve">
<value>Database Configurations</value> <value>Datenbank Einstellungen</value>
</data> </data>
<data name="category_date" xml:space="preserve"> <data name="category_date" xml:space="preserve">
<value>Datums Einstellungen</value> <value>Datums Einstellungen</value>
</data> </data>
<data name="category_font" xml:space="preserve"> <data name="category_font" xml:space="preserve">
<value>Font Configurations</value> <value>Schrift Einstellungen</value>
</data> </data>
<data name="category_form" xml:space="preserve"> <data name="category_form" xml:space="preserve">
<value>Form Einstellungen</value> <value>Form Einstellungen</value>
@@ -139,10 +139,10 @@
<value>ID</value> <value>ID</value>
</data> </data>
<data name="category_other" xml:space="preserve"> <data name="category_other" xml:space="preserve">
<value>Other Configurations</value> <value>Andere Einstellungen</value>
</data> </data>
<data name="category_view" xml:space="preserve"> <data name="category_view" xml:space="preserve">
<value>ViewConfigurations</value> <value>Ansichts Einstellungen</value>
</data> </data>
<data name="desc_backcolor" xml:space="preserve"> <data name="desc_backcolor" xml:space="preserve">
<value>Gibt die Hintergrundfarbe des Elements an.</value> <value>Gibt die Hintergrundfarbe des Elements an.</value>
@@ -150,9 +150,6 @@
<data name="desc_caption" xml:space="preserve"> <data name="desc_caption" xml:space="preserve">
<value>Gibt den Beschreibungstext dieses Elements an.</value> <value>Gibt den Beschreibungstext dieses Elements an.</value>
</data> </data>
<data name="desc_columntitle" xml:space="preserve">
<value>Gibt den Spaltentitel des Elements an.</value>
</data>
<data name="desc_col_title" xml:space="preserve"> <data name="desc_col_title" xml:space="preserve">
<value>Gibt den Spaltentitel des Elements an.</value> <value>Gibt den Spaltentitel des Elements an.</value>
</data> </data>