From 60a5e03a21ebf57479faba929ecbfe12982c7630 Mon Sep 17 00:00:00 2001 From: Digital Data - Marlon Schreiber Date: Mon, 11 Jan 2021 09:35:33 +0100 Subject: [PATCH] MS --- GUIs.ZooFlow/ClassInit.vb | 26 ++++++++ GUIs.ZooFlow/FlowSearch/frmFlowSearch.vb | 74 ++++++++++++++++++++-- GUIs.ZooFlow/Queries/ClassCommonQueries.vb | 2 +- GUIs.ZooFlow/modCurrent.vb | 3 + Modules.EDMIAPI/Client.vb | 9 ++- 5 files changed, 107 insertions(+), 7 deletions(-) diff --git a/GUIs.ZooFlow/ClassInit.vb b/GUIs.ZooFlow/ClassInit.vb index debdaa59..e93436a2 100644 --- a/GUIs.ZooFlow/ClassInit.vb +++ b/GUIs.ZooFlow/ClassInit.vb @@ -275,6 +275,32 @@ Public Class ClassInit For Each oLine In oLines _Logger.Debug(oLine.Trim) Next + Case "WORKING_MODE" + Dim oLines = oValue.ToString.Split("|"c) + _Logger.Debug("WORKING_MODEs for Module {0}", ModuleName) + For Each oLine In oLines + _Logger.Debug(oLine.Trim) + If oLine = "NO_BASICCONF" Then + NOBASIC_CONF = True + ElseIf oLine.StartsWith("SEARCH_STRING_ATTRID") Then + Try + Dim oResult = oLine.Replace("SEARCH_STRING_ATTRID=", "") + SEARCH_STRING_ATTRID = oResult + Catch ex As Exception + SEARCH_STRING_ATTRID = "" + End Try + ElseIf oLine.StartsWith("SEARCH_INT_ATTRID") Then + Try + Dim oResult = oLine.Replace("SEARCH_INT_ATTRID=", "") + SEARCH_INTEGER_ATTRID = oResult + Catch ex As Exception + SEARCH_INTEGER_ATTRID = "" + End Try + + Else + _Logger.Info($"Wrong WorkingMode: {oLine}") + End If + Next End Select End Sub End Class diff --git a/GUIs.ZooFlow/FlowSearch/frmFlowSearch.vb b/GUIs.ZooFlow/FlowSearch/frmFlowSearch.vb index f2500f77..5225b679 100644 --- a/GUIs.ZooFlow/FlowSearch/frmFlowSearch.vb +++ b/GUIs.ZooFlow/FlowSearch/frmFlowSearch.vb @@ -1,5 +1,8 @@ Imports DigitalData.Modules.Logging Imports DevExpress.XtraEditors +Imports DigitalData.GUIs.Common +Imports DevExpress.XtraSplashScreen + Public Class frmFlowSearch Private Logger As Logger Private FontLargeBold As New Font("Segoe UI", 10, FontStyle.Bold) @@ -9,6 +12,7 @@ Public Class frmFlowSearch Dim oLastAttribute As String = "" Dim oAttributeCount As Integer = 1 Dim BASE_SSEARCHCommand As String + Private LastSearchForm As frmDocumentResultList Public Sub New(pBaseSearchSql As String) @@ -37,7 +41,7 @@ Public Class frmFlowSearch Sub SearchContent(oSearchValue As String) oLastAttribute = "" Dim oSQL = BASE_SSEARCHCommand.Replace("@SEARCH_STRING", oSearchValue) - + Dim oResultCount As Integer = 0 TileControlMatch.Groups.Clear() Dim ODT As DataTable = My.DatabaseIDB.GetDatatable(oSQL) @@ -48,19 +52,20 @@ Public Class frmFlowSearch Dim oGroups = ODT.AsEnumerable().GroupBy(Function(row) row.Field(Of String)("ATTRIBUTE")) Dim oNewTable As New DataTable oNewTable.Columns.Add("ATTRIBUTE") - oNewTable.Columns.Add("COUNT", Type.GetType("System.Int16")) + oNewTable.Columns.Add("COUNT", Type.GetType("System.Int32")) For Each oGroup In oGroups oNewTable.Rows.Add(oGroup.Key, oGroup.Sum(Function(row) row.Field(Of Int32)("COUNT_OBJ"))) Next If Not IsNothing(oNewTable) Then Dim oAttrCount As Integer = 0 - Dim oResultCount As Integer = 0 + For Each orow As DataRow In oNewTable.Rows oAttrCount += 1 oResultCount += orow.Item(1) Next lblFoundResult.Text = GetResultString(oResultCount, oAttrCount, oSearchValue) lblFoundResult.Visible = True + End If oNewTable.DefaultView.Sort = "COUNT ASC" oNewTable = oNewTable.DefaultView.ToTable @@ -77,13 +82,74 @@ Public Class frmFlowSearch Next TileControlMatch.Groups.Add(oGroup) Next - Dim oTESTTABLE As DataTable = My.DatabaseIDB.GetDatatable("EXEC PRSEARCH_RUN1 '3',1,1") + + 'Wenn weniger als 45 Belege gefunden wurden wird direkt die Suche ausgeführt + If oResultCount > 0 And oResultCount <= 45 Then + StartSearch_Full(oSearchValue) + End If + Else lblFoundResult.Text = "Result from DB Is Nothing..Check SQL" lblFoundResult.Visible = True End If End Sub + Private Function StartSearch_Full(pSearchValue As String) As Boolean + Dim oHandle As IOverlaySplashScreenHandle = Nothing + Dim oItemsFound As Boolean = False + Try + oHandle = SplashScreenManager.ShowOverlayForm(Me) + + Dim oEXECSQL = $"EXEC PRFLOW_SEARCH_GET_RESULT '{pSearchValue}',{My.Application.User.UserId},'{SEARCH_STRING_ATTRID}','{SEARCH_INTEGER_ATTRID}'" + Dim oDTOBJECT_RESULT As DataTable = My.DatabaseIDB.GetDatatable(oEXECSQL) + If Not IsNothing(oDTOBJECT_RESULT) Then + Dim oEnvironment As New Modules.ZooFlow.Environment() With { + .User = My.Application.User, + .Modules = My.Application.Modules, + .Database = My.Database, + .DatabaseIDB = My.DatabaseIDB, + .Settings = My.Application.Settings, + .Service = My.Application.Service + } + Dim oShortGuid = Guid.NewGuid() + Dim oWindowGuid = $"FLOWSEARCH-{My.User.Name}" + Dim oParams = New DocumentResultParams() With { + .WindowGuid = oWindowGuid, + .Results = New List(Of DocumentResult) From { + New DocumentResult() With { + .Title = "FlowSearchResult", + .Datatable = oDTOBJECT_RESULT + } + } + } + Dim oForm As New frmDocumentResultList(My.LogConfig, oEnvironment, oParams) + oForm.Show() + + LastSearchForm = oForm + + ' Position Result Window below this window + LastSearchForm.Location = GetResultFormLocation() + LastSearchForm.Size = GetResultFormSize() + oItemsFound = True + End If + + + Catch ex As Exception + MsgBox(ex.Message, MsgBoxStyle.Critical, Text) + Finally + SplashScreenManager.CloseOverlayForm(oHandle) + + End Try + Return oItemsFound + End Function + + Private Function GetResultFormLocation() As Point + Return Location + End Function + + Private Function GetResultFormSize() As Size + Return Size + End Function Private Function GetResultString(CountObjects, CountAttribute, SearchContent) As String Dim oResultString = $"wurden {CountObjects} Objekte" ' IIf(CountAttribute = 1, $"wurden {CountObjects} Objekte", $"wurden {CountObjects} Objekte in {CountAttribute} Attributen") Dim oProfileString = IIf(CountAttribute = 1, "einem Attribut", $"{CountAttribute} Attributen") diff --git a/GUIs.ZooFlow/Queries/ClassCommonQueries.vb b/GUIs.ZooFlow/Queries/ClassCommonQueries.vb index dbab0284..ec6f94f0 100644 --- a/GUIs.ZooFlow/Queries/ClassCommonQueries.vb +++ b/GUIs.ZooFlow/Queries/ClassCommonQueries.vb @@ -1,6 +1,6 @@ Public Class ClassCommonQueries Public Function FNDD_CHECK_USER_MODULE(Username As String, Optional ClientId As Integer = 1) As String - Return String.Format("SELECT * FROM [dbo].[FNDD_CHECK_USER_MODULE] ('{0}','CW',{1})", Username, ClientId) + Return String.Format("SELECT * FROM [dbo].[FNDD_CHECK_USER_MODULE] ('{0}','ZF',{1})", Username, ClientId) End Function Public Function FNDD_MODULE_INIT(Username As String) As String diff --git a/GUIs.ZooFlow/modCurrent.vb b/GUIs.ZooFlow/modCurrent.vb index 58b3d3e0..124c91e5 100644 --- a/GUIs.ZooFlow/modCurrent.vb +++ b/GUIs.ZooFlow/modCurrent.vb @@ -3,4 +3,7 @@ Module modCurrent Public _Client As Client Public APPSERVER_ACTIVE As Boolean = False + Public SEARCH_STRING_ATTRID As String + Public SEARCH_INTEGER_ATTRID As String + Public NOBASIC_CONF As Boolean = False End Module diff --git a/Modules.EDMIAPI/Client.vb b/Modules.EDMIAPI/Client.vb index 2d7c7a73..1ae5badc 100644 --- a/Modules.EDMIAPI/Client.vb +++ b/Modules.EDMIAPI/Client.vb @@ -7,6 +7,8 @@ Imports System.IO Public Class Client Private ReadOnly _logger As Logger Private ReadOnly _channelFactory As ChannelFactory(Of IEDMIServiceChannel) + Private _ServiceAddress As String + Private _IPAddressServer As String Private _channel As IEDMIServiceChannel Public Class StreamedFile @@ -32,6 +34,7 @@ Public Class Client _logger = LogConfig.GetLogger() Try + _ServiceAddress = ServiceAdress Dim oBinding = Channel.GetBinding() Dim oAddress = New EndpointAddress(ServiceAdress) Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress) @@ -46,6 +49,7 @@ Public Class Client _logger = LogConfig.GetLogger() Try + _IPAddressServer = IPAddress Dim oBinding = Channel.GetBinding() Dim oAddress = New EndpointAddress($"net.tcp://{IPAddress}:{PortNumber}/DigitalData/Services/Main") Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress) @@ -67,7 +71,8 @@ Public Class Client _logger.Debug("Opening channel..") _channel.Open() - _logger.Info("Connection to Service established!") + _logger.Info($"Connection to AppService {_IPAddressServer} successfully established!") + Return True Catch ex As Exception _logger.Error(ex) @@ -255,7 +260,7 @@ Public Class Client ''' A channel object Private Function GetChannel() As IEDMIServiceChannel Try - _logger.Debug("Creating channel..") + _logger.Debug("...Creating channel..") Dim oChannel = _channelFactory.CreateChannel() AddHandler oChannel.Faulted, AddressOf Reconnect