Changes Wisag Pitch

This commit is contained in:
Digital Data - Marlon Schreiber 2018-12-18 23:47:18 +01:00
parent eedabf3da6
commit c9577c30ad
5 changed files with 25 additions and 20 deletions

View File

@ -64,13 +64,13 @@ Public Class MyComService
_Logger.Warn("Firebird-DB could not be intitialized!") _Logger.Warn("Firebird-DB could not be intitialized!")
Exit Sub Exit Sub
End If End If
Dim oSQL = "SELECT * FROM TBEDM_EMAIL_ACCOUNT WHERE GUID IN (SELECT DISTINCT EMAIL_ACCOUNT_ID FROM TBEDM_EMAIL_QUEUE WHERE EMAIL_SENT IS NULL and EMAIL_TO is not null)" Dim oSQL = "SELECT * FROM TBEDM_EMAIL_ACCOUNT WHERE ACTIVE = True"
Dim oDT_EMAIL_ACCOUNT As DataTable = _firebird.GetDatatable(oSQL) Dim oDT_EMAIL_ACCOUNT As DataTable = _firebird.GetDatatable(oSQL)
If IsNothing(oDT_EMAIL_ACCOUNT) Then If IsNothing(oDT_EMAIL_ACCOUNT) Then
_Logger.Warn("DT_EMAIL_ACCOUNT is nothing!") _Logger.Warn("DT_EMAIL_ACCOUNT is nothing!")
Exit Sub Exit Sub
End If End If
oSQL = "SELECT * FROM TBEDM_EMAIL_QUEUE WHERE EMAIL_SENT IS NULL and EMAIL_TO is not null" oSQL = "SELECT * FROM TBEDM_EMAIL_QUEUE WHERE EMAIL_SENT IS NULL and EMAIL_TO <> ''"
Dim oDT_EMAIL_QUEUE As DataTable = _firebird.GetDatatable(oSQL) Dim oDT_EMAIL_QUEUE As DataTable = _firebird.GetDatatable(oSQL)
If Not IsNothing(oDT_EMAIL_QUEUE) And oDT_EMAIL_ACCOUNT.Rows.Count >= 1 Then If Not IsNothing(oDT_EMAIL_QUEUE) And oDT_EMAIL_ACCOUNT.Rows.Count >= 1 Then
Dim oEmailTo, oSubject, oBody As String Dim oEmailTo, oSubject, oBody As String
@ -119,7 +119,7 @@ Public Class MyComService
oBody = oBody.Replace("[%PMOLINK_US]", "<a href=""" & link & """>here</a>") oBody = oBody.Replace("[%PMOLINK_US]", "<a href=""" & link & """>here</a>")
End If End If
If _Email.NewEmail(oEmailTo, oSubject, oBody, oMailFrom, oMailSMTP, oMailport, oMailUser, oMailPW, oAuthType) = True Then If _Email.NewEmail(oEmailTo, oSubject, oBody, oMailFrom, oMailSMTP, oMailport, oMailUser, oMailPW, oAuthType, "DDEDMI_ComService") = True Then
Dim upd = "UPDATE TBEDM_EMAIL_QUEUE SET EMAIL_SENT = CURRENT_TIMESTAMP WHERE GUID = " & oGUID Dim upd = "UPDATE TBEDM_EMAIL_QUEUE SET EMAIL_SENT = CURRENT_TIMESTAMP WHERE GUID = " & oGUID
_firebird.ExecuteNonQuery(upd) _firebird.ExecuteNonQuery(upd)
End If End If
@ -132,9 +132,6 @@ Public Class MyComService
End If End If
End If End If
Catch ex As Exception Catch ex As Exception
_Logger.Error(ex) _Logger.Error(ex)
End Try End Try

View File

@ -163,7 +163,7 @@ Public Class frmEmailAccount
Dim PWPlain = wrapper.DecryptData(txtEMAIL_PW.Text) Dim PWPlain = wrapper.DecryptData(txtEMAIL_PW.Text)
If _Email.NewEmail(txtTestmail.Text, "Testmail DD Windream-ResultHandler", "This is the body (text will be replaced within profile)", txtEMAIL_FROM.Text, txtSERVER_OUT.Text, txtPORT_OUT.Text, txtEMAIL_USER.Text, PWPlain, cmbAUTH_TYPE.Text) = True Then If _Email.NewEmail(txtTestmail.Text, "Testmail DD Windream-ResultHandler", "This is the body (text will be replaced within profile)", txtEMAIL_FROM.Text, txtSERVER_OUT.Text, txtPORT_OUT.Text, txtEMAIL_USER.Text, PWPlain, cmbAUTH_TYPE.Text, "EDMI GUI") = True Then
MsgBox("Email was send successfully.", MsgBoxStyle.Information) MsgBox("Email was send successfully.", MsgBoxStyle.Information)
Else Else
MsgBox("Could not send the testmail. Please check the log.", MsgBoxStyle.Exclamation) MsgBox("Could not send the testmail. Please check the log.", MsgBoxStyle.Exclamation)

View File

@ -13,7 +13,7 @@ Public Class Email
End Sub End Sub
Public Function NewEmail(mailto As String, mailSubject As String, mailBody As String, Public Function NewEmail(mailto As String, mailSubject As String, mailBody As String,
mailfrom As String, mailsmtp As String, mailport As Integer, mailUser As String, mailPW As String, mailfrom As String, mailsmtp As String, mailport As Integer, mailUser As String, mailPW As String,
AUTH_TYPE As String, Optional attment As String = "") AUTH_TYPE As String, SENDER_INSTANCE As String, Optional attment As String = "")
Try Try
_logger.Debug($"in NewEmail..") _logger.Debug($"in NewEmail..")
Dim oEmpfaenger As String() Dim oEmpfaenger As String()
@ -35,8 +35,12 @@ Public Class Email
_logger.Debug($"Message created..") _logger.Debug($"Message created..")
Dim oTextBodyPart As New BodyPart() Dim oTextBodyPart As New BodyPart()
oTextBodyPart.ContentType = New ContentType("text", "html", "utf-8") oTextBodyPart.ContentType = New ContentType("text", "html", "utf-8")
oTextBodyPart.ContentTransferEncoding = ContentTransferEncoding.QuotedPrintable oTextBodyPart.ContentTransferEncoding = ContentTransferEncoding.QuotedPrintable
oTextBodyPart.Body = mailBody Dim formattedBody = "<font face=""Tahoma"">" & mailBody & "<br><br>>> Service: " & SENDER_INSTANCE & "<br>" &
">> DateTime: " & My.Computer.Clock.LocalTime.ToShortDateString & " " &
My.Computer.Clock.LocalTime.ToLongTimeString & "</font>"
oTextBodyPart.Body = formattedBody
oMessage.BodyParts.Add(oTextBodyPart) oMessage.BodyParts.Add(oTextBodyPart)
If attment <> String.Empty Then If attment <> String.Empty Then
If System.IO.File.Exists(attment) Then If System.IO.File.Exists(attment) Then
@ -68,11 +72,11 @@ Public Class Email
oError = True oError = True
' Continue For ' Continue For
End Try End Try
_logger.Info("Connected to Client!") _logger.Debug("Connected to Client!")
If AUTH_TYPE = "SSL" Then If AUTH_TYPE = "SSL" Then
oEmailCient.EnableSsl = True oEmailCient.EnableSsl = True
'client.ValidateRemoteCertificate = True 'client.ValidateRemoteCertificate = True
_logger.Info("Authentification via SSL.") _logger.Debug("Authentification via SSL.")
ElseIf AUTH_TYPE = "TLS" Then ElseIf AUTH_TYPE = "TLS" Then
' client.ValidateRemoteCertificate = False ' client.ValidateRemoteCertificate = False
oEmailCient.StartTls() oEmailCient.StartTls()
@ -83,7 +87,6 @@ Public Class Email
_logger.Info("Authentification NONE. SSL disabled") _logger.Info("Authentification NONE. SSL disabled")
End If End If
Try Try
oEmailCient.Connect() oEmailCient.Connect()
Catch ex As Exception Catch ex As Exception
_logger.Warn("clsEmail.Client.Connect: " & ex.Message) _logger.Warn("clsEmail.Client.Connect: " & ex.Message)
@ -97,7 +100,7 @@ Public Class Email
oEmailCient.Login(mailUser, mailPW) oEmailCient.Login(mailUser, mailPW)
End If End If
_logger.Info("Logged in!") _logger.Debug("Logged in!")
Catch ex As Exception Catch ex As Exception
Try Try
If mailsmtp.Contains("office365.com") Then If mailsmtp.Contains("office365.com") Then

View File

@ -7,7 +7,7 @@ Imports DigitalData.Modules.Logging
''' '''
''' VERSION: 0.0.0.4 ''' VERSION: 0.0.0.4
''' '''
''' DATE: 05.12.2018 ''' DATE: 18.12.2018
''' '''
''' DESCRIPTION: ''' DESCRIPTION:
''' '''
@ -46,8 +46,8 @@ Imports DigitalData.Modules.Logging
''' REMARKS: If the connection fails due to "wrong username or password", the cause might be that the server harddrive is full.. ''' REMARKS: If the connection fails due to "wrong username or password", the cause might be that the server harddrive is full..
''' </summary> ''' </summary>
Public Class Firebird Public Class Firebird
Private _logger As Logger Private _Logger As Logger
Private _logConfig As LogConfig Private _MyLogger As LogConfig
Private _connectionServer As String Private _connectionServer As String
Private _connectionDatabase As String Private _connectionDatabase As String
Private _connectionUsername As String Private _connectionUsername As String
@ -85,8 +85,12 @@ Public Class Firebird
''' <param name="Password"></param> ''' <param name="Password"></param>
''' <exception cref="Exceptions.DatabaseException"></exception> ''' <exception cref="Exceptions.DatabaseException"></exception>
Public Sub New(LogConfig As LogConfig, Datasource As String, Database As String, User As String, Password As String) Public Sub New(LogConfig As LogConfig, Datasource As String, Database As String, User As String, Password As String)
_logger = LogConfig.GetLogger()
_logConfig = LogConfig _MyLogger = LogConfig
_Logger = _MyLogger.GetLogger()
Dim oConnectionString = GetConnectionString(Datasource, Database, User, Password) Dim oConnectionString = GetConnectionString(Datasource, Database, User, Password)
@ -199,7 +203,8 @@ Public Class Firebird
oCommand.ExecuteNonQuery() oCommand.ExecuteNonQuery()
Catch ex As Exception Catch ex As Exception
_logger.Error(ex, $"Error in ExecuteNonQuery while executing command: '{SqlCommand}'") _Logger.Error(ex, $"Error in ExecuteNonQuery while executing command: '{SqlCommand}'")
_Logger.Warn($"Unexpected error in ExecuteNonQueryWithConnection: '{SqlCommand}'")
Throw ex Throw ex
Finally Finally
MaybeCommitTransaction(oTransaction, TransactionMode) MaybeCommitTransaction(oTransaction, TransactionMode)

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("0.0.0.3")> <Assembly: AssemblyVersion("1.0.0.4")>
<Assembly: AssemblyFileVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.0")>