diff --git a/app/DD-Record-Organiser/DD-Record-Organiser.vbproj b/app/DD-Record-Organiser/DD-Record-Organiser.vbproj
index 366bf2d..80428af 100644
--- a/app/DD-Record-Organiser/DD-Record-Organiser.vbproj
+++ b/app/DD-Record-Organiser/DD-Record-Organiser.vbproj
@@ -294,6 +294,12 @@
Form
+
+ frmWD_Link_to_Record.vb
+
+
+ Form
+
ControlProperties.en.resx
True
@@ -666,6 +672,9 @@
frmRecordView.vb
+
+ frmWD_Link_to_Record.vb
+
ResXFileCodeGenerator
diff --git a/app/DD-Record-Organiser/frmConstructor_Main.Designer.vb b/app/DD-Record-Organiser/frmConstructor_Main.Designer.vb
index d390fc9..0d889ef 100644
--- a/app/DD-Record-Organiser/frmConstructor_Main.Designer.vb
+++ b/app/DD-Record-Organiser/frmConstructor_Main.Designer.vb
@@ -71,6 +71,7 @@ Partial Class frmConstructor_Main
Me.DeleteToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripSeparator9 = New System.Windows.Forms.ToolStripSeparator()
Me.PropertiesToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.DateiMitDatensatzVerknüpfenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.GridViewDoc_Search = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.ToolStripDokumente = New System.Windows.Forms.ToolStrip()
Me.tslblWindreamView = New System.Windows.Forms.ToolStripLabel()
@@ -444,7 +445,7 @@ Partial Class frmConstructor_Main
'
'ContextMenuStripResultFiles
'
- Me.ContextMenuStripResultFiles.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.DateiÖffnenToolStripMenuItem, Me.ToolStripSeparator7, Me.CopyToolStripMenuItem, Me.ToolStripSeparator10, Me.UmbenennenToolStripMenuItem, Me.ToolStripSeparator8, Me.DeleteToolStripMenuItem, Me.ToolStripSeparator9, Me.PropertiesToolStripMenuItem})
+ Me.ContextMenuStripResultFiles.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.DateiÖffnenToolStripMenuItem, Me.ToolStripSeparator7, Me.CopyToolStripMenuItem, Me.ToolStripSeparator10, Me.UmbenennenToolStripMenuItem, Me.ToolStripSeparator8, Me.DeleteToolStripMenuItem, Me.ToolStripSeparator9, Me.PropertiesToolStripMenuItem, Me.DateiMitDatensatzVerknüpfenToolStripMenuItem})
Me.ContextMenuStripResultFiles.Name = "ContextMenuStripResultFiles"
resources.ApplyResources(Me.ContextMenuStripResultFiles, "ContextMenuStripResultFiles")
'
@@ -502,6 +503,11 @@ Partial Class frmConstructor_Main
Me.PropertiesToolStripMenuItem.Name = "PropertiesToolStripMenuItem"
resources.ApplyResources(Me.PropertiesToolStripMenuItem, "PropertiesToolStripMenuItem")
'
+ 'DateiMitDatensatzVerknüpfenToolStripMenuItem
+ '
+ Me.DateiMitDatensatzVerknüpfenToolStripMenuItem.Name = "DateiMitDatensatzVerknüpfenToolStripMenuItem"
+ resources.ApplyResources(Me.DateiMitDatensatzVerknüpfenToolStripMenuItem, "DateiMitDatensatzVerknüpfenToolStripMenuItem")
+ '
'GridViewDoc_Search
'
Me.GridViewDoc_Search.Appearance.OddRow.BackColor = CType(resources.GetObject("GridViewDoc_Search.Appearance.OddRow.BackColor"), System.Drawing.Color)
@@ -1211,4 +1217,5 @@ Partial Class frmConstructor_Main
Friend WithEvents ToolStripSeparator10 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents UmbenennenToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents ToolStripTextBox2 As System.Windows.Forms.ToolStripTextBox
+ Friend WithEvents DateiMitDatensatzVerknüpfenToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
End Class
diff --git a/app/DD-Record-Organiser/frmConstructor_Main.resx b/app/DD-Record-Organiser/frmConstructor_Main.resx
index 1fcaa79..ce703c2 100644
--- a/app/DD-Record-Organiser/frmConstructor_Main.resx
+++ b/app/DD-Record-Organiser/frmConstructor_Main.resx
@@ -310,7 +310,7 @@
0, 0
- 795, 237
+ 788, 237
0
@@ -379,7 +379,7 @@
0, 0
- 1077, 349
+ 1081, 345
0
@@ -397,7 +397,7 @@
0
- 1077, 349
+ 1081, 345
Detailansicht
@@ -415,7 +415,7 @@
0
- 1083, 380
+ 1083, 373
1
@@ -424,52 +424,58 @@
124, 134
- 152, 22
+ 239, 22
Datei Öffnen
- 149, 6
+ 236, 6
- 152, 22
+ 239, 22
Kopieren
- 149, 6
+ 236, 6
350, 23
- 152, 22
+ 239, 22
Umbenennen
- 149, 6
+ 236, 6
- 152, 22
+ 239, 22
Löschen
- 149, 6
+ 236, 6
- 152, 22
+ 239, 22
Eigenschaften
+
+ 239, 22
+
+
+ Datei mit Datensatz verknüpfen
+
- 153, 160
+ 240, 160
ContextMenuStripResultFiles
@@ -1688,7 +1694,7 @@
True
- 104
+ 194
6, 13
@@ -2343,6 +2349,12 @@
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ DateiMitDatensatzVerknüpfenToolStripMenuItem
+
+
+ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
GridViewDoc_Search
diff --git a/app/DD-Record-Organiser/frmConstructor_Main.vb b/app/DD-Record-Organiser/frmConstructor_Main.vb
index eb4e5c0..4d2e39c 100644
--- a/app/DD-Record-Organiser/frmConstructor_Main.vb
+++ b/app/DD-Record-Organiser/frmConstructor_Main.vb
@@ -5361,4 +5361,11 @@ Public Class frmConstructor_Main
MsgBox("Unexpected Error in getting the filename: " & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
+
+ Private Sub DateiMitDatensatzVerknüpfenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DateiMitDatensatzVerknüpfenToolStripMenuItem.Click
+ Dim fileName As String = RESULT_DOC_PATH
+
+ Dim frm As New frmWD_Link_to_Record(fileName)
+ frm.Show()
+ End Sub
End Class
\ No newline at end of file
diff --git a/app/DD-Record-Organiser/frmWD_Link_to_Record.Designer.vb b/app/DD-Record-Organiser/frmWD_Link_to_Record.Designer.vb
new file mode 100644
index 0000000..411510a
--- /dev/null
+++ b/app/DD-Record-Organiser/frmWD_Link_to_Record.Designer.vb
@@ -0,0 +1,196 @@
+ _
+Partial Class frmWD_Link_to_Record
+ Inherits System.Windows.Forms.Form
+
+ 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
+ _
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Wird vom Windows Form-Designer benötigt.
+ Private components As System.ComponentModel.IContainer
+
+ 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
+ 'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
+ 'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
+ _
+ Private Sub InitializeComponent()
+ Me.cmbConstructorForms = New System.Windows.Forms.ComboBox()
+ Me.Label1 = New System.Windows.Forms.Label()
+ Me.tvEntities = New System.Windows.Forms.TreeView()
+ Me.Label2 = New System.Windows.Forms.Label()
+ Me.dgEntityRecords = New DevExpress.XtraGrid.GridControl()
+ Me.grvwGrid = New DevExpress.XtraGrid.Views.Grid.GridView()
+ Me.btnLink = New System.Windows.Forms.Button()
+ Me.Label3 = New System.Windows.Forms.Label()
+ Me.Label4 = New System.Windows.Forms.Label()
+ Me.txtFilename = New System.Windows.Forms.TextBox()
+ Me.txtRecordId = New System.Windows.Forms.TextBox()
+ Me.Label5 = New System.Windows.Forms.Label()
+ CType(Me.dgEntityRecords, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.grvwGrid, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.SuspendLayout()
+ '
+ 'cmbConstructorForms
+ '
+ Me.cmbConstructorForms.FormattingEnabled = True
+ Me.cmbConstructorForms.Location = New System.Drawing.Point(170, 14)
+ Me.cmbConstructorForms.Name = "cmbConstructorForms"
+ Me.cmbConstructorForms.Size = New System.Drawing.Size(174, 21)
+ Me.cmbConstructorForms.TabIndex = 0
+ '
+ 'Label1
+ '
+ Me.Label1.AutoSize = True
+ Me.Label1.Font = New System.Drawing.Font("Segoe UI", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label1.Location = New System.Drawing.Point(9, 17)
+ Me.Label1.Name = "Label1"
+ Me.Label1.Size = New System.Drawing.Size(142, 13)
+ Me.Label1.TabIndex = 1
+ Me.Label1.Text = "1. Konstruktor auswählen:"
+ '
+ 'tvEntities
+ '
+ Me.tvEntities.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
+ Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
+ Me.tvEntities.Location = New System.Drawing.Point(12, 58)
+ Me.tvEntities.Name = "tvEntities"
+ Me.tvEntities.Size = New System.Drawing.Size(332, 491)
+ Me.tvEntities.TabIndex = 2
+ '
+ 'Label2
+ '
+ Me.Label2.AutoSize = True
+ Me.Label2.Font = New System.Drawing.Font("Segoe UI", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label2.Location = New System.Drawing.Point(9, 42)
+ Me.Label2.Name = "Label2"
+ Me.Label2.Size = New System.Drawing.Size(115, 13)
+ Me.Label2.TabIndex = 3
+ Me.Label2.Text = "2. Entität auswählen:"
+ '
+ 'dgEntityRecords
+ '
+ Me.dgEntityRecords.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
+ Or System.Windows.Forms.AnchorStyles.Left) _
+ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
+ Me.dgEntityRecords.Location = New System.Drawing.Point(350, 58)
+ Me.dgEntityRecords.MainView = Me.grvwGrid
+ Me.dgEntityRecords.Name = "dgEntityRecords"
+ Me.dgEntityRecords.Size = New System.Drawing.Size(896, 491)
+ Me.dgEntityRecords.TabIndex = 4
+ Me.dgEntityRecords.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.grvwGrid})
+ '
+ 'grvwGrid
+ '
+ Me.grvwGrid.Appearance.EvenRow.BackColor = System.Drawing.Color.Aqua
+ Me.grvwGrid.Appearance.EvenRow.Options.UseBackColor = True
+ Me.grvwGrid.Appearance.FilterPanel.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer), CType(CType(0, Byte), Integer))
+ Me.grvwGrid.Appearance.FilterPanel.Options.UseBackColor = True
+ Me.grvwGrid.GridControl = Me.dgEntityRecords
+ Me.grvwGrid.Name = "grvwGrid"
+ Me.grvwGrid.OptionsBehavior.Editable = False
+ Me.grvwGrid.OptionsBehavior.ReadOnly = True
+ Me.grvwGrid.OptionsView.EnableAppearanceEvenRow = True
+ '
+ 'btnLink
+ '
+ Me.btnLink.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
+ Me.btnLink.Font = New System.Drawing.Font("Segoe UI", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnLink.Location = New System.Drawing.Point(1057, 12)
+ Me.btnLink.Name = "btnLink"
+ Me.btnLink.Size = New System.Drawing.Size(189, 23)
+ Me.btnLink.TabIndex = 5
+ Me.btnLink.Text = "Verknüpfen"
+ Me.btnLink.UseVisualStyleBackColor = True
+ '
+ 'Label3
+ '
+ Me.Label3.AutoSize = True
+ Me.Label3.Font = New System.Drawing.Font("Segoe UI", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label3.Location = New System.Drawing.Point(347, 17)
+ Me.Label3.Name = "Label3"
+ Me.Label3.Size = New System.Drawing.Size(37, 13)
+ Me.Label3.TabIndex = 6
+ Me.Label3.Text = "Datei:"
+ '
+ 'Label4
+ '
+ Me.Label4.AutoSize = True
+ Me.Label4.Font = New System.Drawing.Font("Segoe UI", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label4.Location = New System.Drawing.Point(821, 17)
+ Me.Label4.Name = "Label4"
+ Me.Label4.Size = New System.Drawing.Size(135, 13)
+ Me.Label4.TabIndex = 7
+ Me.Label4.Text = "Ausgewählter Datensatz:"
+ '
+ 'txtFilename
+ '
+ Me.txtFilename.Location = New System.Drawing.Point(390, 14)
+ Me.txtFilename.Name = "txtFilename"
+ Me.txtFilename.ReadOnly = True
+ Me.txtFilename.Size = New System.Drawing.Size(425, 22)
+ Me.txtFilename.TabIndex = 8
+ '
+ 'txtRecordId
+ '
+ Me.txtRecordId.Location = New System.Drawing.Point(962, 14)
+ Me.txtRecordId.Name = "txtRecordId"
+ Me.txtRecordId.ReadOnly = True
+ Me.txtRecordId.Size = New System.Drawing.Size(89, 22)
+ Me.txtRecordId.TabIndex = 9
+ '
+ 'Label5
+ '
+ Me.Label5.AutoSize = True
+ Me.Label5.Font = New System.Drawing.Font("Segoe UI", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label5.Location = New System.Drawing.Point(347, 42)
+ Me.Label5.Name = "Label5"
+ Me.Label5.Size = New System.Drawing.Size(132, 13)
+ Me.Label5.TabIndex = 3
+ Me.Label5.Text = "3. Datensatz auswählen:"
+ '
+ 'frmWD_Link_to_Record
+ '
+ Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.ClientSize = New System.Drawing.Size(1258, 561)
+ Me.Controls.Add(Me.txtRecordId)
+ Me.Controls.Add(Me.txtFilename)
+ Me.Controls.Add(Me.Label4)
+ Me.Controls.Add(Me.Label3)
+ Me.Controls.Add(Me.btnLink)
+ Me.Controls.Add(Me.dgEntityRecords)
+ Me.Controls.Add(Me.Label5)
+ Me.Controls.Add(Me.Label2)
+ Me.Controls.Add(Me.tvEntities)
+ Me.Controls.Add(Me.Label1)
+ Me.Controls.Add(Me.cmbConstructorForms)
+ Me.Font = New System.Drawing.Font("Segoe UI", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Name = "frmWD_Link_to_Record"
+ Me.Text = "Datei mit Datensatz verknüpfen"
+ CType(Me.dgEntityRecords, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.grvwGrid, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.ResumeLayout(False)
+ Me.PerformLayout()
+
+ End Sub
+ Friend WithEvents cmbConstructorForms As System.Windows.Forms.ComboBox
+ Friend WithEvents Label1 As System.Windows.Forms.Label
+ Friend WithEvents tvEntities As System.Windows.Forms.TreeView
+ Friend WithEvents Label2 As System.Windows.Forms.Label
+ Friend WithEvents dgEntityRecords As DevExpress.XtraGrid.GridControl
+ Friend WithEvents grvwGrid As DevExpress.XtraGrid.Views.Grid.GridView
+ Friend WithEvents btnLink As System.Windows.Forms.Button
+ Friend WithEvents Label3 As System.Windows.Forms.Label
+ Friend WithEvents Label4 As System.Windows.Forms.Label
+ Friend WithEvents txtFilename As System.Windows.Forms.TextBox
+ Friend WithEvents txtRecordId As System.Windows.Forms.TextBox
+ Friend WithEvents Label5 As System.Windows.Forms.Label
+End Class
diff --git a/app/DD-Record-Organiser/frmWD_Link_to_Record.resx b/app/DD-Record-Organiser/frmWD_Link_to_Record.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/app/DD-Record-Organiser/frmWD_Link_to_Record.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/app/DD-Record-Organiser/frmWD_Link_to_Record.vb b/app/DD-Record-Organiser/frmWD_Link_to_Record.vb
new file mode 100644
index 0000000..8263c2a
--- /dev/null
+++ b/app/DD-Record-Organiser/frmWD_Link_to_Record.vb
@@ -0,0 +1,246 @@
+Imports System.Text
+Imports System.IO
+
+Public Class frmWD_Link_to_Record
+
+ Private Class ClassConstructor
+ Public title As String
+ Public id As Integer
+
+ Public Overrides Function ToString() As String
+ Return Me.title
+ End Function
+ End Class
+
+ Private CONSTRUCTOR_DETAIL_ID, CONSTRUCTOR_ID, FORM_ID As Integer
+
+ Public Sub New(fileName As String)
+ InitializeComponent()
+ txtFilename.Text = fileName
+ End Sub
+
+ Private Function GetConstructorForms() As DataTable
+ Try
+ Dim SQL As String = String.Format("SELECT GUID, dbo.FNPMO_GETOBJECTCAPTION('{0}', 'CONSTR_MENUE' + CONVERT(VARCHAR(5), GUID), {1}) AS FORM_TITLE, SEQUENCE_MENU, ADDED_WHO, ADDED_WHEN, CHANGED_WHO," & _
+ "CHANGED_WHEN, MENU_IMG, SHORT_TITLE, LANGUAGE, " & _
+ "'CONSTR_MENUE' + CONVERT(VARCHAR(5), GUID) as OBECTNAME FROM TBPMO_FORM_CONSTRUCTOR where GUID in (SELECT CONSTRUCT_ID FROM TBPMO_CONSTRUCTOR_USER WHERE HOME_MENUE = 1 AND USER_ID = {2}) ORDER BY SEQUENCE_MENU", USER_LANGUAGE, CURRENT_SCREEN_ID, USER_GUID)
+ Dim dt As DataTable = ClassDatabase.Return_Datatable(SQL)
+ Return dt
+ Catch ex As Exception
+ MsgBox("Constructor Forms could not be loaded in LinkToRecord: " & vbNewLine & ex.Message)
+ Return Nothing
+ End Try
+ End Function
+
+ Private Sub frmWD_Link_to_Record_Load(sender As Object, e As EventArgs) Handles MyBase.Load
+ Dim constructorForms As DataTable = GetConstructorForms()
+ Dim selected As Integer = 0
+
+ If constructorForms.Rows.Count = 0 Then
+ Exit Sub
+ End If
+
+ For Each row As DataRow In constructorForms.Rows
+ Dim constructor As New ClassConstructor
+ constructor.title = row.Item("FORM_TITLE")
+ constructor.id = row.Item("GUID")
+ cmbConstructorForms.Items.Add(constructor)
+
+ ' Von der aktuell geöffneten ConstructorForm den Index in Combobox speichern
+ If constructor.id = CURRENT_CONSTRUCTOR_ID Then
+ selected = cmbConstructorForms.Items.Count - 1
+ End If
+ Next
+
+ ' Den index der aktuell geöffneten ConstructorForm setzen
+ cmbConstructorForms.SelectedIndex = selected
+ End Sub
+
+ Sub Load_TreeViewEbene(constructorId As Integer)
+ Try
+ Dim sel_sql = String.Format("SELECT *, [dbo].[FNPMO_GETOBJECTCAPTION]('{0}','FORMVIEW_TITLE' + CONVERT(VARCHAR(5), FORM_VIEW_ID), {1}) AS 'CAPTION' " & _
+ "from VWPMO_CONSTRUCTOR_FORMS WHERE FORM_TYPE_ID IN (1,4) AND PARENT_ID = 0 AND CONSTRUCT_ID = {2} AND SCREEN_ID = {3} ORDER BY SEQUENCE", USER_LANGUAGE, CURRENT_SCREEN_ID, constructorId, CURRENT_SCREEN_ID)
+
+ Dim DT As DataTable = ClassDatabase.Return_Datatable(sel_sql)
+ If DT.Rows.Count >= 1 Then
+ tvEntities.Nodes.Clear()
+ For Each rowEbene0 As DataRow In DT.Rows
+ Dim Node As TreeNode
+ Node = tvEntities.Nodes.Add("E1: " & rowEbene0.Item("CAPTION").ToString)
+ Node.Tag = rowEbene0.Item("GUID")
+ 'Jetzt die Ebene1Knoten einhängen
+ sel_sql = String.Format("SELECT *, [dbo].[FNPMO_GETOBJECTCAPTION]('{0}','FORMVIEW_TITLE' + CONVERT(VARCHAR(5), FORM_VIEW_ID), {1}) AS 'CAPTION' " & _
+ "from VWPMO_CONSTRUCTOR_FORMS WHERE FORM_TYPE_ID in (2,5) AND PARENT_ID = {2} AND CONSTRUCT_ID = {3} AND SCREEN_ID = {4} ORDER BY SEQUENCE", USER_LANGUAGE, CURRENT_SCREEN_ID, rowEbene0.Item("FORM_ID"), constructorId, CURRENT_SCREEN_ID)
+
+ Dim dtEbene1 As DataTable = ClassDatabase.Return_Datatable(sel_sql)
+ If dtEbene1.Rows.Count > 0 Then
+ For Each rowEbene1 As DataRow In dtEbene1.Rows
+ Dim Node1 As TreeNode
+ Node1 = Node.Nodes.Add("E2: " & rowEbene1.Item("CAPTION").ToString)
+ Node1.Tag = rowEbene1.Item("GUID")
+ 'Jetzt die Ebene2 Knoten einhängen
+ sel_sql = String.Format("SELECT *, [dbo].[FNPMO_GETOBJECTCAPTION]('{0}','FORMVIEW_TITLE' + CONVERT(VARCHAR(5), FORM_VIEW_ID), {1}) AS 'CAPTION' " & _
+ "from VWPMO_CONSTRUCTOR_FORMS WHERE FORM_TYPE_ID in (3,5) AND PARENT_ID = {2} AND CONSTRUCT_ID = {3} AND SCREEN_ID = {4} ORDER BY SEQUENCE", USER_LANGUAGE, CURRENT_SCREEN_ID, rowEbene1.Item("FORM_ID"), constructorId, CURRENT_SCREEN_ID)
+
+ Dim dtEbene2 As DataTable = ClassDatabase.Return_Datatable(sel_sql)
+ If dtEbene2.Rows.Count > 0 Then
+ For Each rowEbene2 As DataRow In dtEbene2.Rows
+ Dim Node2 As TreeNode
+ Node2 = Node1.Nodes.Add("E3: " & rowEbene2.Item("CAPTION").ToString)
+ Node2.Tag = rowEbene2.Item("GUID")
+ Next
+ End If
+
+ Next
+
+ End If
+ Next
+ tvEntities.ExpandAll()
+ tvEntities.Nodes(0).EnsureVisible()
+ Else
+ MsgBox("Achtung Konfigurationsfehler: Mehrere oder keine Level 0 Entität gefunden!" & "Korrigieren Sie bitte Ihre Eingaben", MsgBoxStyle.Exclamation)
+ End If
+ Catch ex As Exception
+ MsgBox("Error in Load_TreeViewEbene in LinkToRecord:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
+ End Try
+
+ End Sub
+
+ Public Function Get_Grid_Sql(ConstructorId As Integer, FormId As Integer, ConstructorDetailID As Integer) As String
+ Try
+ Dim ResultSQL, ResultViewName As String
+ Dim RecordId As Integer
+
+ If LogErrorsOnly = False Then ClassLogger.Add(" >> GridType = Grid", False)
+ ResultViewName = "VWTEMP_PMO_FORM" & FormId.ToString
+ ResultSQL = "SELECT T.* FROM " & ResultViewName & " T"
+
+ Try
+ Dim sql = String.Format("SELECT COUNT(*) FROM TBPMO_CONSTRUCTOR_USER_SQL WHERE USER_ID = {0} AND CONSTR_DET_ID = {1} AND SQL_COMMAND IS NOT NULL AND SQL_COMMAND <> ''", USER_GUID, ConstructorDetailID)
+ Dim exists = ClassDatabase.Execute_Scalar(sql)
+ If exists = 1 Then
+ sql = String.Format("SELECT SQL_COMMAND FROM TBPMO_CONSTRUCTOR_USER_SQL WHERE USER_ID = {0} AND CONSTR_DET_ID = {1}", USER_GUID, ConstructorDetailID)
+ Dim result = ClassDatabase.Execute_Scalar(sql)
+ If Not IsNothing(result) Then
+ ResultSQL = ResultSQL & " " & result.ToString
+ 'ResultSQL = ResultSQL.ToUpper.Replace("@RECORDID", RECORD_ID)
+ ResultSQL = ResultSQL.ToUpper.Replace("@USER_ID", USER_GUID)
+ End If
+ End If
+
+ Return ResultSQL
+ Catch ex As Exception
+ ClassLogger.Add("Error in Get_Grid_Sql in LinkToRecord: " & vbNewLine & ex.Message, True)
+ MsgBox("Error in Get_Grid_Sql in LinkToRecord: " & vbNewLine & ex.Message)
+ End Try
+ Catch ex As Exception
+ ClassLogger.Add("Error in Get_Grid_Sql: " & vbNewLine & ex.Message, True)
+ MsgBox("Error in Get_Grid_Sql: " & vbNewLine & ex.Message)
+ End Try
+ End Function
+
+ Public foundNode As TreeNode = Nothing
+ Private Sub cmbConstructorForms_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbConstructorForms.SelectedIndexChanged
+ Dim constructor As ClassConstructor = DirectCast(cmbConstructorForms.SelectedItem, ClassConstructor)
+
+ If cmbConstructorForms.SelectedIndex <> -1 Then
+ CONSTRUCTOR_ID = constructor.id
+ ' Entitäten laden
+ Load_TreeViewEbene(constructor.id)
+
+ foundNode = Nothing
+ SelectNodeRecursive(tvEntities, tvEntities.Nodes, CURRENT_CONSTRUCTOR_DETAIL_ID)
+
+ If IsNothing(foundNode) Then
+ ' Erste Entität selektieren
+ tvEntities.SelectedNode = tvEntities.Nodes.Item(0)
+ Else
+ ' Aktuelle Entität selektieren
+ tvEntities.SelectedNode = foundNode
+ End If
+ End If
+ End Sub
+
+ Public Sub SelectNodeRecursive(treeview As TreeView, nodes As TreeNodeCollection, constructorDetailId As Integer)
+ For Each node As TreeNode In nodes
+ Dim id As Integer = node.Tag
+ If id = constructorDetailId Then
+ foundNode = node
+ Exit Sub
+ Else
+ SelectNodeRecursive(treeview, node.Nodes, constructorDetailId)
+ End If
+ Next
+ End Sub
+
+ Private Sub tvEntities_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles tvEntities.AfterSelect
+ CONSTRUCTOR_DETAIL_ID = Integer.Parse(e.Node.Tag)
+ Dim dt As DataTable
+
+ Try
+ Dim SQL As String = String.Format("SELECT FORM_ID FROM VWPMO_CONSTRUCTOR_FORMS WHERE GUID = {0} AND CONSTRUCT_ID = {1}", CONSTRUCTOR_DETAIL_ID, CONSTRUCTOR_ID)
+ FORM_ID = ClassDatabase.Execute_Scalar(SQL)
+
+
+ SQL = Get_Grid_Sql(CONSTRUCTOR_ID, FORM_ID, CONSTRUCTOR_DETAIL_ID)
+ dt = ClassDatabase.Return_Datatable(SQL)
+
+ ' Datasource neu setzen und columns laden
+ dgEntityRecords.DataSource = dt
+ grvwGrid.PopulateColumns()
+ dgEntityRecords.RefreshDataSource()
+
+ Dim constructor = DirectCast(cmbConstructorForms.Items.Item(cmbConstructorForms.SelectedIndex), ClassConstructor)
+ Dim constructorName As String = constructor.title
+
+ Load_Grid_Layout(constructorName)
+
+ Catch ex As Exception
+ MsgBox("Entität " + CONSTRUCTOR_DETAIL_ID + " konnte nicht geladen werden: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
+ Exit Sub
+ End Try
+ End Sub
+
+ Function GetSafeFilename(filename As String)
+ Return String.Join("_", filename.Split(Path.GetInvalidFileNameChars()))
+ End Function
+
+ Private Function Get_Grid_Layout_Filename(EntityName As String)
+ Dim Filename As String = String.Format("{0}-{1}-{2}-UserLayout.xml", grvwGrid.Name, GetSafeFilename(EntityName), CONSTRUCTOR_ID)
+ Return System.IO.Path.Combine(Application.UserAppDataPath(), Filename)
+ End Function
+
+ Sub Load_Grid_Layout(constructorName As String)
+ Try
+ Dim XMLPath = Get_Grid_Layout_Filename(constructorName)
+ If File.Exists(XMLPath) Then
+ grvwGrid.RestoreLayoutFromXml(XMLPath)
+ grvwGrid.GuessAutoFilterRowValuesFromFilter()
+ End If
+ Catch ex As Exception
+ MsgBox("Error in Load_Grid_Layout: " & vbNewLine & ex.Message)
+ End Try
+ End Sub
+
+ Private Sub GridView1_FocusedRowChanged(sender As Object, e As DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs) Handles grvwGrid.FocusedRowChanged
+ Dim RecordId As Integer = grvwGrid.GetFocusedRowCellValue(grvwGrid.Columns(0))
+ txtRecordId.Text = RecordId
+ End Sub
+
+ Private Sub btnLink_Click(sender As Object, e As EventArgs) Handles btnLink.Click
+ Dim RecordId As Integer
+ Dim FileName As String
+
+ If txtRecordId.Text.Trim.Count > 0 Then
+ RecordId = Integer.Parse(txtRecordId.Text)
+ FileName = txtFilename.Text
+
+ Else
+ MsgBox("Bitte wählen Sie einen Datensatz aus!", MsgBoxStyle.Exclamation, "Kein Datensatz ausgewählt")
+ Exit Sub
+ End If
+
+ 'TODO: Datei mit Record verknüpfen
+
+ End Sub
+End Class
\ No newline at end of file