This commit is contained in:
2021-09-14 13:00:45 +02:00
parent 0a0ac4a065
commit 13f28aa1d8
16 changed files with 373 additions and 52 deletions

View File

@@ -1,5 +1,6 @@
Imports com.esendex.sdk.messaging
Imports com.esendex.sdk.sent
Imports com.esendex.sdk.core
Imports System.Data.SqlClient
Imports System.Reflection
@@ -213,10 +214,17 @@ Public Class cSMS
End Try
End Function
Function checkSMSStatus(Optional silent = False) As String
Function checkSMSStatus(Optional silent = False, Optional insertVermerkAviso = True) As String
Try
If Me.sms_Status >= 3 Then Return Me.sms_Status ' Bereits finaler Status, keine Abfrage nötig
Select Case Me.sms_Status
Case MessageStatus.Submitted, MessageStatus.Sent, MessageStatus.Scheduled, MessageStatus.Connecting, -1
'Weiter...
Case Else
' Bereits finaler Status, keine Abfrage nötig
Return Me.sms_Status
End Select
If If(Me.sms_MessageIds, "") = "" Then
If Not silent Then MsgBox("Keine MessageId gefunden!")
Return False ' Keine MsgId
@@ -226,23 +234,44 @@ Public Class cSMS
'Send a message and retrieve the message ID
Dim MSG = sendService.GetMessage(New Guid(Me.sms_MessageIds.ToString))
Dim messageStatus = MSG.Status
Dim msgStatus = MSG.Status
' MsgBox(MSG.Status)
'Status in DB Ubdaten
Me.sms_Status = messageStatus
Me.sms_Status = msgStatus
Me.sms_Sent = MSG.SentAt
Me.sms_Delivered = MSG.DeliveredAt
If IsDate(MSG.DeliveredAt) Then
Me.sms_Status = 3 ': MsgBox("SENT")
Else
'MsgBox("NOT SENT")
End If
'If IsDate(MSG.DeliveredAt) Then
' Me.sms_Status = 2 ': MsgBox("SENT")
'Else
' 'MsgBox("NOT SENT")
'End If
If MSG.FailureReason IsNot Nothing Then Me.sms_Failure = MSG.FailureReason.Description
Me.SAVE()
Return messageStatus
If True Then
Try
If Me.sms_AvisoId IsNot Nothing AndAlso IsNumeric(Me.sms_AvisoId) Then
Select Case MSG.Status
Case MessageStatus.Expired, MessageStatus.Failed, MessageStatus.FailedAuthorisation, MessageStatus.Cancelled, MessageStatus.Rejected
'Keine Übermittlung.
Dim MaId As Integer = SQL.DLookup("LetzterMitarbeiterId", "Aviso", "AvisoId='" & Me.sms_AvisoId & "' ", "AVISO", -1)
If MaId > 0 Then
VERAG_PROG_ALLGEMEIN.cAvisoBenachrichtigungen.INSERT_BENACHRICHTIGUNG(Me.sms_AvisoId, Nothing, 3, "B", MaId, "*SMS Fehler*", 0, "", "Fehler bei der SMS Übermittlung: " & If(Me.sms_Failure, ""))
End If
End Select
End If
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name)
End Try
End If
Return msgStatus
Catch ex As Exception
If Not silent Then MsgBox("Fehler beim Prüfen des SMS Status!" & vbNewLine & ex.Message & ex.StackTrace)
End Try