neu
This commit is contained in:
@@ -189,19 +189,29 @@ Public Class cDATENSERVER
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function replaceInvalidCahr(ByRef s)
|
||||
s = s.replace("İ", "I")
|
||||
s = s.replace("ı", "i")
|
||||
|
||||
|
||||
|
||||
Dim tempBytes = System.Text.Encoding.GetEncoding("ISO-8859-8").GetBytes(s)
|
||||
s = System.Text.Encoding.UTF8.GetString(tempBytes)
|
||||
|
||||
Return s
|
||||
End Function
|
||||
|
||||
Public Function uploadDataToDATENSERVER(srcPath, Optional bezeichnung = "", Optional endung = "", Optional allowMsg = True, Optional coll_archiv = False) As Boolean
|
||||
'LAST_ID = -1
|
||||
If endung = "" Then Dim fi As New IO.DirectoryInfo(srcPath) : endung = fi.Extension
|
||||
' If bezeichnung = "" Then bezeichnung = System.IO.Path.GetFileName(srcPath) : endung = ""
|
||||
If bezeichnung = "" Then bezeichnung = da_name
|
||||
replaceInvalidCahr(bezeichnung)
|
||||
|
||||
Dim destpath = DATENVERVER_OPTIONS.getDescPath(rootDir, da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_KundenNr, da_name, endung)
|
||||
|
||||
Dim destpath = DATENVERVER_OPTIONS.getDescPath(rootDir, da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_KundenNr, replaceInvalidCahr(da_name), endung)
|
||||
genHEADER_DATA()
|
||||
|
||||
If Not da_multifiles Then
|
||||
If DATA_LIST.LIST.Count > 0 Then
|
||||
If allowMsg AndAlso DATA_LIST.LIST.Count > 0 Then
|
||||
If Not vbYes = MsgBox("Die Datei existiert bereits. Soll die Datei ersetzt werden?", vbYesNoCancel) Then
|
||||
Return False 'NICHT Passiert
|
||||
End If
|
||||
@@ -220,7 +230,7 @@ Public Class cDATENSERVER
|
||||
If endung = "" Then Dim fi As New IO.DirectoryInfo(srcPath) : endung = fi.Extension
|
||||
' If bezeichnung = "" Then bezeichnung = System.IO.Path.GetFileName(srcPath) : endung = ""
|
||||
If bezeichnung = "" Then bezeichnung = da_name
|
||||
|
||||
replaceInvalidCahr(bezeichnung)
|
||||
|
||||
genHEADER_DATA()
|
||||
|
||||
@@ -276,6 +286,7 @@ Public Class cDATENSERVER
|
||||
If bezeichnung = "" Then
|
||||
bezeichnung = System.IO.Path.GetFileName(fd.FileName).ToString
|
||||
End If
|
||||
replaceInvalidCahr(bezeichnung)
|
||||
If da_name = "" Then Me.da_name = bezeichnung : LOAD() 'Wenn sich der Name ändert, muss eine neuer Header erstellt werden...
|
||||
Return uploadDataToDATENSERVER(fd.FileName, bezeichnung, endung, allowMsg, coll_archiv)
|
||||
End If
|
||||
@@ -371,9 +382,9 @@ Public Class cDATENSERVER
|
||||
End Function
|
||||
|
||||
|
||||
Public Function OPEN_SINGLE(Optional openFile As Boolean = True) As String
|
||||
Public Function OPEN_SINGLE(Optional openFile As Boolean = True, Optional useBezeichnung As Boolean = False) As String
|
||||
If DATA_LIST.LIST.Count > 0 Then
|
||||
Return DATA_LIST.LIST(0).OPEN(openFile)
|
||||
Return DATA_LIST.LIST(0).OPEN(openFile, useBezeichnung)
|
||||
End If
|
||||
Return ""
|
||||
End Function
|
||||
@@ -384,10 +395,10 @@ Public Class cDATENSERVER
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
Public Function OPEN(coll_id As Integer, Optional openFile As Boolean = True) As String
|
||||
Public Function OPEN(coll_id As Integer, Optional openFile As Boolean = True, Optional useBezeichnung As Boolean = False) As String
|
||||
For Each l In DATA_LIST.LIST
|
||||
If l.coll_id = coll_id Then
|
||||
Return l.OPEN(openFile)
|
||||
Return l.OPEN(openFile, useBezeichnung)
|
||||
End If
|
||||
Next
|
||||
Return ""
|
||||
@@ -1023,13 +1034,94 @@ Public Class cFormularManager
|
||||
End Try
|
||||
End Function
|
||||
|
||||
'??????????????????????????????????????????'??????????????????????????????????????????'??????????????????????????????????????????'??????????????????????????????????????????'??????????????????????????????????????????
|
||||
'Dim pdftmp As New Spire.PdfViewer.Forms.PdfViewer
|
||||
' pdftmp.LoadFromFile("C:\Users\DEVELOPER1\Desktop\Agrotel.pdf")
|
||||
' pdftmp.Print()
|
||||
|
||||
' Dim docs As PdfDocument() = {New PdfDocument("C:\Users\DEVELOPER1\Desktop\Agrotel.pdf")}
|
||||
' For Each doc As PdfDocument In docs
|
||||
' doc.PageSettings.Size = PdfPageSize.A4
|
||||
' doc.PrintDocument.DefaultPageSettings.Landscape = True
|
||||
' doc.PageScaling = PdfPrintPageScaling.FitSize
|
||||
' doc.PrinterName = "ES3452 MFP(PCL)"
|
||||
' doc.PrintDocument.Print()
|
||||
' Next
|
||||
Public Shared Sub PrintViaSpirePDF(PDFFile As List(Of String), Optional printerName As String = "")
|
||||
PrintViaSpirePDF(PDFFile.ToArray, printerName)
|
||||
End Sub
|
||||
|
||||
|
||||
Public Shared Sub PrintViaSpirePDF(PDFFile As String(), Optional printerName As String = "")
|
||||
Try
|
||||
If printerName = "" Then
|
||||
Dim oPS As New System.Drawing.Printing.PrinterSettings
|
||||
printerName = oPS.PrinterName
|
||||
End If
|
||||
'Dim docs As Spire.Pdf.PdfDocument() = {New Spire.Pdf.PdfDocument("C:\Users\DEVELOPER1\Desktop\Agrotel.pdf")}
|
||||
|
||||
'For Each doc As Spire.Pdf.PdfDocument In docs
|
||||
For Each pdfPath In PDFFile
|
||||
Dim doc As New Spire.Pdf.PdfDocument(pdfPath)
|
||||
|
||||
doc.PageSettings.Size = Spire.Pdf.PdfPageSize.A4
|
||||
doc.PrintDocument.DefaultPageSettings.Landscape = True
|
||||
doc.PageScaling = Spire.Pdf.PdfPrintPageScaling.FitSize
|
||||
doc.PrinterName = printerName
|
||||
doc.PrintDocument.Print()
|
||||
Next
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
End Sub
|
||||
Public Shared Sub PrintViaSpirePDF_FromURL(URLs As String(), Optional printerName As String = "")
|
||||
Try
|
||||
If printerName = "" Then
|
||||
Dim oPS As New System.Drawing.Printing.PrinterSettings
|
||||
printerName = oPS.PrinterName
|
||||
End If
|
||||
'Dim docs As Spire.Pdf.PdfDocument() = {New Spire.Pdf.PdfDocument("C:\Users\DEVELOPER1\Desktop\Agrotel.pdf")}
|
||||
|
||||
'For Each doc As Spire.Pdf.PdfDocument In docs
|
||||
For Each pdfPath In URLs
|
||||
'Dim doc As New Spire.Pdf.PdfDocument()
|
||||
|
||||
Using webClient As New Net.WebClient()
|
||||
Dim data() As Byte = webClient.DownloadData(pdfPath)
|
||||
Using stream As New MemoryStream(data)
|
||||
Dim doc As Spire.Pdf.PdfDocument = New Spire.Pdf.PdfDocument(stream)
|
||||
If doc IsNot Nothing Then
|
||||
doc.PageSettings.Size = Spire.Pdf.PdfPageSize.A4
|
||||
doc.PrintDocument.DefaultPageSettings.Landscape = True
|
||||
doc.PageScaling = Spire.Pdf.PdfPrintPageScaling.FitSize
|
||||
doc.PrinterName = printerName
|
||||
doc.PrintDocument.Print()
|
||||
End If
|
||||
End Using
|
||||
End Using
|
||||
|
||||
' doc.LoadFromHTML(pdfPath, True, True, True)
|
||||
|
||||
Next
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
Public Shared Sub PrintViaGS(PDFFile As String, printerName As String)
|
||||
Try
|
||||
Dim assembly = System.Reflection.Assembly.GetExecutingAssembly()
|
||||
Dim location As String = assembly.CodeBase
|
||||
Dim fullPath As String = New Uri(location).LocalPath
|
||||
Dim directoryPath As String = Path.GetDirectoryName(fullPath)
|
||||
|
||||
Dim MyP As New System.Diagnostics.Process
|
||||
MyP.StartInfo.FileName = Application.StartupPath & "\Resources\GS\gswin32c.exe"
|
||||
MyP.StartInfo.FileName = directoryPath & "\Resources\GS\gswin32c.exe"
|
||||
Dim sw As New List(Of String)()
|
||||
|
||||
'MyP.StartInfo.Arguments = "-dPrinted -dBATCH -dNOPAUSE -dNOSAFER -dPDFFitPage -dNumCopies=1 -dNoCancel -sDEVICE=mswinpr2 " & (Convert.ToString("-sOutputFile=%printer%") & printerName) & " -f" & PDFFile
|
||||
@@ -1069,7 +1161,7 @@ Public Class cFormularManager
|
||||
'End Using
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
@@ -1244,12 +1336,16 @@ Public Class cDatenarchiv_Collection
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function OPEN(Optional openFILE As Boolean = True) As String
|
||||
Public Function OPEN(Optional openFILE As Boolean = True, Optional useBezeichnung As Boolean = False) As String
|
||||
If Not IO.File.Exists(coll_pfad) Then MsgBox("Die Datei existiert nicht") : Return ""
|
||||
|
||||
Dim fi As New IO.DirectoryInfo(coll_pfad)
|
||||
Dim destPath = DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension, , False)
|
||||
|
||||
Dim destPath = ""
|
||||
If useBezeichnung Then
|
||||
destPath = DATENVERVER_OPTIONS.copyToTmp_KeepFilename(coll_pfad, coll_bezeichnung)
|
||||
Else
|
||||
destPath = DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension, , False)
|
||||
End If
|
||||
' MsgBox(destPath)
|
||||
IO.File.Copy(coll_pfad, destPath, True)
|
||||
If openFILE Then Process.Start(destPath)
|
||||
@@ -1443,6 +1539,33 @@ Public Class DATENVERVER_OPTIONS
|
||||
Return destPath
|
||||
End Function
|
||||
|
||||
Shared Function copyToTmp_KeepFilenameByDS(dId As Integer, bezeichnung As String) As String
|
||||
Dim DS As New cDATENSERVER(dId)
|
||||
Dim pfad As String = DS.GET_TOP1_PATH
|
||||
If pfad = "" Then Return ""
|
||||
Dim fi As New IO.FileInfo(pfad)
|
||||
|
||||
Dim tmpPath = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(bezeichnung, fi.Extension,, False, "ClipBoard_TMP\ClipBoard_" & Now.ToString("ddMMyyyyHHmmss_sss") & "\")
|
||||
Try
|
||||
IO.File.Copy(pfad, tmpPath)
|
||||
Return tmpPath
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
Return pfad
|
||||
End Function
|
||||
|
||||
Shared Function copyToTmp_KeepFilename(pfad As String, bezeichnung As String) As String
|
||||
Dim fi As New IO.FileInfo(pfad)
|
||||
Dim tmpPath = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(bezeichnung, fi.Extension,, False, "ClipBoard_TMP\ClipBoard_" & Now.ToString("ddMMyyyyHHmmss_sss") & "\")
|
||||
Try
|
||||
IO.File.Copy(pfad, tmpPath)
|
||||
Return tmpPath
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
Return pfad
|
||||
End Function
|
||||
|
||||
Shared Function getTMPAbsolutePath(AbsolutePath As String, extension As String, Optional special As Boolean = False, Optional delete As Boolean = True) As String
|
||||
|
||||
@@ -1461,11 +1584,15 @@ Public Class DATENVERVER_OPTIONS
|
||||
|
||||
|
||||
Shared Sub clearTMPPath(Optional unterOrdner As String = "")
|
||||
Dim TMP_PATH2 = TMP_PATH & If(unterOrdner <> "", "\" & unterOrdner & "\", "")
|
||||
Dim TMP_PATH2 As String = TMP_PATH & If(unterOrdner <> "", "\" & unterOrdner & "\", "")
|
||||
TMP_PATH2 = TMP_PATH2.Replace("\\", "\")
|
||||
If My.Computer.FileSystem.DirectoryExists(TMP_PATH2) Then
|
||||
For Each file As String In IO.Directory.GetFiles(TMP_PATH2) ' Ermittelt alle Dateien des Ordners und löscht diese (sind tmp)
|
||||
Try : IO.File.Delete(file) : Catch : End Try
|
||||
Next
|
||||
For Each dir As String In IO.Directory.GetDirectories(TMP_PATH2) ' Ermittelt alle Dateien des Ordners und löscht diese (sind tmp)
|
||||
Try : IO.Directory.Delete(dir, True) : Catch : End Try
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user