This commit is contained in:
Jonathan Jenne 2021-01-11 16:11:18 +01:00
commit 57bf8dfd8e
5 changed files with 107 additions and 7 deletions

View File

@ -275,6 +275,32 @@ Public Class ClassInit
For Each oLine In oLines For Each oLine In oLines
_Logger.Debug(oLine.Trim) _Logger.Debug(oLine.Trim)
Next 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 Select
End Sub End Sub
End Class End Class

View File

@ -1,5 +1,8 @@
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports DevExpress.XtraEditors Imports DevExpress.XtraEditors
Imports DigitalData.GUIs.Common
Imports DevExpress.XtraSplashScreen
Public Class frmFlowSearch Public Class frmFlowSearch
Private Logger As Logger Private Logger As Logger
Private FontLargeBold As New Font("Segoe UI", 10, FontStyle.Bold) Private FontLargeBold As New Font("Segoe UI", 10, FontStyle.Bold)
@ -9,6 +12,7 @@ Public Class frmFlowSearch
Dim oLastAttribute As String = "" Dim oLastAttribute As String = ""
Dim oAttributeCount As Integer = 1 Dim oAttributeCount As Integer = 1
Dim BASE_SSEARCHCommand As String Dim BASE_SSEARCHCommand As String
Private LastSearchForm As frmDocumentResultList
Public Sub New(pBaseSearchSql As String) Public Sub New(pBaseSearchSql As String)
@ -37,7 +41,7 @@ Public Class frmFlowSearch
Sub SearchContent(oSearchValue As String) Sub SearchContent(oSearchValue As String)
oLastAttribute = "" oLastAttribute = ""
Dim oSQL = BASE_SSEARCHCommand.Replace("@SEARCH_STRING", oSearchValue) Dim oSQL = BASE_SSEARCHCommand.Replace("@SEARCH_STRING", oSearchValue)
Dim oResultCount As Integer = 0
TileControlMatch.Groups.Clear() TileControlMatch.Groups.Clear()
Dim ODT As DataTable = My.DatabaseIDB.GetDatatable(oSQL) 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 oGroups = ODT.AsEnumerable().GroupBy(Function(row) row.Field(Of String)("ATTRIBUTE"))
Dim oNewTable As New DataTable Dim oNewTable As New DataTable
oNewTable.Columns.Add("ATTRIBUTE") 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 For Each oGroup In oGroups
oNewTable.Rows.Add(oGroup.Key, oGroup.Sum(Function(row) row.Field(Of Int32)("COUNT_OBJ"))) oNewTable.Rows.Add(oGroup.Key, oGroup.Sum(Function(row) row.Field(Of Int32)("COUNT_OBJ")))
Next Next
If Not IsNothing(oNewTable) Then If Not IsNothing(oNewTable) Then
Dim oAttrCount As Integer = 0 Dim oAttrCount As Integer = 0
Dim oResultCount As Integer = 0
For Each orow As DataRow In oNewTable.Rows For Each orow As DataRow In oNewTable.Rows
oAttrCount += 1 oAttrCount += 1
oResultCount += orow.Item(1) oResultCount += orow.Item(1)
Next Next
lblFoundResult.Text = GetResultString(oResultCount, oAttrCount, oSearchValue) lblFoundResult.Text = GetResultString(oResultCount, oAttrCount, oSearchValue)
lblFoundResult.Visible = True lblFoundResult.Visible = True
End If End If
oNewTable.DefaultView.Sort = "COUNT ASC" oNewTable.DefaultView.Sort = "COUNT ASC"
oNewTable = oNewTable.DefaultView.ToTable oNewTable = oNewTable.DefaultView.ToTable
@ -77,13 +82,74 @@ Public Class frmFlowSearch
Next Next
TileControlMatch.Groups.Add(oGroup) TileControlMatch.Groups.Add(oGroup)
Next 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 Else
lblFoundResult.Text = "Result from DB Is Nothing..Check SQL" lblFoundResult.Text = "Result from DB Is Nothing..Check SQL"
lblFoundResult.Visible = True lblFoundResult.Visible = True
End If End If
End Sub 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 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 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") Dim oProfileString = IIf(CountAttribute = 1, "einem Attribut", $"{CountAttribute} Attributen")

View File

@ -1,6 +1,6 @@
Public Class ClassCommonQueries Public Class ClassCommonQueries
Public Function FNDD_CHECK_USER_MODULE(Username As String, Optional ClientId As Integer = 1) As String 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 End Function
Public Function FNDD_MODULE_INIT(Username As String) As String Public Function FNDD_MODULE_INIT(Username As String) As String

View File

@ -3,4 +3,7 @@
Module modCurrent Module modCurrent
Public _Client As Client Public _Client As Client
Public APPSERVER_ACTIVE As Boolean = False 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 End Module

View File

@ -7,6 +7,8 @@ Imports System.IO
Public Class Client Public Class Client
Private ReadOnly _logger As Logger Private ReadOnly _logger As Logger
Private ReadOnly _channelFactory As ChannelFactory(Of IEDMIServiceChannel) Private ReadOnly _channelFactory As ChannelFactory(Of IEDMIServiceChannel)
Private _ServiceAddress As String
Private _IPAddressServer As String
Private _channel As IEDMIServiceChannel Private _channel As IEDMIServiceChannel
Public Class StreamedFile Public Class StreamedFile
@ -32,6 +34,7 @@ Public Class Client
_logger = LogConfig.GetLogger() _logger = LogConfig.GetLogger()
Try Try
_ServiceAddress = ServiceAdress
Dim oBinding = Channel.GetBinding() Dim oBinding = Channel.GetBinding()
Dim oAddress = New EndpointAddress(ServiceAdress) Dim oAddress = New EndpointAddress(ServiceAdress)
Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress) Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
@ -46,6 +49,7 @@ Public Class Client
_logger = LogConfig.GetLogger() _logger = LogConfig.GetLogger()
Try Try
_IPAddressServer = IPAddress
Dim oBinding = Channel.GetBinding() Dim oBinding = Channel.GetBinding()
Dim oAddress = New EndpointAddress($"net.tcp://{IPAddress}:{PortNumber}/DigitalData/Services/Main") Dim oAddress = New EndpointAddress($"net.tcp://{IPAddress}:{PortNumber}/DigitalData/Services/Main")
Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress) Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
@ -67,7 +71,8 @@ Public Class Client
_logger.Debug("Opening channel..") _logger.Debug("Opening channel..")
_channel.Open() _channel.Open()
_logger.Info("Connection to Service established!") _logger.Info($"Connection to AppService {_IPAddressServer} successfully established!")
Return True Return True
Catch ex As Exception Catch ex As Exception
_logger.Error(ex) _logger.Error(ex)
@ -255,7 +260,7 @@ Public Class Client
''' <returns>A channel object</returns> ''' <returns>A channel object</returns>
Private Function GetChannel() As IEDMIServiceChannel Private Function GetChannel() As IEDMIServiceChannel
Try Try
_logger.Debug("Creating channel..") _logger.Debug("...Creating channel..")
Dim oChannel = _channelFactory.CreateChannel() Dim oChannel = _channelFactory.CreateChannel()
AddHandler oChannel.Faulted, AddressOf Reconnect AddHandler oChannel.Faulted, AddressOf Reconnect