4 Commits

Author SHA1 Message Date
Jonathan Jenne
095b79be96 ClipboardWatcher: Actually use configured connection strings 2020-06-02 16:19:24 +02:00
Jonathan Jenne
66ad52ba26 Chat: WIP 2020-06-02 16:12:10 +02:00
Jonathan Jenne
3a61685882 Database: Version 1.0.0.6 2020-06-02 16:11:55 +02:00
Jonathan Jenne
21802dcfa2 Database/MSSQL: Support connection string per query, for now only for datatable 2020-06-02 16:11:42 +02:00
12 changed files with 116 additions and 32 deletions

View File

@@ -30,14 +30,14 @@ Partial Class Form1
Me.ChatControl1.Dock = System.Windows.Forms.DockStyle.Fill Me.ChatControl1.Dock = System.Windows.Forms.DockStyle.Fill
Me.ChatControl1.Location = New System.Drawing.Point(0, 0) Me.ChatControl1.Location = New System.Drawing.Point(0, 0)
Me.ChatControl1.Name = "ChatControl1" Me.ChatControl1.Name = "ChatControl1"
Me.ChatControl1.Size = New System.Drawing.Size(305, 324) Me.ChatControl1.Size = New System.Drawing.Size(397, 384)
Me.ChatControl1.TabIndex = 0 Me.ChatControl1.TabIndex = 0
' '
'Form1 'Form1
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(305, 324) Me.ClientSize = New System.Drawing.Size(397, 384)
Me.Controls.Add(Me.ChatControl1) Me.Controls.Add(Me.ChatControl1)
Me.Name = "Form1" Me.Name = "Form1"
Me.Text = "Form1" Me.Text = "Form1"

View File

@@ -52,6 +52,8 @@ Partial Class ChatControl
Me.columnUsername = New DevExpress.XtraGrid.Columns.TileViewColumn() Me.columnUsername = New DevExpress.XtraGrid.Columns.TileViewColumn()
Me.columnMessage = New DevExpress.XtraGrid.Columns.TileViewColumn() Me.columnMessage = New DevExpress.XtraGrid.Columns.TileViewColumn()
Me.columnDate = New DevExpress.XtraGrid.Columns.TileViewColumn() Me.columnDate = New DevExpress.XtraGrid.Columns.TileViewColumn()
Me.RepositoryItemHypertextLabel1 = New DevExpress.XtraEditors.Repository.RepositoryItemHypertextLabel()
Me.RepositoryItemHyperLinkEdit1 = New DevExpress.XtraEditors.Repository.RepositoryItemHyperLinkEdit()
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl() Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
Me.GridChat = New DevExpress.XtraGrid.GridControl() Me.GridChat = New DevExpress.XtraGrid.GridControl()
Me.ChatView = New DevExpress.XtraGrid.Views.Tile.TileView() Me.ChatView = New DevExpress.XtraGrid.Views.Tile.TileView()
@@ -60,6 +62,8 @@ Partial Class ChatControl
Me.txtMessage = New DevExpress.XtraEditors.MemoEdit() Me.txtMessage = New DevExpress.XtraEditors.MemoEdit()
Me.btnSendMessage = New DevExpress.XtraEditors.SimpleButton() Me.btnSendMessage = New DevExpress.XtraEditors.SimpleButton()
Me.ChatSource = New System.Windows.Forms.BindingSource(Me.components) Me.ChatSource = New System.Windows.Forms.BindingSource(Me.components)
CType(Me.RepositoryItemHypertextLabel1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.RepositoryItemHyperLinkEdit1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainerControl1.SuspendLayout() Me.SplitContainerControl1.SuspendLayout()
CType(Me.GridChat, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridChat, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -91,6 +95,15 @@ Partial Class ChatControl
Me.columnDate.Visible = True Me.columnDate.Visible = True
Me.columnDate.VisibleIndex = 2 Me.columnDate.VisibleIndex = 2
' '
'RepositoryItemHypertextLabel1
'
Me.RepositoryItemHypertextLabel1.Name = "RepositoryItemHypertextLabel1"
'
'RepositoryItemHyperLinkEdit1
'
Me.RepositoryItemHyperLinkEdit1.AutoHeight = False
Me.RepositoryItemHyperLinkEdit1.Name = "RepositoryItemHyperLinkEdit1"
'
'SplitContainerControl1 'SplitContainerControl1
' '
Me.SplitContainerControl1.Dock = System.Windows.Forms.DockStyle.Fill Me.SplitContainerControl1.Dock = System.Windows.Forms.DockStyle.Fill
@@ -116,6 +129,7 @@ Partial Class ChatControl
Me.GridChat.Location = New System.Drawing.Point(0, 20) Me.GridChat.Location = New System.Drawing.Point(0, 20)
Me.GridChat.MainView = Me.ChatView Me.GridChat.MainView = Me.ChatView
Me.GridChat.Name = "GridChat" Me.GridChat.Name = "GridChat"
Me.GridChat.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.RepositoryItemHyperLinkEdit1, Me.RepositoryItemHypertextLabel1})
Me.GridChat.Size = New System.Drawing.Size(317, 234) Me.GridChat.Size = New System.Drawing.Size(317, 234)
Me.GridChat.TabIndex = 0 Me.GridChat.TabIndex = 0
Me.GridChat.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.ChatView}) Me.GridChat.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.ChatView})
@@ -123,15 +137,19 @@ Partial Class ChatControl
'ChatView 'ChatView
' '
Me.ChatView.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.columnMessage, Me.columnUsername, Me.columnDate}) Me.ChatView.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.columnMessage, Me.columnUsername, Me.columnDate})
Me.ChatView.ContextButtonOptions.HoverStateOpacity = 0.75!
Me.ChatView.ContextButtonOptions.TopPanelColor = System.Drawing.Color.White
Me.ChatView.GridControl = Me.GridChat Me.ChatView.GridControl = Me.GridChat
Me.ChatView.Name = "ChatView" Me.ChatView.Name = "ChatView"
Me.ChatView.OptionsTiles.GroupTextPadding = New System.Windows.Forms.Padding(0) Me.ChatView.OptionsTiles.ColumnCount = 1
Me.ChatView.OptionsTiles.GroupTextPadding = New System.Windows.Forms.Padding(0, 8, 12, 8)
Me.ChatView.OptionsTiles.IndentBetweenGroups = 0 Me.ChatView.OptionsTiles.IndentBetweenGroups = 0
Me.ChatView.OptionsTiles.IndentBetweenItems = 0 Me.ChatView.OptionsTiles.IndentBetweenItems = 10
Me.ChatView.OptionsTiles.ItemPadding = New System.Windows.Forms.Padding(0) Me.ChatView.OptionsTiles.ItemPadding = New System.Windows.Forms.Padding(0)
Me.ChatView.OptionsTiles.ItemSize = New System.Drawing.Size(374, 64) Me.ChatView.OptionsTiles.ItemSize = New System.Drawing.Size(374, 64)
Me.ChatView.OptionsTiles.LayoutMode = DevExpress.XtraGrid.Views.Tile.TileViewLayoutMode.List Me.ChatView.OptionsTiles.LayoutMode = DevExpress.XtraGrid.Views.Tile.TileViewLayoutMode.Kanban
Me.ChatView.OptionsTiles.Orientation = System.Windows.Forms.Orientation.Vertical Me.ChatView.OptionsTiles.Orientation = System.Windows.Forms.Orientation.Vertical
Me.ChatView.OptionsTiles.Padding = New System.Windows.Forms.Padding(5)
Me.ChatView.OptionsTiles.RowCount = 0 Me.ChatView.OptionsTiles.RowCount = 0
Me.ChatView.OptionsTiles.ScrollMode = DevExpress.XtraEditors.TileControlScrollMode.ScrollBar Me.ChatView.OptionsTiles.ScrollMode = DevExpress.XtraEditors.TileControlScrollMode.ScrollBar
TableColumnDefinition7.Length.Value = 250.0R TableColumnDefinition7.Length.Value = 250.0R
@@ -243,7 +261,7 @@ Partial Class ChatControl
' '
Me.btnSendMessage.Dock = System.Windows.Forms.DockStyle.Right Me.btnSendMessage.Dock = System.Windows.Forms.DockStyle.Right
Me.btnSendMessage.ImageOptions.Location = DevExpress.XtraEditors.ImageLocation.MiddleCenter Me.btnSendMessage.ImageOptions.Location = DevExpress.XtraEditors.ImageLocation.MiddleCenter
Me.btnSendMessage.ImageOptions.SvgImage = CType(resources.GetObject("SimpleButton1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.btnSendMessage.ImageOptions.SvgImage = CType(resources.GetObject("btnSendMessage.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage)
Me.btnSendMessage.Location = New System.Drawing.Point(275, 0) Me.btnSendMessage.Location = New System.Drawing.Point(275, 0)
Me.btnSendMessage.Name = "btnSendMessage" Me.btnSendMessage.Name = "btnSendMessage"
Me.btnSendMessage.PaintStyle = DevExpress.XtraEditors.Controls.PaintStyles.Light Me.btnSendMessage.PaintStyle = DevExpress.XtraEditors.Controls.PaintStyles.Light
@@ -257,6 +275,8 @@ Partial Class ChatControl
Me.Controls.Add(Me.SplitContainerControl1) Me.Controls.Add(Me.SplitContainerControl1)
Me.Name = "ChatControl" Me.Name = "ChatControl"
Me.Size = New System.Drawing.Size(317, 314) Me.Size = New System.Drawing.Size(317, 314)
CType(Me.RepositoryItemHypertextLabel1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.RepositoryItemHyperLinkEdit1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainerControl1.ResumeLayout(False) Me.SplitContainerControl1.ResumeLayout(False)
CType(Me.GridChat, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridChat, System.ComponentModel.ISupportInitialize).EndInit()
@@ -280,4 +300,6 @@ Partial Class ChatControl
Friend WithEvents lookupConversations As LookupGrid.LookupControl2 Friend WithEvents lookupConversations As LookupGrid.LookupControl2
Friend WithEvents LookupControl21View As DevExpress.XtraGrid.Views.Grid.GridView Friend WithEvents LookupControl21View As DevExpress.XtraGrid.Views.Grid.GridView
Friend WithEvents btnSendMessage As DevExpress.XtraEditors.SimpleButton Friend WithEvents btnSendMessage As DevExpress.XtraEditors.SimpleButton
Friend WithEvents RepositoryItemHyperLinkEdit1 As DevExpress.XtraEditors.Repository.RepositoryItemHyperLinkEdit
Friend WithEvents RepositoryItemHypertextLabel1 As DevExpress.XtraEditors.Repository.RepositoryItemHypertextLabel
End Class End Class

View File

@@ -127,7 +127,7 @@
</value> </value>
</data> </data>
<assembly alias="DevExpress.Data.v19.2" name="DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> <assembly alias="DevExpress.Data.v19.2" name="DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<data name="SimpleButton1.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="btnSendMessage.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z
LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl

View File

@@ -92,7 +92,9 @@ Public Class ChatControl
Private Sub ChatView_ItemCustomize(sender As Object, e As TileViewItemCustomizeEventArgs) Handles ChatView.ItemCustomize Private Sub ChatView_ItemCustomize(sender As Object, e As TileViewItemCustomizeEventArgs) Handles ChatView.ItemCustomize
Dim oRow As DataRow = ChatView.GetDataRow(e.RowHandle) Dim oRow As DataRow = ChatView.GetDataRow(e.RowHandle)
Dim oUsername As String = oRow.Item(UsernameColumn) Dim oUsername As String = oRow.Item(UsernameColumn)
Dim oMessage As String = oRow.Item(MessageColumn)
Dim oColor As Color = UsernameColorsDict.Item(oUsername) Dim oColor As Color = UsernameColorsDict.Item(oUsername)
If oUsername = CurrentUser Then If oUsername = CurrentUser Then
@@ -102,12 +104,6 @@ Public Class ChatControl
e.Item.Item(UsernameColumn).Appearance.Normal.ForeColor = oColor e.Item.Item(UsernameColumn).Appearance.Normal.ForeColor = oColor
End Sub End Sub
Private Sub txtMessage_KeyUp(sender As Object, e As KeyEventArgs) Handles txtMessage.KeyUp
If e.Control And e.KeyCode = Keys.Enter And txtMessage.Text.Count > 0 Then
SendMessage(txtMessage.Text)
End If
End Sub
Private Sub lookupConversations_SelectedValuesChanged(sender As Object, SelectedValues As List(Of String)) Handles lookupConversations.SelectedValuesChanged Private Sub lookupConversations_SelectedValuesChanged(sender As Object, SelectedValues As List(Of String)) Handles lookupConversations.SelectedValuesChanged
If SelectedValues.Count > 0 Then If SelectedValues.Count > 0 Then
CurrentConversation = SelectedValues.First() CurrentConversation = SelectedValues.First()
@@ -115,6 +111,12 @@ Public Class ChatControl
End If End If
End Sub End Sub
Private Sub txtMessage_KeyUp(sender As Object, e As KeyEventArgs) Handles txtMessage.KeyUp
If e.Control And e.KeyCode = Keys.Enter And txtMessage.Text.Count > 0 Then
SendMessage(txtMessage.Text)
End If
End Sub
Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles btnSendMessage.Click Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles btnSendMessage.Click
If txtMessage.Text.Count > 0 Then If txtMessage.Text.Count > 0 Then
SendMessage(txtMessage.Text) SendMessage(txtMessage.Text)

View File

@@ -6,8 +6,8 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E}</ProjectGuid> <ProjectGuid>{B7D465A2-AE31-4CDF-A8B2-34B42D3EA84E}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>DigitalData.Modules.ClipboardWatcher</RootNamespace> <RootNamespace>DigitalData.GUIs.ClipboardWatcher</RootNamespace>
<AssemblyName>DigitalData.Modules.ClipboardWatcher</AssemblyName> <AssemblyName>DigitalData.GUIs.ClipboardWatcher</AssemblyName>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<MyType>Windows</MyType> <MyType>Windows</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
@@ -18,7 +18,7 @@
<DefineDebug>true</DefineDebug> <DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace> <DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>DigitalData.Modules.ClipboardWatcher.xml</DocumentationFile> <DocumentationFile>DigitalData.GUIs.ClipboardWatcher.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -27,7 +27,7 @@
<DefineTrace>true</DefineTrace> <DefineTrace>true</DefineTrace>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DocumentationFile>DigitalData.Modules.ClipboardWatcher.xml</DocumentationFile> <DocumentationFile>DigitalData.GUIs.ClipboardWatcher.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>

View File

@@ -22,7 +22,7 @@ Namespace My.Resources
'''<summary> '''<summary>
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. ''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
'''</summary> '''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0"), _ <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _ Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
@@ -39,7 +39,7 @@ Namespace My.Resources
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get Get
If Object.ReferenceEquals(resourceMan, Nothing) Then If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DigitalData.Modules.ClipboardWatcher.Resources", GetType(Resources).Assembly) Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("DigitalData.GUIs.ClipboardWatcher.Resources", GetType(Resources).Assembly)
resourceMan = temp resourceMan = temp
End If End If
Return resourceMan Return resourceMan

View File

@@ -15,7 +15,7 @@ Option Explicit On
Namespace My Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0"), _ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase Inherits Global.System.Configuration.ApplicationSettingsBase
@@ -64,9 +64,9 @@ Namespace My
Friend Module MySettingsProperty Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _ <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.DigitalData.Modules.ClipboardWatcher.My.MySettings Friend ReadOnly Property Settings() As Global.DigitalData.GUIs.ClipboardWatcher.My.MySettings
Get Get
Return Global.DigitalData.Modules.ClipboardWatcher.My.MySettings.Default Return Global.DigitalData.GUIs.ClipboardWatcher.My.MySettings.Default
End Get End Get
End Property End Property
End Module End Module

View File

@@ -0,0 +1 @@
DevExpress.XtraEditors.TileControl, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@@ -1,5 +1,7 @@
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.ZooFlow Imports DigitalData.Modules.ZooFlow
Imports DigitalData.Modules.Patterns
Public Class ProfileSearches Public Class ProfileSearches
Private _LogConfig As LogConfig Private _LogConfig As LogConfig
@@ -34,7 +36,7 @@ Public Class ProfileSearches
Dim oSearchesDataTable = _Environment.Database.GetDatatable(oSQL) Dim oSearchesDataTable = _Environment.Database.GetDatatable(oSQL)
Dim oDocSearches As New List(Of Search) Dim oDocSearches As New List(Of Search)
Dim oCounter As Integer = 0 Dim oCounter As Integer = 0
Dim oPatterns As New Patterns.ClassPatterns(_LogConfig) Dim oPatterns As New ClassPatterns(_LogConfig)
For Each oRow As DataRow In oSearchesDataTable.Rows For Each oRow As DataRow In oSearchesDataTable.Rows
Dim oProfileId As Integer = oRow.Item("PROFILE_ID") Dim oProfileId As Integer = oRow.Item("PROFILE_ID")
@@ -47,7 +49,8 @@ Public Class ProfileSearches
oSQL = oPatterns.ReplaceInternalValues(oSQL) oSQL = oPatterns.ReplaceInternalValues(oSQL)
oSQL = oPatterns.ReplaceClipboardContents(oSQL, _Params.ClipboardContents) oSQL = oPatterns.ReplaceClipboardContents(oSQL, _Params.ClipboardContents)
Dim oDatatable As DataTable = _Environment.Database.GetDatatable(oSQL, oConnectionId) Dim oConnectionString = GetConnectionString(oConnectionId)
Dim oDatatable As DataTable = _Environment.Database.GetDatatableWithConnection(oSQL, oConnectionString)
If oDatatable Is Nothing Then If oDatatable Is Nothing Then
_Logger.Warn("Error in SQL-Query '{0}'", oSQL) _Logger.Warn("Error in SQL-Query '{0}'", oSQL)
@@ -69,6 +72,26 @@ Public Class ProfileSearches
Return oDocSearches Return oDocSearches
End Function End Function
Private Function GetConnectionString(ConnectionId As Integer) As String
Dim oDatatable As DataTable = _Environment.Database.GetDatatable($"SELECT * FROM TBDD_CONNECTION WHERE GUID = {ConnectionId}")
If oDatatable.Rows.Count > 0 Then
Dim oRow As DataRow = oDatatable.Rows.Item(0)
Select Case oRow.Item("SQL_PROVIDER")
Case "MS-SQL"
Dim oConnectionString = MSSQLServer.GetConnectionString(oRow.Item("SERVER"), oRow.Item("DATENBANK"), oRow.Item("USERNAME"), oRow.Item("PASSWORD"))
Return oConnectionString
Case Else
Return Nothing
End Select
Else
Return Nothing
End If
End Function
Public Async Function LoadDataSearchesAsync(ProfileId As Integer) As Task(Of List(Of Search)) Public Async Function LoadDataSearchesAsync(ProfileId As Integer) As Task(Of List(Of Search))
Return Await Task.Run(Function() Return Await Task.Run(Function()
Return DoLoadDataSearches(ProfileId) Return DoLoadDataSearches(ProfileId)
@@ -83,7 +106,7 @@ Public Class ProfileSearches
Dim oSearchesDataTable = _Environment.Database.GetDatatable(oSQL) Dim oSearchesDataTable = _Environment.Database.GetDatatable(oSQL)
Dim oCounter As Integer = 0 Dim oCounter As Integer = 0
Dim oPatterns As New Patterns.ClassPatterns(_LogConfig) Dim oPatterns As New ClassPatterns(_LogConfig)
For Each oRow As DataRow In oSearchesDataTable.Rows For Each oRow As DataRow In oSearchesDataTable.Rows
Try Try
@@ -95,7 +118,8 @@ Public Class ProfileSearches
oSQL = oPatterns.ReplaceUserValues(oSQL, _Environment.User) oSQL = oPatterns.ReplaceUserValues(oSQL, _Environment.User)
oSQL = oPatterns.ReplaceInternalValues(oSQL) oSQL = oPatterns.ReplaceInternalValues(oSQL)
Dim oDatatable As DataTable = _Environment.Database.GetDatatable(oSQL, oConnectionId) Dim oConnectionString = GetConnectionString(oConnectionId)
Dim oDatatable As DataTable = _Environment.Database.GetDatatableWithConnection(oSQL, oConnectionString)
If oDatatable Is Nothing Then If oDatatable Is Nothing Then
_Logger.Warn("Error in SQL-Query '{0}'", oSQL) _Logger.Warn("Error in SQL-Query '{0}'", oSQL)

View File

@@ -7,6 +7,7 @@ Imports DigitalData.Modules.Windows
Imports DigitalData.Modules.Language Imports DigitalData.Modules.Language
Imports DigitalData.Modules.ZooFlow Imports DigitalData.Modules.ZooFlow
Imports DigitalData.Modules.ZooFlow.Params Imports DigitalData.Modules.ZooFlow.Params
Imports DigitalData.Modules
''' <summary> ''' <summary>
''' '''

View File

@@ -51,8 +51,12 @@ Public Class MSSQLServer
End Function End Function
Private Function TestCanConnect() As Boolean Private Function TestCanConnect() As Boolean
Return TestCanConnect(CurrentSQLConnectionString)
End Function
Private Function TestCanConnect(ConnectionString As String) As Boolean
Try Try
Dim oConnection As New SqlConnection(CurrentSQLConnectionString) Dim oConnection As New SqlConnection(ConnectionString)
oConnection.Open() oConnection.Open()
oConnection.Close() oConnection.Close()
Return True Return True
@@ -63,13 +67,17 @@ Public Class MSSQLServer
End Function End Function
Private Function GetSQLConnection() As SqlConnection Private Function GetSQLConnection() As SqlConnection
Return GetSQLConnection(CurrentSQLConnectionString)
End Function
Private Function GetSQLConnection(ConnectionString As String) As SqlConnection
Try Try
Dim oBuilder As New SqlConnectionStringBuilder() With {.ConnectionString = CurrentSQLConnectionString} Dim oBuilder As New SqlConnectionStringBuilder() With {.ConnectionString = ConnectionString}
Dim oConnection As New SqlConnection(CurrentSQLConnectionString) Dim oConnection As New SqlConnection(ConnectionString)
oConnection.Open() oConnection.Open()
Try Try
Dim oConnectionString = CurrentSQLConnectionString.Replace(oBuilder.Password, "XXXXX") Dim oConnectionString = ConnectionString.Replace(oBuilder.Password, "XXXXX")
_Logger.Debug($"Following Connectionstring is open: {oConnectionString}") _Logger.Debug($"Following Connectionstring is open: {oConnectionString}")
Catch ex As Exception Catch ex As Exception
End Try End Try
@@ -117,6 +125,32 @@ Public Class MSSQLServer
Return GetDatatable(SqlCommand, _Timeout) 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
Return Nothing
End If
_Logger.Debug("Running Query: {0}", SqlCommand)
Using oConnection = GetSQLConnection(ConnectionString)
Using oSQLCOmmand = oConnection.CreateCommand()
oSQLCOmmand.CommandText = SqlCommand
oSQLCOmmand.CommandTimeout = _Timeout
Dim dt As DataTable = New DataTable()
Dim oAdapter As SqlDataAdapter = New SqlDataAdapter(oSQLCOmmand)
oAdapter.Fill(dt)
Return dt
End Using
End Using
Catch ex As Exception
_Logger.Error(ex)
_Logger.Warn("sqlcommand: " & SqlCommand)
Return Nothing
End Try
End Function
''' <summary> ''' <summary>
''' Executes the passed sql-statement ''' Executes the passed sql-statement
''' </summary> ''' </summary>

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.5")> <Assembly: AssemblyVersion("1.0.0.6")>
<Assembly: AssemblyFileVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.0")>