diff --git a/ZooFlow/App.config b/ZooFlow/App.config index b80dcf2..e9c4984 100644 --- a/ZooFlow/App.config +++ b/ZooFlow/App.config @@ -21,10 +21,10 @@ - Skin/Office 2019 Colorful + - Custom/Digital Data Palette + Custom/Digital Data 2 @@ -36,7 +36,7 @@ - + True @@ -56,6 +56,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -81,54 +131,28 @@ - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - + + + - - - - - - - + + + + + + + diff --git a/ZooFlow/ClassInit.vb b/ZooFlow/ClassInit.vb index 1a86254..dd16d84 100644 --- a/ZooFlow/ClassInit.vb +++ b/ZooFlow/ClassInit.vb @@ -35,9 +35,8 @@ Public Class ClassInit _Loader = New ClassInitLoader(LogConfig) ' === Init Schritte definieren - _Loader.AddStep("Initializing Base", AddressOf InitializeBase, True) - _Loader.AddStep("Initializing EDMI Service", AddressOf InitializeService, True) - _Loader.AddStep("Initializing Database", AddressOf InitializeDatabaseWithFallback, True) + _Loader.AddStep("Initializing Service", AddressOf InitializeService, True) + _Loader.AddStep("Initializing Database", AddressOf InitializeDatabase, True) _Loader.AddStep("Initializing User", AddressOf InitializeUser, True) _Loader.AddStep("Initializing BasicCatalogues", AddressOf InitializeBasicsfromDB, True) _Loader.AddStep("Initializing Language", AddressOf InitializeLanguage, False) @@ -83,60 +82,6 @@ Public Class ClassInit #Region "=== Init Steps ===" - Private Sub InitializeBase(MyApplication As My.MyApplication) - End Sub - - Private Sub InitializeDatabase(MyApplication As My.MyApplication) - 'Dim oConnectionString = MSSQLServer.DecryptConnectionString(My.SystemConfig.ConnectionString) - 'My.DatabaseECM = New MSSQLServer(My.LogConfig, oConnectionString) - - 'If My.DatabaseECM.DBInitialized = False Then - ' Logger.Warn("Could not initialize DD_ECM-Database!") - ' Throw New InitException("Could not initialize ECM-Database!") - - 'Else - ' Dim oSQl = "SELECT * FROM TBDD_CONNECTION WHERE BEZEICHNUNG = 'IDB' AND AKTIV = 1" - ' Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSQl) - - ' If IsNothing(oDatatable) OrElse oDatatable.Rows.Count = 0 Then - - ' Dim oForm As New frmSQLConfig(My.LogConfig) With {.FormTitle = "IDB Datenbank"} - ' Dim oResult = oForm.ShowDialog() - - ' If oResult = DialogResult.OK Then - ' Dim oConnectionStringSaved = SaveConnectionString(oForm.ConnectionString) - - ' If oConnectionStringSaved = False Then - ' Throw New InitException("Fehler beim Laden der IDB Verbindungsdaten!") - ' End If - - ' oDatatable = My.Database.GetDatatableECM(oSQl) - ' End If - - ' End If - - ' If oDatatable.Rows.Count > 1 Then - ' Logger.Warn("Multiple IDB connection entries in TBDD_CONNECTION found!") - ' Throw New InitException("Fehler beim Laden der IDB Verbindungsdaten!") - ' End If - - ' Dim oDataRow As DataRow = oDatatable.Rows.Item(0) - ' Dim oConString = My.DatabaseECM.GetConnectionString( - ' oDataRow.Item("SERVER").ToString, - ' oDataRow.Item("DATENBANK").ToString, - ' oDataRow.Item("USERNAME").ToString, - ' oDataRow.Item("PASSWORD").ToString - ' ) - - ' Dim oDecryptedConnectionString = MSSQLServer.DecryptConnectionString(oConString) - ' My.DatabaseIDB = New MSSQLServer(My.LogConfig, oDecryptedConnectionString) - 'End If - - 'If My.DatabaseIDB.DBInitialized = False Then - ' Logger.Warn("Could not initialize IDB-Database!") - ' Throw New InitException("Could not initialize IDB-Database!") - 'End If - End Sub Private Sub InitializeService(MyApplication As My.MyApplication) Try If My.SystemConfig.AppServerConfig = String.Empty Then @@ -172,7 +117,8 @@ Public Class ClassInit Throw New InitException("Error in InitializeService", ex) End Try End Sub - Private Sub InitializeDatabaseWithFallback(MyApplication As My.MyApplication) + + Private Sub InitializeDatabase(MyApplication As My.MyApplication) Try Logger.Debug("Loading client config..") Dim oClientConfig = My.Application.Service.Client.ClientConfig @@ -192,6 +138,7 @@ Public Class ClassInit Throw New InitException("Error in InitializeDatabaseWithFallback!", ex) End Try End Sub + Private Sub InitializeUser(MyApplication As My.MyApplication) Try Dim oSql As String = My.Queries.Common.FNDD_MODULE_INIT(Environment.UserName) @@ -348,28 +295,6 @@ Public Class ClassInit #End Region - Private Function SetupDatabase() As Boolean - 'If My.SystemConfig.ConnectionString = String.Empty Then - ' Dim oConnectionString = My.SystemConfig.ConnectionString - ' Dim oForm As New frmSQLConfig(My.LogConfig) With { - ' .ConnectionString = oConnectionString, - ' .FormTitle = "ECM Datenbank" - ' } - ' Dim oResult = oForm.ShowDialog() - - ' If oResult = DialogResult.OK Then - ' My.SystemConfig.ConnectionString = oForm.ConnectionString - ' My.SystemConfigManager.Save() - - ' Return True - ' Else - ' Return False - ' End If - 'End If - - Return True - End Function - Private Function SaveConnectionString(pConnectionString As String) As Boolean Try Dim oBuilder As New SqlConnectionStringBuilder(pConnectionString) diff --git a/ZooFlow/MailLicense.xml b/ZooFlow/MailLicense.xml new file mode 100644 index 0000000..0510526 --- /dev/null +++ b/ZooFlow/MailLicense.xml @@ -0,0 +1,23 @@ + + + 4dc5ef40-f1a9-468b-994c-b7ed600ad878 + Mail.dll + 2022-07-29 + Digital Data GmbH + single developer + Digital Data GmbH + + + + + + + + + + 75MRtl4ipYelIZYlpT8O7QDX9Zc= + + + Raxfkz6DfQVs/sMvH+F2nH0eHXD8FoUFSdP3t7AgBUdpABJQx86srlyuMSEhXPlc1THCqPouEVob4RsWnd9OXvTiPPSOUSK9zuNG6uz93KLAhpSD5PraAgBCF4jwZArlAp7aCNfZpHqQ3w6TRHS+CfravUU0AHHG3MZ1ZcRkGuo= + + \ No newline at end of file diff --git a/ZooFlow/Search/SearchRunner.vb b/ZooFlow/Search/SearchRunner.vb index 6b20210..5e17f15 100644 --- a/ZooFlow/Search/SearchRunner.vb +++ b/ZooFlow/Search/SearchRunner.vb @@ -40,28 +40,40 @@ Namespace Search Public Event NeedsNewSavedSearch As EventHandler Public Event Closed As EventHandler(Of Integer) - Private Property _ActiveDateConstraint As String = String.Empty - Public ReadOnly Property ActiveDateConstraint As String + 'Private Property _ActiveDateConstraint As String = String.Empty + 'Public ReadOnly Property ActiveDateConstraint As String + ' Get + ' Return _ActiveDateConstraint + ' End Get + 'End Property + + 'Private _ActiveSearchTokens As New List(Of SearchToken.Token) + 'Private _ActiveDateAttribute As String = SEARCH_FACT_DATE_DEFAULT + 'Private _ActiveTokenOperator As TokenOperator = TokenOperator.And + + 'Public ReadOnly Property ActiveDateAttribute As String + ' Get + ' Return _ActiveDateAttribute + ' End Get + 'End Property + + 'Public ReadOnly Property ActiveTokens As List(Of SearchToken.Token) + ' Get + ' Return _ActiveSearchTokens + ' End Get + 'End Property + + + + Private _ActiveParams As New SearchParameters + + Public ReadOnly Property ActiveSearchParameters As SearchParameters Get - Return _ActiveDateConstraint + Return _ActiveParams End Get End Property - Private _ActiveSearchTokens As New List(Of SearchToken.Token) - Private _ActiveDateAttribute As String = SEARCH_FACT_DATE_DEFAULT - Private _ActiveTokenOperator As TokenOperator = TokenOperator.And - - Public ReadOnly Property ActiveDateAttribute As String - Get - Return _ActiveDateAttribute - End Get - End Property - - Public ReadOnly Property ActiveTokens As List(Of SearchToken.Token) - Get - Return _ActiveSearchTokens - End Get - End Property + Public Property LastOpenedForm As Common.IResultForm Public Property BaseSearchSQL As String Public Property ExplicitDate As Boolean = False @@ -122,10 +134,7 @@ Namespace Search End Function Public Async Function RunWithTokens(pTokens As IEnumerable(Of Search.SearchToken.Token), pDateFrom As Date, pDateTo As Date, pSearchTitle As String) As Task(Of SearchResult) - If pTokens.Count = 0 And - pDateFrom = Date.MinValue And - pDateTo = Date.MinValue And - _ActiveDateConstraint = String.Empty Then + If pTokens.Count = 0 And pDateFrom = Date.MinValue And pDateTo = Date.MinValue And _ActiveParams.DateConstraint = String.Empty Then Return New SearchResult(0) End If @@ -136,33 +145,38 @@ Namespace Search }) End Function + Private Async Function ExecuteSearch(pTokens As List(Of SearchToken.Token), pSearchTerm As String, pDateConstraint As String) As Task(Of Boolean) + Dim oSQL = String.Empty - 'Public Async Function RunWithSearchTerm(pSearchTerm As String, pDateFrom As Date, pDateTo As Date) As Task(Of SearchResult) - ' Return Await RunWithSearchTerm(pSearchTerm, pDateFrom, pDateTo, Nothing, Nothing) - 'End Function + _ActiveParams.DateConstraint = pDateConstraint + + If pTokens IsNot Nothing AndAlso pTokens.Count > 0 Then + _ActiveParams.SearchTokens = pTokens + _ActiveParams.SearchString = String.Empty + + Await InsertSearchTokens(pTokens) + oSQL = $"EXEC PRIDB_SEARCH_GET_TOKEN_RESULT_DOCS {UserId}, '{pDateConstraint}', '{UserLanguage}'" + ElseIf pSearchTerm IsNot Nothing Then + _ActiveParams.SearchTokens.Clear() + _ActiveParams.SearchString = pSearchTerm + + oSQL = $"EXEC PRIDB_SEARCH_GET_TEXT_RESULTS {UserId},'{pSearchTerm}','{pDateConstraint}', '{UserLanguage}'" + Else + _ActiveParams.SearchTokens.Clear() + _ActiveParams.SearchString = String.Empty + + oSQL = $"EXEC PRIDB_SEARCH_GET_TEXT_RESULTS {UserId},'{String.Empty}','{pDateConstraint}', '{UserLanguage}'" + End If + + Return Await My.Database.ExecuteNonQueryIDBAsync(oSQL) + End Function Private Async Function RunWithSearchOptions(pOptions As SearchOptions) As Task(Of SearchResult) Dim oDateConstraint = Await GetDateConstraint(pOptions.DateFrom, pOptions.DateTo) Dim oWindowTitle = GetResultWindowString(pOptions.SearchString, pOptions.SearchTitle) Dim oParams = GetParams(oWindowTitle) - Dim oTokens = pOptions.SearchTokens - Dim oSearchTerm = pOptions.SearchString - Dim oSQL = String.Empty - - If oTokens IsNot Nothing AndAlso oTokens.Count > 0 Then - _ActiveSearchTokens = oTokens - Await InsertSearchTokens(oTokens) - oSQL = $"EXEC PRIDB_SEARCH_GET_TOKEN_RESULT_DOCS {UserId}, '{oDateConstraint}', '{UserLanguage}'" - ElseIf oSearchTerm IsNot Nothing Then - _ActiveSearchTokens.Clear() - oSQL = $"EXEC PRIDB_SEARCH_GET_TEXT_RESULTS {UserId},'{pOptions.SearchString}','{oDateConstraint}', '{UserLanguage}'" - Else - _ActiveSearchTokens.Clear() - oSQL = $"EXEC PRIDB_SEARCH_GET_TEXT_RESULTS {UserId},'{String.Empty}','{oDateConstraint}', '{UserLanguage}'" - End If - - If Await My.Database.ExecuteNonQueryIDBAsync(oSQL) = True Then + If Await ExecuteSearch(pOptions.SearchTokens, pOptions.SearchString, oDateConstraint) = True Then Dim oDTDocResult = Await My.Database.GetDatatableIDBAsync(BaseSearchSQL) If oDTDocResult Is Nothing Then @@ -182,6 +196,7 @@ Namespace Search Dim oForm As New frmDocumentResultList(My.LogConfig, Environment, oParams) AddEventHandlers(oForm) + LastOpenedForm = oForm oForm.Show() Return New SearchResult(oRowCount) @@ -195,9 +210,25 @@ Namespace Search End If End Function + Public Async Function RunLastSearch() As Task(Of DocumentResultList.DocumentResult) + Try + If Await ExecuteSearch(_ActiveParams.SearchTokens, _ActiveParams.SearchString, _ActiveParams.DateConstraint) Then + Dim oResult = Await My.Database.GetDatatableIDBAsync(BaseSearchSQL) + + Return New DocumentResultList.DocumentResult() With { + .Title = SearchId, + .Datatable = oResult + } + Else + Return Nothing + End If + Catch ex As Exception + Logger.Error(ex) + Return Nothing + End Try + End Function + Private Sub AddEventHandlers(pForm As frmDocumentResultList) - ' TODO: Implement - 'AddHandler pForm.NeedsRefresh, AddressOf Form_NeedsRefresh AddHandler pForm.FormClosed, AddressOf Form_Closed ' Only setup event if it is actually used @@ -220,7 +251,7 @@ Namespace Search End Sub Private Async Function GetDateConstraint(pDateFrom As Date, pDateTo As Date) As Task(Of String) - Dim oSimpleDateConstraint = $"{_ActiveDateAttribute}~{_ActiveDateConstraint}" + Dim oSimpleDateConstraint = $"{_ActiveParams.DateAttribute}~{_ActiveParams.DateConstraint}" Dim oExplicitConstraint = Await MaybeSetExplicitDateConstraint(pDateFrom, pDateTo) If IsNothing(oExplicitConstraint) Then @@ -246,7 +277,7 @@ Namespace Search Dim oOperatorString - Select Case _ActiveTokenOperator + Select Case _ActiveParams.TokenOperator Case TokenOperator.Or oOperatorString = "OR" Case Else @@ -277,7 +308,7 @@ Namespace Search End If Dim oProc = $"EXEC PRIDB_SEARCH_ADD_USR_DATE {UserId},'{pDateFrom}','{oDateTo}'" If Await My.Database.ExecuteNonQueryIDBAsync(oProc) = True Then - Return $"{_ActiveDateAttribute}~DATEPART" + Return $"{_ActiveParams.DateAttribute}~DATEPART" Else Return Nothing End If @@ -332,19 +363,19 @@ Namespace Search End Function Public Sub SetDateConstraint() - _ActiveDateConstraint = String.Empty + _ActiveParams.DateConstraint = String.Empty End Sub Public Sub SetDateConstraint(pConstraintName As String) - _ActiveDateConstraint = pConstraintName + _ActiveParams.DateConstraint = pConstraintName End Sub Public Sub SetDateConstraint(pConstraint As DateConstraint) - _ActiveDateConstraint = DateConstraintToConstant(pConstraint) + _ActiveParams.DateConstraint = DateConstraintToConstant(pConstraint) End Sub Public Sub SetTokenOperator(pOperator As TokenOperator) - _ActiveTokenOperator = pOperator + _ActiveParams.DateConstraint = pOperator End Sub Public Function DateConstraintToConstant(pConstraint As DateConstraint) As String @@ -402,13 +433,21 @@ Namespace Search End Function Public Sub SetDateAttribute(pAttributeName As String) - _ActiveDateAttribute = pAttributeName + _ActiveParams.DateAttribute = pAttributeName End Sub Public Sub SetDateAttribute() - _ActiveDateAttribute = SEARCH_FACT_DATE_DEFAULT + _ActiveParams.DateAttribute = SEARCH_FACT_DATE_DEFAULT End Sub + Public Class SearchParameters + Public SearchTokens As New List(Of Search.SearchToken.Token) + Public TokenOperator As TokenOperator + Public SearchString As String + Public DateConstraint As String + Public DateAttribute As String + End Class + Public Class SearchOptions Public SearchTitle As String diff --git a/ZooFlow/Search/frmSearchFlow.vb b/ZooFlow/Search/frmSearchFlow.vb index d6044eb..e50fc69 100644 --- a/ZooFlow/Search/frmSearchFlow.vb +++ b/ZooFlow/Search/frmSearchFlow.vb @@ -6,6 +6,7 @@ Imports DevExpress.XtraEditors.Controls Imports DevExpress.XtraGrid Imports DevExpress.XtraGrid.Views.Tile Imports DevExpress.XtraSplashScreen +Imports DigitalData.GUIs.Common Imports DigitalData.GUIs.ZooFlow.ClassConstants Imports DigitalData.GUIs.ZooFlow.SavedSearch Imports DigitalData.GUIs.ZooFlow.Search @@ -17,7 +18,7 @@ Public Class frmSearchFlow Private ReadOnly LogConfig As LogConfig = My.LogConfig Private ReadOnly Logger = My.LogConfig.GetLogger() Private SearchLoader As SearchLoader - Private SearchRunner As SearchRunner + Private WithEvents SearchRunner As SearchRunner Private TokenTable As DataTable = Nothing Private FormLoading As Boolean = True @@ -34,6 +35,7 @@ Public Class frmSearchFlow } AddHandler SearchRunner.NeedsNewSavedSearch, AddressOf SearchRunner_NewSavedSearch + AddHandler SearchRunner.NeedsRefresh, AddressOf SearchRunner_NeedsRefresh TokenTable = GetTokenTable() ComboBoxDateAttributes.Properties.Items.AddRange(LoadDateAttributes()) @@ -51,13 +53,18 @@ Public Class frmSearchFlow End Sub + Private Async Sub SearchRunner_NeedsRefresh(sender As Object, e As Integer) + Dim oResult = Await SearchRunner.RunLastSearch() + SearchRunner.LastOpenedForm.RefreshResults(New List(Of DocumentResultList.DocumentResult) From {oResult}) + End Sub + Private Sub SearchRunner_NewSavedSearch(sender As Object, e As EventArgs) Dim oForm As New frmEditSearch With {.IsNew = True} If oForm.ShowDialog() = DialogResult.OK Then ' Get active tokens and create the search - Dim oTokens = SearchRunner.ActiveTokens + Dim oTokens = SearchRunner.ActiveSearchParameters.SearchTokens SearchLoader.CreateCustomSearch(oForm.Title, oForm.Description, oTokens, oForm.ImageString) ' Reload the searches diff --git a/ZooFlow/ZooFlow.vbproj b/ZooFlow/ZooFlow.vbproj index 97659e1..5112855 100644 --- a/ZooFlow/ZooFlow.vbproj +++ b/ZooFlow/ZooFlow.vbproj @@ -1140,6 +1140,9 @@ + + PreserveNewest + diff --git a/Zooflow.Setup/Product.wxs b/Zooflow.Setup/Product.wxs index 4c6b7bf..e9ede0d 100644 --- a/Zooflow.Setup/Product.wxs +++ b/Zooflow.Setup/Product.wxs @@ -78,9 +78,9 @@ - - - + + + @@ -96,17 +96,94 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Zooflow.Setup/Zooflow.Setup.wixproj b/Zooflow.Setup/Zooflow.Setup.wixproj index 18b474f..21396e3 100644 --- a/Zooflow.Setup/Zooflow.Setup.wixproj +++ b/Zooflow.Setup/Zooflow.Setup.wixproj @@ -16,7 +16,7 @@ -b "$(SolutionDir)Zooflow\bin\$(Configuration)" - de-DE;en-US + de-DE bin\$(Configuration)\