From 8a9f9241e6ad2a123103bd2179d987c069e99e68 Mon Sep 17 00:00:00 2001 From: JenneJ Date: Mon, 14 Mar 2016 11:27:54 +0100 Subject: [PATCH 1/5] jj 14.03 update datepicker --- .../ClassControlBuilder.vb | 8 +- .../frmTool_ControlDesigner.Designer.vb | 56 +- .../frmTool_ControlDesigner.en-US.resx | 12 +- .../frmTool_ControlDesigner.resx | 635 +++++++++--------- .../frmTool_ControlProperties.vb | 4 + 5 files changed, 358 insertions(+), 357 deletions(-) diff --git a/app/DD-Record-Organiser/ClassControlBuilder.vb b/app/DD-Record-Organiser/ClassControlBuilder.vb index 2d0bc2a..c5e0cb7 100644 --- a/app/DD-Record-Organiser/ClassControlBuilder.vb +++ b/app/DD-Record-Organiser/ClassControlBuilder.vb @@ -1021,7 +1021,7 @@ Public Class ClassControlBuilder Try Dim control As New DevExpress.XtraEditors.DateEdit 'Dim control As New DateTimePicker - Dim defaultSize As Size = New Size(120, 24) + Dim defaultSize As Size = New Size(90, 20) Dim metadata As New ClassControlMetadata() metadata.Id = id @@ -1105,9 +1105,9 @@ Public Class ClassControlBuilder - column.HeaderText = "" - column.Name = "column1" - control.Columns.Add(column) + 'column.HeaderText = "" + 'column.Name = "column1" + 'control.Columns.Add(column) If _new And IsNothing(parent) Then control.Location = Me.GetCursorPosition() diff --git a/app/DD-Record-Organiser/frmTool_ControlDesigner.Designer.vb b/app/DD-Record-Organiser/frmTool_ControlDesigner.Designer.vb index 8146a53..c3808db 100644 --- a/app/DD-Record-Organiser/frmTool_ControlDesigner.Designer.vb +++ b/app/DD-Record-Organiser/frmTool_ControlDesigner.Designer.vb @@ -24,9 +24,6 @@ Partial Class frmTool_ControlDesigner Private Sub InitializeComponent() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmTool_ControlDesigner)) Me.GroupBox1 = New System.Windows.Forms.GroupBox() - Me.GroupBox2 = New System.Windows.Forms.GroupBox() - Me.btn_addformdata = New System.Windows.Forms.Button() - Me.btn_addtocal = New System.Windows.Forms.Button() Me.btnListBox = New System.Windows.Forms.Button() Me.btnListBoxCheckable = New System.Windows.Forms.Button() Me.btnRadioButton = New System.Windows.Forms.Button() @@ -38,13 +35,15 @@ Partial Class frmTool_ControlDesigner Me.btncmb = New System.Windows.Forms.Button() Me.btntextbox = New System.Windows.Forms.Button() Me.btnlabel = New System.Windows.Forms.Button() + Me.GroupBox2 = New System.Windows.Forms.GroupBox() + Me.btn_addformdata = New System.Windows.Forms.Button() + Me.btn_addtocal = New System.Windows.Forms.Button() Me.GroupBox1.SuspendLayout() Me.GroupBox2.SuspendLayout() Me.SuspendLayout() ' 'GroupBox1 ' - resources.ApplyResources(Me.GroupBox1, "GroupBox1") Me.GroupBox1.Controls.Add(Me.btnListBox) Me.GroupBox1.Controls.Add(Me.btnListBoxCheckable) Me.GroupBox1.Controls.Add(Me.btnRadioButton) @@ -56,33 +55,10 @@ Partial Class frmTool_ControlDesigner Me.GroupBox1.Controls.Add(Me.btncmb) Me.GroupBox1.Controls.Add(Me.btntextbox) Me.GroupBox1.Controls.Add(Me.btnlabel) + resources.ApplyResources(Me.GroupBox1, "GroupBox1") Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.TabStop = False ' - 'GroupBox2 - ' - resources.ApplyResources(Me.GroupBox2, "GroupBox2") - Me.GroupBox2.Controls.Add(Me.btn_addformdata) - Me.GroupBox2.Controls.Add(Me.btn_addtocal) - Me.GroupBox2.Name = "GroupBox2" - Me.GroupBox2.TabStop = False - ' - 'btn_addformdata - ' - resources.ApplyResources(Me.btn_addformdata, "btn_addformdata") - Me.btn_addformdata.Image = Global.DD_Record_Organiser.My.Resources.Resources.AddMark_10580 - Me.btn_addformdata.Name = "btn_addformdata" - Me.btn_addformdata.TabStop = False - Me.btn_addformdata.UseVisualStyleBackColor = True - ' - 'btn_addtocal - ' - resources.ApplyResources(Me.btn_addtocal, "btn_addtocal") - Me.btn_addtocal.Image = Global.DD_Record_Organiser.My.Resources.Resources.AddTable_5632 - Me.btn_addtocal.Name = "btn_addtocal" - Me.btn_addtocal.TabStop = False - Me.btn_addtocal.UseVisualStyleBackColor = True - ' 'btnListBox ' resources.ApplyResources(Me.btnListBox, "btnListBox") @@ -169,6 +145,30 @@ Partial Class frmTool_ControlDesigner Me.btnlabel.TabStop = False Me.btnlabel.UseVisualStyleBackColor = True ' + 'GroupBox2 + ' + Me.GroupBox2.Controls.Add(Me.btn_addformdata) + Me.GroupBox2.Controls.Add(Me.btn_addtocal) + resources.ApplyResources(Me.GroupBox2, "GroupBox2") + Me.GroupBox2.Name = "GroupBox2" + Me.GroupBox2.TabStop = False + ' + 'btn_addformdata + ' + resources.ApplyResources(Me.btn_addformdata, "btn_addformdata") + Me.btn_addformdata.Image = Global.DD_Record_Organiser.My.Resources.Resources.AddMark_10580 + Me.btn_addformdata.Name = "btn_addformdata" + Me.btn_addformdata.TabStop = False + Me.btn_addformdata.UseVisualStyleBackColor = True + ' + 'btn_addtocal + ' + resources.ApplyResources(Me.btn_addtocal, "btn_addtocal") + Me.btn_addtocal.Image = Global.DD_Record_Organiser.My.Resources.Resources.AddTable_5632 + Me.btn_addtocal.Name = "btn_addtocal" + Me.btn_addtocal.TabStop = False + Me.btn_addtocal.UseVisualStyleBackColor = True + ' 'frmTool_ControlDesigner ' resources.ApplyResources(Me, "$this") diff --git a/app/DD-Record-Organiser/frmTool_ControlDesigner.en-US.resx b/app/DD-Record-Organiser/frmTool_ControlDesigner.en-US.resx index d1988ff..de4467a 100644 --- a/app/DD-Record-Organiser/frmTool_ControlDesigner.en-US.resx +++ b/app/DD-Record-Organiser/frmTool_ControlDesigner.en-US.resx @@ -145,6 +145,9 @@ NoControl + + DatePicker + NoControl @@ -154,18 +157,15 @@ NoControl + + functions + NoControl NoControl - - functions - - - NoControl - Controls - Formdesigner diff --git a/app/DD-Record-Organiser/frmTool_ControlDesigner.resx b/app/DD-Record-Organiser/frmTool_ControlDesigner.resx index a39627e..faac4c0 100644 --- a/app/DD-Record-Organiser/frmTool_ControlDesigner.resx +++ b/app/DD-Record-Organiser/frmTool_ControlDesigner.resx @@ -117,513 +117,510 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - GroupBox1 - - - PictureBox - - - 12, 127 - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 134, 31 - - - GroupBox1 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Funktionen + + Segoe UI, 8.25pt, style=Bold - + MiddleLeft - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 12, 200 + + + 134, 31 - - 3 + + 10 + + + ListBox MiddleRight - - MiddleRight + + btnListBox - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ListBox + + GroupBox1 - - 134, 27 + + 0 - + + Segoe UI, 8.25pt, style=Bold + + MiddleLeft - - 12, 90 + + 12, 164 - - MiddleRight + + 134, 31 - - Add to Calendar + + 9 - - GroupBox + + ListBox Checkable - - DateTimePicker + + MiddleRight - - Tabelle + + btnListBoxCheckable - - 5 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 8 + + GroupBox1 - + + 1 + + Segoe UI, 8.25pt, style=Bold - - 2 + + MiddleLeft - - 134, 31 + + 152, 92 - - 12, 22 + + 132, 31 - - Segoe UI, 8.25pt + + 5 - - btn_addformdata + + RadioButton - - Werkzeug-Formulardesigner + + MiddleRight - - GroupBox1 + + btnRadioButton - - 10 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 13, 55 + + GroupBox1 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 2 - - MiddleRight + + Segoe UI, 8.25pt, style=Bold - - RadioButton + + MiddleLeft - - 132, 27 + + 152, 164 - - 6, 13 + + 132, 31 - - 12, 164 + + 8 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + GroupBox - - btncmb + + MiddleRight - - MiddleLeft + + btngb - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - MiddleLeft - GroupBox1 - - MiddleLeft + + 3 - - btnlabel + + Segoe UI, 8.25pt, style=Bold - - 132, 31 + + MiddleLeft - - btn_addtocal + + 12, 127 - - 0 + + 134, 31 - - 1 + + 6 - - MiddleRight + + PictureBox - - 152, 22 + + MiddleRight - - Segoe UI, 8.25pt, style=Bold + + btnpb - - Segoe UI, 8.25pt, style=Bold + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - $this + + GroupBox1 - - MiddleRight + + 4 - - 3 + + Segoe UI, 8.25pt, style=Bold - - btnRadioButton + + MiddleLeft - - 134, 31 + + 152, 127 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 132, 31 - - 2 + + 7 - - frmTool_ControlDesigner + + Tabelle MiddleRight - - 1 + + btnTabelle - - 134, 31 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Segoe UI, 8.25pt, style=Bold + + GroupBox1 - - 3 + + 5 - - ListBox Checkable + + Segoe UI, 8.25pt, style=Bold - + MiddleLeft - - 9 - - - GroupBox1 + + 152, 55 - - 0 + + 132, 31 - - GroupBox1 + + 3 - - GroupBox2 + + CheckBox - - GroupBox1 + + MiddleRight - - 5 + + btnCheckbox - - 12, 24 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + GroupBox1 - - GroupBox2 + + 6 + + + Segoe UI, 8.25pt, style=Bold MiddleLeft - - GroupBox1 + + 152, 22 - - MiddleLeft + + 132, 27 - - btngb + + 1 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + DatePicker - - $this + + MiddleRight - - 132, 31 + + btndtp - - 134, 31 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + GroupBox1 - - MiddleRight + + 7 - + + Segoe UI, 8.25pt, style=Bold + + MiddleLeft - - 7 + + 12, 90 - + + 134, 31 + + 4 - - 152, 164 + + ComboBox - + + MiddleRight + + + btncmb + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - MiddleRight + + GroupBox1 - + + 8 + + Segoe UI, 8.25pt, style=Bold - - MiddleRight + + MiddleLeft - - GroupBox1 + + 13, 55 - - Segoe UI, 8.25pt, style=Bold + + 133, 29 - - CheckBox + + 2 TextBox - - 1 + + MiddleRight - - MiddleLeft + + btntextbox - - 152, 55 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 12, 200 + + GroupBox1 + + + 9 Segoe UI, 8.25pt, style=Bold - - 133, 29 - - - Label - - + MiddleLeft - - 6 + + 12, 22 - - btnTabelle + + 134, 27 - - btntextbox + + 0 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Label - - 9 + + MiddleRight - - 152, 92 + + btnlabel - - System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - MiddleLeft + + GroupBox1 - - MiddleRight + + 10 - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Segoe UI, 9.75pt, style=Bold 12, 12 - - Segoe UI, 8.25pt, style=Bold + + 295, 237 - - 4 + + 3 - - 7 + + Control-Types (Drag and Drop) - - 152, 127 + + GroupBox1 - - btnCheckbox + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 132, 31 + + $this - - Segoe UI, 8.25pt, style=Bold + + 1 - + Segoe UI, 8.25pt, style=Bold - - 0 + + MiddleLeft + + + 152, 24 132, 31 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 1 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Add Form Data - - 0 + + MiddleRight - - MiddleLeft + + btn_addformdata - - GroupBox2 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 1 + + GroupBox2 0 - - 132, 31 - - - 1 + + Segoe UI, 8.25pt, style=Bold - - 10 + + MiddleLeft - - 324, 337 + + 12, 24 - - 152, 24 + + 134, 31 - - 8 + + 0 - - Segoe UI, 8.25pt, style=Bold + + Add to Calendar - - btnpb + + MiddleRight - - Add Form Data + + btn_addtocal - - 295, 237 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - btnListBoxCheckable + + GroupBox2 - - MiddleRight + + 1 - + Segoe UI, 9.75pt, style=Bold - - Segoe UI, 8.25pt, style=Bold - - - GroupBox1 + + 12, 255 - - btndtp + + 295, 71 - + 4 - - btnListBox + + Funktionen - - 6 + + GroupBox2 - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ComboBox + + $this - - Segoe UI, 8.25pt, style=Bold + + 0 - - 295, 71 + + True + + + 6, 13 - - 12, 255 + + 324, 337 - - MiddleRight + + Segoe UI, 8.25pt - - Control-Types (Drag and Drop) + + Werkzeug-Formulardesigner - - Segoe UI, 9.75pt, style=Bold + + frmTool_ControlDesigner + + + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - - - en-US - \ No newline at end of file diff --git a/app/DD-Record-Organiser/frmTool_ControlProperties.vb b/app/DD-Record-Organiser/frmTool_ControlProperties.vb index d665120..fa265f8 100644 --- a/app/DD-Record-Organiser/frmTool_ControlProperties.vb +++ b/app/DD-Record-Organiser/frmTool_ControlProperties.vb @@ -150,6 +150,10 @@ CType(r.Item("CTRLSCR_FONT_STYLE"), FontStyle)) props.ColumnTitle = ClassConverter.ToStringOrDefault(r.Item("CONTROL_COL_NAME"), ctrl.Name) props.ShowColumn = ClassConverter.ToBooleanOrDefault(r.Item("CONTROL_SHOW_COLUMN"), True) + props.StaticList = NotNull(r.Item("CONTROL_STATIC_LIST"), "") + props.SQLCommand = New SQLValue(NotNull(r.Item("CONTROL_SQLCOMMAND_1"), "")) + props.IsRequired = r.Item("CONTROL_REQUIRED") + props.IsReadOnly = r.Item("CONTROL_READ_ONLY") Case "Groupbox" props.Caption = r.Item("CTRLSCR_CAPTION") From 65ff842c1e50273bea488b421b8e0177e01ea8dc Mon Sep 17 00:00:00 2001 From: JenneJ Date: Mon, 14 Mar 2016 11:32:14 +0100 Subject: [PATCH 2/5] =?UTF-8?q?jj=2014.03=20showcolumn=20f=C3=BCr=20datagr?= =?UTF-8?q?idview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ClassControlCommands.vb | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/DD-Record-Organiser/ClassControlCommands.vb b/app/DD-Record-Organiser/ClassControlCommands.vb index 3fa8719..d57ccb8 100644 --- a/app/DD-Record-Organiser/ClassControlCommands.vb +++ b/app/DD-Record-Organiser/ClassControlCommands.vb @@ -233,16 +233,20 @@ DEFAULTVALUE = properties.DefaultValue End If - If type = "TextBox" OrElse - type = "ComboBox" OrElse - type = "CheckBox" OrElse - type = "RadioButton" OrElse - type = "CheckedListBoxControl" OrElse - type = "ListBoxControl" Then + 'If type = "TextBox" OrElse + ' type = "ComboBox" OrElse + ' type = "CheckBox" OrElse + ' type = "RadioButton" OrElse + ' type = "CheckedListBoxControl" OrElse + ' type = "ListBoxControl" Then + + ' SHOW_COLUMN = BoolToInt(properties.ShowColumn) + 'Else + ' SHOW_COLUMN = BoolToInt(True) + 'End If + If propExists(properties, "ShowColumn") Then SHOW_COLUMN = BoolToInt(properties.ShowColumn) - Else - SHOW_COLUMN = BoolToInt(True) End If If type = "TextBox" AndAlso propExists(properties, "Format") Then From 0f271342b6905845f6eb65ba2e7db4785f22d896 Mon Sep 17 00:00:00 2001 From: JenneJ Date: Mon, 14 Mar 2016 15:16:04 +0100 Subject: [PATCH 3/5] jj 14.03 add props for dgv, new value structure for clb --- .../ClassControlCommandsUI.vb | 35 ++++++++++++++++-- app/DD-Record-Organiser/ClassControlLoader.vb | 36 +++++++++++++++---- .../ClassControlProperties.vb | 25 +++++++++++++ app/DD-Record-Organiser/ClassControlValues.vb | 22 +++++++++--- 4 files changed, 105 insertions(+), 13 deletions(-) diff --git a/app/DD-Record-Organiser/ClassControlCommandsUI.vb b/app/DD-Record-Organiser/ClassControlCommandsUI.vb index da94bd8..808fb7c 100644 --- a/app/DD-Record-Organiser/ClassControlCommandsUI.vb +++ b/app/DD-Record-Organiser/ClassControlCommandsUI.vb @@ -495,6 +495,12 @@ Public Class ClassControlCommandsUI Continue For End If + If TypeOf ctrl Is DevExpress.XtraEditors.CheckedListBoxControl Then + Dim id As Integer = DirectCast(ctrl.Tag, ClassControlMetadata).Id + UpdateMultipleValues(id, RecordID, CONTROL_VALUE) + Continue For + End If + Dim ValueExists = ClassDatabase.Execute_Scalar(String.Format("SELECT RECORD_ID FROM VWPMO_VALUES WHERE RECORD_ID = {0} AND CONTROL_ID = {1}", RecordID, CONTROL_ID)) If ValueExists Then ' Control Updaten @@ -510,6 +516,31 @@ Public Class ClassControlCommandsUI End Sub + Public Sub UpdateMultipleValues(ControlId As Integer, RecordId As Integer, value As String) + Try + Dim values As New List(Of String)(value.Split(";")) + Dim dt As DataTable = ClassDatabase.Return_Datatable(String.Format("SELECT VALUE FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1}", ControlId, RecordId)) + ' Konvertiere datatable zu liste + Dim oldValues = dt.AsEnumerable().Select(Of String)(Function(r) + Return r.Item("VALUE") + End Function).ToList() + + Dim AddValues = values.Except(oldValues) + Dim RemoveValues = oldValues.Except(values) + + For Each v As String In AddValues + ClassDatabase.Execute_non_Query(String.Format("INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID, RECORD_ID, VALUE) VALUES({0}, {1}, '{2}')", ControlId, RecordId, v)) + Next + + For Each v As String In RemoveValues + ClassDatabase.Execute_non_Query(String.Format("DELETE FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1} AND VALUE = '{2}'", ControlId, RecordId, v)) + Next + + Catch ex As Exception + MsgBox("Error in UpdateMultipleValues:" & vbNewLine & ex.Message) + End Try + End Sub + Function GetControlValue(ctrl As Control) As String Dim type = ctrl.GetType().Name @@ -547,7 +578,7 @@ Public Class ClassControlCommandsUI Dim result_string As String For Each item As DevExpress.XtraEditors.Controls.CheckedListBoxItem In chklbx.CheckedItems - result.Add(item.Value) + result.Add(item.Value.ToString.Trim) Next result_string = String.Join(";", result) @@ -598,7 +629,7 @@ Public Class ClassControlCommandsUI If LogErrorsOnly = False Then ClassLogger.Add(">> Checked ListBox record '" & rid.ToString & "' was linked successfully.", False) End If End If - + End If End If Catch ex As Exception diff --git a/app/DD-Record-Organiser/ClassControlLoader.vb b/app/DD-Record-Organiser/ClassControlLoader.vb index b6ab323..20cd737 100644 --- a/app/DD-Record-Organiser/ClassControlLoader.vb +++ b/app/DD-Record-Organiser/ClassControlLoader.vb @@ -66,7 +66,7 @@ If IsNothing(staticList) Or String.IsNullOrWhiteSpace(staticList) Then Return Nothing Else - Return New List(Of String)(staticList.Split(";")) + Return New List(Of String)(staticList.Split(";").ToArray()) End If Catch ex As Exception MsgBox("Error in CheckForStaticList: " & vbNewLine & ex.Message) @@ -74,7 +74,7 @@ End Try End Function - Private Shared Function GetSqlList(controlId As Integer, formId As Integer, connection_Id As Object, sqlCommand As String) + Public Shared Function GetSqlList(controlId As Integer, formId As Integer, connection_Id As Object, sqlCommand As String) As DataTable Try If sqlCommand Is Nothing Or sqlCommand = String.Empty Then Return Nothing @@ -178,6 +178,10 @@ control.DataSource = dt End Sub + Overloads Shared Sub SetDataSource(control As Windows.Forms.DataGridView, dt As DataTable) + control.DataSource = dt + End Sub + End Class Public Structure DynamicValue @@ -333,13 +337,11 @@ Public Class CheckedListBox : Inherits _ListControl - Public Shared Sub LoadValue(control As DevExpress.XtraEditors.CheckedListBoxControl, value As String) - If IsNothing(value) Then + Public Shared Sub LoadValue(control As DevExpress.XtraEditors.CheckedListBoxControl, values As List(Of Object)) + If IsNothing(values) Then Exit Sub End If - Dim values() As String = value.Split(";") - For Each v As String In values Dim pos = control.FindStringExact(v) If pos >= 0 Then @@ -391,4 +393,26 @@ End Class + Public Class DataGridView : Inherits _ListControl + + Public Shared Sub LoadList(control As Windows.Forms.DataGridView, formId As Integer, ConnId As Object, SQLCommand As String) + Dim controlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id + Dim dynamic As DynamicValue = GetDynamicValue(DirectCast(control.Tag, ClassControlMetadata).Id, formId, ConnId, SQLCommand) + + ' SQLCommand ignorieren + If dynamic.StaticList IsNot Nothing Then + Dim bindingSource As New BindingSource() + + For Each item As String In dynamic.StaticList + bindingSource.Add(item) + Next + + 'control.DataSource = dynamic.StaticList + control.DataSource = bindingSource + End If + + End Sub + + End Class + End Namespace diff --git a/app/DD-Record-Organiser/ClassControlProperties.vb b/app/DD-Record-Organiser/ClassControlProperties.vb index 0fa1460..b8b2361 100644 --- a/app/DD-Record-Organiser/ClassControlProperties.vb +++ b/app/DD-Record-Organiser/ClassControlProperties.vb @@ -399,6 +399,31 @@ Module ClassControlProperties Public Class DataGridViewProperties Inherits CommonProperties + + Private _show_column As Boolean + Private _static_list As String + + + + Public Property ShowColumn() As Boolean + Get + Return _show_column + End Get + Set(value As Boolean) + _show_column = value + End Set + End Property + + + + Public Property StaticList() As String + Get + Return _static_list + End Get + Set(value As String) + _static_list = value + End Set + End Property End Class Public Class PictureBoxProperties Inherits CommonProperties diff --git a/app/DD-Record-Organiser/ClassControlValues.vb b/app/DD-Record-Organiser/ClassControlValues.vb index 77950b4..619a644 100644 --- a/app/DD-Record-Organiser/ClassControlValues.vb +++ b/app/DD-Record-Organiser/ClassControlValues.vb @@ -159,15 +159,15 @@ Public Class ClassControlValues Dim ControlId As Integer = DirectCast(control.Tag, ClassControlMetadata).Id ' Wert per LINQ aus DT_ControlValues suchen der zur aktuellen controlId passt - Dim value = (From row In DT_ControlValues.AsEnumerable() + Dim values As List(Of Object) = (From row In DT_ControlValues.AsEnumerable() Where row.Item("CONTROL_ID") = ControlId - Select row.Item("VALUE")).FirstOrDefault() + Select row.Item("VALUE")).ToList() If TypeOf control Is GroupBox Then Dim groupbox As GroupBox = DirectCast(control, GroupBox) LoadControlValues(RecordId, ParentRecordId, FormId, groupbox.Controls) Else - LoadControlValue(RecordId, ParentRecordId, ControlId, control, value) + LoadControlValue(RecordId, ParentRecordId, ControlId, control, values) End If Next @@ -178,8 +178,15 @@ Public Class ClassControlValues End Sub - Private Shared Sub LoadControlValue(recordId As Integer, parentRecordId As Integer, controlId As Integer, control As Control, value As Object) + Private Shared Sub LoadControlValue(recordId As Integer, parentRecordId As Integer, controlId As Integer, control As Control, values As List(Of Object)) Try + ' 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) @@ -219,7 +226,7 @@ Public Class ClassControlValues 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, value) + ControlLoader.CheckedListBox.LoadValue(checkedlistbox, values) Case GetType(PictureBox) If LogErrorsOnly = False Then ClassLogger.Add(">> Sub LoadControlValueNeu - GetType(PictureBox) ", False) @@ -290,6 +297,11 @@ Public Class ClassControlValues Dim chlistbox = DirectCast(Ctrl, DevExpress.XtraEditors.CheckedListBoxControl) ControlLoader.CheckedListBox.LoadList(chlistbox, FormID, ConnID, sqlcommand) + Case GetType(DataGridView) + Dim gridview = DirectCast(Ctrl, DataGridView) + Dim noSQL As String = "" + ControlLoader.DataGridView.LoadList(gridview, FormID, ConnID, noSQL) + End Select swcontrol.Stop() From 0786619d10009284411e4323074a3abf0146013a Mon Sep 17 00:00:00 2001 From: JenneJ Date: Mon, 14 Mar 2016 15:48:25 +0100 Subject: [PATCH 4/5] jj 14.03 work on dgv --- app/DD-Record-Organiser/ClassControlLoader.vb | 11 +++-------- app/DD-Record-Organiser/ClassControlValues.vb | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/DD-Record-Organiser/ClassControlLoader.vb b/app/DD-Record-Organiser/ClassControlLoader.vb index 20cd737..45463b0 100644 --- a/app/DD-Record-Organiser/ClassControlLoader.vb +++ b/app/DD-Record-Organiser/ClassControlLoader.vb @@ -401,14 +401,9 @@ ' SQLCommand ignorieren If dynamic.StaticList IsNot Nothing Then - Dim bindingSource As New BindingSource() - - For Each item As String In dynamic.StaticList - bindingSource.Add(item) - Next - - 'control.DataSource = dynamic.StaticList - control.DataSource = bindingSource + control.DataSource = dynamic.StaticList.Select(Function(v) + Return New With {Key .Value = v} + End Function) End If End Sub diff --git a/app/DD-Record-Organiser/ClassControlValues.vb b/app/DD-Record-Organiser/ClassControlValues.vb index 619a644..f02e932 100644 --- a/app/DD-Record-Organiser/ClassControlValues.vb +++ b/app/DD-Record-Organiser/ClassControlValues.vb @@ -257,7 +257,7 @@ Public Class ClassControlValues ' 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 <> '' AND CONTROL_SQLCOMMAND_1 NOT LIKE '%@%'", FormID) + 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) swsql.Stop() From 68506182d7c6317b6717a41d2b4359044edd7e93 Mon Sep 17 00:00:00 2001 From: JenneJ Date: Mon, 14 Mar 2016 16:11:53 +0100 Subject: [PATCH 5/5] jj 14.03 fix clb --- app/DD-Record-Organiser/ClassControlLoader.vb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/DD-Record-Organiser/ClassControlLoader.vb b/app/DD-Record-Organiser/ClassControlLoader.vb index 45463b0..7a12432 100644 --- a/app/DD-Record-Organiser/ClassControlLoader.vb +++ b/app/DD-Record-Organiser/ClassControlLoader.vb @@ -355,7 +355,11 @@ Dim dynamic As DynamicValue = GetDynamicValue(DirectCast(control.Tag, ClassControlMetadata).Id, formId, conn_Id, SQLCommand) If dynamic.StaticList IsNot Nothing Then - control.DataSource = dynamic.StaticList + control.Items.Clear() + For Each item In dynamic.StaticList + control.Items.Add(item) + Next + 'control.DataSource = dynamic.StaticList End If If dynamic.DataTable IsNot Nothing AndAlso dynamic.DataTable.Rows.Count > 0 Then @@ -401,9 +405,7 @@ ' SQLCommand ignorieren If dynamic.StaticList IsNot Nothing Then - control.DataSource = dynamic.StaticList.Select(Function(v) - Return New With {Key .Value = v} - End Function) + control.DataSource = dynamic.StaticList End If End Sub