diff --git a/GUIs.ZooFlow/ClassIDBData.vb b/GUIs.ZooFlow/ClassIDBData.vb index d34c6675..7a79ccbb 100644 --- a/GUIs.ZooFlow/ClassIDBData.vb +++ b/GUIs.ZooFlow/ClassIDBData.vb @@ -10,20 +10,18 @@ Public Class ClassIDBData ''' Title of Business Entity ''' Array with all Indices Private _Logger As Logger - Private _DataASorDB As ClassDataASorDB Private _Database As DatabaseWithFallback Public Sub New(LogConfig As LogConfig) _Logger = LogConfig.GetLogger _Database = New DatabaseWithFallback(LogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB) - _DataASorDB = New ClassDataASorDB(LogConfig) Dim oSQL = $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE LANG_ID = {My.Application.User.LanguageId}" - DTVWIDB_BE_ATTRIBUTE = _Database.GetDatatable("VWIDB_BE_ATTRIBUTE", oSQL, DatabaseType.IDB, $"LANG_ID = {My.Application.User.LanguageId}") - 'DTVWIDB_BE_ATTRIBUTE = _DataASorDB.GetDatatable("IDB", oSQL, "VWIDB_BE_ATTRIBUTE", $"LANG_ID = {My.Application.User.LanguageID}") End Sub + Public IDBSystemIndices As List(Of String) + Public Function GetIndicesByBE(ByVal pBusinessEntity As String) As List(Of String) Try IDBSystemIndices = New List(Of String) From { diff --git a/GUIs.ZooFlow/ClassInit.vb b/GUIs.ZooFlow/ClassInit.vb index 4a752818..789de859 100644 --- a/GUIs.ZooFlow/ClassInit.vb +++ b/GUIs.ZooFlow/ClassInit.vb @@ -18,7 +18,6 @@ Public Class ClassInit Inherits Base.BaseClass Private ReadOnly _MainForm As frmFlowForm - Private ReadOnly _DataASorDB As ClassDataASorDB Private ReadOnly _Database As DatabaseWithFallback Private _Loader As ClassInitLoader @@ -27,9 +26,6 @@ Public Class ClassInit Public Sub New(LogConfig As LogConfig, ParentForm As frmFlowForm) MyBase.New(LogConfig) _MainForm = ParentForm - - 'TODO: Remove when Globix uses DatabaseWithFallback - clsDataASorDB = New ClassDataASorDB(LogConfig) End Sub Public Sub InitializeApplication() diff --git a/GUIs.ZooFlow/ClassWindowLayout.vb b/GUIs.ZooFlow/ClassWindowLayout.vb index 1f2eb07b..103cfc6d 100644 --- a/GUIs.ZooFlow/ClassWindowLayout.vb +++ b/GUIs.ZooFlow/ClassWindowLayout.vb @@ -23,6 +23,7 @@ Public Class ClassWindowLayout oPath = Path.Combine(Application.UserAppDataPath(), pForm.Name & "-Layout.xml") oAlternatePath = oPath.Replace("frm", "frmfrm") + If File.Exists(oAlternatePath) Then Dim oNewFilename = Path.GetFileName(oPath) diff --git a/GUIs.ZooFlow/Globix/ClassFileDrop.vb b/GUIs.ZooFlow/Globix/ClassFileDrop.vb index ff2f4cc0..3c7fdf68 100644 --- a/GUIs.ZooFlow/Globix/ClassFileDrop.vb +++ b/GUIs.ZooFlow/Globix/ClassFileDrop.vb @@ -5,9 +5,10 @@ Imports DigitalData.Modules.Logging Imports Microsoft.Office.Interop Public Class ClassFileDrop - Public files_dropped As String() - Private _LOGGER As Logger - Private clsFilehandle As ClassFilehandle + Inherits Base.BaseClass + + Public Property files_dropped As List(Of String) + Private ReadOnly FileHandle As ClassFilehandle Public Class DroppedFile Public FilePath As String @@ -18,20 +19,21 @@ Public Class ClassFileDrop End Enum End Class - Public Sub New(LogConfig As LogConfig) - _LOGGER = LogConfig.GetLogger() - clsFilehandle = New ClassFilehandle() + Public Sub New(pLogConfig As LogConfig) + MyBase.New(pLogConfig) + FileHandle = New ClassFilehandle(pLogConfig) End Sub Public Function Drop_File(e As DragEventArgs) As Boolean Try - _LOGGER.Info("Available Drop Formats:") + Logger.Info("Available Drop Formats:") For Each oFormat As String In e.Data.GetFormats() - _LOGGER.Debug(oFormat) + Logger.Debug(oFormat) Next - _LOGGER.Info(">> Drop_File") - files_dropped = Nothing + Logger.Info(">> Drop_File") + files_dropped = New List(Of String) + If e.Data.GetDataPresent(DataFormats.FileDrop) Then Dim MyFiles() As String Dim i As Integer @@ -39,10 +41,8 @@ Public Class ClassFileDrop MyFiles = DirectCast(e.Data.GetData(DataFormats.FileDrop), String()) ' Loop through the array and add the files to the list. For i = 0 To MyFiles.Length - 1 - _LOGGER.Info(">> Simple FileDrop - File: " & MyFiles(i)) - ReDim Preserve files_dropped(i) - files_dropped(i) = "|DROPFROMFSYSTEM|" & MyFiles(i) - ' ListBox1.Items.Add(MyFiles(i)) + Logger.Info(">> Simple FileDrop - File: " & MyFiles(i)) + files_dropped.Add("|DROPFROMFSYSTEM|" & MyFiles(i)) Next Return True ElseIf (e.Data.GetDataPresent("FileGroupDescriptor")) AndAlso (e.Data.GetDataPresent("FileContents")) Then @@ -66,7 +66,7 @@ Public Class ClassFileDrop Loop stmInput.Close() 'Sonderzeichen entfernen - Dim Tempfilename = clsFilehandle.InvalidCharacters(stbFileName.ToString) + Dim Tempfilename = FileHandle.InvalidCharacters(stbFileName.ToString) Dim anhaenge = e.Data.GetDataPresent("FileContents") 'Dim path As String = "C:\VBProjekte\Dateien" '// put the zip file into the temp directory @@ -89,19 +89,21 @@ Public Class ClassFileDrop Dim fsOutput As IO.FileStream = New IO.FileStream(strOutFile, IO.FileMode.Create) '; fsOutput.Write(aryFileBytes, 0, aryFileBytes.Length) fsOutput.Close() ' // close the file - Dim resultVersion = clsFilehandle.Versionierung_Datei(strOutFile) + Dim resultVersion = FileHandle.Versionierung_Datei(strOutFile) If resultVersion <> "" Then strOutFile = resultVersion End If Dim finTemp As IO.FileInfo = New IO.FileInfo(strOutFile) '// always good to make sure we actually created the file If (finTemp.Exists = True) Then - ReDim Preserve files_dropped(0) - files_dropped(0) = "|OUTLOOK_ATTACHMENT|" & strOutFile - _LOGGER.Info(">> Drop an Attachment - File: " & strOutFile) + files_dropped.Add("|OUTLOOK_ATTACHMENT|" & strOutFile) + + 'ReDim Preserve files_dropped(0) + 'files_dropped(0) = "|OUTLOOK_ATTACHMENT|" & strOutFile + Logger.Info(">> Drop an Attachment - File: " & strOutFile) Return True Else - _LOGGER.Info(">> Attachment File from Outlook could not be created") + Logger.Info(">> Attachment File from Outlook could not be created") End If End If End If @@ -113,7 +115,7 @@ Public Class ClassFileDrop MsgBox("Unexpected error in Initialisieren von Outlook-API:" & vbNewLine & ex.Message & vbNewLine & vbNewLine & "Evtl ist Outlook nicht in der dafür vorgesehenen For") End Try - _LOGGER.Info(">> Drop of msg") + Logger.Info(">> Drop of msg") 'supports a drop of a Outlook message Dim myobj As Object For i As Integer = 1 To oApp.ActiveExplorer.Selection.Count @@ -129,14 +131,14 @@ Public Class ClassFileDrop subj = subj.Replace("/", "-") End If 'Sonderzeichen entfernen - subj = clsFilehandle.InvalidCharacters(subj) + subj = FileHandle.InvalidCharacters(subj) 'hardcode a destination path for testing Dim strFile As String = IO.Path.Combine(Path.GetTempPath, subj + ".msg") strFile = strFile.Replace("?", "") strFile = strFile.Replace("!", "") strFile = strFile.Replace("%", "") strFile = strFile.Replace("$", "") - _LOGGER.Info(">> Drop of msg - File:" & strFile) + Logger.Info(">> Drop of msg - File:" & strFile) Try myobj.SaveAs(strFile) Catch ex As Exception @@ -144,8 +146,9 @@ Public Class ClassFileDrop Return False End Try - ReDim Preserve files_dropped(i) - files_dropped(i) = "|OUTLOOK_MESSAGE|" & strFile + 'ReDim Preserve files_dropped(i) + 'files_dropped(i) = "|OUTLOOK_MESSAGE|" & strFile + files_dropped.Add("|OUTLOOK_MESSAGE|" & strFile) Next Return True 'Drop eines Outlook Attachments diff --git a/GUIs.ZooFlow/Globix/ClassFilehandle.vb b/GUIs.ZooFlow/Globix/ClassFilehandle.vb index 1a2b0ce1..ab60293e 100644 --- a/GUIs.ZooFlow/Globix/ClassFilehandle.vb +++ b/GUIs.ZooFlow/Globix/ClassFilehandle.vb @@ -6,10 +6,12 @@ Imports DigitalData.Modules.Logging Imports Independentsoft Public Class ClassFilehandle - Private _LOGGER As Logger - Public Sub New() - _LOGGER = My.LogConfig.GetLogger + Inherits Base.BaseClass + + Public Sub New(pLogConfig As LogConfig) + MyBase.New(pLogConfig) End Sub + ''' ''' Diese Funktion entfernt alle Zeichen aus dem übergebenen String ''' die in Dateinamen nicht erlaubt sind. @@ -85,6 +87,7 @@ Public Class ClassFilehandle Return Insert_GI_File(filename, handletype) Catch ex As Exception + Logger.Error(ex) MsgBox("Unexpected Error in Decide_FileHandle: " & ex.Message, MsgBoxStyle.Critical) Return False End Try @@ -103,7 +106,7 @@ Public Class ClassFilehandle If Not msg.InternetMessageId Is Nothing Then My.Application.Globix.CurrMessageID = msg.InternetMessageId Else - _LOGGER.Info(">> Email_Decay: Es konnte keine Message-ID gelesen werden. Eine GUID wird erzeugt!") + Logger.Info(">> Email_Decay: Es konnte keine Message-ID gelesen werden. Eine GUID wird erzeugt!") Dim sGUID As String sGUID = System.Guid.NewGuid.ToString() My.Application.Globix.CurrMessageID = sGUID @@ -127,7 +130,7 @@ Public Class ClassFilehandle Dim _msg As New Msg.Message(msgname) Dim i1 As Integer = 1 - _LOGGER.Info(">> Anzahl der Attachments: " & _msg.Attachments.Count) + Logger.Info(">> Anzahl der Attachments: " & _msg.Attachments.Count) For Each attachment As Independentsoft.Msg.Attachment In _msg.Attachments If erfolgreich = False Then Exit For @@ -147,7 +150,7 @@ Public Class ClassFilehandle Dim oMessage = attachment.EmbeddedMessage oMessage.Save(tempfile) My.Application.Globix.TEMP_FILES.Add(tempfile) - _LOGGER.Info(">> Attachment (" & i1 & "):" & tempfile) + Logger.Info("Attachment (" & i1 & "):" & tempfile) erfolgreich = Insert_GI_File(tempfile, ATT_EXTR) i1 += 1 End If @@ -160,7 +163,7 @@ Public Class ClassFilehandle attachment.Save(tempfile) 'Datei in Array zum Templöschen speichern My.Application.Globix.TEMP_FILES.Add(tempfile) - _LOGGER.Info(">> Attachment (" & i1 & "):" & tempfile) + Logger.Info("Attachment (" & i1 & "):" & tempfile) 'nun der Insert des Anhanges erfolgreich = Insert_GI_File(tempfile, ATT_EXTR) i1 += 1 @@ -170,7 +173,9 @@ Public Class ClassFilehandle End If Return erfolgreich Catch ex As Exception + Logger.Error(ex) MsgBox("Error in Email_Decay: " & ex.Message, MsgBoxStyle.Critical) + Return False End Try End Function @@ -200,19 +205,20 @@ Public Class ClassFilehandle ' Ist ein Fehler aufgetreten, so wird nach außen hin generell ' davon ausgegangen, dass die Datei in Benutzung ist (obwohl ' auch andere Ursachen, etwa Rechteprobleme, möglich sind). - _LOGGER.Info(">> FileInUse Message: " & ex.Message) - IsFileInUse = True + Logger.Info(">> FileInUse Message: " & ex.Message) + Return True Finally ' Die eventuell geöffnete Datei schließen FileClose(ff) End Try Return False + Else + Return False End If - End Function Public Function Versionierung_Datei(Dateiname As String) As String Dim extension As String - Dim _NewFileString As String + Dim _NewFileString As String = "" Try Dim version As Integer = 1 @@ -233,36 +239,10 @@ Public Class ClassFilehandle End If Return _NewFileString & extension Catch ex As Exception - _LOGGER.Info(" - Error in versioning file - error: " & vbNewLine & ex.Message) - _LOGGER.Error(ex.Message) + Logger.Info(" - Error in versioning file - error: " & vbNewLine & ex.Message) + Logger.Error(ex) MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in versioning file:") Return "" End Try - End Function - ''' - '''' Ersetzt alle nicht zulässigen Zeichen im angegebenen Dateinamen - '''' - '''' Dateiname ohne Pfadangabe - '''' Ersatzzeichen für alle unzulässigen Zeichen - '''' im Dateinamen - 'Public Function CleanFilename(ByVal sFilename As String, Optional ByVal REPLACEChar As String = "") As String - ' _LOGGER.Info(" Filename before CleanFilename: '" & sFilename & "'") - ' If sFilename.Contains(".\") Then - ' sFilename = sFilename.Replace(".\", "\") - ' End If - ' 'If sFilename.Contains("'") Then - ' ' sFilename = sFilename.Replace("'", "") - ' 'End If - ' 'If sFilename.Contains("..") Then - ' ' sFilename = sFilename.Replace("..", ".") - ' 'End If - ' ' alle nicht zulässigen Zeichen ersetzen - ' sFilename = System.Text.RegularExpressions.Regex.Replace(sFilename, My.Application.Globix.REGEX_CLEAN_FILENAME, REPLACEChar) - ' sFilename = System.Text.RegularExpressions.Regex.Replace(sFilename, "[\\/:*?""<>|\r\n]", "", System.Text.RegularExpressions.RegexOptions.Singleline) - ' 'Dim oCleanFileName As String = String.Join(REPLACEChar, sFilename.Split(Path.GetInvalidFileNameChars())) - ' Dim oCleanFileName As New System.IO.FileInfo(System.Text.RegularExpressions.Regex.Replace(sFilename, String.Format("[{0}]", String.Join(String.Empty, Path.GetInvalidFileNameChars)), REPLACEChar)) - ' _LOGGER.Info("Filename after CleanFilename: '" & sFilename & "'") - ' Return sFilename - 'End Function End Class diff --git a/GUIs.ZooFlow/Globix/ClassFolderwatcher.vb b/GUIs.ZooFlow/Globix/ClassFolderwatcher.vb index fe11c42c..a11d5b3b 100644 --- a/GUIs.ZooFlow/Globix/ClassFolderwatcher.vb +++ b/GUIs.ZooFlow/Globix/ClassFolderwatcher.vb @@ -2,14 +2,16 @@ Imports DigitalData.Modules.Logging Public Class ClassFolderwatcher + Inherits Base.BaseClass + Public Shared FWFolderWatcher As FileSystemWatcher Public Shared FWScan As FileSystemWatcher - Private clsFilehandle As ClassFilehandle - Private Logger As Logger - Public Sub New() - Logger = My.LogConfig.GetLogger() - clsFilehandle = New ClassFilehandle() + Private ReadOnly FileHandle As ClassFilehandle + + Public Sub New(pLogConfig As LogConfig) + MyBase.New(pLogConfig) + FileHandle = New ClassFilehandle(pLogConfig) End Sub Public Function Restart_FolderWatch() As Boolean @@ -19,7 +21,7 @@ Public Class ClassFolderwatcher FWFolderWatcher.EnableRaisingEvents = False My.Application.Globix.Folderwatchstarted = False 'FolderWatch neu instanzieren - FWFolderWatcher = New System.IO.FileSystemWatcher(My.Application.Globix.CurrentFolderWatchPath, "*.*") + FWFolderWatcher = New FileSystemWatcher(My.Application.Globix.CurrentFolderWatchPath, "*.*") Logger.Info(" >> FolderWatch neu instanziert") FWFolderWatcher.IncludeSubdirectories = False FWFolderWatcher.EnableRaisingEvents = True @@ -65,7 +67,6 @@ Public Class ClassFolderwatcher FWFolderWatcher.EnableRaisingEvents = True AddHandler FWFolderWatcher.Created, AddressOf OnCreated My.Application.Globix.Folderwatchstarted = True - 'SaveConfigValue("my.Application.Globix.Folderwatchstarted", "True") My.UIConfig.Globix.FolderWatchStarted = True My.UIConfigManager.Save() End If @@ -78,7 +79,6 @@ Public Class ClassFolderwatcher FWFolderWatcher.EnableRaisingEvents = True AddHandler FWFolderWatcher.Created, AddressOf OnCreated My.Application.Globix.Folderwatchstarted = True - 'SaveConfigValue("my.Application.Globix.Folderwatchstarted", "True") My.UIConfig.Globix.FolderWatchStarted = True My.UIConfigManager.Save() Else @@ -86,7 +86,6 @@ Public Class ClassFolderwatcher FWFolderWatcher.EnableRaisingEvents = False My.Application.Globix.Folderwatchstarted = False Logger.Info(" >> FolderWatch gestoppt") - 'SaveConfigValue("my.Application.Globix.Folderwatchstarted", "False") My.UIConfig.Globix.FolderWatchStarted = False My.UIConfigManager.Save() End If @@ -183,8 +182,8 @@ Public Class ClassFolderwatcher 'Die Datei übergeben Logger.Info(">> OnCreated-File:" & e.FullPath) - If clsFilehandle.CheckDuplicateFiles(e.FullPath, "FolderWatch/Scan") Then - clsFilehandle.Decide_FileHandle(e.FullPath, handleType) + If FileHandle.CheckDuplicateFiles(e.FullPath, "FolderWatch/Scan") Then + FileHandle.Decide_FileHandle(e.FullPath, handleType) Else Logger.Info(">> Folderwatcher: File already exists:" & e.FullPath) End If diff --git a/GUIs.ZooFlow/Globix/ClassValidator.vb b/GUIs.ZooFlow/Globix/ClassValidator.vb index f4c897c0..08ca8628 100644 --- a/GUIs.ZooFlow/Globix/ClassValidator.vb +++ b/GUIs.ZooFlow/Globix/ClassValidator.vb @@ -129,11 +129,15 @@ Public Class ClassValidator End Try End Function - Function GetControlValues(pPanel As Panel) + Function GetControlValues(pPanel As Panel) As List(Of UserAttributeValue) Dim oAttributeValues As New List(Of UserAttributeValue) For Each oControl As Control In pPanel.Controls + If oControl.Name.StartsWith("lbl") Then + Continue For + End If + ' ========================= TEXTBOX ========================= If oControl.Name.StartsWith("txt") Then Dim oTextBox As DevExpress.XtraEditors.TextEdit = oControl diff --git a/GUIs.ZooFlow/Globix/Models/ManualIndex.vb b/GUIs.ZooFlow/Globix/Models/ManualIndex.vb index 908f0f46..a856ee22 100644 --- a/GUIs.ZooFlow/Globix/Models/ManualIndex.vb +++ b/GUIs.ZooFlow/Globix/Models/ManualIndex.vb @@ -4,8 +4,18 @@ Public Property DocTypeName As String Public Property DocTypeId As Integer + ''' + ''' WD_INDEX, Name of the Attribute + ''' Public Property Name As String - Public Property Comment As String + ''' + ''' INDEXNAME, Internal Name for Admin + ''' + Public Property InternalName As String + ''' + ''' COMMENT, Caption in Index Form + ''' + Public Property LabelCaption As String Public Property DataType As String Public Property Sequence As Integer @@ -16,7 +26,6 @@ Public Property DefaultValue As String Public Property IsOptional As Boolean - Public Property IsActive As Boolean Public Property IsMultiselect As Boolean Public Property AllowAddingItems As Boolean Public Property PreventMultleValue As Boolean diff --git a/GUIs.ZooFlow/Globix/frmGlobixBasicConfig.vb b/GUIs.ZooFlow/Globix/frmGlobixBasicConfig.vb index 1272fbde..687baae0 100644 --- a/GUIs.ZooFlow/Globix/frmGlobixBasicConfig.vb +++ b/GUIs.ZooFlow/Globix/frmGlobixBasicConfig.vb @@ -99,16 +99,16 @@ Public Class frmGlobixBasicConfig Private Sub frmGlobixBasicConfig_Load(sender As Object, e As EventArgs) Handles Me.Load Logger = My.LogConfig.GetLogger() - clsFW = New ClassFolderwatcher() + clsFW = New ClassFolderwatcher(My.LogConfig) Try oReload = True Dim oFolderwatch = My.DatabaseECM.GetScalarValue("SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE FOLDER_TYPE = 'DEFAULT' AND USER_ID = " & My.Application.User.UserId) - If Not oFolderwatch Is Nothing Then + If oFolderwatch IsNot Nothing Then My.Application.Globix.CurrentFolderWatchPath = oFolderwatch End If Me.txtFolderWatch.Text = My.Application.Globix.CurrentFolderWatchPath Dim oSCANFolderwatch = My.DatabaseECM.GetScalarValue("SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE FOLDER_TYPE = 'SCAN' AND USER_ID = " & My.Application.User.UserId) - If Not oSCANFolderwatch Is Nothing Then + If oSCANFolderwatch IsNot Nothing Then My.Application.Globix.CURRENT_SCAN_FOLDERWATCH = oSCANFolderwatch End If Me.txtFolderWatch.Text = My.Application.Globix.CurrentFolderWatchPath diff --git a/GUIs.ZooFlow/Globix/frmGlobix_Index.Designer.vb b/GUIs.ZooFlow/Globix/frmGlobix_Index.Designer.vb index afda87ff..3334dba6 100644 --- a/GUIs.ZooFlow/Globix/frmGlobix_Index.Designer.vb +++ b/GUIs.ZooFlow/Globix/frmGlobix_Index.Designer.vb @@ -59,6 +59,7 @@ Partial Class frmGlobix_Index Me.cmbDocType = New DevExpress.XtraEditors.ComboBoxEdit() Me.DocumentViewer1 = New DigitalData.Controls.DocumentViewer.DocumentViewer() Me.GlobixDataset = New DigitalData.GUIs.ZooFlow.GlobixDataset() + Me.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, GetType(Global.DigitalData.GUIs.ZooFlow.frmWaitForm), True, True) CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.SplitContainerControl1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SplitContainerControl1.SuspendLayout() @@ -326,6 +327,10 @@ Partial Class frmGlobix_Index Me.GlobixDataset.DataSetName = "GlobixDataset" Me.GlobixDataset.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema ' + 'SplashScreenManager + ' + Me.SplashScreenManager.ClosingDelay = 500 + ' 'frmGlobix_Index ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -381,4 +386,5 @@ Partial Class frmGlobix_Index Friend WithEvents GlobixDataset As GlobixDataset Friend WithEvents cmbDocType As DevExpress.XtraEditors.ComboBoxEdit Friend WithEvents SimpleButton1 As SimpleButton + Friend WithEvents SplashScreenManager As DevExpress.XtraSplashScreen.SplashScreenManager End Class diff --git a/GUIs.ZooFlow/Globix/frmGlobix_Index.vb b/GUIs.ZooFlow/Globix/frmGlobix_Index.vb index 1422c8de..34994e85 100644 --- a/GUIs.ZooFlow/Globix/frmGlobix_Index.vb +++ b/GUIs.ZooFlow/Globix/frmGlobix_Index.vb @@ -26,7 +26,6 @@ Public Class frmGlobix_Index Private Const TEXT_MISSING_INPUT = "Bitte vervollständigen Sie die Eingaben!" Private Property MultifileCount As Integer - Public Property DT_VWGI_DOCTYPE As DataTable Public Property FormLoaded As Boolean = False Public Property DropType As String @@ -36,17 +35,14 @@ Public Class frmGlobix_Index Public Property SelectedDocType As DocType Private Property WindowLocation As ClassWindowLayout - Private Property _DataASorDB As ClassDataASorDB Private Property Database As DatabaseWithFallback Private Property Patterns2 As Patterns2 - - - Public Class ControlMeta - Public Property IndexName As String - Public Property IndexType As String - Public Property MultipleValues As Boolean = False - End Class + 'Public Class ControlMeta + ' Public Property IndexName As String + ' Public Property IndexType As String + ' Public Property MultipleValues As Boolean = False + 'End Class #End Region Public Sub New(pLogConfig As LogConfig) @@ -57,8 +53,6 @@ Public Class frmGlobix_Index Logger = pLogConfig.GetLogger() LogConfig = pLogConfig - _DataASorDB = New ClassDataASorDB(pLogConfig) - Database = New DatabaseWithFallback(pLogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB) WindowLocation = New ClassWindowLayout(pLogConfig) Patterns2 = New Patterns2(pLogConfig) @@ -67,14 +61,28 @@ Public Class frmGlobix_Index End Sub Private Sub frmGlobix_Index_Load(sender As Object, e As EventArgs) Handles MyBase.Load - ColorizeInactiveIcon = False + ColorizeInactiveIcon = DevExpress.Utils.DefaultBoolean.True ' Abbruchzähler zurücksetzen CancelAttempts = 0 My.Application.Globix.INDEXING_ACTIVE = True + End Sub + + Private Sub frmGlobix_Index_Shown(sender As Object, e As EventArgs) Handles Me.Shown + Cursor = Cursors.Default + + SplashScreenManager.ShowWaitForm() + + checkItemTopMost.Checked = My.UIConfig.Globix.TopMost + TopMost = My.UIConfig.Globix.TopMost + BringToFront() + Focus() Try + Refresh_Dokart() + pnlIndex.Controls.Clear() + My.Application.Globix.CURRENT_ISATTACHMENT = False Dim oSql = $"SELECT HANDLE_TYPE FROM TBGI_FILES_USER WHERE GUID = {My.Application.Globix.CurrentWorkfile.Id}" DropType = My.DatabaseECM.GetScalarValue(oSql) @@ -121,27 +129,6 @@ Public Class frmGlobix_Index End If - Catch ex As Exception - Logger.Warn(" - Unexpected error in Öffnen des Formulares - Fehler: " & vbNewLine & ex.Message) - Logger.Error(ex.Message) - MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Öffnen des Formulares:") - End Try - End Sub - - Private Sub frmGlobix_Index_Shown(sender As Object, e As EventArgs) Handles Me.Shown - BringToFront() - Focus() - Cursor = Cursors.Default - Refresh_Dokart() - pnlIndex.Controls.Clear() - - checkItemTopMost.Checked = My.UIConfig.Globix.TopMost - TopMost = My.UIConfig.Globix.TopMost - BringToFront() - - FormLoaded = True - - Try ' Letzte Auswahl merken überschreibt die automatische selektion If My.UIConfig.Globix.ProfilePreselection Then checkItemPreselection.Checked = True @@ -158,7 +145,7 @@ Public Class frmGlobix_Index End If Else - Dim oSQL As String = "SELECT DISTINCT T1.DOCTYPE as DocType, T.* FROM TBGI_REGEX_DOCTYPE T, VWGI_DOCTYPE T1 WHERE T.DOCTYPE_ID = T1.DOCTYPE_ID" + oSql = "SELECT DISTINCT T1.DOCTYPE as DocType, T.* FROM TBGI_REGEX_DOCTYPE T, VWGI_DOCTYPE_USER T1 WHERE T.DOCTYPE_ID = T1.DOCTYPE_ID" Dim oRegexDoctypeTable = Database.GetDatatable("DTTBGI_REGEX_DOCTYPE", oSQL, ECM) For Each oRoW As DataRow In oRegexDoctypeTable.Rows @@ -179,9 +166,13 @@ Public Class frmGlobix_Index End If Next End If + + Catch ex As Exception Logger.Warn("Unexpected error DTTBGI_REGEX_DOCTYPE - ErrorMessage: " & vbNewLine & ex.Message) - + Finally + SplashScreenManager.CloseWaitForm() + FormLoaded = True End Try End Sub @@ -301,21 +292,24 @@ Public Class frmGlobix_Index End Sub Sub Refresh_Dokart() Try - Dim oSql = String.Format("SELECT * FROM VWGI_DOCTYPE_IDB where UPPER(USERNAME) = UPPER('{0}') ORDER BY SEQUENCE", My.Application.User.UserName) - DT_VWGI_DOCTYPE = Database.GetDatatable("VWGI_DOCTYPE_IDB", oSql, ECM, pSortByColumn:="SEQUENCE") - Dim oDocTypes As New List(Of DocType) + Dim oSql = String.Format("SELECT * FROM VWGI_DOCTYPE_USER WHERE AKTIV = 1 AND USERNAME = '{0}' ORDER BY SEQUENCE", My.Application.User.UserName) + Dim oTable = Database.GetDatatable("VWGI_DOCTYPE_USER", oSql, ECM, + pSortByColumn:="SEQUENCE", + pFilterExpression:=$"AKTIV = 1 AND USERNAME = '{My.Application.User.UserName}'") - For Each oRow As DataRow In DT_VWGI_DOCTYPE.Rows + For Each oRow As DataRow In oTable.Rows Dim oDocType = New DocType With { .Guid = oRow.Item("DOCTYPE_ID"), .Name = oRow.Item("DOCTYPE"), - .ObjectStore = oRow.Item("OBJECT_STORE") + .ObjectStore = oRow.Item("OBJECT_ST_NAME") } oDocTypes.Add(oDocType) cmbDocType.Properties.Items.Add(oDocType) Next + + DocTypes = oDocTypes Catch ex As Exception Logger.Warn("Unexpected error in Refresh_Dokart: " & vbNewLine & ex.Message) MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Laden der Dokumentarten:") @@ -336,7 +330,7 @@ Public Class frmGlobix_Index 'My.Application.Globix.CURRENT_DOCTYPE_DuplicateHandling = My.Application.Globix.CURR_DT_DOCTYPE.Rows(0).Item("DUPLICATE_HANDLING").ToString ManualIndexes = Refresh_IndexeMan(oSelectedItem.Guid) - LoadIndexe_Man() + LoadIndexe_Man(ManualIndexes) End If End Sub @@ -347,13 +341,14 @@ Public Class frmGlobix_Index T1.BEZEICHNUNG AS DOKUMENTART, T.* FROM TBDD_INDEX_MAN T, TBDD_DOKUMENTART T1 - WHERE T.ACTIVE = 1 AND - T.DOK_ID = T1.GUID AND + WHERE T.DOK_ID = T1.GUID AND T.DOK_ID = {dokartid} ORDER BY T.SEQUENCE" - Dim oFilter = "DOK_ID = " & dokartid - Dim oTable = _DataASorDB.GetDatatable("DD_ECM", oSql, "DT_INDEXE_MAN", oFilter, "SEQUENCE") + Dim oTable = My.Database.GetDatatable("VWDDINDEX_MAN", oSql, ECM, + pSortByColumn:="SEQUENCE", + pFilterExpression:=$"DOK_ID = {dokartid}") + Dim oManualIndexes As New List(Of ManualIndex) For Each oRow As DataRow In oTable.Rows @@ -361,8 +356,9 @@ Public Class frmGlobix_Index .Id = oRow.ItemEx(Of Integer)("GUID"), .DocTypeId = oRow.ItemEx(Of Integer)("DOK_ID"), .DocTypeName = oRow.ItemEx(Of String)("DOKUMENTART"), - .Name = oRow.ItemEx(Of String)("NAME"), - .Comment = oRow.ItemEx(Of String)("COMMENT"), + .Name = oRow.ItemEx(Of String)("WD_INDEX"), + .InternalName = oRow.ItemEx(Of String)("INDEXNAME"), + .LabelCaption = oRow.ItemEx(Of String)("COMMENT"), .DataType = oRow.ItemEx(Of String)("DATATYPE"), .Sequence = oRow.ItemEx("SEQUENCE", 0), .SQLCommand = oRow.ItemEx("SQL_RESULT", String.Empty), @@ -370,7 +366,6 @@ Public Class frmGlobix_Index .SQLSuggestion = oRow.ItemEx("SUGGESTION", String.Empty), .DefaultValue = oRow.ItemEx("DEFAULT_VALUE", String.Empty), .IsOptional = oRow.ItemEx(Of Integer)("OPTIONAL", False), - .IsActive = oRow.ItemEx("ACTIVE", False), .IsMultiselect = oRow.ItemEx("MULTISELECT", False) } @@ -403,7 +398,7 @@ Public Class frmGlobix_Index labelError.Caption = text End Sub - Private Sub LoadIndexe_Man() + Private Sub LoadIndexe_Man(pManualIndexes As List(Of ManualIndex)) Try Dim oScreen As New DigitalData.Modules.Windows.Screen() Dim oDpiScale = oScreen.GetScreenScaling(Me) @@ -421,22 +416,21 @@ Public Class frmGlobix_Index Logger.Info("Loading Indicies for Screen Scaling Factor [{0}]", oDpiScale) - If ManualIndexes Is Nothing OrElse ManualIndexes.Count = 0 Then + If pManualIndexes Is Nothing OrElse pManualIndexes.Count = 0 Then ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDocType.Text & " definiert") Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDocType.Text & " definiert") End If - For Each oIndex As ManualIndex In ManualIndexes + For Each oIndex As ManualIndex In pManualIndexes Dim MultiSelect As Boolean = oIndex.IsMultiselect Dim AddNewItems As Boolean = oIndex.AllowAddingItems Dim PreventDuplicates As Boolean = oIndex.PreventMultleValue Dim oControlName As String = oIndex.Name Dim oConnectionId = oIndex.SQLConnection - Dim oSQLSuggestion = oIndex.SQLSuggestion Dim oDataType = oIndex.DataType If oDataType <> "BOOLEAN" Then - addLabel(oControlName, oIndex.Comment, oLabelPosition, oControlCount) + addLabel(oControlName, oIndex.LabelCaption, oLabelPosition, oControlCount) End If 'Dim oDefaultValue = Check_HistoryValues(oControlName, oIndex.DocTypeName) @@ -444,14 +438,13 @@ Public Class frmGlobix_Index ' 'oDefaultValue = GetPlaceholderValue(oIndex.DefaultValue, My.Application.Globix.CURRENT_WORKFILE) 'End If Dim oDefaultValue = GetPlaceholderValue(oIndex.DefaultValue, My.Application.Globix.CurrentWorkfile.FilePath) - Dim oControl As Control = Nothing - Dim oHasSqlCommand = (oSQLSuggestion = True And oIndex.SQLCommand.Length > 0) + Dim oHasSqlCommand = (oConnectionId > 0 And oIndex.SQLCommand.Length > 0) Dim oNeedsLookup As Boolean = oHasSqlCommand Or MultiSelect = True Select Case oIndex.DataType Case "BOOLEAN" - Dim oCheckbox As CheckBox = oControls.AddCheckBox(oControlName, oControlPosition, oDefaultValue, oIndex.Comment) + Dim oCheckbox As CheckBox = oControls.AddCheckBox(oControlName, oControlPosition, oDefaultValue, oIndex.LabelCaption) oControl = oCheckbox Case "INTEGER" @@ -478,7 +471,7 @@ Public Class frmGlobix_Index MsgBox("Please check Datatype of Indexvalue!", MsgBoxStyle.Critical, "Warning:") End If - Logger.Warn(" - Datentyp nicht hinterlegt - LoadIndexe_Man") + Logger.Warn("DataType [{0}] not implemented!", oIndex.DataType) End Select If Not IsNothing(oControl) Then @@ -511,7 +504,7 @@ Public Class frmGlobix_Index End If Try - Dim oMeta = DirectCast(pControl.Tag, ControlMeta) + Dim oMeta = DirectCast(pControl.Tag, GlobalIndexer.ControlMeta) Dim oIndexName As String = oMeta.IndexName Dim oSQL = $"SELECT * FROM TBDD_INDEX_MAN WHERE SQL_RESULT LIKE '%{oIndexName}%' AND DOK_ID = {SelectedDocType.Guid}" Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSQL) @@ -559,7 +552,7 @@ Public Class frmGlobix_Index Continue For End If - Dim oMeta = DirectCast(oControl.Tag, ControlMeta) + Dim oMeta = DirectCast(oControl.Tag, GlobalIndexer.ControlMeta) Dim oIndex As String = oMeta.IndexName If oIndex = IndexName Then @@ -753,28 +746,51 @@ Public Class frmGlobix_Index ClearNotice() Cursor = Cursors.WaitCursor + Logger.Info("Validating user values") + Dim oValidator As New ClassValidator(My.LogConfig, My.Application.Service.Client, ManualIndexes) If oValidator.ValidateControls(pnlIndex, pDocType) = False Then Return False End If + Logger.Info("Collecting user values") + Dim oValues = oValidator.GetControlValues(pnlIndex) + Logger.Info("Preparing method parameters") Dim oFilePath As String = My.Application.Globix.CurrentWorkfile.FilePath - Dim oObjectStore As String = "WORK" + Dim oObjectStore As String = SelectedDocType.ObjectStore Dim oObjectKind As String = "DOC" Dim oBusinessEntity As String = "DEFAULT" Dim oProfileId As Integer = SelectedDocType.Guid Dim oAttributes As List(Of UserAttributeValue) = oValues - Dim oOptions As New Modules.EDMI.API.Options.ImportFileOptions + Dim oOptions As New Options.ImportFileOptions - Await My.Application.Service.Client.ImportFileAsync( + Logger.Debug("FilePath: [{0}]", oFilePath) + Logger.Debug("ObjectStore: [{0}]", oObjectStore) + Logger.Debug("ObjectKind: [{0}]", oObjectKind) + Logger.Debug("BusinessEntity: [{0}]", oBusinessEntity) + Logger.Debug("ProfileId: [{0}]", oProfileId) + Logger.Debug("BusinessEntity: [{0}]", oBusinessEntity) + + Logger.Info("Running Import") + + Dim oResult = Await My.Application.Service.Client.ImportFileAsync( oFilePath, oProfileId, oAttributes, oObjectStore, oObjectKind, oBusinessEntity, oOptions) - MsgBox("Die Datei wurde erfolgreich verarbeitet!", MsgBoxStyle.Information, Text) + Logger.Info("Import result: [{0}]", oResult.OK) + Logger.Info("Imported file got ObjectId [{0}]", oResult.ObjectId) + + If oResult.OK Then + MsgBox("Die Datei wurde erfolgreich verarbeitet!", MsgBoxStyle.Information, Text) + Return True + Else + Logger.Warn("Import failed with message: [{0}] and details [{1}]", oResult.ErrorMessage, oResult.ErrorDetails) + MsgBox($"Die Datei wurde nicht verarbeitet.{vbNewLine}{vbNewLine}Fehler: {oResult.ErrorMessage}", MsgBoxStyle.Critical, Text) + Return False + End If - Return True Catch ex As Exception Logger.Error(ex) MsgBox("Indexierung fehlgeschlagen!", MsgBoxStyle.Critical, Text) @@ -793,6 +809,7 @@ Public Class frmGlobix_Index Exit Sub End If + Logger.Info("Importing file with DocumentType [{0}]", oDokart.Name) Dim oResult = Await GlobixFlowNew(oDokart) If oResult = True Then DocumentViewer1.CloseDocument() @@ -806,4 +823,9 @@ Public Class frmGlobix_Index Private Sub PreviewItem_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles PreviewItem.CheckedChanged SetFilePreview(PreviewItem.Checked) End Sub + + Private Sub checkItemTopMost_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles checkItemTopMost.CheckedChanged + My.UIConfig.Globix.TopMost = checkItemTopMost.Checked + My.UIConfigManager.Save() + End Sub End Class diff --git a/GUIs.ZooFlow/ModuleHelpers.vb b/GUIs.ZooFlow/ModuleHelpers.vb index 8dd33e65..4b69b50a 100644 --- a/GUIs.ZooFlow/ModuleHelpers.vb +++ b/GUIs.ZooFlow/ModuleHelpers.vb @@ -35,7 +35,9 @@ Module ModuleHelpers Dim connectionString As String = "" Try Dim oSQL = "SELECT * FROM TBDD_CONNECTION WHERE GUID = " & id - Dim DTConnection As DataTable = clsDataASorDB.GetDatatable("DD_ECM", oSQL, "TBDD_CONNECTION", "GUID = " & id, "") + Dim DTConnection As DataTable = My.Database.GetDatatable("TBDD_CONNECTION", oSQL, Modules.EDMI.API.Constants.DatabaseType.ECM, $"GUID = {id}") + + If DTConnection.Rows.Count = 1 Then Dim CSType = DTConnection.Rows(0).Item("SQL_PROVIDER").ToString.ToUpper Select Case CSType diff --git a/GUIs.ZooFlow/ZooFlow.vbproj b/GUIs.ZooFlow/ZooFlow.vbproj index c72e2e58..252293fa 100644 --- a/GUIs.ZooFlow/ZooFlow.vbproj +++ b/GUIs.ZooFlow/ZooFlow.vbproj @@ -253,6 +253,12 @@ + + frmWaitForm.vb + + + Form + True @@ -432,6 +438,9 @@ frmGlobixNameconvention.vb + + frmWaitForm.vb + frmFlowSearch.vb diff --git a/GUIs.ZooFlow/frmFlowForm.vb b/GUIs.ZooFlow/frmFlowForm.vb index 7b83e99f..290c8701 100644 --- a/GUIs.ZooFlow/frmFlowForm.vb +++ b/GUIs.ZooFlow/frmFlowForm.vb @@ -22,7 +22,6 @@ Public Class frmFlowForm ' Common Helpers Classes Private Init As ClassInit - Private AppServerOrDB As ClassDataASorDB Private FileClass As Filesystem.File ' Globix Helper Classes @@ -69,9 +68,6 @@ Public Class frmFlowForm ' === Show Splash Screen === SplashScreenManager.ShowForm(Me, GetType(frmSplash), False, False) - ' === Initialize AppServer Database Connection with Failover - AppServerOrDB = New ClassDataASorDB(My.LogConfig) - ' === Initialization === Init = New ClassInit(My.LogConfig, Me) AddHandler Init.Completed, AddressOf Init_Completed @@ -110,7 +106,7 @@ Public Class frmFlowForm AddHandler Watcher.ClipboardChanged, AddressOf Watcher_ClipboardChanged Dim oSQL = My.Queries.Common.FNIDB_GET_SEARCH_PROFILES(My.Application.User.UserId, My.Application.User.Language) - Dim oDatatable As DataTable = My.DatabaseIDB.GetDatatable(oSql) + Dim oDatatable As DataTable = My.DatabaseIDB.GetDatatable(oSQL) PictureBoxSearch1.Visible = False If Not IsNothing(oDatatable) OrElse oDatatable.Rows.Count > 0 Then IDBSearchActive = True @@ -161,9 +157,8 @@ Public Class frmFlowForm If My.Application.ModulesActive.Contains(MODULE_GLOBAL_INDEXER) Then FileDrop = New ClassFileDrop(My.LogConfig) - FileHandle = New ClassFilehandle() - FolderWatch = New ClassFolderwatcher() - 'Refresh_RegexTable() + FileHandle = New ClassFilehandle(My.LogConfig) + FolderWatch = New ClassFolderwatcher(My.LogConfig) Dim oFileExclusions As New ClassExclusions() If oFileExclusions.Load(My.Application.Globix.PATH_FileExclusions) = False Then @@ -180,17 +175,17 @@ Public Class frmFlowForm GlobixToolStripMenuItem.Visible = True End If - oSQL = "SELECT * FROM TBIDB_ATTRIBUTE" - My.Tables.DTIDB_ATTRIBUTE = AppServerOrDB.GetDatatable("IDB", oSQL, "TBIDB_ATTRIBUTE", "", "") + oSQL = "SELECT * FROM TBIDB_ATTRIBUTE" + My.Tables.DTIDB_ATTRIBUTE = My.Database.GetDatatable("TBIDB_ATTRIBUTE", "SELECT * FROM TBIDB_ATTRIBUTE", EDMI.API.Constants.DatabaseType.IDB) + Me.Cursor = Cursors.Default End Sub Public Sub Init_Folderwatch() Try Dim oSql As String = "SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE FOLDER_TYPE = 'DEFAULT' AND USER_ID = " & My.Application.User.UserId - - Dim oDT As DataTable = AppServerOrDB.GetDatatable("DD_ECM", oSql, "TBGI_FOLDERWATCH_USER", $"FOLDER_TYPE = 'DEFAULT' AND USER_ID = {My.Application.User.UserId}") + Dim oDT = My.Database.GetDatatable("TBGI_FOLDERWATCH_USER", oSql, EDMI.API.Constants.DatabaseType.ECM, $"FOLDER_TYPE = 'DEFAULT' AND USER_ID = {My.Application.User.UserId}") If oDT.Rows.Count = 0 Then 'Throw New ApplicationException("No Default Path configured for User!") @@ -204,7 +199,6 @@ Public Class frmFlowForm If oFolderWatchPath = String.Empty Then Logger.Info("Init_Folderwatch: folderwatchPath is empty") My.Application.Globix.Folderwatchstarted = False - 'SaveConfigValue("my.Application.Globix.Folderwatchstarted", "False") My.UIConfig.Globix.FolderWatchStarted = False My.UIConfigManager.Save() @@ -213,7 +207,6 @@ Public Class frmFlowForm If Not IO.Directory.Exists(oFolderWatchPath) Then Logger.Info("Init_Folderwatch: folderwatchPath does not exists or is invalid path") My.Application.Globix.Folderwatchstarted = False - 'SaveConfigValue("my.Application.Globix.Folderwatchstarted", "False") My.UIConfig.Globix.FolderWatchStarted = False My.UIConfigManager.Save() @@ -335,19 +328,6 @@ Public Class frmFlowForm Private Sub PictureBoxSearch1_Click(sender As Object, e As EventArgs) Handles PictureBoxSearch1.Click Open_FlowSearch() - 'Cursor = Cursors.WaitCursor - 'If TheFormIsAlreadyLoaded("frmSearchStart") Then - ' Cursor = Cursors.Default - ' Exit Sub - 'End If - - - 'Dim oForm As New frmSearchStart(DTIDB_SEARCHES) 'frmFlowSearch(osql) - 'oForm.Show() - 'Cursor = Cursors.Default - 'If TimerCheckActiveForms.Enabled = False Then - ' TimerCheckActiveForms.Enabled = True - 'End If End Sub Private Sub ZooFlowBeendenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ZooFlowBeendenToolStripMenuItem.Click @@ -474,46 +454,41 @@ Public Class frmFlowForm TimerCheckDroppedFiles.Start() Me.Cursor = Cursors.WaitCursor End If - - PictureBoxDragDrop.Image = My.Resources._1_LOGO_ZOO_FLOW1 End Sub Private Sub PictureBox1_DragDrop(sender As Object, e As DragEventArgs) Handles PictureBoxDragDrop.DragDrop DragDropForm(e) End Sub - Private Sub TimerCheckDroppedFiles_Tick(sender As Object, e As EventArgs) Handles TimerCheckDroppedFiles.Tick + Private Async Sub TimerCheckDroppedFiles_Tick(sender As Object, e As EventArgs) Handles TimerCheckDroppedFiles.Tick If Not My.Application.ModulesActive.Contains(ClassConstants.MODULE_GLOBAL_INDEXER) Then Exit Sub End If TimerCheckDroppedFiles.Stop() - Globix_Check_Dropped_Files() + Await Globix_Check_Dropped_Files() Me.Cursor = Cursors.Default End Sub - Sub Globix_Check_Dropped_Files() + Private Async Function Globix_Check_Dropped_Files() As Threading.Tasks.Task Try - My.DatabaseECM.ExecuteNonQuery("DELETE FROM TBGI_FILES_USER WHERE WORKED = 1 AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')") + Await My.DatabaseECM.ExecuteNonQueryAsync($"DELETE FROM TBGI_FILES_USER WHERE WORKED = 1 AND UPPER(USER@WORK) = UPPER('{Environment.UserName}')") Dim i As Integer - For Each Str As Object In FileDrop.files_dropped - If Not Str Is Nothing Then - Logger.Info(" Check Drop-File: " & Str.ToString) - Dim handleType As String = Str.Substring(0, Str.LastIndexOf("|") + 1) - Dim filename As String = Str.Substring(Str.LastIndexOf("|") + 1) + For Each pFile As String In FileDrop.files_dropped + If Not pFile Is Nothing Then + Logger.Info(" Check Drop-File: " & pFile.ToString) + Dim handleType As String = pFile.Substring(0, pFile.LastIndexOf("|") + 1) + Dim filename As String = pFile.Substring(pFile.LastIndexOf("|") + 1) If FileHandle.CheckDuplicateFiles(filename, "Manuelle Ablage") Then FileHandle.Decide_FileHandle(filename, handleType) i += 1 - Else - ' Console.WriteLine("File gibt es bereits") End If - End If Next Dim sql As String = "SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')" My.Application.Globix.DTACTUAL_FILES = Nothing - My.Application.Globix.DTACTUAL_FILES = My.DatabaseECM.GetDatatable(sql) + My.Application.Globix.DTACTUAL_FILES = Await My.DatabaseECM.GetDatatableAsync(sql) My.Application.Globix.ABORT_INDEXING = False Dim oOnlyFilesFromFilesystem = True @@ -530,17 +505,19 @@ Public Class frmFlowForm My.Application.Globix.DTACTUAL_FILES = My.DatabaseECM.GetDatatable(sql) End If - For Each oFileRow As DataRow In My.Application.Globix.DTACTUAL_FILES.Rows - Dim oFilePath As String = oFileRow.Item("FILENAME2WORK").ToString + For Each oRow As DataRow In My.Application.Globix.DTACTUAL_FILES.Rows + Dim oFilePath As String = oRow.Item("FILENAME2WORK").ToString + Dim oFileId As Integer = oRow.Item("GUID") My.Application.Globix.CurrentWorkfile = New Globix.Models.WorkFile With { - .Id = oFileRow.Item(0), + .Id = oFileId, .FilePath = oFilePath } Logger.Info(" CURRENT_WORKFILE: {0}", My.Application.Globix.CurrentWorkfile) If IO.File.Exists(My.Application.Globix.CurrentWorkfile.FilePath) = True And My.Application.Globix.DTACTUAL_FILES.Rows.Count > 0 Then Globix_Open_IndexDialog() + PictureBoxDragDrop.Image = My.Resources._1_LOGO_ZOO_FLOW1 End If Next Show() @@ -549,7 +526,7 @@ Public Class frmFlowForm Show() End Try - End Sub + End Function Sub Globix_Open_IndexDialog() Try IndexForm = New frmGlobix_Index(My.LogConfig) @@ -597,12 +574,6 @@ Public Class frmFlowForm End If If My.Application.Globix.CurrentFolderWatchPath <> "" Or My.Application.Globix.CURRENT_SCAN_FOLDERWATCH <> "" Then - 'If My.Application.Globix.Folderwatchstarted = True Then - ' tslblFW.Visible = True - 'Else - ' tslblFW.Visible = False - 'End If - Try If My.UIConfigManager.Config.Globix.FolderWatchScanStarted = True Then Logger.Info("FWSCAN started - Checking file:" & My.Application.Globix.CURRENT_SCAN_FOLDERWATCH) diff --git a/GUIs.ZooFlow/frmWaitForm.Designer.vb b/GUIs.ZooFlow/frmWaitForm.Designer.vb new file mode 100644 index 00000000..1a20c4c9 --- /dev/null +++ b/GUIs.ZooFlow/frmWaitForm.Designer.vb @@ -0,0 +1,83 @@ + _ +Partial Class frmWaitForm + Inherits DevExpress.XtraWaitForm.WaitForm + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.progressPanel1 = New DevExpress.XtraWaitForm.ProgressPanel() + Me.tableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() + Me.tableLayoutPanel1.SuspendLayout() + Me.SuspendLayout() + ' + 'progressPanel1 + ' + Me.progressPanel1.Appearance.BackColor = System.Drawing.Color.Transparent + Me.progressPanel1.Appearance.Options.UseBackColor = True + Me.progressPanel1.AppearanceCaption.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!) + Me.progressPanel1.AppearanceCaption.Options.UseFont = True + Me.progressPanel1.AppearanceDescription.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!) + Me.progressPanel1.AppearanceDescription.Options.UseFont = True + Me.progressPanel1.Dock = System.Windows.Forms.DockStyle.Fill + Me.progressPanel1.ImageHorzOffset = 20 + Me.progressPanel1.Location = New System.Drawing.Point(0, 17) + Me.progressPanel1.Margin = New System.Windows.Forms.Padding(0, 3, 0, 3) + Me.progressPanel1.Name = "progressPanel1" + Me.progressPanel1.Size = New System.Drawing.Size(246, 39) + Me.progressPanel1.TabIndex = 0 + Me.progressPanel1.Text = "progressPanel1" + ' + 'tableLayoutPanel1 + ' + Me.tableLayoutPanel1.AutoSize = True + Me.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent + Me.tableLayoutPanel1.ColumnCount = 1 + Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) + Me.tableLayoutPanel1.Controls.Add(Me.progressPanel1, 0, 0) + Me.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill + Me.tableLayoutPanel1.Location = New System.Drawing.Point(0, 0) + Me.tableLayoutPanel1.Name = "tableLayoutPanel1" + Me.tableLayoutPanel1.Padding = New System.Windows.Forms.Padding(0, 14, 0, 14) + Me.tableLayoutPanel1.RowCount = 1 + Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100.0!)) + Me.tableLayoutPanel1.Size = New System.Drawing.Size(246, 73) + Me.tableLayoutPanel1.TabIndex = 1 + ' + 'Form1 + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.AutoSize = True + Me.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ClientSize = New System.Drawing.Size(246, 73) + Me.Controls.Add(Me.tableLayoutPanel1) + Me.DoubleBuffered = True + Me.Name = "Form1" + Me.StartPosition = FormStartPosition.Manual + Me.Text = "Form1" + Me.tableLayoutPanel1.ResumeLayout(false) + Me.ResumeLayout(False) + Me.PerformLayout() + End Sub + + Private WithEvents progressPanel1 As DevExpress.XtraWaitForm.ProgressPanel + Private WithEvents tableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel +End Class diff --git a/GUIs.ZooFlow/frmWaitForm.resx b/GUIs.ZooFlow/frmWaitForm.resx new file mode 100644 index 00000000..9d1fc387 --- /dev/null +++ b/GUIs.ZooFlow/frmWaitForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/GUIs.ZooFlow/frmWaitForm.vb b/GUIs.ZooFlow/frmWaitForm.vb new file mode 100644 index 00000000..04b65efe --- /dev/null +++ b/GUIs.ZooFlow/frmWaitForm.vb @@ -0,0 +1,24 @@ +Public Class frmWaitForm + Sub New + InitializeComponent() + Me.progressPanel1.AutoHeight = True + End Sub + + Public Overrides Sub SetCaption(ByVal caption As String) + MyBase.SetCaption(caption) + Me.progressPanel1.Caption = caption + End Sub + + Public Overrides Sub SetDescription(ByVal description As String) + MyBase.SetDescription(description) + Me.progressPanel1.Description = description + End Sub + + Public Overrides Sub ProcessCommand(ByVal cmd As System.Enum, ByVal arg As Object) + MyBase.ProcessCommand(cmd, arg) + End Sub + + Public Enum WaitFormCommand + SomeCommandId + End Enum +End Class diff --git a/GUIs.ZooFlow/frmtest.vb b/GUIs.ZooFlow/frmtest.vb index b3e322ed..791f8b6f 100644 --- a/GUIs.ZooFlow/frmtest.vb +++ b/GUIs.ZooFlow/frmtest.vb @@ -4,6 +4,7 @@ Imports DigitalData.Modules.EDMI.API Imports System.IO Imports System.Text Imports DigitalData.Modules.EDMI.API.Client +Imports DigitalData.Modules.EDMI.API.EDMIServiceReference Public Class frmtest @@ -36,7 +37,7 @@ Public Class frmtest Private Async Sub btnImportFile_Click_(sender As Object, e As EventArgs) Handles btnImportFile.Click - Dim oObjectId As Long = Await My.Application.Service.Client.ImportFileAsync( + Dim oResponse As ImportFileResponse = Await My.Application.Service.Client.ImportFileAsync( txtFile2Import.Text, txtProfileId.Text, New List(Of EDMIServiceReference.UserAttributeValue) From { @@ -50,11 +51,13 @@ Public Class frmtest "DEFAULT" ) - If oObjectId <> INVALID_OBEJCT_ID Then + If oResponse.OK Then MsgBox("File Imported!", MsgBoxStyle.Information, Text) + txtIDB_OBJ_ID.Text = oResponse.ObjectId Else - MsgBox("File was not imported. Check the server logs!") + MsgBox("File was not imported. Check the server logs!", MsgBoxStyle.Critical, Text) End If - txtIDB_OBJ_ID.Text = oObjectId + + End Sub End Class \ No newline at end of file diff --git a/GUIs.ZooFlow/modCurrent.vb b/GUIs.ZooFlow/modCurrent.vb index 30120a91..7f8b8cf9 100644 --- a/GUIs.ZooFlow/modCurrent.vb +++ b/GUIs.ZooFlow/modCurrent.vb @@ -12,6 +12,5 @@ Module modCurrent Public Property NI_TITLE As String = "" Public Property NI_MESSAGE As String = "" Public Property NI_TYPE As String = "INFO" - Public Property clsDataASorDB As ClassDataASorDB Public Property GLOBIX_JUMP_DOCTYPE_ID As Integer End Module diff --git a/Modules.EDMIAPI/Client.vb b/Modules.EDMIAPI/Client.vb index 3db4c23f..b9d98da5 100644 --- a/Modules.EDMIAPI/Client.vb +++ b/Modules.EDMIAPI/Client.vb @@ -187,7 +187,7 @@ Public Class Client pObjectKind As String, pBusinessEntity As String, Optional pImportOptions As Options.ImportFileOptions = Nothing - ) As Task(Of Long) + ) As Task(Of ImportFileResponse) Try ' Set default options If pImportOptions Is Nothing Then @@ -233,16 +233,13 @@ Public Class Client .ProfileId = pProfileId, .AttributeValues = pAttributeValues.ToArray }) - If oFileImportResponse.OK = False Then - Throw New ApplicationException("Could not Import File Contents!") - End If - Return oFileImportResponse.ObjectId + Return oFileImportResponse End Using End Using Catch ex As Exception _logger.Error(ex) - Return INVALID_OBEJCT_ID + Return Nothing End Try End Function diff --git a/Modules.EDMIAPI/DatabaseWithFallback.vb b/Modules.EDMIAPI/DatabaseWithFallback.vb index 716a7d5b..63dea9d3 100644 --- a/Modules.EDMIAPI/DatabaseWithFallback.vb +++ b/Modules.EDMIAPI/DatabaseWithFallback.vb @@ -48,7 +48,7 @@ Public Class DatabaseWithFallback End Try If oTableResult Is Nothing OrElse oTableResult.OK = False Then - _Logger.Warn("Datatable [{0}] could not be fetched from AppServer Cache. Falling back to direct Database Access.") + _Logger.Warn("Datatable [{0}] could not be fetched from AppServer Cache. Falling back to direct Database Access.", pDataTableName) Return GetDatatableFromDatabase(pFallbackSQL, pFallbackType) End If diff --git a/Modules.Logging/LogConfig.vb b/Modules.Logging/LogConfig.vb index 081ffac1..73dc2824 100644 --- a/Modules.Logging/LogConfig.vb +++ b/Modules.Logging/LogConfig.vb @@ -101,6 +101,7 @@ Public Class LogConfig Private _config As LoggingConfiguration Private _isDebug As Boolean = False + Private _isTrace As Boolean = False #End Region #Region "Public Properties" @@ -139,7 +140,17 @@ Public Class LogConfig End Get Set(isDebug As Boolean) _isDebug = isDebug - ReloadConfig(isDebug) + ReloadConfig(isDebug, _isTrace) + End Set + End Property + + Public Property Trace As Boolean + Get + Return _isTrace + End Get + Set(isTrace As Boolean) + _isTrace = isTrace + ReloadConfig(_isDebug, isTrace) End Set End Property @@ -467,7 +478,8 @@ Public Class LogConfig ''' Reconfigures and re-adds all loggers, optionally adding the debug rule. ''' ''' Adds the Debug rule if true. - Private Sub ReloadConfig(Optional Debug As Boolean = False) + ''' Adds the Trace rule if true. + Private Sub ReloadConfig(Optional Debug As Boolean = False, Optional Trace As Boolean = False) ' Clear Logging Rules _config.LoggingRules.Clear() @@ -476,11 +488,14 @@ Public Class LogConfig ' Add debug rule, if configured If Debug Then - _config.AddRuleForAllLevels(TARGET_TRACE) _config.AddRule(LogLevel.Debug, LogLevel.Error, TARGET_DEBUG) _config.AddRule(LogLevel.Debug, LogLevel.Error, TARGET_MEMORY) End If + If Trace Then + _config.AddRuleForAllLevels(TARGET_TRACE) + End If + ' Reload all running loggers LogFactory.ReconfigExistingLoggers() End Sub diff --git a/Modules.ZooFlow/Environment.vb b/Modules.ZooFlow/Environment.vb index 497c32c9..2a010237 100644 --- a/Modules.ZooFlow/Environment.vb +++ b/Modules.ZooFlow/Environment.vb @@ -1,10 +1,10 @@ Imports DigitalData.Modules.Database Public Class Environment - Public User As State.UserState - Public Settings As State.SettingsState - Public Service As State.ServiceState - Public Database As MSSQLServer - Public DatabaseIDB As MSSQLServer - Public Modules As Dictionary(Of String, State.ModuleState) + Public Property User As State.UserState + Public Property Settings As State.SettingsState + Public Property Service As State.ServiceState + Public Property Database As MSSQLServer + Public Property DatabaseIDB As MSSQLServer + Public Property Modules As Dictionary(Of String, State.ModuleState) End Class diff --git a/Service.EDMIService/Methods/AttributeValue.vb b/Service.EDMIService/Methods/AttributeValue.vb index fee681e5..f34631c9 100644 --- a/Service.EDMIService/Methods/AttributeValue.vb +++ b/Service.EDMIService/Methods/AttributeValue.vb @@ -16,6 +16,10 @@ Public Overrides Function ToString() As String Return Name End Function + + Public Overrides Function GetHashCode() As Integer + Return Name.GetHashCode() + End Function End Class Public Class AutoAttributeValue diff --git a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb index a81f029a..040ce527 100644 --- a/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb +++ b/Service.EDMIService/Methods/GlobalIndexer/ImportFile/ImportFileMethod.vb @@ -121,8 +121,8 @@ Namespace Methods.GlobalIndexer.ImportFile Dim oAutoAttributeDict = Helpers.UserAttributesToDictionary(pAutoAttributes) If pPathConvention Is Nothing OrElse pPathConvention = String.Empty Then - Logger.Warn("Virtual path template for File [{0}] was empty. Returning empty string.", pFileInfo.Name) - Return String.Empty + Logger.Warn("Virtual path template for File [{0}] was empty. Returning nothing.", pFileInfo.Name) + Return Nothing End If diff --git a/Service.EDMIService/Methods/GlobalIndexer/Loader.vb b/Service.EDMIService/Methods/GlobalIndexer/Loader.vb index f6b6e773..e49e8b58 100644 --- a/Service.EDMIService/Methods/GlobalIndexer/Loader.vb +++ b/Service.EDMIService/Methods/GlobalIndexer/Loader.vb @@ -119,16 +119,16 @@ Namespace Methods.GlobalIndexer For Each oRow As DataRow In oManualIndexes.Table.Rows Dim oManualIndex As New ManualIndex With { - .Id = oRow.ItemEx(Of Integer)("GUID"), - .Name = oRow.ItemEx(Of String)("INDEXNAME"), - .ProfileId = oRow.ItemEx(Of Integer)("DOCTYPE_ID"), - .IsOptional = oRow.ItemEx(Of Boolean)("OPTIONAL"), - .IsMultiselect = oRow.ItemEx(Of String)("MULTISELECT"), - .SQLCommand = oRow.ItemEx(Of String)("SQL_RESULT"), - .SQLConnectionId = oRow.ItemEx(Of Integer)("CONNECTION_ID"), - .DefaultValue = oRow.ItemEx(Of String)("DEFAULT_VALUE"), - .DataType = oRow.ItemEx(Of String)("DATA_TYPE") - } + .Id = oRow.ItemEx(Of Integer)("GUID"), + .Name = oRow.ItemEx(Of String)("INDEXNAME"), + .ProfileId = oRow.ItemEx(Of Integer)("DOK_ID"), + .IsOptional = oRow.ItemEx(Of Boolean)("OPTIONAL"), + .IsMultiselect = oRow.ItemEx(Of String)("MULTISELECT"), + .SQLCommand = oRow.ItemEx(Of String)("SQL_RESULT"), + .SQLConnectionId = oRow.ItemEx(Of Integer)("CONNECTION_ID"), + .DefaultValue = oRow.ItemEx(Of String)("DEFAULT_VALUE"), + .DataType = oRow.ItemEx(Of String)("DATATYPE") + } oIndexes.Add(oManualIndex) Next