neu
This commit is contained in:
@@ -21,9 +21,9 @@ Public Class SQL
|
||||
|
||||
Public Shared Function GetADMINConnectionString() As String
|
||||
If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then
|
||||
Return My.MySettings.Default.ADMINConnectionString
|
||||
Return My.MySettings.Default.ADMINConnectionString_DEV
|
||||
Else
|
||||
Return My.MySettings.Default.ADMINConnectionString
|
||||
Return My.MySettings.Default.ADMINConnectionString_DEV
|
||||
End If
|
||||
End Function
|
||||
Public Shared Function GetFMZOLLConnectionString() As String
|
||||
|
||||
@@ -122,6 +122,7 @@ Public Class cEmailBenachrichtigung
|
||||
Dim Firmen As New cFirmenDAL
|
||||
Dim Firma As New cFirma
|
||||
|
||||
'In diesen Strings werden die Mailadressen übergeben:
|
||||
Emails = ""
|
||||
Emails_CC = ""
|
||||
Emails_BCC = ""
|
||||
@@ -139,23 +140,35 @@ Public Class cEmailBenachrichtigung
|
||||
|
||||
'Dim Emails As String
|
||||
For Each i In Kdnr_Mails.LIST
|
||||
|
||||
|
||||
If i.eb_bcc Then
|
||||
If Not existing(Kdnr, i.eb_EMail, Emails_BCC_list.LIST, Emails_CC_list.LIST, Emails_list.LIST) And Not existingWOKdNr(i.eb_EMail, Emails_list_sent.LIST) Then Emails_BCC_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
If Not existingNEW(Kdnr, i.eb_bcc, "BCC", Emails_list_sent.LIST) Then Emails_BCC_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
ElseIf i.eb_cc Then
|
||||
If Not existing(Kdnr, i.eb_EMail, Emails_BCC_list.LIST, Emails_CC_list.LIST, Emails_list.LIST) And Not existingWOKdNr(i.eb_EMail, Emails_list_sent.LIST) Then Emails_CC_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
If Not existingNEW(Kdnr, i.eb_cc, "CC", Emails_list_sent.LIST) Then Emails_CC_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
Else
|
||||
If Not existing(Kdnr, i.eb_EMail, Emails_BCC_list.LIST, Emails_CC_list.LIST, Emails_list.LIST) And Not existingWOKdNr(i.eb_EMail, Emails_list_sent.LIST) Then Emails_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
If Not existingNEW(Kdnr, i.eb_EMail, "", Emails_list_sent.LIST) Then Emails_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
End If
|
||||
|
||||
'DAS WAR VORHER:::::::::::
|
||||
'If i.eb_bcc Then
|
||||
' If Not existing(Kdnr, i.eb_EMail, Emails_BCC_list.LIST, Emails_CC_list.LIST, Emails_list.LIST) And Not existingWOKdNr(i.eb_EMail, Emails_list_sent.LIST) Then Emails_BCC_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
'ElseIf i.eb_cc Then
|
||||
' If Not existing(Kdnr, i.eb_EMail, Emails_BCC_list.LIST, Emails_CC_list.LIST, Emails_list.LIST) And Not existingWOKdNr(i.eb_EMail, Emails_list_sent.LIST) Then Emails_CC_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
'Else
|
||||
' If Not existing(Kdnr, i.eb_EMail, Emails_BCC_list.LIST, Emails_CC_list.LIST, Emails_list.LIST) And Not existingWOKdNr(i.eb_EMail, Emails_list_sent.LIST) Then Emails_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
'End If
|
||||
':::::::::::::::::::::::
|
||||
|
||||
'''Es muss mit KdNr geprüft werden, sonst wird zB OPUS/SOMEDAY nciht gesendet (gleiche Mail, andere KdNr)
|
||||
'''If i.eb_bcc Then
|
||||
''' If Not existing(Kdnr, i.eb_EMail, Emails_BCC_list.LIST, Emails_CC_list.LIST, Emails_list.LIST) And Not existingWOKdNr(i.eb_EMail, Emails_list_sent.LIST) Then Emails_BCC_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
'''ElseIf i.eb_cc Then
|
||||
''' If Not existing(Kdnr, i.eb_EMail, Emails_BCC_list.LIST, Emails_CC_list.LIST, Emails_list.LIST) And Not existingWOKdNr(i.eb_EMail, Emails_list_sent.LIST) Then Emails_CC_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
'''Else
|
||||
''' If Not existing(Kdnr, i.eb_EMail, Emails_BCC_list.LIST, Emails_CC_list.LIST, Emails_list.LIST) And Not existingWOKdNr(i.eb_EMail, Emails_list_sent.LIST) Then Emails_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
'''End If
|
||||
Next
|
||||
'For Each i In Fraechter_Mails.LIST
|
||||
' If i.eb_bcc Then
|
||||
' If Not existing(hFrächter_kdnr, i.eb_EMail, Emails_BCC_list.LIST, Emails_CC_list.LIST, Emails_list.LIST) And Not existing(hFrächter_kdnr, i.eb_EMail, Emails_list_sent.LIST) Then Emails_BCC_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
' ElseIf i.eb_cc Then
|
||||
' If Not existing(hFrächter_kdnr, i.eb_EMail, Emails_BCC_list.LIST, Emails_CC_list.LIST, Emails_list.LIST) And Not existing(hFrächter_kdnr, i.eb_EMail, Emails_list_sent.LIST) Then Emails_CC_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
' Else
|
||||
' If Not existing(hFrächter_kdnr, i.eb_EMail, Emails_BCC_list.LIST, Emails_CC_list.LIST, Emails_list.LIST) And Not existing(hFrächter_kdnr, i.eb_EMail, Emails_list_sent.LIST) Then Emails_list.LIST.Add(i) ' &= i.eb_EMail & ";"
|
||||
' End If
|
||||
'Next
|
||||
|
||||
For Each i In Emails_list.LIST
|
||||
Emails &= i.eb_EMail & ";"
|
||||
@@ -240,6 +253,20 @@ Public Class cEmailBenachrichtigung
|
||||
For Each i In Emails_list.LIST : Emails_list_sent.LIST.Add(i) : Next
|
||||
|
||||
End Sub
|
||||
Shared Function existingNEW(KundenNr As Integer, Email As String, art As String, Emails_list As List(Of VERAG_PROG_ALLGEMEIN.cEmailBenachrichtigung)) As Boolean
|
||||
If Emails_list IsNot Nothing Then
|
||||
For Each i In Emails_list
|
||||
Select Case art
|
||||
Case "BCC" : If i.eb_bcc = Email And i.eb_KundenNr = KundenNr Then Return True
|
||||
Case "CC" : If i.eb_cc = Email And i.eb_KundenNr = KundenNr Then Return True
|
||||
Case Else : If i.eb_EMail = Email And i.eb_KundenNr = KundenNr Then Return True
|
||||
End Select
|
||||
|
||||
Next
|
||||
End If
|
||||
|
||||
Return False
|
||||
End Function
|
||||
Shared Function existing(KundenNr As Integer, Email As String, Emails_list As List(Of VERAG_PROG_ALLGEMEIN.cEmailBenachrichtigung), Optional ListEmails_CC_list As List(Of VERAG_PROG_ALLGEMEIN.cEmailBenachrichtigung) = Nothing, Optional ListEmails_BCC_list As List(Of VERAG_PROG_ALLGEMEIN.cEmailBenachrichtigung) = Nothing) As Boolean
|
||||
If Emails_list IsNot Nothing Then
|
||||
For Each i In Emails_list
|
||||
|
||||
167
VERAG_PROG_ALLGEMEIN/Classes/cGrenzstelle.vb
Normal file
167
VERAG_PROG_ALLGEMEIN/Classes/cGrenzstelle.vb
Normal file
@@ -0,0 +1,167 @@
|
||||
|
||||
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Reflection
|
||||
|
||||
Public Class cGrenzstelle
|
||||
Property grz_Grenzstelle As String
|
||||
|
||||
Property grz_BezeichnungCBO As String
|
||||
Property grz_Bezeichnung As String
|
||||
Property grz_Firma As String
|
||||
Property grz_Cluster As Object = Nothing
|
||||
Property grz_Reihenfolge As Integer
|
||||
Property grz_Warenort As Boolean
|
||||
Property grz_Zollamt As Boolean
|
||||
Property grz_Aktiv As Boolean
|
||||
Property grz_ZollamtDST As Object = Nothing
|
||||
Property grz_ZollamtBezeichnung As Object = Nothing
|
||||
|
||||
|
||||
|
||||
Public hasEntry As Boolean = False
|
||||
|
||||
Dim SQL As New SQL
|
||||
|
||||
Sub New()
|
||||
|
||||
End Sub
|
||||
Sub New(grz_Grenzstelle As String)
|
||||
Me.grz_Grenzstelle = grz_Grenzstelle
|
||||
LOAD()
|
||||
End Sub
|
||||
|
||||
|
||||
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("grz_Grenzstelle", grz_Grenzstelle,, True))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("grz_BezeichnungCBO", grz_BezeichnungCBO))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("grz_Bezeichnung", grz_Bezeichnung))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("grz_Firma", grz_Firma))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("grz_Cluster", grz_Cluster))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("grz_Reihenfolge", grz_Reihenfolge))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("grz_Warenort", grz_Warenort))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("grz_Zollamt", grz_Zollamt))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("grz_Aktiv", grz_Aktiv))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("grz_ZollamtDST", grz_ZollamtDST))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("grz_ZollamtBezeichnung", grz_ZollamtBezeichnung))
|
||||
|
||||
Return list
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
'Public Shared Function LOADByBezeichnung(grz_Bezeichnung) As cGrenzstelle
|
||||
' Try
|
||||
' Dim GRZ As New cGrenzstelle
|
||||
|
||||
' Using conn As SqlConnection = SQL.GetNewOpenConnectionAVISO()
|
||||
' MsgBox("SELECT * FROM tblGrenzstelle WHERE grz_Bezeichnung=@grz_Bezeichnung " & grz_Bezeichnung)
|
||||
' Using cmd As New SqlCommand("SELECT * FROM tblGrenzstelle WHERE grz_Bezeichnung=@grz_Bezeichnung ", conn)
|
||||
' cmd.Parameters.AddWithValue("@grz_Bezeichnung", grz_Bezeichnung)
|
||||
' Dim dr = cmd.ExecuteReader()
|
||||
' If dr.Read Then
|
||||
' For Each li In GRZ.getParameterList()
|
||||
' Dim propInfo As PropertyInfo = GRZ.GetType.GetProperty(li.Scalarvariable)
|
||||
|
||||
' If dr.Item(li.Text) Is DBNull.Value Then
|
||||
' propInfo.SetValue(GRZ, Nothing)
|
||||
' Else
|
||||
' propInfo.SetValue(GRZ, dr.Item(li.Text))
|
||||
' End If
|
||||
|
||||
' Next
|
||||
' GRZ.hasEntry = True
|
||||
' End If
|
||||
' dr.Close()
|
||||
' End Using
|
||||
' Return GRZ
|
||||
' End Using
|
||||
' Catch ex As Exception
|
||||
' MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
||||
' End Try
|
||||
' Return Nothing
|
||||
'End Function
|
||||
Public Function SAVE() As Boolean
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
|
||||
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblGrenzstelle WHERE grz_Grenzstelle=@grz_Grenzstelle) " &
|
||||
" BEGIN " & getUpdateCmd() & " END " &
|
||||
" Else " &
|
||||
" BEGIN " & getInsertCmd() & " END " &
|
||||
" commit tran "
|
||||
|
||||
Return SQL.doSQLVarList(sqlstr, "AVISO", , list)
|
||||
End Function
|
||||
|
||||
Public Sub LOAD()
|
||||
Try
|
||||
hasEntry = False
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionAVISO()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblGrenzstelle WHERE grz_Grenzstelle=@grz_Grenzstelle ", conn)
|
||||
cmd.Parameters.AddWithValue("@grz_Grenzstelle", grz_Grenzstelle)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
For Each li In getParameterList()
|
||||
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable)
|
||||
|
||||
If dr.Item(li.Text) Is DBNull.Value Then
|
||||
propInfo.SetValue(Me, Nothing)
|
||||
Else
|
||||
propInfo.SetValue(Me, dr.Item(li.Text))
|
||||
End If
|
||||
|
||||
Next
|
||||
hasEntry = True
|
||||
End If
|
||||
dr.Close()
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Public Function getUpdateCmd() As String
|
||||
Try
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
|
||||
Dim str As String = ""
|
||||
For Each i In list
|
||||
If Not i.isPrimaryParam Then
|
||||
str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
|
||||
End If
|
||||
Next
|
||||
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||
Return (" UPDATE [tblGrenzstelle] SET " & str & " WHERE grz_Grenzstelle=@grz_Grenzstelle ")
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
||||
End Try
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
|
||||
Public Function getInsertCmd() As String
|
||||
Try
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
Dim str As String = ""
|
||||
Dim values As String = ""
|
||||
For Each i In list
|
||||
If Not i.isPrimaryParam Then
|
||||
str &= "[" & i.Text & "],"
|
||||
values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
|
||||
End If
|
||||
Next
|
||||
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||
values = values.Substring(0, values.Length - 1) 'wg. ','
|
||||
Return (" INSERT INTO tblGrenzstelle (" & str & ") VALUES(" & values & ") ")
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
||||
End Try
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
End Class
|
||||
@@ -21,6 +21,7 @@ Public Class cSMS
|
||||
Property sms_Vorwahl As Object = Nothing
|
||||
Property sms_Handynummer As Object = Nothing
|
||||
Property sms_Nachricht As Object = Nothing
|
||||
Property sms_templateID As Object = Nothing
|
||||
Property sms_BatchId As Object = Nothing
|
||||
Property sms_MessageIds As Object = Nothing
|
||||
Property sms_Uris As Object = Nothing
|
||||
@@ -73,6 +74,7 @@ Public Class cSMS
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("sms_Vorwahl", sms_Vorwahl))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("sms_Handynummer", sms_Handynummer))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("sms_Nachricht", sms_Nachricht))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("sms_templateID", sms_templateID))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("sms_BatchId", sms_BatchId))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("sms_MessageIds", sms_MessageIds))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("sms_Uris", sms_Uris))
|
||||
@@ -230,7 +232,14 @@ Public Class cSMS
|
||||
|
||||
|
||||
|
||||
Function sendWhatsApp(Originator As String) As Boolean
|
||||
'Function sendWhatsApp(Originator As String) As Boolean
|
||||
' Return sendWhatsAppMessage(Originator)
|
||||
' 'If sendWhatsAppTemplate(Originator) Then
|
||||
' ' Return sendWhatsAppMessage(Originator)
|
||||
' 'End If
|
||||
' 'Return False
|
||||
'End Function
|
||||
Function sendWhatsAppMessage(Originator As String) As Boolean
|
||||
Try
|
||||
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
|
||||
Dim API_STRING = "https://connect.esendex.com"
|
||||
@@ -267,11 +276,44 @@ Public Class cSMS
|
||||
|
||||
Dim json As New Chilkat.JsonObject
|
||||
|
||||
'---------------------------------------------
|
||||
Me.sms_Account = "EX0341154" 'WHATSAPP Account
|
||||
|
||||
'Dim successJsonLoad As Boolean = json.Load("
|
||||
' {
|
||||
' ""accountReference"": """ & Me.sms_Account & """,
|
||||
' ""channels"": [
|
||||
' ""WHATSAPP""
|
||||
' ],
|
||||
' ""metadata"":{
|
||||
' ""key"": ""value""
|
||||
' },
|
||||
' ""recipient"": {
|
||||
' ""address"": {
|
||||
' ""msisdn"": """ & HandyNr & """
|
||||
' }
|
||||
' },
|
||||
' ""content"": {
|
||||
' ""body"": {
|
||||
' ""text"": {
|
||||
' ""value"": """ & Me.sms_Nachricht & """
|
||||
' }
|
||||
' }
|
||||
' },
|
||||
' ""channelSettings"": {
|
||||
' ""sms"": {
|
||||
' ""originator"": """ & Originator & """,
|
||||
' ""characterSet"": ""GSM""
|
||||
' }
|
||||
' },
|
||||
' ""expiry"": ""30""
|
||||
' }")
|
||||
|
||||
Dim successJsonLoad As Boolean = json.Load("
|
||||
{
|
||||
""accountReference"": """ & Me.sms_Account & """,
|
||||
""channels"": [
|
||||
""WhatsApp""
|
||||
""WHATSAPP""
|
||||
],
|
||||
""metadata"":{
|
||||
""key"": ""value""
|
||||
@@ -287,14 +329,7 @@ Public Class cSMS
|
||||
""value"": """ & Me.sms_Nachricht & """
|
||||
}
|
||||
}
|
||||
},
|
||||
""channelSettings"": {
|
||||
""sms"": {
|
||||
""originator"": """ & Originator & """,
|
||||
""characterSet"": ""GSM""
|
||||
}
|
||||
},
|
||||
""expiry"": ""30""
|
||||
}
|
||||
}")
|
||||
|
||||
If (successJsonLoad <> True) Then
|
||||
@@ -306,7 +341,7 @@ Public Class cSMS
|
||||
Dim sbRequestBody As New Chilkat.StringBuilder
|
||||
json.EmitSb(sbRequestBody)
|
||||
|
||||
' MsgBox(sbRequestBody.ToString)
|
||||
MsgBox(sbRequestBody.ToString)
|
||||
Dim sbResponseBody As New Chilkat.StringBuilder
|
||||
success = rest.FullRequestSb("POST", "/richcontent/v3/send", sbRequestBody, sbResponseBody)
|
||||
If (success <> True) Then
|
||||
@@ -333,7 +368,7 @@ Public Class cSMS
|
||||
Dim Resp_errorCode = jsonResp.StringOf("errorCode")
|
||||
|
||||
Me.whatsApp_gatewayId = gatewayId
|
||||
|
||||
MsgBox(gatewayId)
|
||||
If Resp_error <> "" Then Me.whatsApp_error = Resp_error
|
||||
If Resp_errorCode <> "" Then Me.whatsApp_errorCode = Resp_errorCode
|
||||
|
||||
@@ -398,6 +433,186 @@ Public Class cSMS
|
||||
End Function
|
||||
|
||||
|
||||
Function sendWhatsAppTemplate(Originator As String, template_ParamMFGAdditional As String) As Boolean
|
||||
Try
|
||||
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
|
||||
Dim API_STRING = "https://connect.esendex.com"
|
||||
|
||||
Dim rest As New Chilkat.Rest
|
||||
Dim success As Boolean
|
||||
|
||||
Dim bTls As Boolean = True
|
||||
Dim port As Integer = 443
|
||||
Dim bAutoReconnect As Boolean = True
|
||||
success = rest.Connect(API_STRING, port, bTls, bAutoReconnect)
|
||||
If (success <> True) Then
|
||||
Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
|
||||
Return False
|
||||
End If
|
||||
|
||||
rest.AddHeader("Content-Type", "application/json")
|
||||
rest.AddHeader("Authorization", API_USER_AUTHORIZATION)
|
||||
'rest.AddHeader("Accept", "application/vnd.hmrc.1.0+json")
|
||||
|
||||
'Dim sbRequestBody As New Chilkat.StringBuilder
|
||||
'json.EmitSb(sbRequestBody)
|
||||
Me.sms_art = "WHATSAPP"
|
||||
|
||||
|
||||
Dim mfg = ""
|
||||
Dim location = ""
|
||||
|
||||
Select Case Originator
|
||||
Case "FRONTOFFICE"
|
||||
mfg = "VERAG - UNISPED - IMEX"
|
||||
location = Originator
|
||||
Case Else
|
||||
location = Originator
|
||||
End Select
|
||||
If template_ParamMFGAdditional <> "" Then
|
||||
mfg = template_ParamMFGAdditional & " " & mfg
|
||||
End If
|
||||
|
||||
Dim absenderFirma As String = Me.sms_Firma
|
||||
Dim HandyNr As String = Me.sms_Handynummer.replace(" ", "")
|
||||
If HandyNr.ToString.StartsWith("00") Then HandyNr = "+" & HandyNr.Substring(2)
|
||||
|
||||
If Originator = "" Then Originator = absenderFirma
|
||||
If Originator.Length > 11 Then Originator = Originator.Substring(0, 11)
|
||||
|
||||
Dim json As New Chilkat.JsonObject
|
||||
|
||||
'---------------------------------------------
|
||||
Me.sms_Account = "EX0341154" 'WHATSAPP Account
|
||||
' Dim TemplateId = "e5c1ce77-31a0-4663-9576-be340f73ac1c"
|
||||
|
||||
|
||||
Dim successJsonLoad As Boolean = json.Load("
|
||||
{
|
||||
""accountReference"": """ & Me.sms_Account & """,
|
||||
""channels"": [
|
||||
""WHATSAPP""
|
||||
],
|
||||
""metadata"":{
|
||||
""key"": ""value""
|
||||
},
|
||||
""recipient"": {
|
||||
""variables"": {
|
||||
""mfg"": """ & mfg & """,
|
||||
""location"": """ & location & """
|
||||
},
|
||||
""address"": {
|
||||
""msisdn"": """ & HandyNr & """
|
||||
}
|
||||
},
|
||||
""content"": {
|
||||
""templateId"": """ & Me.sms_templateID & """
|
||||
}
|
||||
}")
|
||||
|
||||
|
||||
If (successJsonLoad <> True) Then
|
||||
' MsgBox(json.LastErrorText)
|
||||
Return False
|
||||
End If
|
||||
|
||||
|
||||
Dim sbRequestBody As New Chilkat.StringBuilder
|
||||
json.EmitSb(sbRequestBody)
|
||||
|
||||
'MsgBox(sbRequestBody.ToString)
|
||||
Dim sbResponseBody As New Chilkat.StringBuilder
|
||||
success = rest.FullRequestSb("POST", "/richcontent/v3/send", sbRequestBody, sbResponseBody)
|
||||
If (success <> True) Then
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
Return False
|
||||
End If
|
||||
Dim respStatusCode As Integer = rest.ResponseStatusCode
|
||||
|
||||
Me.whatsApp_status = respStatusCode ' 202 = OK - Gesendet
|
||||
|
||||
If (respStatusCode <> 202) Then
|
||||
|
||||
MsgBox(sbResponseBody.GetAsString())
|
||||
|
||||
Return False
|
||||
End If
|
||||
|
||||
|
||||
Dim jsonResp = New Chilkat.JsonObject()
|
||||
jsonResp.LoadSb(sbResponseBody)
|
||||
|
||||
Dim gatewayId = jsonResp.StringOf("gatewayId")
|
||||
Dim Resp_error = jsonResp.StringOf("error")
|
||||
Dim Resp_errorCode = jsonResp.StringOf("errorCode")
|
||||
|
||||
Me.whatsApp_gatewayId = gatewayId
|
||||
' MsgBox(gatewayId)
|
||||
If Resp_error <> "" Then Me.whatsApp_error = Resp_error
|
||||
If Resp_errorCode <> "" Then Me.whatsApp_errorCode = Resp_errorCode
|
||||
|
||||
' MsgBox(gatewayId)
|
||||
|
||||
If Not Me.SAVE() Then
|
||||
MsgBox("Fehler: WHATSAPP Daten wurden nicht gespeichert!")
|
||||
End If
|
||||
|
||||
|
||||
Return True
|
||||
'productTitle = json.StringOf("product.title");
|
||||
'productBody_html = json.StringOf("product.body_html");
|
||||
'productVendor = json.StringOf("product.vendor");
|
||||
'productProduct_type = json.StringOf("product.product_type");
|
||||
'productCreated_at = json.StringOf("product.created_at");
|
||||
'productHandle = json.StringOf("product.handle");
|
||||
'productUpdated_at = json.StringOf("product.updated_at");
|
||||
'productPublished_at = json.IsNullOf("product.published_at");
|
||||
'productTemplate_suffix = json.IsNullOf("product.template_suffix");
|
||||
'productPublished_scope = json.StringOf("product.published_scope");
|
||||
'productTags = json.StringOf("product.tags");
|
||||
'productImage = json.IsNullOf("product.image");
|
||||
'i = 0;
|
||||
'count_i = json.SizeOfArray("product.variants");
|
||||
'while (i < count_i) {
|
||||
' json.I = i;
|
||||
' id = json.IntOf("product.variants[i].id");
|
||||
' product_id = json.IntOf("product.variants[i].product_id");
|
||||
' title = json.StringOf("product.variants[i].title");
|
||||
' price = json.StringOf("product.variants[i].price");
|
||||
' sku = json.StringOf("product.variants[i].sku");
|
||||
' position = json.IntOf("product.variants[i].position");
|
||||
' grams = json.IntOf("product.variants[i].grams");
|
||||
' inventory_policy = json.StringOf("product.variants[i].inventory_policy");
|
||||
' compare_at_price = json.IsNullOf("product.variants[i].compare_at_price");
|
||||
' fulfillment_service = json.StringOf("product.variants[i].fulfillment_service");
|
||||
' inventory_management = json.IsNullOf("product.variants[i].inventory_management");
|
||||
' option1 = json.StringOf("product.variants[i].option1");
|
||||
' option2 = json.IsNullOf("product.variants[i].option2");
|
||||
' option3 = json.IsNullOf("product.variants[i].option3");
|
||||
' created_at = json.StringOf("product.variants[i].created_at");
|
||||
' updated_at = json.StringOf("product.variants[i].updated_at");
|
||||
' taxable = json.BoolOf("product.variants[i].taxable");
|
||||
' barcode = json.IsNullOf("product.variants[i].barcode");
|
||||
' image_id = json.IsNullOf("product.variants[i].image_id");
|
||||
' inventory_quantity = json.IntOf("product.variants[i].inventory_quantity");
|
||||
' weight = json.IntOf("product.variants[i].weight");
|
||||
' weight_unit = json.StringOf("product.variants[i].weight_unit");
|
||||
' old_inventory_quantity = json.IntOf("product.variants[i].old_inventory_quantity");
|
||||
' requires_shipping = json.BoolOf("product.variants[i].requires_shipping");
|
||||
' i = i + 1;
|
||||
'}
|
||||
Return True
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("Fehler beim Senden der WhatsApp-SMS!" & vbNewLine & ex.Message & ex.StackTrace)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Function checkSMSStatus(Optional silent = False, Optional insertVermerkAviso = True) As String
|
||||
Try
|
||||
@@ -467,6 +682,7 @@ Public Class cSMS
|
||||
|
||||
Function checkWhatsAppStatus(Optional silent = False, Optional insertVermerkAviso = True) As String
|
||||
Try
|
||||
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
|
||||
|
||||
|
||||
Select Case Me.sms_Status
|
||||
@@ -485,7 +701,6 @@ Public Class cSMS
|
||||
|
||||
|
||||
|
||||
|
||||
Dim API_STRING = "https://connect.esendex.com"
|
||||
|
||||
Dim rest As New Chilkat.Rest
|
||||
@@ -523,7 +738,7 @@ Public Class cSMS
|
||||
|
||||
'Fehler --> --> FALLBACK SMS!!!
|
||||
If DateDiff(DateInterval.Minute, Me.sms_Datum, Now) > 10 Then
|
||||
Me.FALLBACK_SMS
|
||||
Me.FALLBACK_SMS()
|
||||
End If
|
||||
|
||||
|
||||
@@ -531,12 +746,13 @@ Public Class cSMS
|
||||
If Not silent Then MsgBox("Error: " & respStatusCode)
|
||||
|
||||
Return Me.sms_Status
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Dim jsonResp = New Chilkat.JsonObject()
|
||||
jsonResp.LoadSb(sbResponseBody)
|
||||
' MsgBox(sbResponseBody.ToString)
|
||||
' MsgBox(sbResponseBody.ToString)
|
||||
Dim allowVermerk = True
|
||||
|
||||
Dim lastUpdatedUtc = jsonResp.StringOf("lastUpdatedUtc")
|
||||
@@ -605,6 +821,7 @@ Public Class cSMS
|
||||
Sub FALLBACK_SMS()
|
||||
'--> FALLBACK SMS!!!
|
||||
Me.sms_art = "SMS"
|
||||
Me.sms_Account = GET_AccountByAbsFirma(Me.sms_Firma) ' Ändern, da WhatsApp Account nciht in TR freigeschaltet ist.
|
||||
Me.sms_Status = -1
|
||||
Me.sendSMS()
|
||||
Me.SAVE()
|
||||
@@ -663,6 +880,23 @@ Public Class cSMS
|
||||
|
||||
End Sub
|
||||
|
||||
Shared Function GET_AccountByAbsFirma(absenderFirma)
|
||||
|
||||
Select Case absenderFirma'cboFirma._value
|
||||
Case "VERAG Spedition" : Return "EX0252513"
|
||||
Case "VERAG 360" : Return "EX0252747"
|
||||
Case "ATILLA Spedition" : Return "EX0252746"
|
||||
Case "IMEX Spedition" : Return "EX0272082"
|
||||
Case "UNISPED Spedition" : Return "EX0300174"
|
||||
Case "FRONT-OFFICE SUBEN" : Return "EX0300173"
|
||||
Case "AMBAR" : Return "EX0315223"
|
||||
|
||||
Case Else : Return "EX0300173"
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ Public Class cSendungen
|
||||
If SENDUNG_LIST Is Nothing Then SENDUNG_LIST = New List(Of cSendungen)
|
||||
SENDUNG_LIST.Clear()
|
||||
Dim SQL As New SQL
|
||||
For Each r In SQL.loadDgvBySql("SELECT tblSnd_SendungID FROM tblSendungen WHERE tblSnd_AvisoID=" & AvisoId & " AND (tblSnd_Vorpapier='" & Vorpapier & "' OR tblSnd_Vorpapier2='" & Vorpapier & "' OR tblSnd_Vorpapier3='" & Vorpapier & "' ) ORDER BY tblSnd_PosUnterNr,tblSnd_SendungID", "AVISO").Rows
|
||||
For Each r In SQL.loadDgvBySql("SELECT tblSnd_SendungID FROM tblSendungen WHERE tblSnd_AvisoID=" & AvisoId & " AND (tblSnd_Vorpapier='" & Vorpapier & "' OR tblSnd_Vorpapier2='" & Vorpapier & "' OR tblSnd_Vorpapier3='" & Vorpapier & "' ) AND tblSnd_Abfertigungsart_ID not in(44) ORDER BY tblSnd_PosUnterNr,tblSnd_SendungID", "AVISO").Rows
|
||||
SENDUNG_LIST.Add(New VERAG_PROG_ALLGEMEIN.cSendungen(r("tblSnd_SendungID")))
|
||||
Next
|
||||
If allowchangeCurrIndex Then CURRENT_INDEX = IIf(SENDUNG_LIST.Count > 0, 0, -1)
|
||||
@@ -200,7 +200,7 @@ Public Class cSendungen
|
||||
If SENDUNG_LIST Is Nothing Then SENDUNG_LIST = New List(Of cSendungen)
|
||||
SENDUNG_LIST.Clear()
|
||||
Dim SQL As New SQL
|
||||
For Each r In SQL.loadDgvBySql("SELECT tblSnd_SendungID FROM tblSendungen WHERE tblSnd_AvisoID=" & AvisoId & " AND (isnull(tblSnd_Vorpapier,'')='' AND isnull(tblSnd_Vorpapier2,'')='' AND isnull(tblSnd_Vorpapier3,'')='' ) ORDER BY tblSnd_PosUnterNr,tblSnd_SendungID", "AVISO").Rows
|
||||
For Each r In SQL.loadDgvBySql("SELECT tblSnd_SendungID FROM tblSendungen WHERE tblSnd_AvisoID=" & AvisoId & " AND (isnull(tblSnd_Vorpapier,'')='' AND isnull(tblSnd_Vorpapier2,'')='' AND isnull(tblSnd_Vorpapier3,'')='' ) AND tblSnd_Abfertigungsart_ID not in(44) ORDER BY tblSnd_PosUnterNr,tblSnd_SendungID", "AVISO").Rows
|
||||
SENDUNG_LIST.Add(New VERAG_PROG_ALLGEMEIN.cSendungen(r("tblSnd_SendungID")))
|
||||
Next
|
||||
If allowchangeCurrIndex Then CURRENT_INDEX = IIf(SENDUNG_LIST.Count > 0, 0, -1)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
Imports System.Reflection
|
||||
|
||||
|
||||
|
||||
Public Class cSpeditionsbuchList
|
||||
Property FilialenNr As Integer = -1
|
||||
Property AbfertigungsNr As Integer = -1
|
||||
@@ -873,4 +874,6 @@ Public Class cEndEmpfaener
|
||||
Return False
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
@@ -14,7 +14,7 @@ Public Class cTranslate_LIST
|
||||
Public Sub LOAD()
|
||||
Try
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblTranslate WHERE trs_progId=@trs_progId ", conn)
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblTranslate WHERE trs_progId=@trs_progId and [trs_active]=1 ", conn)
|
||||
cmd.Parameters.AddWithValue("@trs_progId", trs_progId)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
While dr.Read
|
||||
@@ -91,7 +91,7 @@ Public Class cTranslate
|
||||
Try
|
||||
hasEntry = False
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblTranslate WHERE trs_id=@trs_id ", conn)
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblTranslate WHERE trs_id=@trs_id AND [trs_active]=1 ", conn)
|
||||
cmd.Parameters.AddWithValue("@trs_id", trs_id)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
|
||||
Reference in New Issue
Block a user