This commit is contained in:
2021-12-14 17:28:39 +01:00
26 changed files with 484 additions and 239 deletions

View File

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

View File

@@ -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
''' <summary>
''' 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
''' <summary>
'''' Ersetzt alle nicht zulässigen Zeichen im angegebenen Dateinamen
'''' </summary>
'''' <param name="sFilename">Dateiname ohne Pfadangabe</param>
'''' <param name="sChar">Ersatzzeichen für alle unzulässigen Zeichen
'''' im Dateinamen</param>
'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

View File

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

View File

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

View File

@@ -4,8 +4,18 @@
Public Property DocTypeName As String
Public Property DocTypeId As Integer
''' <summary>
''' WD_INDEX, Name of the Attribute
''' </summary>
Public Property Name As String
Public Property Comment As String
''' <summary>
''' INDEXNAME, Internal Name for Admin
''' </summary>
Public Property InternalName As String
''' <summary>
''' COMMENT, Caption in Index Form
''' </summary>
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

View File

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

View File

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

View File

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