MS24112015

This commit is contained in:
SchreiberM
2015-11-24 11:13:04 +01:00
parent 80247e18dd
commit ad1308fe18
47 changed files with 5379 additions and 1570 deletions

View File

@@ -58,7 +58,7 @@ Public Class frmIndex
pnlIndex.Controls.Add(lbl)
lbl.Location = New Point(11, ylbl)
End Sub
Sub AddTextBox(indexname As String, y As Integer, text As String)
Function AddTextBox(indexname As String, y As Integer, text As String)
Dim txt As New TextBox
txt.Name = "txt" & indexname
@@ -77,7 +77,8 @@ Public Class frmIndex
AddHandler txt.LostFocus, AddressOf OnTextBoxLostFocus
AddHandler txt.KeyUp, AddressOf OnTextBoxKeyUp
AddHandler txt.TextChanged, AddressOf OnTextBoxTextChanged
End Sub
Return txt
End Function
Public Sub OnTextBoxFocus(sender As System.Object, e As System.EventArgs)
Dim box As TextBox = sender
box.BackColor = Color.Lime
@@ -564,6 +565,102 @@ Public Class frmIndex
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Fehler bei AddVorschlag_ComboBox:")
End Try
End Sub
Private Sub AddAutoSuggest_Textbox(indexname As String, y As Integer, conid As Integer, sql_Vorschlag As String, Optional Vorgabe As String = "")
Try
Dim connectionString As String
Dim sqlCnn As SqlConnection
Dim sqlCmd As SqlCommand
Dim adapter As New SqlDataAdapter
Dim oracleConn As OracleConnection
Dim oracleCmd As OracleCommand
Dim oracleadapter As New OracleDataAdapter
Dim NewDataset As New DataSet
Dim i As Integer
Dim sql As String
Dim runinLZ As Boolean = False
connectionString = ClassFormFunctions.GetConnectionString(conid)
If connectionString Is Nothing = False Then
'SQL Befehl füllt die Auswahlliste
sql = sql_Vorschlag
If Not sql.Contains("@") Then
If connectionString.Contains("Initial Catalog=") Then
sqlCnn = New SqlConnection(connectionString)
sqlCnn.Open()
sqlCmd = New SqlCommand(sql, sqlCnn)
adapter.SelectCommand = sqlCmd
adapter.Fill(NewDataset)
ElseIf connectionString.StartsWith("Data Source=") And connectionString.Contains("SERVICE_NAME") Then
oracleConn = New OracleConnection(connectionString)
' Try
oracleConn.Open()
oracleCmd = New OracleCommand(sql_Vorschlag, oracleConn)
oracleadapter.SelectCommand = oracleCmd
oracleadapter.Fill(NewDataset)
End If
Else
runinLZ = True
If LogErrorsOnly = False Then ClassLogger.Add(" >>sql enthält Platzhalter und wird erst während der Laufzeit gefüllt!", False)
End If
Dim newASTextbox As TextBox
If runinLZ = True Then
'Die Standardcombobox anlegen
newASTextbox = AddTextBox(indexname, y, "")
newASTextbox.Size = New Size(300, 27)
Else
If NewDataset.Tables(0).Rows.Count > 0 Then
'Die Standardcombobox anlegen
newASTextbox = AddTextBox(indexname, y, "")
'Die Standargrösse definieren
Dim newWidth As Integer = 300
'LOOPING THE ROW OF DATA IN THE DATATABLE
For Each r In NewDataset.Tables(0).Rows
'ADDING THE DATA IN THE AUTO COMPLETE SOURCE OF THE TEXTBOX
newASTextbox.AutoCompleteCustomSource.Add(r.Item(0).ToString)
Next
With newASTextbox
.AutoCompleteMode = AutoCompleteMode.SuggestAppend
.AutoCompleteSource = AutoCompleteSource.CustomSource
End With
Else
End If
If connectionString.Contains("Initial Catalog=") Then
Try
adapter.Dispose()
sqlCmd.Dispose()
sqlCnn.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try
Else
Try
oracleadapter.Dispose()
oracleCmd.Dispose()
oracleConn.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try
End If
End If
End If
Catch ex As Exception
ClassLogger.Add(" - Unvorhergesehener Fehler bei AddAutoSuggest_Textbox - Indexname: " & indexname & " - Fehler: " & vbNewLine & ex.Message)
MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Fehler bei AddAutoSuggest_Textbox:")
End Try
End Sub
Private Sub Renew_ComboboxResults(INDEX_GUID As Integer, SearchString As String, Resultvalue As String)
Try
@@ -854,8 +951,7 @@ Public Class frmIndex
'####
' alle Vorkommen innerhalbd er Namenkonvention durchlaufen
For Each element As System.Text.RegularExpressions.Match In elemente
Console.WriteLine(element.Value)
Console.WriteLine(element.Value.Substring(2, 1).ToUpper)
Console.WriteLine(element.ToString)
Select Case element.Value.Substring(2, 1).ToUpper
'Manueller Indexwert
Case "M"
@@ -915,6 +1011,7 @@ Public Class frmIndex
_day = "0" & _day
End If
Dim type = element.Value '.ToUpper.Replace("[v%", "")
type = type.Replace("[%v_", "")
type = type.Replace("[%v", "")
type = type.Replace("]", "")
Select Case type
@@ -988,38 +1085,44 @@ Public Class frmIndex
For Each row As DataRow In DTMan.Rows
Dim idxvalue = row.Item("Indexwert")
Dim indexname = row.Item("WD_INDEX").ToString
Dim optional_Index = CBool(row.Item("OPTIONAL"))
If CBool(row.Item("Indexiert")) = True And idxvalue.ToString <> "" Then
'Den Indexwert zwischenspeichern
Dim DTTemp As DataTable = MyDataset.TBTEMP_INDEXRESULTS
Dim rowexists As Boolean = False
For Each rowTemp As DataRow In DTTemp.Rows
'Wenn bereits ein Eintrag existiert.....
If rowTemp.Item("Dokumentart") = row.Item("DOKUMENTART") And rowTemp.Item("Indexname") = row.Item("INDEXNAME") Then
rowexists = True
'......überschreiben
rowTemp.Item("Value") = row.Item("Indexwert")
If indexname <> "" And optional_Index = False Then
'Den Indexwert zwischenspeichern
Dim DTTemp As DataTable = MyDataset.TBTEMP_INDEXRESULTS
Dim rowexists As Boolean = False
For Each rowTemp As DataRow In DTTemp.Rows
'Wenn bereits ein Eintrag existiert.....
If rowTemp.Item("Dokumentart") = row.Item("DOKUMENTART") And rowTemp.Item("Indexname") = row.Item("INDEXNAME") Then
rowexists = True
'......überschreiben
rowTemp.Item("Value") = row.Item("Indexwert")
End If
Next
'.....ansonsten neu anlegen
If rowexists = False Then
Dim newRow As DataRow = DTTemp.NewRow()
newRow("Dokumentart") = row.Item("DOKUMENTART").ToString
newRow("Indexname") = row.Item("INDEXNAME").ToString
newRow("Value") = row.Item("Indexwert")
DTTemp.Rows.Add(newRow)
End If
If LogErrorsOnly = False Then ClassLogger.Add(" >> Manueller Indexvalue: " & idxvalue.ToString, False)
Count += 1
indexierung_erfolgreich = ClassWindream.DateiIndexieren(CURRENT_NEWFILENAME, indexname, idxvalue)
If indexierung_erfolgreich = False Then
MsgBox("Error in Indexing file - See log", MsgBoxStyle.Critical)
Return False
Exit For
End If
Else
If LogErrorsOnly = False Then
ClassLogger.Add(" >> No Indexing: indexname: " & indexname, False)
ClassLogger.Add(" >> No Indexing: is optional? " & optional_Index.ToString, False)
End If
Next
'.....ansonsten neu anlegen
If rowexists = False Then
Dim newRow As DataRow = DTTemp.NewRow()
newRow("Dokumentart") = row.Item("DOKUMENTART").ToString
newRow("Indexname") = row.Item("INDEXNAME").ToString
newRow("Value") = row.Item("Indexwert")
DTTemp.Rows.Add(newRow)
End If
If LogErrorsOnly = False Then ClassLogger.Add(" >> Manueller Indexvalue: " & idxvalue.ToString, False)
Count += 1
indexierung_erfolgreich = ClassWindream.DateiIndexieren(CURRENT_NEWFILENAME, indexname, idxvalue)
If indexierung_erfolgreich = False Then
MsgBox("Error in Indexing file - See log", MsgBoxStyle.Critical)
Return False
Exit For
End If
End If
Next
@@ -1511,6 +1614,7 @@ Public Class frmIndex
Case "INTEGER"
If DR.Item("SUGGESTION") = True And DR.Item("SQL_RESULT").ToString.Length > 0 Then
AddVorschlag_ComboBox(DR.Item("NAME"), y, DR.Item("CONNECTION_ID"), DR.Item("SQL_RESULT"), DefaultValue)
'AddAutoSuggest_Textbox(DR.Item("NAME"), y, DR.Item("CONNECTION_ID"), DR.Item("SQL_RESULT"), DefaultValue)
Else
Dim VORBELGUNG As Integer = DefaultValue
'nur eine Textbox
@@ -1519,6 +1623,7 @@ Public Class frmIndex
Case "VARCHAR"
If DR.Item("SUGGESTION") = True And DR.Item("SQL_RESULT").ToString.Length > 0 Then
AddVorschlag_ComboBox(DR.Item("NAME"), y, DR.Item("CONNECTION_ID"), DR.Item("SQL_RESULT"), DefaultValue)
'AddAutoSuggest_Textbox(DR.Item("NAME"), y, DR.Item("CONNECTION_ID"), DR.Item("SQL_RESULT"), DefaultValue)
Else
If DR.Item("NAME").ToString.ToLower = "dateiname" Then
'Übergibt den Dateinamen um diesen Vorzuschlagen
@@ -1691,10 +1796,10 @@ Public Class frmIndex
End If
Next
Case Else
If My.Settings.DoNot_Show_Documents = False And UniversalViewer <> "" Then
If File.Exists(UniversalViewer) Then
If My.Settings.DoNot_Show_Documents = False And UniversalViewer_Path <> "" Then
If File.Exists(UniversalViewer_Path) Then
Console.WriteLine(Path.GetExtension(CURRENT_WORKFILE))
Dim psi As New ProcessStartInfo(UniversalViewer, """" & CURRENT_WORKFILE & """")
Dim psi As New ProcessStartInfo(UniversalViewer_Path, """" & CURRENT_WORKFILE & """")
Proc.EnableRaisingEvents = True
Proc.StartInfo = psi
Proc.Start()
@@ -1706,12 +1811,14 @@ Public Class frmIndex
Else
Dim tempFilename = My.Computer.FileSystem.GetTempFileName()
Try
Me.grpBetreff.Dock = DockStyle.Top
Me.grpbxMailBody.Dock = DockStyle.Fill
Dim msg_email As New Msg.Message(CURRENT_WORKFILE)
'Eine tempfile generieren
Dim name = Path.GetFileNameWithoutExtension(tempFilename)
tempFilename = Path.Combine(Path.GetDirectoryName(tempFilename), name & ".html")
TEMP_FILES.Add(tempFilename)
If LogErrorsOnly = False Then ClassLogger.Add(" ...tempFilename: " & tempFilename, False)
'tempfile löschen
If My.Computer.FileSystem.FileExists(tempFilename) Then
@@ -1731,13 +1838,18 @@ Public Class frmIndex
'Catch ex As IOException
' MsgBox(ex.ToString)
'End Try
Dim vIn() As Byte
If IsNothing(msg_email.BodyHtml) Then
File.WriteAllText(tempFilename, msg_email.Body, System.Text.Encoding.UTF8)
Else
vIn = msg_email.BodyHtml
Dim vOut As String = System.Text.Encoding.UTF8.GetString(vIn)
File.WriteAllText(tempFilename, vOut, System.Text.Encoding.UTF8)
End If
Dim vIn() As Byte = msg_email.BodyHtml
Dim vOut As String = System.Text.Encoding.UTF8.GetString(vIn)
If LogErrorsOnly = False Then ClassLogger.Add(" ...byteData finished. Now write to file", False)
File.WriteAllText(tempFilename, vOut, System.Text.Encoding.UTF8)
If LogErrorsOnly = False Then ClassLogger.Add(" ...byteData and write to file finished.", False)
Catch ex As Exception
MsgBox("Unerwarteter Fehler bei getHTML from Email: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
MsgBox("Unexpected Error in getHTML from Email: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
CURRENT_HTML_DOC = tempFilename
@@ -1880,6 +1992,7 @@ Public Class frmIndex
Me.Cursor = Cursors.Default
If err = False Then
MsgBox("Alle Dateien wurden mit Multiindexing erfolgreich verarbeitet!", MsgBoxStyle.Information, "Erfolgsmeldung:")
DTACTUAL_FILES.Clear()
Me.Close()
End If
End If
@@ -2008,17 +2121,18 @@ Public Class frmIndex
Dim RootFolder As String = Path.GetDirectoryName(fullfilename)
'######
Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
Dim p_reg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
' einen Regulären Ausdruck laden
Dim regulärerAusdruck As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex(preg)
Dim regularExpression As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex(p_reg)
' die Vorkommen im Folder-String auslesen
Dim elemente As System.Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(folderindex)
Dim elemente As System.Text.RegularExpressions.MatchCollection = regularExpression.Matches(folderindex)
'####
' alle Vorkommen innerhalb des Ordnerstrings durchlaufen
For Each element As System.Text.RegularExpressions.Match In elemente
If LogErrorsOnly = False Then ClassLogger.Add(" >> Elementname in FolderString: '" & element.ToString & "'", False)
Console.WriteLine(element.ToString)
Select Case element.Value.Substring(2, 1).ToUpper
'Manueller Indexwert
Case "M"
Dim ManIndexname = element.Value.Substring(3, element.Value.Length - 4)
@@ -2062,6 +2176,9 @@ Public Class frmIndex
_day = "0" & _day
End If
Dim type = element.Value.Substring(3, element.Value.Length - 4)
If type.StartsWith("_") Then
type = type.Replace("_", "")
End If
Select Case type
Case "YYYY/MM/DD"
folder_temp = My.Computer.Clock.LocalTime.Year & "\" & _Month & "\" & _day