ClipboardWatcher: Actually use configured connection strings

This commit is contained in:
Jonathan Jenne 2020-06-02 16:12:41 +02:00
parent 66ad52ba26
commit 095b79be96
6 changed files with 40 additions and 14 deletions

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>
''' '''