This commit is contained in:
2024-08-29 10:32:17 +02:00

View File

@@ -259,38 +259,44 @@ Public Class cDATENSERVER
End Function
Public Shared Function replaceInvalidCahr(ByRef s As String) As String
Try
s = s.Replace("", "I")
s = s.Replace("İ", "I")
s = s.Replace("ı", "i")
s = s.Replace("", "E")
s = s.Replace(",", ".")
s = s.Replace("'", "")
s = s.Replace("´", "")
s = s.Replace("^", "") ' Es gibt Ü, die so geschreiben werden: Ü ....
s = s.Replace("Ì", ".")
s = s.Replace("", "U") ' .... das zum Beispiel
s = s.Replace("А", "A") 'cyrillic A
s = s.Replace("Р", "P") 'cyrillic P
s = s.Replace("С", "C") 'cyrillic C
s = s.Replace("Т", "T") 'cyrillic T
s = s.Replace("Ѕ", "S") 'cyrillic S
s = s.Replace("І", "I") 'cyrillic I
s = s.Replace("Ј", "J") 'cyrillic J
s = s.Replace("Е", "E") 'cyrillic E
s = s.Replace("?", "")
s = s.Replace("", "I")
s = s.Replace("İ", "I")
s = s.Replace("ı", "i")
s = s.Replace("", "E")
s = s.Replace(",", ".")
s = s.Replace("'", "")
s = s.Replace("´", "")
s = s.Replace("^", "") ' Es gibt Ü, die so geschreiben werden: Ü ....
s = s.Replace("Ì", ".")
s = s.Replace("", "U") ' .... das zum Beispiel
Dim temp = s
s = Regex.Replace(s, "[бБвгГдДёЁжЖзЗиИйЙкКлЛмнпПртфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяЯ]", "").Replace("""", "") 'REMOVE cyrillic letters
'If s = "" Then s = temp
s = s.Replace("А", "A") 'cyrillic A
s = s.Replace("Р", "P") 'cyrillic P
s = s.Replace("С", "C") 'cyrillic C
s = s.Replace("Т", "T") 'cyrillic T
s = s.Replace("Ѕ", "S") 'cyrillic S
s = s.Replace("І", "I") 'cyrillic I
s = s.Replace("Ј", "J") 'cyrillic J
s = s.Replace("Е", "E") 'cyrillic E
s = s.Replace("?", "")
Dim tempBytes = System.Text.Encoding.GetEncoding("ISO-8859-8").GetBytes(s)
s = System.Text.Encoding.UTF8.GetString(tempBytes)
s = s.Replace("<EFBFBD>", "")
s = s.Replace("?", "")
Dim temp = s
s = Regex.Replace(s, "[бБвгГдДёЁжЖзЗиИйЙкКлЛмнпПртфФхХцЦчЧшШщЩъЪыЫьЬэЭюЮяЯ]", "").Replace("""", "") 'REMOVE cyrillic letters
'If s = "" Then s = temp
Return s
Dim tempBytes = System.Text.Encoding.GetEncoding("ISO-8859-8").GetBytes(s)
s = System.Text.Encoding.UTF8.GetString(tempBytes)
s = s.Replace("<EFBFBD>", "")
s = s.Replace("?", "")
Return s
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Function
Public Function uploadDataToDATENSERVER(srcPath, Optional bezeichnung = "", Optional endung = "", Optional allowMsg = True, Optional coll_archiv = False, Optional delteFromFileSystem = True, Optional enableOverwritting = False) As Boolean
@@ -479,7 +485,7 @@ Public Class cDATENSERVER
End Using
Return False
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Return da_id
End Function
@@ -578,7 +584,7 @@ Public Class cDATENSERVER
'SQL.doSQL("DELETE FROM [tblDatenarchiv_Collection] WHERE [coll_daId]=" & id & " ", "FMZOLL")
End If
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
Return False
End Try
Return True
@@ -1059,7 +1065,7 @@ Public Class cFormularManager
image.SetAbsolutePosition(bc.x, pagesize.Top - bc.y)
over.AddImage(image)
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Next
End If
@@ -1079,7 +1085,7 @@ Public Class cFormularManager
pdf.Close()
Return destPath
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
Return ""
End Try
@@ -1248,8 +1254,99 @@ Public Class cFormularManager
Public Shared Sub PrintViaSpirePDF(PDFFile As String(), Optional printerName As String = "")
'---------------------WEGEN PERFORMANCE-PROBLEMEN DEAKTIVIERT!
'Try
' Dim printerPaperSizeA4 As Boolean = False
' If printerName = "" Then
' Dim sPrinters As ArrayList
' If VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_LIST IsNot Nothing Then
' sPrinters = VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_LIST
' Else
' sPrinters = New ArrayList
' For Each sPrinter As String In System.Drawing.Printing.PrinterSettings.InstalledPrinters
' sPrinters.Add(sPrinter)
' Next
' End If
' If VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD <> String.Empty Then
' For Each printer In sPrinters
' If printer.ToString.ToLower.Contains(VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD.ToLower) Then
' printerName = printer
' For Each installedPrinter In System.Drawing.Printing.PrinterSettings.InstalledPrinters
' If printerName = installedPrinter.ToString Then
' Dim currentInstalledPrinter As New System.Drawing.Printing.PrinterSettings
' currentInstalledPrinter.PrinterName = printerName
' For Each sizes In currentInstalledPrinter.PaperSizes
' If sizes.PaperName = "A4" Then
' printerPaperSizeA4 = True
' Exit For
' End If
' Next
' Exit For
' End If
' Next
' Exit For
' End If
' Next
' End If
' End If
' If printerName = "" Then
' Dim oPS As New System.Drawing.Printing.PrinterSettings
' printerName = oPS.PrinterName
' For Each sizes In oPS.PaperSizes
' If sizes.PaperName = "A4" Then printerPaperSizeA4 = True
' Exit For
' Next
' Else
' If Not printerPaperSizeA4 Then
' Dim currentInstalledPrinter As New System.Drawing.Printing.PrinterSettings
' currentInstalledPrinter.PrinterName = printerName
' For Each sizes In currentInstalledPrinter.PaperSizes
' If sizes.PaperName = "A4" Then printerPaperSizeA4 = True
' Exit For
' Next
' End If
' End If
' If printerName = "" Then
' MsgBox("Drucker konnte nicht ermittelt werden!")
' Exit Sub
' End If
' If Not printerPaperSizeA4 Then
' MsgBox("Der ermittelte Drucker " & printerName & " unterstützt keinen A4 Ausdrucke!" & vbNewLine & "Vorang wird abgebrochen!")
' Exit Sub
' End If
' VERAG_PROG_ALLGEMEIN.cProgramFunctions.spireLoadLicense()
' For Each pdfPath In PDFFile
' Dim doc As New Spire.Pdf.PdfDocument(pdfPath)
' doc.PageSettings.Size = Spire.Pdf.PdfPageSize.A4
' doc.PageSettings.Orientation = Spire.Pdf.PdfPageOrientation.Landscape
' doc.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.FitSize, True)
' doc.PrintSettings.PrinterName = printerName
' If doc.PrintSettings.IsValid Then
' doc.Print()
' Else
' MsgBox("Druckereinstellungen ungültig!")
' Exit Sub
' End If
' Next
Try
Dim printerPaperSizeA4 As Boolean = False
If printerName = "" Then
Dim sPrinters As ArrayList
@@ -1264,52 +1361,24 @@ Public Class cFormularManager
If VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD <> String.Empty Then
For Each printer In sPrinters
If printer.ToString.ToLower.Contains(VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD.ToLower) Then
printerName = printer
For Each installedPrinter In System.Drawing.Printing.PrinterSettings.InstalledPrinters
If printerName = installedPrinter.ToString Then
Dim currentInstalledPrinter As New System.Drawing.Printing.PrinterSettings
currentInstalledPrinter.PrinterName = printerName
For Each sizes In currentInstalledPrinter.PaperSizes
If sizes.PaperName = "A4" Then printerPaperSizeA4 = True
Exit For
Next
Exit For
End If
Next
Exit For
For i As Integer = 0 To sPrinters.Count - 1
If i.ToString.ToLower.Contains(VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD.ToLower) Then
printerName = i
End If
Next
End If
If printerName = "" Then
Dim oPS As New System.Drawing.Printing.PrinterSettings
printerName = oPS.PrinterName
End If
End If
If printerName = "" Then
Dim oPS As New System.Drawing.Printing.PrinterSettings
printerName = oPS.PrinterName
For Each sizes In oPS.PaperSizes
If sizes.PaperName = "A4" Then printerPaperSizeA4 = True
Exit For
Next
Else
If Not printerPaperSizeA4 Then
Dim currentInstalledPrinter As New System.Drawing.Printing.PrinterSettings
currentInstalledPrinter.PrinterName = printerName
For Each sizes In currentInstalledPrinter.PaperSizes
If sizes.PaperName = "A4" Then printerPaperSizeA4 = True
Exit For
Next
End If
End If
'Dim docs As Spire.Pdf.PdfDocument() = {New Spire.Pdf.PdfDocument("C:\Users\DEVELOPER1\Desktop\Agrotel.pdf")}
If printerName = "" Then
MsgBox("Drucker konnte nicht ermittelt werden!")
Exit Sub
End If
Exit Sub
End If
'If Not printerPaperSizeA4 Then
@@ -1326,42 +1395,13 @@ Public Class cFormularManager
doc.PageSettings.Orientation = Spire.Pdf.PdfPageOrientation.Landscape
doc.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.FitSize, True)
doc.PrintSettings.PrinterName = printerName
doc.Print()
If doc.PrintSettings.IsValid Then
doc.Print()
Else
MsgBox("Druckereinstellungen ungültig!")
Exit Sub
End If
'doc.PrintDocument.DefaultPageSettings.Landscape = True
'doc.PageScaling = Spire.Pdf.PdfPrintPageScaling.FitSize
'doc.PrinterName = printerName
'doc.PrintDocument.Print()
'Dim doc As New Spire.Pdf.PdfDocument
'doc.LoadFromFile(pdfPath)
'doc.Pages(0).TryCompressImage(0)
''signature.SetSignNameWidth(float width);
'doc.SaveToFile("C:\Users\DEVELOPER1\Desktop\TEST.pdf", 0, 0, Spire.Pdf.FileFormat.PDF)
'Dim doc2 As New Spire.Pdf.PdfDocument("C:\Users\DEVELOPER1\Desktop\TEST.pdf")
'doc2.PageSettings.Size = Spire.Pdf.PdfPageSize.A4
'doc2.PrintDocument.DefaultPageSettings.Landscape = True
'doc2.PageScaling = Spire.Pdf.PdfPrintPageScaling.FitSize
'doc2.PrinterName = printerName
'doc2.PrintDocument.Print()
Next
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Sub
@@ -1408,7 +1448,7 @@ Public Class cFormularManager
Next
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Sub
@@ -1451,7 +1491,7 @@ Public Class cFormularManager
Next
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Sub
@@ -1491,7 +1531,7 @@ Public Class cFormularManager
Return targetPath
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Return ""
End Function
@@ -1588,7 +1628,7 @@ Public Class cFormularManager
'End Using
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Sub
@@ -2004,7 +2044,7 @@ Public Class DATENVERVER_OPTIONS
IO.File.Copy(pfad, tmpPath)
Return tmpPath
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Return pfad
End Function
@@ -2016,7 +2056,7 @@ Public Class DATENVERVER_OPTIONS
IO.File.Copy(pfad, tmpPath)
Return tmpPath
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Return pfad
End Function
@@ -2219,7 +2259,7 @@ Public Class DATENVERVER_OPTIONS
Return targetPath
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Return ""
End Function