From 7750fdf6a5679c01a530ec9316b1997ab8ddba24 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Thu, 29 Oct 2020 16:05:10 +0100 Subject: [PATCH] ZooFlow: PropertyDialog, ContextMenu, Async Queries in Database --- GUIs.Common/Common.vbproj | 6 ++ .../DocumentPropertyMenu.vb | 69 +++++++++++++ .../frmDocumentResultList.Designer.vb | 34 ++++--- .../frmDocumentResultList.resx | 84 ++++++++++++---- .../frmDocumentResultList.vb | 34 +++++++ GUIs.Common/My Project/licenses.licx | 1 + .../ObjectPropertyDialog/PropertyControls.vb | 68 +++++++++++++ .../frmObjectPropertyDialog.Designer.vb | 90 +++++++---------- .../frmObjectPropertyDialog.vb | 98 ++++++++++++++++++- GUIs.ZooFlow/ClassControlCreator.vb | 2 +- GUIs.ZooFlow/ClassInit.vb | 4 +- GUIs.ZooFlow/MyApplication.vb | 2 +- GUIs.ZooFlow/frmFlowForm.vb | 11 +-- GUIs.ZooFlow/frmSearchStart.vb | 20 ++-- Modules.Database/MSSQLServer.vb | 12 +++ Modules.ZooFlow/Environment.vb | 1 + Modules.ZooFlow/Params/Attribute.vb | 6 ++ Modules.ZooFlow/ZooFlow.vbproj | 1 + 18 files changed, 431 insertions(+), 112 deletions(-) create mode 100644 GUIs.Common/DocumentPropertyMenu/DocumentPropertyMenu.vb create mode 100644 GUIs.Common/ObjectPropertyDialog/PropertyControls.vb create mode 100644 Modules.ZooFlow/Params/Attribute.vb diff --git a/GUIs.Common/Common.vbproj b/GUIs.Common/Common.vbproj index ed8a5a15..a92abdc9 100644 --- a/GUIs.Common/Common.vbproj +++ b/GUIs.Common/Common.vbproj @@ -104,6 +104,7 @@ Form + @@ -134,6 +135,7 @@ Form + @@ -165,6 +167,10 @@ + + {3DCD6D1A-C830-4241-B7E4-27430E7EA483} + LookupControl + {44982f9b-6116-44e2-85d0-f39650b1ef99} Config diff --git a/GUIs.Common/DocumentPropertyMenu/DocumentPropertyMenu.vb b/GUIs.Common/DocumentPropertyMenu/DocumentPropertyMenu.vb new file mode 100644 index 00000000..12faa925 --- /dev/null +++ b/GUIs.Common/DocumentPropertyMenu/DocumentPropertyMenu.vb @@ -0,0 +1,69 @@ +Imports System.Windows.Forms +Imports DevExpress.Utils.Menu +Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.ZooFlow + +Public Class DocumentPropertyMenu + Private ReadOnly _Logger As Logger + Private ReadOnly _LogConfig As LogConfig + Private ReadOnly _Environment As Environment + + Private ReadOnly _FilePath As String + Private ReadOnly _ObjectId As Long + + Public Sub New(LogConfig As LogConfig, Environment As Environment, FilePath As String, Optional ObjectId As Long = 0) + _LogConfig = LogConfig + _Logger = LogConfig.GetLogger() + _Environment = Environment + _FilePath = FilePath + _ObjectId = ObjectId + End Sub + + Public Function GetMenuItems() As List(Of DXMenuItem) + Dim oOpenFile = New DXMenuItem("Datei öffnen", AddressOf OpenFile_Click) + Dim oOpenFolder = New DXMenuItem("Ordner öffnen", AddressOf OpenFolder_Click) + Dim oCopyPath = New DXMenuItem("Pfad kopieren", AddressOf CopyPath_Click) + Dim oProperties = New DXMenuItem("Eigenschaften", AddressOf Properties_Click) + + Return New List(Of DXMenuItem) From { + oOpenFile, + oOpenFolder, + oCopyPath, + oProperties + } + End Function + + Public Sub Properties_Click(sender As Object, e As EventArgs) + If _ObjectId = 0 Then + Exit Sub + End If + + Dim oPropertyDialog As New frmObjectPropertyDialog(_LogConfig, _Environment, _ObjectId) + oPropertyDialog.Show() + End Sub + + Public Sub CopyPath_Click(sender As Object, e As EventArgs) + If IO.File.Exists(_FilePath) Then + Clipboard.SetText(_FilePath) + Else + MessageBox.Show($"Datei {_FilePath} existiert nicht oder wurde verschoben!", "Dateipfad kopieren", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) + End If + End Sub + + Public Sub OpenFile_Click(sender As Object, e As EventArgs) + If IO.File.Exists(_FilePath) Then + Process.Start(_FilePath) + Else + MessageBox.Show($"Datei {_FilePath} existiert nicht oder wurde verschoben!", "Datei öffnen", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) + End If + End Sub + + Public Sub OpenFolder_Click(sender As Object, e As EventArgs) + If IO.File.Exists(_FilePath) Then + Dim oDirectory = IO.Path.GetDirectoryName(_FilePath) + Process.Start(oDirectory) + Else + MessageBox.Show($"Datei {_FilePath} existiert nicht oder wurde verschoben!", "Ordner öffnen", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) + End If + End Sub +End Class diff --git a/GUIs.Common/DocumentResultList/frmDocumentResultList.Designer.vb b/GUIs.Common/DocumentResultList/frmDocumentResultList.Designer.vb index 49cd6bf5..e88466a3 100644 --- a/GUIs.Common/DocumentResultList/frmDocumentResultList.Designer.vb +++ b/GUIs.Common/DocumentResultList/frmDocumentResultList.Designer.vb @@ -31,6 +31,7 @@ Partial Class frmDocumentResultList Me.BarStaticItem1 = New DevExpress.XtraBars.BarStaticItem() Me.labelResultCount = New DevExpress.XtraBars.BarStaticItem() Me.BarButtonItem4 = New DevExpress.XtraBars.BarButtonItem() + Me.BarButtonItem5 = New DevExpress.XtraBars.BarButtonItem() Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() Me.RibbonPageGroup4 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroup3 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() @@ -43,6 +44,7 @@ Partial Class frmDocumentResultList Me.DateiÖffnenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.OrdnerÖffnenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.PfadInZwischenablageKopierenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.EigenschaftenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.GridView1 = New DevExpress.XtraGrid.Views.BandedGrid.BandedGridView() Me.GridBand1 = New DevExpress.XtraGrid.Views.BandedGrid.GridBand() Me.SplitContainerControl2 = New DevExpress.XtraEditors.SplitContainerControl() @@ -55,7 +57,6 @@ Partial Class frmDocumentResultList Me.SplitContainerControl3 = New DevExpress.XtraEditors.SplitContainerControl() Me.DocumentViewer1 = New DigitalData.Controls.DocumentViewer.DocumentViewer() Me.XtraSaveFileDialog = New DevExpress.XtraEditors.XtraSaveFileDialog(Me.components) - Me.BarButtonItem5 = New DevExpress.XtraBars.BarButtonItem() CType(Me.RibbonControl, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SplitContainerControl1.SuspendLayout() @@ -75,7 +76,7 @@ Partial Class frmDocumentResultList 'RibbonControl ' Me.RibbonControl.ExpandCollapseItem.Id = 0 - Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.SwitchMainContainerHorizontal, Me.SwitchDetailContainerHorizontal, Me.BarButtonItemExportGrid1, Me.BarButtonItem1, Me.BarButtonItem2, Me.BarButtonItem3, Me.BarStaticItem1, Me.labelResultCount, Me.BarButtonItem4, Me.RibbonControl.SearchEditItem, Me.BarButtonItem5}) + Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.RibbonControl.SearchEditItem, Me.SwitchMainContainerHorizontal, Me.SwitchDetailContainerHorizontal, Me.BarButtonItemExportGrid1, Me.BarButtonItem1, Me.BarButtonItem2, Me.BarButtonItem3, Me.BarStaticItem1, Me.labelResultCount, Me.BarButtonItem4, Me.BarButtonItem5}) Me.RibbonControl.Location = New System.Drawing.Point(0, 0) Me.RibbonControl.MaxItemId = 11 Me.RibbonControl.Name = "RibbonControl" @@ -102,8 +103,7 @@ Partial Class frmDocumentResultList ' Me.BarButtonItemExportGrid1.Caption = "Als XLSX exportieren" Me.BarButtonItemExportGrid1.Id = 3 - Me.BarButtonItemExportGrid1.ImageOptions.Image = CType(resources.GetObject("BarButtonItemExportGrid1.ImageOptions.Image"), System.Drawing.Image) - Me.BarButtonItemExportGrid1.ImageOptions.LargeImage = CType(resources.GetObject("BarButtonItemExportGrid1.ImageOptions.LargeImage"), System.Drawing.Image) + Me.BarButtonItemExportGrid1.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItemExportGrid1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.BarButtonItemExportGrid1.Name = "BarButtonItemExportGrid1" ' 'BarButtonItem1 @@ -151,6 +151,13 @@ Partial Class frmDocumentResultList Me.BarButtonItem4.ImageOptions.LargeImage = CType(resources.GetObject("BarButtonItem4.ImageOptions.LargeImage"), System.Drawing.Image) Me.BarButtonItem4.Name = "BarButtonItem4" ' + 'BarButtonItem5 + ' + Me.BarButtonItem5.Caption = "Layout zurücksetzen" + Me.BarButtonItem5.Id = 10 + Me.BarButtonItem5.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem5.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) + Me.BarButtonItem5.Name = "BarButtonItem5" + ' 'RibbonPage1 ' Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup4, Me.RibbonPageGroup3, Me.RibbonPageGroup1, Me.RibbonPageGroup2}) @@ -211,7 +218,6 @@ Partial Class frmDocumentResultList ' 'GridControl1 ' - Me.GridControl1.ContextMenuStrip = Me.ContextMenuGrid Me.GridControl1.Dock = System.Windows.Forms.DockStyle.Fill Me.GridControl1.Location = New System.Drawing.Point(0, 0) Me.GridControl1.MainView = Me.GridView1 @@ -223,9 +229,9 @@ Partial Class frmDocumentResultList ' 'ContextMenuGrid ' - Me.ContextMenuGrid.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.DateiÖffnenToolStripMenuItem, Me.OrdnerÖffnenToolStripMenuItem, Me.PfadInZwischenablageKopierenToolStripMenuItem}) + Me.ContextMenuGrid.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.DateiÖffnenToolStripMenuItem, Me.OrdnerÖffnenToolStripMenuItem, Me.PfadInZwischenablageKopierenToolStripMenuItem, Me.EigenschaftenToolStripMenuItem}) Me.ContextMenuGrid.Name = "ContextMenuGrid" - Me.ContextMenuGrid.Size = New System.Drawing.Size(200, 70) + Me.ContextMenuGrid.Size = New System.Drawing.Size(200, 92) ' 'DateiÖffnenToolStripMenuItem ' @@ -248,6 +254,12 @@ Partial Class frmDocumentResultList Me.PfadInZwischenablageKopierenToolStripMenuItem.Size = New System.Drawing.Size(199, 22) Me.PfadInZwischenablageKopierenToolStripMenuItem.Text = "Pfad in Zwischenablage" ' + 'EigenschaftenToolStripMenuItem + ' + Me.EigenschaftenToolStripMenuItem.Name = "EigenschaftenToolStripMenuItem" + Me.EigenschaftenToolStripMenuItem.Size = New System.Drawing.Size(199, 22) + Me.EigenschaftenToolStripMenuItem.Text = "Eigenschaften" + ' 'GridView1 ' Me.GridView1.Bands.AddRange(New DevExpress.XtraGrid.Views.BandedGrid.GridBand() {Me.GridBand1}) @@ -372,13 +384,6 @@ Partial Class frmDocumentResultList ' Me.XtraSaveFileDialog.FileName = "XtraSaveFileDialog1" ' - 'BarButtonItem5 - ' - Me.BarButtonItem5.Caption = "Layout zurücksetzen" - Me.BarButtonItem5.Id = 10 - Me.BarButtonItem5.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem5.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) - Me.BarButtonItem5.Name = "BarButtonItem5" - ' 'frmDocumentResultList ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -447,4 +452,5 @@ Partial Class frmDocumentResultList Friend WithEvents BarButtonItem4 As DevExpress.XtraBars.BarButtonItem Friend WithEvents RibbonPageGroup4 As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents BarButtonItem5 As DevExpress.XtraBars.BarButtonItem + Friend WithEvents EigenschaftenToolStripMenuItem As Windows.Forms.ToolStripMenuItem End Class diff --git a/GUIs.Common/DocumentResultList/frmDocumentResultList.resx b/GUIs.Common/DocumentResultList/frmDocumentResultList.resx index 806fc342..74f243d4 100644 --- a/GUIs.Common/DocumentResultList/frmDocumentResultList.resx +++ b/GUIs.Common/DocumentResultList/frmDocumentResultList.resx @@ -117,28 +117,73 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAfdEVYdFRpdGxlAEV4cG9ydDtYc2x0O0V4cG9ydFRv - WHNsdDsT1nubAAAAd0lEQVQ4T91S2wmAMAzs1E6QHRzBHVzBTweKXMpJDBUN8cuDI6/LtZQ2VTWKiGbI - vYvBW/zVAJ0kusG0zFqhGQCjCK77ZjUw0pwGFPphzFl7rRmwgUgRF+Is1o83INkDvPb2DQCf80TARzOo - sP4PmHzylTPse9oOhn1G54TA0vAAAAAASUVORK5CYII= - - - + + - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m - dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAAfdEVYdFRpdGxlAEV4cG9ydDtYc2x0O0V4cG9ydFRv - WHNsdDsT1nubAAABNUlEQVRYR+WQPQ7CMAyFOV+PwgE4QdcOiIGpMxNiZGJAYuIOnZA4BAzhPYRRcJ02 - paH8PemTa9dpPhg5596KORwSczgk5nBIzCHJ89x15AAywLM1rDuIOSQ4hBIf7hdFcS7LMkOrv/XQ+5jD - G51CgaqqTIlWgcli7vrAyD9mSVAAezX4LrkAoyWiBBirkuV+e+2Z0K4vwNwkTpSIFpCLpGfVz9LrXS3A - iATeZdhrFpAPsrJnWK131i4FGjhir1mAkQ9Lz+ojM0bvNoUS2GsX0JXxn/1fbO2GEiXQh7Z8hYD1Mlla - BWbjVQ0eShnrDozTCaymO15yhZFnHzXfoE0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LTAuMmMtMC4yLDAt + MC4zLTAuMS0wLjUtMC4xcy0wLjMsMC0wLjUsMCAgIGMtMC4yLDAtMC40LDAtMC41LDAuMWMtMC4yLDAt + MC4zLDAuMS0wLjQsMC4yYy0wLjEsMC4xLTAuMiwwLjEtMC4zLDAuMmMtMC4xLDAuMS0wLjEsMC4yLTAu + MSwwLjNjMCwwLjEsMCwwLjIsMC4xLDAuMyAgIGMwLjEsMC4xLDAuMiwwLjIsMC4zLDAuM2MwLjEsMC4x + LDAuMywwLjIsMC41LDAuM3MwLjQsMC4yLDAuNiwwLjNjMC4zLDAuMSwwLjYsMC4zLDAuOCwwLjRjMC4y + LDAuMSwwLjUsMC4zLDAuNiwwLjUgICBjMC4yLDAuMiwwLjMsMC40LDAuNCwwLjZzMC4xLDAuNSwwLjEs + MC44QzIyLjYsMTYuMywyMi41LDE2LjYsMjIuNCwxNi45eiBNMjguMSwxOGwtMS4zLTIuNWMtMC4xLTAu + MS0wLjEtMC4zLTAuMi0wLjVoMCAgIGMwLDAuMS0wLjEsMC4zLTAuMiwwLjVMMjUuMSwxOEgyM2wyLjUt + My45bC0yLjItMy45aDIuMWwxLjEsMi4zYzAuMSwwLjIsMC4yLDAuNCwwLjIsMC43aDBjMC0wLjIsMC4x + LTAuNCwwLjItMC43bDEuMi0yLjNoMS45ICAgbC0yLjMsMy44bDIuNCwzLjlIMjguMXoiIGNsYXNzPSJC + bHVlIiAvPg0KICA8L2c+DQo8L3N2Zz4L + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m @@ -228,7 +273,6 @@ 9R2NAy0xdbc3UVqAub8fp91RTf0DZ0rWioS6adsAAAAASUVORK5CYII= - AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z diff --git a/GUIs.Common/DocumentResultList/frmDocumentResultList.vb b/GUIs.Common/DocumentResultList/frmDocumentResultList.vb index 941e3e90..159ceebd 100644 --- a/GUIs.Common/DocumentResultList/frmDocumentResultList.vb +++ b/GUIs.Common/DocumentResultList/frmDocumentResultList.vb @@ -463,6 +463,20 @@ Public Class frmDocumentResultList End Try End Sub + Private Sub OpenProperties() + Try + Dim oRow = GetActiveRow() + + If oRow IsNot Nothing Then + Dim oObjectId = oRow.Item(COLUMN_DOCID) + Dim oPropertyDialog As New frmObjectPropertyDialog(_LogConfig, _Environment, oObjectId) + oPropertyDialog.Show() + End If + Catch ex As Exception + _Logger.Error(ex) + End Try + End Sub + Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick OpenFile() End Sub @@ -479,6 +493,10 @@ Public Class frmDocumentResultList OpenFile() End Sub + Private Sub EigenschaftenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EigenschaftenToolStripMenuItem.Click + OpenProperties() + End Sub + Private Sub OrdnerÖffnenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles OrdnerÖffnenToolStripMenuItem.Click OpenFolderPath() End Sub @@ -523,5 +541,21 @@ Public Class frmDocumentResultList OpenFile() End Sub + Private Sub GridView_PopupMenuShowing(sender As Object, e As PopupMenuShowingEventArgs) Handles GridView1.PopupMenuShowing, GridView2.PopupMenuShowing, GridView3.PopupMenuShowing + Dim oView As GridView = sender + + If e.MenuType = DevExpress.XtraGrid.Views.Grid.GridMenuType.Row Then + Dim oRowHandle = e.HitInfo.RowHandle + Dim oRow As DataRow = oView.GetDataRow(oRowHandle) + Dim oFilepath As String = oRow.Item(COLUMN_FILEPATH) + Dim oObjectId As Long = oRow.Item(COLUMN_DOCID) + Dim oMenu As New DocumentPropertyMenu(_LogConfig, _Environment, oFilepath, oObjectId) + e.Menu.Items.Clear() + + For Each oItem In oMenu.GetMenuItems() + e.Menu.Items.Add(oItem) + Next + End If + End Sub End Class \ No newline at end of file diff --git a/GUIs.Common/My Project/licenses.licx b/GUIs.Common/My Project/licenses.licx index bb9752e0..1b8e60c5 100644 --- a/GUIs.Common/My Project/licenses.licx +++ b/GUIs.Common/My Project/licenses.licx @@ -1,3 +1,4 @@ DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a +DevExpress.XtraEditors.Repository.RepositoryItemComboBox, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a diff --git a/GUIs.Common/ObjectPropertyDialog/PropertyControls.vb b/GUIs.Common/ObjectPropertyDialog/PropertyControls.vb new file mode 100644 index 00000000..a4730082 --- /dev/null +++ b/GUIs.Common/ObjectPropertyDialog/PropertyControls.vb @@ -0,0 +1,68 @@ +Imports DevExpress.XtraEditors +Imports DevExpress.XtraLayout +Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.ZooFlow +Imports DigitalData.Modules.Database +Imports DigitalData.Controls.LookupGrid + +Public Class PropertyControls + Private _LogConfig As LogConfig + Private _Logger As Logger + Private _Db As MSSQLServer + + Public Sub New(LogConfig As LogConfig, Database As MSSQLServer) + _LogConfig = LogConfig + _Logger = LogConfig.GetLogger() + _Db = Database + End Sub + + Public Function GetControlForAttribute(Attribute As Attribute) As BaseEdit + Select Case Attribute.TypeName + Case "BIT" + Dim oCheckboxEdit As New CheckEdit With { + .Name = Attribute.ID, + .Text = Attribute.Title + } + Return oCheckboxEdit + + Case "DATE" + Dim oDateEdit As New DateEdit With { + .Name = Attribute.ID + } + Return oDateEdit + + Case "BIG INTEGER" + Dim oTextEdit As New TextEdit With { + .Name = Attribute.ID + } + Return oTextEdit + + Case "DECIMAL" + Dim oTextEdit As New TextEdit With { + .Name = Attribute.ID + } + Return oTextEdit + + Case "FLOAT" + Dim oTextEdit As New TextEdit With { + .Name = Attribute.ID + } + Return oTextEdit + + Case "VECTOR STRING" + Dim oLookupEdit As New LookupControl2 With { + .Name = Attribute.ID, + .MultiSelect = True, + .[ReadOnly] = True + } + Return oLookupEdit + + Case Else + Dim oTextEdit As New TextEdit With { + .Name = Attribute.ID + } + Return oTextEdit + + End Select + End Function +End Class diff --git a/GUIs.Common/ObjectPropertyDialog/frmObjectPropertyDialog.Designer.vb b/GUIs.Common/ObjectPropertyDialog/frmObjectPropertyDialog.Designer.vb index 1ac37e99..36de67cf 100644 --- a/GUIs.Common/ObjectPropertyDialog/frmObjectPropertyDialog.Designer.vb +++ b/GUIs.Common/ObjectPropertyDialog/frmObjectPropertyDialog.Designer.vb @@ -23,7 +23,9 @@ Partial Class frmObjectPropertyDialog _ Private Sub InitializeComponent() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmObjectPropertyDialog)) + Me.RepositoryItemComboBox1 = New DevExpress.XtraEditors.Repository.RepositoryItemComboBox() Me.TabFormControl1 = New DevExpress.XtraBars.TabFormControl() + Me.cmbBusinessEntity = New DevExpress.XtraBars.BarEditItem() Me.TabPageProperties = New DevExpress.XtraBars.TabFormPage() Me.TabFormContentContainer1 = New DevExpress.XtraBars.TabFormContentContainer() Me.LayoutControlProperties = New DevExpress.XtraLayout.LayoutControl() @@ -32,36 +34,50 @@ Partial Class frmObjectPropertyDialog Me.TabFormContentContainer2 = New DevExpress.XtraBars.TabFormContentContainer() Me.TabPageLifecycle = New DevExpress.XtraBars.TabFormPage() Me.TabFormContentContainer3 = New DevExpress.XtraBars.TabFormContentContainer() - Me.PanelControl1 = New DevExpress.XtraEditors.PanelControl() - Me.Button3 = New System.Windows.Forms.Button() - Me.Button2 = New System.Windows.Forms.Button() - Me.Button1 = New System.Windows.Forms.Button() + Me.BarStaticItem1 = New DevExpress.XtraBars.BarStaticItem() + CType(Me.RepositoryItemComboBox1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.TabFormControl1, System.ComponentModel.ISupportInitialize).BeginInit() Me.TabFormContentContainer1.SuspendLayout() CType(Me.LayoutControlProperties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.Root, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.PanelControl1, System.ComponentModel.ISupportInitialize).BeginInit() - Me.PanelControl1.SuspendLayout() Me.SuspendLayout() ' + 'RepositoryItemComboBox1 + ' + Me.RepositoryItemComboBox1.AutoHeight = False + Me.RepositoryItemComboBox1.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) + Me.RepositoryItemComboBox1.Name = "RepositoryItemComboBox1" + ' 'TabFormControl1 ' + Me.TabFormControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.cmbBusinessEntity, Me.BarStaticItem1}) Me.TabFormControl1.Location = New System.Drawing.Point(0, 0) Me.TabFormControl1.Name = "TabFormControl1" Me.TabFormControl1.Pages.Add(Me.TabPageProperties) Me.TabFormControl1.Pages.Add(Me.TabPageMetadata) Me.TabFormControl1.Pages.Add(Me.TabPageLifecycle) Me.TabFormControl1.SelectedPage = Me.TabPageProperties + Me.TabFormControl1.ShowAddPageButton = False + Me.TabFormControl1.ShowTabCloseButtons = False Me.TabFormControl1.Size = New System.Drawing.Size(572, 71) Me.TabFormControl1.TabForm = Me Me.TabFormControl1.TabIndex = 0 + Me.TabFormControl1.TabRightItemLinks.Add(Me.BarStaticItem1) + Me.TabFormControl1.TabRightItemLinks.Add(Me.cmbBusinessEntity) Me.TabFormControl1.TabStop = False ' + 'cmbBusinessEntity + ' + Me.cmbBusinessEntity.Caption = "cmbBusinessEntity" + Me.cmbBusinessEntity.Edit = Me.RepositoryItemComboBox1 + Me.cmbBusinessEntity.EditWidth = 100 + Me.cmbBusinessEntity.Id = 6 + Me.cmbBusinessEntity.Name = "cmbBusinessEntity" + ' 'TabPageProperties ' Me.TabPageProperties.ContentContainer = Me.TabFormContentContainer1 Me.TabPageProperties.Name = "TabPageProperties" - Me.TabPageProperties.ShowCloseButton = DevExpress.Utils.DefaultBoolean.[False] Me.TabPageProperties.Text = "Eigenschaften" ' 'TabFormContentContainer1 @@ -75,10 +91,11 @@ Partial Class frmObjectPropertyDialog ' 'LayoutControlProperties ' - Me.LayoutControlProperties.Location = New System.Drawing.Point(108, 80) + Me.LayoutControlProperties.Dock = System.Windows.Forms.DockStyle.Fill + Me.LayoutControlProperties.Location = New System.Drawing.Point(0, 0) Me.LayoutControlProperties.Name = "LayoutControlProperties" Me.LayoutControlProperties.Root = Me.Root - Me.LayoutControlProperties.Size = New System.Drawing.Size(180, 120) + Me.LayoutControlProperties.Size = New System.Drawing.Size(572, 534) Me.LayoutControlProperties.TabIndex = 0 Me.LayoutControlProperties.Text = "LayoutControl1" ' @@ -87,14 +104,13 @@ Partial Class frmObjectPropertyDialog Me.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True] Me.Root.GroupBordersVisible = False Me.Root.Name = "Root" - Me.Root.Size = New System.Drawing.Size(180, 120) + Me.Root.Size = New System.Drawing.Size(572, 534) Me.Root.TextVisible = False ' 'TabPageMetadata ' Me.TabPageMetadata.ContentContainer = Me.TabFormContentContainer2 Me.TabPageMetadata.Name = "TabPageMetadata" - Me.TabPageMetadata.ShowCloseButton = DevExpress.Utils.DefaultBoolean.[False] Me.TabPageMetadata.Text = "Metadaten" ' 'TabFormContentContainer2 @@ -109,7 +125,6 @@ Partial Class frmObjectPropertyDialog ' Me.TabPageLifecycle.ContentContainer = Me.TabFormContentContainer3 Me.TabPageLifecycle.Name = "TabPageLifecycle" - Me.TabPageLifecycle.ShowCloseButton = DevExpress.Utils.DefaultBoolean.[False] Me.TabPageLifecycle.Text = "Lebenszyklus" ' 'TabFormContentContainer3 @@ -120,62 +135,28 @@ Partial Class frmObjectPropertyDialog Me.TabFormContentContainer3.Size = New System.Drawing.Size(572, 534) Me.TabFormContentContainer3.TabIndex = 3 ' - 'PanelControl1 - ' - Me.PanelControl1.Controls.Add(Me.Button3) - Me.PanelControl1.Controls.Add(Me.Button2) - Me.PanelControl1.Controls.Add(Me.Button1) - Me.PanelControl1.Dock = System.Windows.Forms.DockStyle.Bottom - Me.PanelControl1.Location = New System.Drawing.Point(0, 554) - Me.PanelControl1.Name = "PanelControl1" - Me.PanelControl1.Size = New System.Drawing.Size(572, 51) - Me.PanelControl1.TabIndex = 1 - ' - 'Button3 - ' - Me.Button3.Location = New System.Drawing.Point(230, 6) - Me.Button3.Name = "Button3" - Me.Button3.Size = New System.Drawing.Size(106, 33) - Me.Button3.TabIndex = 0 - Me.Button3.Text = "OK" - Me.Button3.UseVisualStyleBackColor = True - ' - 'Button2 - ' - Me.Button2.Location = New System.Drawing.Point(342, 6) - Me.Button2.Name = "Button2" - Me.Button2.Size = New System.Drawing.Size(106, 33) - Me.Button2.TabIndex = 0 - Me.Button2.Text = "Abbrechen" - Me.Button2.UseVisualStyleBackColor = True - ' - 'Button1 + 'BarStaticItem1 ' - Me.Button1.Location = New System.Drawing.Point(454, 6) - Me.Button1.Name = "Button1" - Me.Button1.Size = New System.Drawing.Size(106, 33) - Me.Button1.TabIndex = 0 - Me.Button1.Text = "Übernehmen" - Me.Button1.UseVisualStyleBackColor = True + Me.BarStaticItem1.Caption = "Entity:" + Me.BarStaticItem1.Id = 0 + Me.BarStaticItem1.Name = "BarStaticItem1" ' 'frmObjectPropertyDialog ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(572, 605) - Me.Controls.Add(Me.PanelControl1) Me.Controls.Add(Me.TabFormContentContainer1) Me.Controls.Add(Me.TabFormControl1) Me.IconOptions.SvgImage = CType(resources.GetObject("frmObjectPropertyDialog.IconOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.Name = "frmObjectPropertyDialog" Me.TabFormControl = Me.TabFormControl1 Me.Text = "Objekt-Eigenschaften" + CType(Me.RepositoryItemComboBox1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.TabFormControl1, System.ComponentModel.ISupportInitialize).EndInit() Me.TabFormContentContainer1.ResumeLayout(False) CType(Me.LayoutControlProperties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.Root, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.PanelControl1, System.ComponentModel.ISupportInitialize).EndInit() - Me.PanelControl1.ResumeLayout(False) Me.ResumeLayout(False) End Sub @@ -189,8 +170,7 @@ Partial Class frmObjectPropertyDialog Friend WithEvents TabFormContentContainer3 As DevExpress.XtraBars.TabFormContentContainer Friend WithEvents LayoutControlProperties As DevExpress.XtraLayout.LayoutControl Friend WithEvents Root As DevExpress.XtraLayout.LayoutControlGroup - Friend WithEvents PanelControl1 As DevExpress.XtraEditors.PanelControl - Friend WithEvents Button2 As Windows.Forms.Button - Friend WithEvents Button1 As Windows.Forms.Button - Friend WithEvents Button3 As Windows.Forms.Button + Friend WithEvents cmbBusinessEntity As DevExpress.XtraBars.BarEditItem + Friend WithEvents RepositoryItemComboBox1 As DevExpress.XtraEditors.Repository.RepositoryItemComboBox + Friend WithEvents BarStaticItem1 As DevExpress.XtraBars.BarStaticItem End Class diff --git a/GUIs.Common/ObjectPropertyDialog/frmObjectPropertyDialog.vb b/GUIs.Common/ObjectPropertyDialog/frmObjectPropertyDialog.vb index 20473eb1..74aaa834 100644 --- a/GUIs.Common/ObjectPropertyDialog/frmObjectPropertyDialog.vb +++ b/GUIs.Common/ObjectPropertyDialog/frmObjectPropertyDialog.vb @@ -1,4 +1,9 @@ -Imports DigitalData.Modules.Logging +Imports System.Windows.Forms +Imports DevExpress.XtraEditors +Imports DevExpress.XtraEditors.Repository +Imports DevExpress.XtraLayout +Imports DigitalData.Modules.Database +Imports DigitalData.Modules.Logging Imports DigitalData.Modules.ZooFlow Public Class frmObjectPropertyDialog @@ -6,6 +11,8 @@ Public Class frmObjectPropertyDialog Private _Logger As Logger Private _Environment As Environment Private _ObjectId As Int64 + Private _Db As MSSQLServer + Private _Controls As PropertyControls Public Sub New(LogConfig As LogConfig, Environment As Environment, ObjectId As Long) ' Dieser Aufruf ist für den Designer erforderlich. @@ -16,9 +23,96 @@ Public Class frmObjectPropertyDialog _Logger = LogConfig.GetLogger() _Environment = Environment _ObjectId = ObjectId + _Db = _Environment.DatabaseIDB + _Controls = New PropertyControls(_LogConfig, _Db) End Sub - Private Sub frmObjectPropertyDialog_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Private Async Sub frmObjectPropertyDialog_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Try + Dim EntityIds = Await GetBusinessEntitiesForObjectId(_ObjectId) + Dim oCombobox As RepositoryItemComboBox = DirectCast(cmbBusinessEntity.Edit, RepositoryItemComboBox) + oCombobox.Items.AddRange(EntityIds) + If EntityIds.Count = 1 Then + cmbBusinessEntity.EditValue = EntityIds.First() + End If + Catch ex As ApplicationException + _Logger.Error(ex) + MessageBox.Show(ex.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error) + Catch ex As Exception + _Logger.Error(ex) + MessageBox.Show("Unhandled exception occurred please check the log", Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) + End Try + End Sub + + Private Async Function GetAttributesForBusinessEntity(EntityId As Long) As Task(Of List(Of Attribute)) + Dim oSQL = $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE BE_ID = {EntityId}" + Dim oDatatable = Await _Db.GetDatatableAsync(oSQL) + + If oDatatable.Rows.Count = 0 Then + Throw New ApplicationException($"BusinessEntity {EntityId} does not have any attributes!") + Else + Dim oAttributes As New List(Of Attribute) + + For Each oRow As DataRow In oDatatable.Rows + oAttributes.Add(New Attribute() With { + .ID = oRow.Item("ATTR_ID"), + .Title = oRow.Item("ATTR_TITLE"), + .TypeID = oRow.Item("TYPE_ID"), + .TypeName = oRow.Item("TYPE_NAME") + }) + Next + + Return oAttributes + End If + End Function + + Private Async Function GetBusinessEntitiesForObjectId(ObjectId) As Task(Of List(Of Long)) + Dim oSQL = $"SELECT BE_ID FROM TBIDB_OBJECT_BE WHERE IDB_OBJ_ID = {ObjectId}" + Dim oDatatable = Await _Db.GetDatatableAsync(oSQL) + + If oDatatable.Rows.Count = 0 Then + Throw New ApplicationException($"ObjectId {ObjectId} is not assigned to any business entity!") + Else + Dim oEntities As New List(Of Long) + + For Each oRow In oDatatable.Rows + oEntities.Add(oRow.item("BE_ID")) + Next + + Return oEntities + End If + End Function + + Private Async Function GetAttributeValue(AttributeName As String, ObjectId As Long, Optional LanguageCode As String = "de-DE", Optional IsForeign As Boolean = False) As Task(Of Object) + Dim oIsForeign = IIf(IsForeign, 1, 0) + Dim oSQL = $"SELECT TERM_VALUE FROM [dbo].[FNIDB_PM_GET_VARIABLE_VALUE] ({ObjectId}, '{AttributeName}', '{LanguageCode}', {oIsForeign})" + Dim oTermValue = Await _Db.GetScalarValueAsync(oSQL) + + Return oTermValue + End Function + + Private Async Sub cmbBusinessEntity_EditValueChanged(sender As Object, e As EventArgs) Handles cmbBusinessEntity.EditValueChanged + Dim oEntityId As Long + + If Long.TryParse(cmbBusinessEntity.EditValue, oEntityId) = False Then + Exit Sub + End If + + Dim oAttributes = Await GetAttributesForBusinessEntity(oEntityId) + + For Each oAttribute As Attribute In oAttributes + Dim oControl = _Controls.GetControlForAttribute(oAttribute) + Dim oItem As LayoutControlItem = Root.AddItem() + oItem.Text = oAttribute.Title + oItem.Name = oAttribute.Title + oItem.Control = oControl + Next + + For Each oItem As LayoutControlItem In Root.Items + Dim oValue = Await GetAttributeValue(oItem.Name, _ObjectId) + Dim oEdit = DirectCast(oItem.Control, BaseEdit) + oEdit.EditValue = oValue + Next End Sub End Class \ No newline at end of file diff --git a/GUIs.ZooFlow/ClassControlCreator.vb b/GUIs.ZooFlow/ClassControlCreator.vb index c29cc1e7..c86e4be0 100644 --- a/GUIs.ZooFlow/ClassControlCreator.vb +++ b/GUIs.ZooFlow/ClassControlCreator.vb @@ -97,7 +97,7 @@ Public Class ClassControlCreator oSourceSQL = oSourceSQL.Replace("@RESULT_TITLE", pAttributeRow.Item("ATTRIBUTE_TITLE").ToString) Dim oDTSource As DataTable 'If pAttributeRow.Item("DEPENDING_ATTRIBUTE1") = 0 Then - oDTSource = My.Database_IDB.GetDatatable(oSourceSQL) + oDTSource = My.DatabaseIDB.GetDatatable(oSourceSQL) 'End If Dim oMinValue As String = "" diff --git a/GUIs.ZooFlow/ClassInit.vb b/GUIs.ZooFlow/ClassInit.vb index 391647ff..885dc878 100644 --- a/GUIs.ZooFlow/ClassInit.vb +++ b/GUIs.ZooFlow/ClassInit.vb @@ -131,8 +131,8 @@ Public Class ClassInit End If Dim oConString = My.Database.GetConnectionString(oDatatable.Rows(0).Item("SERVER"), oDatatable.Rows(0).Item("DATENBANK"), oDatatable.Rows(0).Item("USERNAME"), oDatatable.Rows(0).Item("PASSWORD")) - My.Database_IDB = New MSSQLServer(My.LogConfig, oConString) - If My.Database_IDB.DBInitialized = False Then + My.DatabaseIDB = New MSSQLServer(My.LogConfig, oConString) + If My.DatabaseIDB.DBInitialized = False Then _Logger.Warn("Could not initialize IDB-Database!") Throw New InitException("Could not initialize IDB-Database!") End If diff --git a/GUIs.ZooFlow/MyApplication.vb b/GUIs.ZooFlow/MyApplication.vb index 59659116..da5279b3 100644 --- a/GUIs.ZooFlow/MyApplication.vb +++ b/GUIs.ZooFlow/MyApplication.vb @@ -30,7 +30,7 @@ Namespace My Property MainForm As frmAdministrationZooFlow Property SearchForm As frmSearchStart Property Database As MSSQLServer - Property Database_IDB As MSSQLServer + Property DatabaseIDB As MSSQLServer Property Queries As New ClassQueries End Module diff --git a/GUIs.ZooFlow/frmFlowForm.vb b/GUIs.ZooFlow/frmFlowForm.vb index 3bff53db..c45a5466 100644 --- a/GUIs.ZooFlow/frmFlowForm.vb +++ b/GUIs.ZooFlow/frmFlowForm.vb @@ -1,10 +1,10 @@ -Imports DevExpress.LookAndFeel -Imports DevExpress.XtraSplashScreen +Imports DevExpress.XtraSplashScreen Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Messaging Public Class frmFlowForm ' Constants + Private Const OPACITY_INITIAL = 0 Private Const OPACITY_HIDDEN = 0.65 Private Const OPACITY_SHOWN = 0.85 @@ -28,7 +28,7 @@ Public Class frmFlowForm InitializeComponent() ' === Hide form initially === - Opacity = 0 + Opacity = OPACITY_INITIAL End Sub @@ -78,7 +78,7 @@ Public Class frmFlowForm ' TODO: Clean up Dim oSQL = $"SELECT * FROM [dbo].[FNIDB_GET_SEARCH_PROFILES] ({My.Application.User.UserId},'{My.Application.User.Language}')" - Dim oDatatable As DataTable = My.Database_IDB.GetDatatable(oSQL) + Dim oDatatable As DataTable = My.DatabaseIDB.GetDatatable(oSQL) PictureBoxSearch.Visible = False If Not IsNothing(oDatatable) OrElse oDatatable.Rows.Count > 0 Then @@ -87,7 +87,7 @@ Public Class frmFlowForm PictureBoxSearch.Visible = True End If - My.DTAttributes = My.Database_IDB.GetDatatable("SELECT * FROM TBIDB_ATTRIBUTE") + My.DTAttributes = My.DatabaseIDB.GetDatatable("SELECT * FROM TBIDB_ATTRIBUTE") End Sub @@ -138,7 +138,6 @@ Public Class frmFlowForm End If End Sub - Public Sub OnEvent(Params As Object) Logger.Debug("OnEvent called!") End Sub diff --git a/GUIs.ZooFlow/frmSearchStart.vb b/GUIs.ZooFlow/frmSearchStart.vb index 49d34c72..1afa9897 100644 --- a/GUIs.ZooFlow/frmSearchStart.vb +++ b/GUIs.ZooFlow/frmSearchStart.vb @@ -156,7 +156,7 @@ Public Class frmSearchStart Try DataLoaded = False Dim oSQL = $"SELECT * FROM VWIDB_SEARCH_PROFILE_ATTRIBUTES WHERE SEARCH_PROFIL_ID = {PSEARCH_ID} ORDER BY [SEQUENCE]" - Dim oDT As DataTable = My.Database_IDB.GetDatatable(oSQL) + Dim oDT As DataTable = My.DatabaseIDB.GetDatatable(oSQL) oDTAttributes = Nothing oDTAttributes = oDT.Clone() oDT.Select("", "SEQUENCE").CopyToDataTable(oDTAttributes, LoadOption.PreserveChanges) @@ -691,15 +691,16 @@ Public Class frmSearchStart Next Dim oEnvironment As New DigitalData.Modules.ZooFlow.Environment() With { - .User = My.Application.User, - .Modules = My.Application.Modules, - .Database = My.Database, - .Settings = My.Application.Settings - } - Dim oDTSearchResult As DataTable = My.Database_IDB.GetDatatable(oSEARCH_SQL) + .User = My.Application.User, + .Modules = My.Application.Modules, + .Database = My.Database, + .DatabaseIDB = My.DatabaseIDB, + .Settings = My.Application.Settings + } + Dim oDTSearchResult As DataTable = My.DatabaseIDB.GetDatatable(oSEARCH_SQL) If oDTSearchResult.Rows.Count > 0 Then Dim oShortGuid = Guid.NewGuid() - Dim oWindowGuid = $"{PSEARCH_ID.ToString}-{My.User.Name}" '{String.Join("-", oShortGuid.ToString)}" + Dim oWindowGuid = $"{PSEARCH_ID.ToString}-{My.User.Name}" Dim oParams = New DocumentResultParams() With { .WindowGuid = oWindowGuid, .Results = New List(Of DocumentResult) From { @@ -711,9 +712,6 @@ Public Class frmSearchStart } Dim oForm As New frmDocumentResultList(My.LogConfig, oEnvironment, oParams) - - ' AddHandler oForm.FormClosed, AddressOf ProfileResultForm_Closed - ' OpenForms.Add(oForm) oForm.Show() Else Display_InfoItem("No results for this searchcombination!", Color.OrangeRed) diff --git a/Modules.Database/MSSQLServer.vb b/Modules.Database/MSSQLServer.vb index af52c1f1..3681a208 100644 --- a/Modules.Database/MSSQLServer.vb +++ b/Modules.Database/MSSQLServer.vb @@ -131,6 +131,12 @@ Public Class MSSQLServer Return GetDatatable(SqlCommand, _Timeout) End Function + Public Async Function GetDatatableAsync(SqlCommand As String) As Task(Of DataTable) + Return Await Task.Run(Function() + Return GetDatatable(SqlCommand, _Timeout) + End Function) + End Function + Public Function GetDatatableWithConnection(SqlCommand As String, ConnectionString As String) As DataTable Try If TestCanConnect(ConnectionString) = False Then @@ -234,6 +240,12 @@ Public Class MSSQLServer Return GetScalarValue(SQLQuery, _Timeout) End Function + Public Async Function GetScalarValueAsync(SQLQuery As String) As Task(Of Object) + Return Await Task.Run(Function() + Return GetScalarValue(SQLQuery, _Timeout) + End Function) + End Function + Public Function GetScalarValueWithConnection(SQLCommand As String, ConnectionString As String) As Object Try If TestCanConnect(ConnectionString) = False Then diff --git a/Modules.ZooFlow/Environment.vb b/Modules.ZooFlow/Environment.vb index 52db9c50..8a074178 100644 --- a/Modules.ZooFlow/Environment.vb +++ b/Modules.ZooFlow/Environment.vb @@ -4,5 +4,6 @@ Public Class Environment Public User As State.UserState Public Settings As State.SettingsState Public Database As MSSQLServer + Public DatabaseIDB As MSSQLServer Public Modules As Dictionary(Of String, State.ModuleState) End Class diff --git a/Modules.ZooFlow/Params/Attribute.vb b/Modules.ZooFlow/Params/Attribute.vb new file mode 100644 index 00000000..78795862 --- /dev/null +++ b/Modules.ZooFlow/Params/Attribute.vb @@ -0,0 +1,6 @@ +Public Class Attribute + Public Property ID As Long + Public Property Title As String + Public Property TypeID As Long + Public Property TypeName As String +End Class diff --git a/Modules.ZooFlow/ZooFlow.vbproj b/Modules.ZooFlow/ZooFlow.vbproj index 271ce2d5..10366b04 100644 --- a/Modules.ZooFlow/ZooFlow.vbproj +++ b/Modules.ZooFlow/ZooFlow.vbproj @@ -90,6 +90,7 @@ Settings.settings True +