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

@@ -282,8 +282,16 @@ Public Class SQL
cn.ConnectionString = GetEZOLLConnectionString()
cn.Open()
Return cn
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, "SQL CONNECTION | " & cn.ConnectionString.Replace("BmWr501956", "*******").Replace("yp/THDd?xM+pZ$", "*******") & " | Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
Catch
System.Threading.Thread.Sleep(500) 'warten...
'2.Versuch
Try
cn.ConnectionString = GetEZOLLConnectionString()
cn.Open()
Return cn
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, "SQL CONNECTION | " & cn.ConnectionString.Replace("BmWr501956", "*******").Replace("yp/THDd?xM+pZ$", "*******") & " | Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Try
Return Nothing

View File

@@ -64,7 +64,7 @@ Public Class cAvisoBenachrichtigungen
If ab_Beschreibung = "" Then ab_Beschreibung = SQL.getValueTxtBySql("SELECT abc_Bezeichnung FROM tblAvisoBenachrichtigungenCodes WHERE abc_id=" & ab_BenachrichtigungCode, "AVISO")
AB.ab_Beschreibung = ab_Beschreibung
AB.ab_Prioritaet = ab_Prioritaet
AB.ab_Mitarbeiter = VERAG_PROG_ALLGEMEIN.cAllgemein.USRNAME
AB.ab_Mitarbeiter = If(VERAG_PROG_ALLGEMEIN.cAllgemein.USRNAME, "AUTO")
AB.ab_MitarbeiterId = VERAG_PROG_ALLGEMEIN.cAllgemein.USRID
AB.ab_Firma = VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA

View File

@@ -0,0 +1,186 @@

Imports System.Data.SqlClient
Imports System.Reflection
Public Class cFilialen
Property FilialenNr As Integer
Property Stammfiliale As Object = Nothing
Property Grenzstelle As Object = Nothing
Property Speditionsbuch As Object =Nothing
Property Name_1 As Object = Nothing
Property Name_2 As Object = Nothing
Property Postfach As Object = Nothing
Property PLZPF As Object = Nothing
Property Straße As Object = Nothing
Property LandKz As Object = Nothing
Property PLZ As Object = Nothing
Property Ort As Object = Nothing
Property Telefon As Object = Nothing
Property Telefax As Object = Nothing
Property E_Mail As Object = Nothing
Property UstIdKz As Object = Nothing
Property UstIdNr As Object = Nothing
Property KorrespondentenNr As Object = Nothing
Property Absender As Object = Nothing
Property Fil_Status As Object = Nothing
Property PP440 As Object = Nothing
Property Firma As Object = Nothing
Property Cluster As Object = Nothing
Property PP441 As Object = Nothing
Public hasEntry = False
Dim SQL As New SQL
Sub New()
End Sub
Sub New(FilialenNr)
Me.FilialenNr = FilialenNr
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("FilialenNr", FilialenNr,, True))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Stammfiliale", Stammfiliale))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Grenzstelle", Grenzstelle))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Speditionsbuch", Speditionsbuch))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Name 1", Name_1, "Name_1"))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Name 2", Name_2, "Name_2"))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Postfach", Postfach))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("PLZPF", PLZPF))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Straße", Straße))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("LandKz", LandKz))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("PLZ", PLZ))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Ort", Ort))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Telefon", Telefon))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Telefax", Telefax))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("E-Mail", E_Mail, "E_Mail"))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UstIdKz", UstIdKz))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UstIdNr", UstIdNr))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("KorrespondentenNr", KorrespondentenNr))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Absender", Absender))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Fil_Status", Fil_Status))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("PP440", PP440))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Firma", Firma))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Cluster", Cluster))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("PP441", PP441))
Return list
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 Filialen WHERE FilialenNr=@FilialenNr) " &
" BEGIN " & getUpdateCmd() & " END " &
" Else " &
" BEGIN " & getInsertCmd() & " END " &
" commit tran "
Return SQL.doSQLVarList(sqlstr, "FMZOLL", , list)
End Function
Public Sub LOAD()
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM Filialen WHERE FilialenNr=@FilialenNr ", conn)
cmd.Parameters.AddWithValue("@FilialenNr", FilialenNr)
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 Filialen SET " & str & " WHERE FilialenNr=@FilialenNr ")
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 Filialen (" & 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
Public Shared Function LOAD_LIST() As List(Of cFilialen)
Dim FILIALEN As New List(Of cFilialen)
Try
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM Filialen ", conn)
Dim dr = cmd.ExecuteReader()
While dr.Read
Dim FILIALE As New cFilialen
For Each li In FILIALE.getParameterList()
Dim propInfo As PropertyInfo = FILIALE.GetType.GetProperty(li.Scalarvariable)
If dr.Item(li.Text) Is DBNull.Value Then
propInfo.SetValue(FILIALE, Nothing)
Else
propInfo.SetValue(FILIALE, dr.Item(li.Text))
End If
Next
FILIALEN.Add(FILIALE)
End While
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
Return FILIALEN
End Function
End Class

View File

@@ -102,6 +102,34 @@ Public Class cFirmen
End Try
End Sub
Public Shared Function LOAD_LIST() As List(Of cFirmen)
Dim FIRMEN As New List(Of cFirmen)
Try
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblFirma ", conn)
Dim dr = cmd.ExecuteReader()
While dr.Read
Dim FIMRA As New cFirmen
For Each li In FIMRA.getParameterList()
Dim propInfo As PropertyInfo = FIMRA.GetType.GetProperty(li.Scalarvariable)
If dr.Item(li.Text) Is DBNull.Value Then
propInfo.SetValue(FIMRA, Nothing)
Else
propInfo.SetValue(FIMRA, dr.Item(li.Text))
End If
Next
FIRMEN.Add(FIMRA)
End While
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
Return FIRMEN
End Function
End Class

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