ms 13_01_16

This commit is contained in:
SchreiberM
2016-01-13 16:35:58 +01:00
parent c069274020
commit 2a36cc2a79
32 changed files with 1193 additions and 869 deletions

View File

@@ -525,7 +525,7 @@ Public Class frmIndex
Next
newCMB.Size = New Size(newWidth, 27)
newCMB.AutoCompleteSource = AutoCompleteSource.ListItems
newCMB.AutoCompleteMode = AutoCompleteMode.SuggestAppend
newCMB.AutoCompleteMode = AutoCompleteMode.Suggest
newCMB.DropDownHeight = (newCMB.ItemHeight + 0.2) * 25
If Vorgabe <> "" Then
newCMB.SelectedIndex = newCMB.FindStringExact(Vorgabe)
@@ -625,7 +625,7 @@ Public Class frmIndex
newASTextbox.AutoCompleteCustomSource.Add(r.Item(0).ToString)
Next
With newASTextbox
.AutoCompleteMode = AutoCompleteMode.SuggestAppend
.AutoCompleteMode = AutoCompleteMode.Suggest
.AutoCompleteSource = AutoCompleteSource.CustomSource
End With
Else
@@ -731,7 +731,7 @@ Public Class frmIndex
Next
cmb.Size = New Size(newWidth, 27)
cmb.AutoCompleteSource = AutoCompleteSource.ListItems
cmb.AutoCompleteMode = AutoCompleteMode.SuggestAppend
cmb.AutoCompleteMode = AutoCompleteMode.Suggest
End If
If connectionString.Contains("Initial Catalog=") Then
Try
@@ -921,7 +921,7 @@ Public Class frmIndex
Dim err As Boolean = False
Dim folder_Created As Boolean = False
Dim Zielordner As String
Dim extension As String = Path.GetExtension(CURRENT_WORKFILE)
Dim extension As String = System.IO.Path.GetExtension(CURRENT_WORKFILE)
Dim DT As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBDD_DOKUMENTART WHERE GUID = " & CURRENT_DOKART_ID)
sql_history_INSERT_INTO = "INSERT INTO TBGI_HISTORY (FILENAME_ORIGINAL,FILENAME_NEW"
sql_history_Index_Values = ""
@@ -929,15 +929,8 @@ Public Class frmIndex
CURR_DOKART_WD_DIRECT = DT.Rows(0).Item("WINDREAM_DIRECT")
CURR_DOKART_OBJECTTYPE = DT.Rows(0).Item("OBJEKTTYP")
CURR_WORKFILE_EXTENSION = extension
If folder_Created = False Then
' Den Zielordner erstellen
Zielordner = DT.Rows(0).Item("ZIEL_PFAD")
If Directory.Exists(Zielordner) = False Then
'Try to create the directory.
Directory.CreateDirectory(Zielordner)
End If
folder_Created = True
End If
Zielordner = DT.Rows(0).Item("ZIEL_PFAD")
'####
' Regulären Ausdruck zum Auslesen der Indexe definieren
Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
@@ -970,11 +963,11 @@ Public Class frmIndex
Dim result As MsgBoxResult
result = MessageBox.Show("Achtung der optionale Index ist leer, wird aber für die Benennung der Datei benutzt." & vbNewLine & "Wollen Sie stattdessen den Originaldateinamen verwenden?", "Bestätigung erforderlich:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.Yes Then
DATEINAME = DATEINAME.Replace(element.Value, Path.GetFileNameWithoutExtension(CURRENT_WORKFILE))
DATEINAME = DATEINAME.Replace(element.Value, System.IO.Path.GetFileNameWithoutExtension(CURRENT_WORKFILE))
NewFileString = DATEINAME
sql_history_INSERT_INTO = sql_history_INSERT_INTO & ", INDEX" & AnzahlIndexe.ToString
AnzahlIndexe += 1
sql_history_Index_Values = sql_history_Index_Values & ", '" & Path.GetFileNameWithoutExtension(CURRENT_WORKFILE) & "'"
sql_history_Index_Values = sql_history_Index_Values & ", '" & System.IO.Path.GetFileNameWithoutExtension(CURRENT_WORKFILE) & "'"
Else
DATEINAME = DATEINAME.Replace(element.Value, value)
NewFileString = DATEINAME
@@ -1024,7 +1017,7 @@ Public Class frmIndex
Case "DD_MM_YYYY"
datetemp = _day & "_" & _Month & "_" & My.Computer.Clock.LocalTime.Year
Case "OFilename"
DATEINAME = DATEINAME.Replace(element.Value, Path.GetFileNameWithoutExtension(CURRENT_WORKFILE))
DATEINAME = DATEINAME.Replace(element.Value, System.IO.Path.GetFileNameWithoutExtension(CURRENT_WORKFILE))
End Select
If datetemp <> "" Then
DATEINAME = DATEINAME.Replace(element.Value, datetemp)
@@ -1059,6 +1052,15 @@ Public Class frmIndex
End Select
Next
CURRENT_NEWFILENAME = NewFileString & extension
Dim path = System.IO.Path.GetDirectoryName(CURRENT_NEWFILENAME)
If folder_Created = False Then
' Den Zielordner erstellen
If Directory.Exists(path) = False Then
'Try to create the directory.
Directory.CreateDirectory(path)
End If
folder_Created = True
End If
'False oder True zurückgeben
If err = False Then
Return True
@@ -1087,7 +1089,7 @@ Public Class frmIndex
Dim indexname = row.Item("WD_INDEX").ToString
Dim optional_Index = CBool(row.Item("OPTIONAL"))
If CBool(row.Item("Indexiert")) = True And idxvalue.ToString <> "" Then
If indexname <> "" And optional_Index = False Then
If indexname <> String.Empty Then
'Den Indexwert zwischenspeichern
Dim DTTemp As DataTable = MyDataset.TBTEMP_INDEXRESULTS
Dim rowexists As Boolean = False
@@ -1122,7 +1124,8 @@ Public Class frmIndex
ClassLogger.Add(" >> No Indexing: is optional? " & optional_Index.ToString, False)
End If
End If
Else
ClassLogger.Add(" >> Indexvalue is empty or field is not indexed - Indexname: " & indexname, False)
End If
Next
@@ -1289,7 +1292,7 @@ Public Class frmIndex
Return indexierung_erfolgreich
End If
Catch ex As Exception
MsgBox("Error in SetEmailIndices:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
MsgBox("Error in SetEmailIndices:" & vbNewLine & ex.Message & vbNewLine & "Please check the configuration Email-Indexing!", MsgBoxStyle.Critical)
Return False
End Try
@@ -1539,11 +1542,11 @@ Public Class frmIndex
cmbDokumentart.DataSource = DT_DOKART
cmbDokumentart.ValueMember = DT_DOKART.Columns("DOCTYPE_ID").ColumnName
cmbDokumentart.DisplayMember = DT_DOKART.Columns("DOCTYPE").ColumnName
cmbDokumentart.AutoCompleteMode = AutoCompleteMode.SuggestAppend
cmbDokumentart.AutoCompleteMode = AutoCompleteMode.Suggest
cmbDokumentart.AutoCompleteSource = AutoCompleteSource.ListItems
Me.cmbDokumentart.SelectedIndex = -1
'If CURRENT_LASTDOKART <> "" Then
' cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(CURRENT_LASTDOKART)
'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(CURRENT_LASTDOKART)
'End If
Catch ex As Exception
ClassLogger.Add(" - Fehler beim Laden der Dokumentarten - Fehler: " & vbNewLine & ex.Message)
@@ -2017,7 +2020,22 @@ Public Class frmIndex
'Datei verschieben
err = Move_Rename_Only(CURRENT_WORKFILE, NewFileString, CURR_WORKFILE_EXTENSION, VERSION_DELIMITER)
Else
If CURRENT_NEWFILENAME.Contains("//") Then
CURRENT_NEWFILENAME = CURRENT_NEWFILENAME.Replace("//", "/")
End If
If CURRENT_NEWFILENAME.Contains("\\") Then
CURRENT_NEWFILENAME = CURRENT_NEWFILENAME.Replace("\\", "\")
End If
Dim exp2WD As Boolean = False
'Variable Folder
Dim sql As String = "SELECT FOLDER_FOR_INDEX FROM TBDD_DOKUMENTART WHERE GUID = " & CURRENT_DOKART_ID
Dim Folder_for_index = ClassDatabase.Execute_Scalar(sql, MyConnectionString, True)
If Not IsDBNull(Folder_for_index) Then
If Folder_for_index <> String.Empty Then
CrFolderForIndex(Folder_for_index)
End If
End If
If DropType = "@DROPFROMFSYSTEM@" Or DropType = "@OUTLOOK_ATTACHMENT@" Or DropType = "@ATTMNTEXTRACTED@" Or DropType = "@FW_SIMPLEINDEXER@" Then
exp2WD = SINGLEFILE_2_WINDREAM(CURR_DOKART_OBJECTTYPE)
ElseIf DropType = "@OUTLOOK_MESSAGE@" Or DropType = "@FW_MSGONLY@" Or DropType = "@MSGONLY@" Then
@@ -2031,13 +2049,7 @@ Public Class frmIndex
'Kein Fehler in Export2windream
err = False
If Write_Indizes() = True Then
Dim sql As String = "SELECT FOLDER_FOR_INDEX FROM TBDD_DOKUMENTART WHERE GUID = " & CURRENT_DOKART_ID
Dim Folder_for_index = ClassDatabase.Execute_Scalar(sql, MyConnectionString, True)
If Not IsDBNull(Folder_for_index) Then
If Folder_for_index <> String.Empty Then
CrFolderForIndex(CURRENT_NEWFILENAME, Folder_for_index)
End If
End If
'Kein Fehler in Setzen der windream-Indizes
@@ -2116,9 +2128,9 @@ Public Class frmIndex
End Try
End Sub
Private Function CrFolderForIndex(ByVal fullfilename As String, folderindex As String)
Private Function CrFolderForIndex(folderindex As String)
Try
Dim RootFolder As String = Path.GetDirectoryName(fullfilename)
Dim RootFolder As String = Path.GetDirectoryName(CURRENT_NEWFILENAME)
'######
Dim p_reg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
@@ -2199,83 +2211,9 @@ Public Class frmIndex
'Dim _folderArray As String()
'_folderArray = folderindex.Split("\")
''Für jeden Folder die maskierung entfernen
'For Each _Uordner As String In _folderArray
' Dim folder_temp
' If _Uordner.StartsWith("[%") Then
' Dim Indexwert As String
' folder_temp = _Uordner.Replace("[%", "")
' folder_temp = folder_temp.Replace("]", "")
' If LogErrorsOnly = False Then ClassLogger.Add(" ...CrFolder Ordner: '" & folder_temp & "'", False)
' 'Den Indexwert auslesen
' Try
' If LogErrorsOnly = False Then ClassLogger.Add(" ...Versuch den Indexwert aus '" & CStr(folder_temp) & "' auszulesen.", False)
' Indexwert = GetManIndex_Value(folder_temp)
' If LogErrorsOnly = False Then ClassLogger.Add(" ...Ergebnis/Wert für neuen Ordner: '" & CStr(Indexwert) & "'", False)
' Catch ex As Exception
' ClassLogger.Add("Der Index '" & folder_temp & "' ist nicht gefüllt oder es trat ein Fehler beim Auslesen der Indexwerte auf", True)
' Return True
' End Try
' If Not Indexwert = String.Empty Then
' If IsDate(Indexwert) Then
' Indexwert = CDate(Indexwert).ToString("yyyyMMdd")
' End If
' newFolder = newFolder & Indexwert & "\"
' If LogErrorsOnly = False Then ClassLogger.Add(" ...newFolder: '" & newFolder & "'", False)
' Else
' Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & CURRENT_DOKART_ID & " AND UPPER(NAME) = UPPER('" & CStr(folder_temp) & "')", MyConnectionString, True)
' If optional_index = True Then
' If LogErrorsOnly = False Then ClassLogger.Add(" ...Optionaler Indexwert ist NICHT gefüllt", False)
' Else
' ClassLogger.Add(" - Achtung Ausnahme in 'CrFolderForIndex': der Index ist leer!", True)
' Return True
' End If
' End If
' End If
' 'Überprüfen ob es ein Variable Ordneranlage sein soll (DATUM)
' If _Uordner.StartsWith("[V%") Then
' Dim _Month As String = My.Computer.Clock.LocalTime.Month
' If _Month.Length = 1 Then
' _Month = "0" & _Month
' End If
' Dim _day As String = My.Computer.Clock.LocalTime.Day
' If _day.Length = 1 Then
' _day = "0" & _day
' End If
' Dim type = _Uordner.Replace("[V%", "")
' type = type.Replace("]", "")
' Select Case type
' Case "YYYY/MM/DD"
' folder_temp = My.Computer.Clock.LocalTime.Year & "\" & _Month & "\" & _day
' newFolder = newFolder & folder_temp & "\"
' Case "YYYY/MM"
' folder_temp = My.Computer.Clock.LocalTime.Year & "\" & _Month
' newFolder = newFolder & folder_temp & "\"
' Case "YYYY"
' folder_temp = My.Computer.Clock.LocalTime.Year
' newFolder = newFolder & folder_temp & "\"
' Case "YYYY-MM"
' folder_temp = My.Computer.Clock.LocalTime.Year & "-" & _Month
' newFolder = newFolder & folder_temp & "\"
' End Select
' End If
' 'Überprüfen ob es ein manueller Ordner ist
' If _Uordner.StartsWith("[MF%") Then
' folder_temp = _Uordner.Replace("[MF%", "")
' folder_temp = folder_temp.Replace("]", "")
' newFolder = newFolder & folder_temp & "\"
' End If
'Next
If LogErrorsOnly = False Then ClassLogger.Add(" >> Den Root-Folder zusammenfügen>> ", False)
Dim fullpath As String = RootFolder & "\" & folderindex & "\"
fullpath.Replace("\\", "\")
fullpath = fullpath.Replace("\\", "\")
If LogErrorsOnly = False Then ClassLogger.Add(" >> Fullpath (mit evtl. Sonderzeichen (SZ)) '" & fullpath & "'", False)
Dim invalidPathChars() As Char = Path.GetInvalidPathChars()
For Each sonderChar As Char In invalidPathChars
@@ -2288,18 +2226,27 @@ Public Class frmIndex
Next sonderChar
If LogErrorsOnly = False Then ClassLogger.Add(" >> Fullpath (ohne SZ) '" & fullpath & "'", False)
If Directory.Exists(fullpath) = False Then
Directory.CreateDirectory(fullpath)
If LogErrorsOnly = False Then ClassLogger.Add(" >> Folder '" & fullpath & "' wurde angelegt", False)
Try
Directory.CreateDirectory(fullpath)
If LogErrorsOnly = False Then ClassLogger.Add(" >> Folder '" & fullpath & "' wurde angelegt", False)
Catch ex As Exception
ClassLogger.Add(" >> Error in CreateFolderforIndex-Method - Root Folder '" & fullpath & "' could not be created. " & ex.Message, True)
MsgBox("Attention: Root Folder '" & fullpath & "' could not be created." & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return False
End Try
End If
'Die aktuelle Datei soll gleichzeitig verschoben werden
Dim extension As String = Path.GetExtension(fullfilename)
Dim Dateiname As String = Path.GetFileName(fullfilename)
Dim extension As String = Path.GetExtension(CURRENT_NEWFILENAME)
Dim Dateiname As String = Path.GetFileName(CURRENT_NEWFILENAME)
Dim _Pfad, _WDLaufwerk, _Ziel As String
_Ziel = fullpath & Dateiname
If LogErrorsOnly = False Then ClassLogger.Add(" >> Ziel: " & _Ziel, False)
'Nur verschieben und überprüfen wenn Pfad ungleich
If Path.GetDirectoryName(fullfilename) <> Path.GetDirectoryName(_Ziel) Then
Dim quell = Path.GetDirectoryName(CURRENT_NEWFILENAME)
Dim ziel = Path.GetDirectoryName(_Ziel)
If quell <> ziel Then
Dim Stammname As String = _Ziel.Substring(0, _Ziel.LastIndexOf("."))
Dim version As Integer = 2
Do While File.Exists(_Ziel) = True
@@ -2308,17 +2255,19 @@ Public Class frmIndex
_Ziel = neuername
version = version + 1
Loop
My.Computer.FileSystem.MoveFile(fullfilename, _Ziel)
ClassLogger.Add(" >> Datei wurde nach CrFolderIndex-Methode erfolgreich verschoben", False)
CURRENT_NEWFILENAME = _Ziel
' My.Computer.FileSystem.MoveFile(fullfilename, _Ziel)
ClassLogger.Add(" >> Dateiname wurde nach CrFolderIndex-Methode erzeugt", False)
CURRENT_NEWFILENAME = _Ziel
Else
ClassLogger.Add(" >> (CrFolderForIndex) Quell- und Zielordner identisch", False)
If Path.GetFileName(fullfilename) <> Path.GetFileName(_Ziel) And File.Exists(_Ziel) Then
ClassLogger.Add(" >> (CrFolderForIndex) Quell- und Zielname nicht identisch", False)
FileSystem.Rename(_Ziel, Path.GetDirectoryName(_Ziel) & Path.GetFileName(fullfilename))
ClassLogger.Add(" >> Datei wurde nach CrFolderIndex-Methode umbenannt", False)
CURRENT_NEWFILENAME = _Ziel
End If
ClassLogger.Add(" >> Quell- und Zielordner identisch", False)
'ClassLogger.Add(" >> (CrFolderForIndex) Quell- und Zielordner identisch", False)
'If Path.GetFileName(fullfilename) <> Path.GetFileName(_Ziel) And File.Exists(_Ziel) Then
' ClassLogger.Add(" >> (CrFolderForIndex) Quell- und Zielname nicht identisch", False)
' FileSystem.Rename(_Ziel, Path.GetDirectoryName(_Ziel) & Path.GetFileName(fullfilename))
' ClassLogger.Add(" >> Datei wurde nach CrFolderIndex-Methode umbenannt", False)
' CURRENT_NEWFILENAME = _Ziel
'End If
End If
Return True
@@ -2328,6 +2277,7 @@ Public Class frmIndex
'End If
Catch ex As Exception
MsgBox("Unexpected Error in CreateFolderforIndex-Method:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
ClassLogger.Add(" >> Fehler in CrFolderForIndex: " & ex.Message, True)
Return False
End Try