Barsan-Implementation
This commit is contained in:
@@ -172,6 +172,7 @@
|
|||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
|||||||
10
VERAGAddIn/rbnVERAG.Designer.vb
generated
10
VERAGAddIn/rbnVERAG.Designer.vb
generated
@@ -52,6 +52,7 @@
|
|||||||
Me.btnGestellungsgarantien = Me.Factory.CreateRibbonButton
|
Me.btnGestellungsgarantien = Me.Factory.CreateRibbonButton
|
||||||
Me.SplitButton1 = Me.Factory.CreateRibbonSplitButton
|
Me.SplitButton1 = Me.Factory.CreateRibbonSplitButton
|
||||||
Me.Button1 = Me.Factory.CreateRibbonButton
|
Me.Button1 = Me.Factory.CreateRibbonButton
|
||||||
|
Me.Button3 = Me.Factory.CreateRibbonButton
|
||||||
Me.Button4 = Me.Factory.CreateRibbonButton
|
Me.Button4 = Me.Factory.CreateRibbonButton
|
||||||
Me.Tab1.SuspendLayout()
|
Me.Tab1.SuspendLayout()
|
||||||
Me.VERAG.SuspendLayout()
|
Me.VERAG.SuspendLayout()
|
||||||
@@ -131,6 +132,7 @@
|
|||||||
Me.SplitButton1.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge
|
Me.SplitButton1.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge
|
||||||
Me.SplitButton1.Image = Global.VERAGAddIn.My.Resources.Resources.wheel
|
Me.SplitButton1.Image = Global.VERAGAddIn.My.Resources.Resources.wheel
|
||||||
Me.SplitButton1.Items.Add(Me.Button1)
|
Me.SplitButton1.Items.Add(Me.Button1)
|
||||||
|
Me.SplitButton1.Items.Add(Me.Button3)
|
||||||
Me.SplitButton1.Items.Add(Me.Button4)
|
Me.SplitButton1.Items.Add(Me.Button4)
|
||||||
Me.SplitButton1.Label = "Spezielle Optionen"
|
Me.SplitButton1.Label = "Spezielle Optionen"
|
||||||
Me.SplitButton1.Name = "SplitButton1"
|
Me.SplitButton1.Name = "SplitButton1"
|
||||||
@@ -142,6 +144,13 @@
|
|||||||
Me.Button1.Name = "Button1"
|
Me.Button1.Name = "Button1"
|
||||||
Me.Button1.ShowImage = True
|
Me.Button1.ShowImage = True
|
||||||
'
|
'
|
||||||
|
'Button3
|
||||||
|
'
|
||||||
|
Me.Button3.Image = Global.VERAGAddIn.My.Resources.Resources.pdf
|
||||||
|
Me.Button3.Label = "Barsan PDFs auslesen"
|
||||||
|
Me.Button3.Name = "Button3"
|
||||||
|
Me.Button3.ShowImage = True
|
||||||
|
'
|
||||||
'Button4
|
'Button4
|
||||||
'
|
'
|
||||||
Me.Button4.Label = "Info"
|
Me.Button4.Label = "Info"
|
||||||
@@ -173,6 +182,7 @@
|
|||||||
Friend WithEvents btnVollmachten As Microsoft.Office.Tools.Ribbon.RibbonButton
|
Friend WithEvents btnVollmachten As Microsoft.Office.Tools.Ribbon.RibbonButton
|
||||||
Friend WithEvents btnVertraege As Microsoft.Office.Tools.Ribbon.RibbonButton
|
Friend WithEvents btnVertraege As Microsoft.Office.Tools.Ribbon.RibbonButton
|
||||||
Friend WithEvents btnGestellungsgarantien As Microsoft.Office.Tools.Ribbon.RibbonButton
|
Friend WithEvents btnGestellungsgarantien As Microsoft.Office.Tools.Ribbon.RibbonButton
|
||||||
|
Friend WithEvents Button3 As Microsoft.Office.Tools.Ribbon.RibbonButton
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Partial Class ThisRibbonCollection
|
Partial Class ThisRibbonCollection
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ Imports System.Net
|
|||||||
Imports System.Security.Policy
|
Imports System.Security.Policy
|
||||||
Imports System.Diagnostics.Eventing.Reader
|
Imports System.Diagnostics.Eventing.Reader
|
||||||
Imports System.Runtime.InteropServices.ComTypes
|
Imports System.Runtime.InteropServices.ComTypes
|
||||||
|
Imports System.Drawing
|
||||||
|
Imports System.Threading.Tasks
|
||||||
|
Imports System.Net.Http
|
||||||
|
Imports System.Diagnostics
|
||||||
|
Imports VERAG_PROG_ALLGEMEIN.Kleinma.Controls
|
||||||
|
|
||||||
Public Class VERAGRibbon
|
Public Class VERAGRibbon
|
||||||
Dim LOGIN_OK = False
|
Dim LOGIN_OK = False
|
||||||
@@ -93,6 +98,9 @@ Public Class VERAGRibbon
|
|||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Sub Button3_Click_1(sender As Object, e As RibbonControlEventArgs) Handles Button3.Click
|
||||||
|
If LOGIN_OK Then AVISO_Mail_Functions.newBarsanMAIL()
|
||||||
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Public Class AVISO_Mail_Functions
|
Public Class AVISO_Mail_Functions
|
||||||
@@ -156,6 +164,13 @@ Public Class AVISO_Mail_Functions
|
|||||||
getATT_EKOL(mailItem, ATTACHMENTS_LIST)
|
getATT_EKOL(mailItem, ATTACHMENTS_LIST)
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If isMail_Barsan(mailItem) Then
|
||||||
|
If vbYes = MsgBox("Barsan-Anhänge laden?", vbYesNoCancel) Then
|
||||||
|
getATT_Barsan(mailItem, ATTACHMENTS_LIST)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
Dim Bezeichnung = strFileName
|
Dim Bezeichnung = strFileName
|
||||||
Dim AvisoId = Nothing
|
Dim AvisoId = Nothing
|
||||||
|
|
||||||
@@ -240,6 +255,29 @@ Public Class AVISO_Mail_Functions
|
|||||||
MsgBox(ex.Message & ex.StackTrace)
|
MsgBox(ex.Message & ex.StackTrace)
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Shared Sub newBarsanMAIL()
|
||||||
|
Try
|
||||||
|
Dim explorer As Outlook.Explorer = Globals.ThisAddIn.Application.ActiveExplorer
|
||||||
|
Dim selection As Outlook.Selection = explorer.Selection
|
||||||
|
If selection.Count > 0 Then
|
||||||
|
Dim selectedItem = selection(1)
|
||||||
|
Dim mailItem As Outlook.MailItem = selectedItem
|
||||||
|
If mailItem IsNot Nothing Then
|
||||||
|
If AVISO_Mail_Functions.isMail_Barsan(mailItem) Then
|
||||||
|
Dim att = getATT_Barsan(mailItem)
|
||||||
|
'Dim result As MsgBoxResult = MsgBox("Wollen Sie die " & att.Count & " Barsan - PDF's ausdrucken?", vbYesNoCancel)
|
||||||
|
'If result = vbYes Then
|
||||||
|
' VERAG_PROG_ALLGEMEIN.cFormularManager.PrintViaSpirePDF(att)
|
||||||
|
'End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox(ex.Message & ex.StackTrace)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
Shared Function initFirmaUser() As Boolean
|
Shared Function initFirmaUser() As Boolean
|
||||||
Dim LOGIN_OK = False
|
Dim LOGIN_OK = False
|
||||||
VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "VERAG" 'DEFAULT
|
VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "VERAG" 'DEFAULT
|
||||||
@@ -353,6 +391,12 @@ Public Class AVISO_Mail_Functions
|
|||||||
End If
|
End If
|
||||||
'End If
|
'End If
|
||||||
|
|
||||||
|
If isMail_Barsan(mailItem) Then
|
||||||
|
If vbYes = MsgBox("Barsan-Anhänge laden?", vbYesNoCancel) Then
|
||||||
|
getATT_Barsan(mailItem, ATTACHMENTS_LIST)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
loadAttachment(mailItem, ATTACHMENTS_LIST)
|
loadAttachment(mailItem, ATTACHMENTS_LIST)
|
||||||
|
|
||||||
@@ -544,6 +588,18 @@ Public Class AVISO_Mail_Functions
|
|||||||
Return False
|
Return False
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Shared Function isMail_Barsan(mailItem As Outlook.MailItem) As Boolean
|
||||||
|
Try
|
||||||
|
If mailItem IsNot Nothing Then
|
||||||
|
Dim srch As String = "<a href=""https://portal.barsan.com/Dokuman/DokumanGoster.aspx"
|
||||||
|
Return mailItem.HTMLBody.ToString.Contains(srch)
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox(ex.Message & ex.StackTrace)
|
||||||
|
End Try
|
||||||
|
Return False
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Shared Function getATT_EKOL(mailItem As Outlook.MailItem, Optional ByRef ATT As List(Of String) = Nothing, Optional ByRef LKW_Nr As String = "", Optional ByRef RefNr As String = "", Optional ByRef INFO As String = "") As List(Of String)
|
Shared Function getATT_EKOL(mailItem As Outlook.MailItem, Optional ByRef ATT As List(Of String) = Nothing, Optional ByRef LKW_Nr As String = "", Optional ByRef RefNr As String = "", Optional ByRef INFO As String = "") As List(Of String)
|
||||||
If ATT Is Nothing Then ATT = New List(Of String)
|
If ATT Is Nothing Then ATT = New List(Of String)
|
||||||
@@ -561,7 +617,7 @@ Public Class AVISO_Mail_Functions
|
|||||||
Dim cnt = 0
|
Dim cnt = 0
|
||||||
For Each l In sp
|
For Each l In sp
|
||||||
If cnt > 0 AndAlso l.Contains(""">") Then ' ENDE
|
If cnt > 0 AndAlso l.Contains(""">") Then ' ENDE
|
||||||
Dim link = ("https://web01.ekol.com/documentservice/download/" & l.ToString.Substring(0, l.ToString.IndexOf(""">")))
|
Dim link = ("https://web01.ekol.com/documentservice/download/" & l.ToString.Substring(0, l.ToString.IndexOf(""">") - 1))
|
||||||
|
|
||||||
'Ansonten stüzt der Webservice-Aufruf ab! ABER -> For .NET 4.7 or later, the System.Net.ServicePointManager.SecurityProtocol should not be set manualy!
|
'Ansonten stüzt der Webservice-Aufruf ab! ABER -> For .NET 4.7 or later, the System.Net.ServicePointManager.SecurityProtocol should not be set manualy!
|
||||||
System.Net.ServicePointManager.SecurityProtocol = System.Net.ServicePointManager.SecurityProtocol Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls12
|
System.Net.ServicePointManager.SecurityProtocol = System.Net.ServicePointManager.SecurityProtocol Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls12
|
||||||
@@ -589,6 +645,81 @@ Public Class AVISO_Mail_Functions
|
|||||||
Return ATT
|
Return ATT
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Shared Function getATT_Barsan(mailItem As Outlook.MailItem, Optional ByRef ATT As List(Of String) = Nothing, Optional ByRef LKW_Nr As String = "", Optional ByRef RefNr As String = "", Optional ByRef INFO As String = "") As List(Of String)
|
||||||
|
If ATT Is Nothing Then ATT = New List(Of String)
|
||||||
|
Try
|
||||||
|
|
||||||
|
If mailItem Is Nothing Then Return ATT
|
||||||
|
|
||||||
|
Dim html = mailItem.HTMLBody
|
||||||
|
|
||||||
|
Dim srch As String = "<a href=""https://portal.barsan.com/Dokuman/DokumanGoster.aspx"
|
||||||
|
If html.ToString.Contains(srch) Then
|
||||||
|
|
||||||
|
Dim myDelims As String() = New String() {srch}
|
||||||
|
Dim sp = html.Split(myDelims, StringSplitOptions.None)
|
||||||
|
|
||||||
|
' Dim sp = html.ToString.Split(srch.ToString)
|
||||||
|
Dim cnt = 0
|
||||||
|
For Each l In sp
|
||||||
|
If cnt > 0 AndAlso l.Contains(""">") Then ' ENDE
|
||||||
|
Dim link = ("https://portal.barsan.com/Dokuman/DokumanGoster.aspx" & l.ToString.Substring(0, l.ToString.IndexOf(""">")))
|
||||||
|
|
||||||
|
|
||||||
|
'Ansonten stüzt der Webservice-Aufruf ab! ABER -> For .NET 4.7 or later, the System.Net.ServicePointManager.SecurityProtocol should not be set manualy!
|
||||||
|
System.Net.ServicePointManager.SecurityProtocol = System.Net.ServicePointManager.SecurityProtocol Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls12
|
||||||
|
If l.ToString.ToLower().Contains(".pdf") Then
|
||||||
|
|
||||||
|
Dim pdf = VERAG_PROG_ALLGEMEIN.cFormularManager.getPDFViaSpirePDF_FromURL(link)
|
||||||
|
'Process.Start(pdf)
|
||||||
|
|
||||||
|
|
||||||
|
'Dim client As New HttpClient()
|
||||||
|
|
||||||
|
'Try
|
||||||
|
|
||||||
|
' Dim response As HttpResponseMessage = Await client.GetAsync(link)
|
||||||
|
|
||||||
|
' response.EnsureSuccessStatusCode()
|
||||||
|
' Dim responseBody As String = Await response.Content.ReadAsStringAsync()
|
||||||
|
' Console.WriteLine(responseBody)
|
||||||
|
|
||||||
|
' Dim PDF = responseBody
|
||||||
|
'Catch e As HttpRequestException
|
||||||
|
' Console.WriteLine(vbLf & "Exception Caught!")
|
||||||
|
' Console.WriteLine("Message :{0} ", e.Message)
|
||||||
|
'End Try
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'Dim TMP_PATH = GetTempFilePathWithExtension(".pdf")
|
||||||
|
|
||||||
|
'Dim TMP_PATH = VERAG_PROG_ALLGEMEIN.cFormularManager.getPDFViaSpirePDF_FromURL(res.ResponseUri.ToString)
|
||||||
|
|
||||||
|
''My.Computer.Network.DownloadFile(res.ResponseUri.ToString, TMP_PATH)
|
||||||
|
|
||||||
|
If IO.File.Exists(pdf) Then
|
||||||
|
ATT.Add(pdf)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
cnt += 1
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
'LKW_Nr = getEKOL_Var(html, "Position :")
|
||||||
|
'RefNr = getEKOL_Var(html, "Truck :")
|
||||||
|
'INFO = getEKOL_Var(html, "Route :")
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox(ex.Message & ex.StackTrace)
|
||||||
|
End Try
|
||||||
|
Return ATT
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Shared Function getEKOL_Var(html, varName, Optional splitTo = "<br>")
|
Shared Function getEKOL_Var(html, varName, Optional splitTo = "<br>")
|
||||||
If html.contains(varName) Then
|
If html.contains(varName) Then
|
||||||
Dim split = html.split(varName)
|
Dim split = html.split(varName)
|
||||||
|
|||||||
Reference in New Issue
Block a user