Cambio en correo de notificaciones

This commit is contained in:
2021-04-14 17:09:04 -07:00
parent 143f09e1e2
commit 1a2422b613
2 changed files with 162 additions and 27 deletions

View File

@@ -357,7 +357,7 @@ Public Class ClsSisNotificaciones
If LSRutasMail.Count > 0 Then If LSRutasMail.Count > 0 Then
Dim ObjMail As New ClsSisMail() Dim ObjMail As New ClsSisMail()
Dim ResultadoMail As Integer = 0 Dim ResultadoMail As Integer = 0
If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then If ObjMail.SendMail(ClsPaginas.EmpresaNotificacionesGPS, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then
UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1) UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
End If End If
End If End If
@@ -418,7 +418,7 @@ Public Class ClsSisNotificaciones
End If End If
If Archivos.Count > 0 Then If Archivos.Count > 0 Then
If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", $"Se adjunta el {Formato} en el Reporte Programado.", "", Archivos) Then If ObjMail.SendMail(ClsPaginas.EmpresaNotificacionesGPS, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", $"Se adjunta el {Formato} en el Reporte Programado.", "", Archivos) Then
UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1) UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
End If End If
End If End If
@@ -467,7 +467,7 @@ Public Class ClsSisNotificaciones
If LSRutasMail.Count > 0 Then If LSRutasMail.Count > 0 Then
Dim ObjMail As New ClsSisMail() Dim ObjMail As New ClsSisMail()
Dim ResultadoMail As Integer = 0 Dim ResultadoMail As Integer = 0
If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then If ObjMail.SendMail(ClsPaginas.EmpresaNotificacionesGPS, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then
UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1) UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
End If End If
End If End If
@@ -509,7 +509,7 @@ Public Class ClsSisNotificaciones
If LSRutasMail.Count > 0 Then If LSRutasMail.Count > 0 Then
Dim ObjMail As New ClsSisMail() Dim ObjMail As New ClsSisMail()
Dim ResultadoMail As Integer = 0 Dim ResultadoMail As Integer = 0
If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then If ObjMail.SendMail(ClsPaginas.EmpresaNotificacionesGPS, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then
UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1) UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
End If End If
End If End If
@@ -557,7 +557,7 @@ Public Class ClsSisNotificaciones
If LSRutasMail.Count > 0 Then If LSRutasMail.Count > 0 Then
Dim ObjMail As New ClsSisMail() Dim ObjMail As New ClsSisMail()
Dim ResultadoMail As Integer = 0 Dim ResultadoMail As Integer = 0
If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then If ObjMail.SendMail(ClsPaginas.EmpresaNotificacionesGPS, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then
UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1) UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
End If End If
End If End If
@@ -596,7 +596,7 @@ Public Class ClsSisNotificaciones
If LSRutasMail.Count > 0 Then If LSRutasMail.Count > 0 Then
Dim ObjMail As New ClsSisMail() Dim ObjMail As New ClsSisMail()
Dim ResultadoMail As Integer = 0 Dim ResultadoMail As Integer = 0
If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then If ObjMail.SendMail(ClsPaginas.EmpresaNotificacionesGPS, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then
UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1) UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
End If End If
End If End If
@@ -635,7 +635,7 @@ Public Class ClsSisNotificaciones
If LSRutasMail.Count > 0 Then If LSRutasMail.Count > 0 Then
Dim ObjMail As New ClsSisMail() Dim ObjMail As New ClsSisMail()
Dim ResultadoMail As Integer = 0 Dim ResultadoMail As Integer = 0
If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then If ObjMail.SendMail(ClsPaginas.EmpresaNotificacionesGPS, Correos, $"Reporte Programado {Date.Today.ToShortDateString}", "Se adjunta en pdf el Reporte Programado.", "", LSRutasMail) Then
UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1) UpdateNotificacionesBitacoraNotifico(CveNotificacionBitacora, 1)
End If End If
End If End If

View File

@@ -165,7 +165,13 @@ Partial Class Sistemas_PopUpAddUsuario
Alert("La contraseña se reestableció correctamente a la contraseña por default '-acceso-'.") Alert("La contraseña se reestableció correctamente a la contraseña por default '-acceso-'.")
Dim Liga As String = $"{Context.Request.Url.OriginalString.Substring(0, Context.Request.Url.OriginalString.Length - Context.Request.Url.PathAndQuery.Length)}/LogIn.aspx" Dim Liga As String = $"{Context.Request.Url.OriginalString.Substring(0, Context.Request.Url.OriginalString.Length - Context.Request.Url.PathAndQuery.Length)}/LogIn.aspx"
Dim LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsuario & "&Clave=" & "-acceso-" & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks& & "&CveE=" & UsuarioActual.CveEmpresa) Dim LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsuario & "&Clave=" & "-acceso-" & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks& & "&CveE=" & UsuarioActual.CveEmpresa)
EnviaCorreo(Liga, LigaActivar)
If UsuarioActual.Empresa.CvePlataforma = 3 Then
EnviaCorreoGPS(Liga, LigaActivar)
Else
EnviaCorreo(Liga, LigaActivar)
End If
End If End If
End If End If
ObjUsuario.Dispose() ObjUsuario.Dispose()
@@ -252,7 +258,13 @@ Partial Class Sistemas_PopUpAddUsuario
If CveUsuario > 0 Then If CveUsuario > 0 Then
Dim Liga As String = $"{Context.Request.Url.OriginalString.Substring(0, Context.Request.Url.OriginalString.Length - Context.Request.Url.PathAndQuery.Length)}/LogIn.aspx" Dim Liga As String = $"{Context.Request.Url.OriginalString.Substring(0, Context.Request.Url.OriginalString.Length - Context.Request.Url.PathAndQuery.Length)}/LogIn.aspx"
Dim LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsuario & "&Clave=" & "-acceso-" & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks& & "&CveE=" & UsuarioActual.CveEmpresa) Dim LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsuario & "&Clave=" & "-acceso-" & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks& & "&CveE=" & UsuarioActual.CveEmpresa)
Mensaje = EnviaCorreo(Liga, LigaActivar)
If UsuarioActual.Empresa.CvePlataforma = 3 Then
Mensaje = EnviaCorreoGPS(Liga, LigaActivar)
Else
Mensaje = EnviaCorreo(Liga, LigaActivar)
End If
Else Else
HuboError = True HuboError = True
End If End If
@@ -653,11 +665,134 @@ Partial Class Sistemas_PopUpAddUsuario
Return Retorno Return Retorno
End Function End Function
Private Function EnviaCorreoGPS(Liga As String, LigaActivar As String) As String
Dim Retorno As String = ""
Try
'Dim URL As String = "https://gps.signalsgps.com/" + LigaActivar
Dim Para = TxtEmail.Text.Trim
Dim Asunto = "ACCESO A SIGNALS GPS"
'Dim SBBody As New StringBuilder
''Linia de estilos
'SBBody.Append("<style> .mailbody{ background-color:#EEF1F5; padding:15px; font-family :'Open Sans', sans-serif; } .mailcontent{ background-color:#fff; font-size: 14px; color: #333; padding:0px 15px ; } .mailtitle{padding:8px;color:#32C5D2; font-size: 18px;font-weight: 700!important;border-bottom:2px solid #EEF1F5;text-transform: uppercase;}.marco{border: 1px solid #869ab3;border-top: 0;background-color: #67809F; margin: 10px 15px 25px 15px;color: #fff;}.marco-title{padding: 10px 10px;text-transform: uppercase;font-weight: 700!important;}.marco-body{color:#333;background-color:#fff;}.nota{background: #E5E5E5;padding:15px;color:#333;} .logo { font-size:12px; font-style:italic; text-align:right; } .col1{width:180px;font-weight: 700!important;display:inline-block;} .col2{min-width:260px;display:inline-block;} </style>")
''incio Cuerpo del correo
'SBBody.Append("<div Class='mailbody'>")
'SBBody.Append("<div Class='mailcontent'>")
'SBBody.Append("<div Class='mailtitle'>")
'SBBody.Append("ALTA DE CUENTA")
'SBBody.Append("</div>")
'SBBody.Append("<br/>")
'SBBody.AppendFormat("<b> Estimado {0}:</b><br/>", TxtNombre.Text.ToUpper)
'SBBody.AppendFormat("El presente correo es para informarle que se le han asignado los siguientes datos para el acceso a la Plataforma de: <b>{0}</b><br/><br/>", UsuarioActual.Empresa.Empresa)
'SBBody.Append("<div Class='marco'>")
'SBBody.Append("<div Class='marco-title'>Datos de usuario</div>")
'SBBody.Append("<div Class='marco-body'>")
'SBBody.Append("<div>")
'SBBody.Append("<div>")
'SBBody.Append("<div class='col1'> Usuario</div>")
'SBBody.AppendFormat("<div class='col2'>{0}</div>", TxtEmail.Text)
'SBBody.Append("</div>")
'SBBody.Append("<div>")
'SBBody.Append("<div class='col1'> Accesé al sistema dando click a la liga y estableciendo su contraseña</div>")
'SBBody.AppendFormat("<div class='col2'><a href='{0}'target='_blank'>Activar</a></div>", LigaActivar)
'SBBody.Append("</div>")
'SBBody.Append("</div>")
'SBBody.Append("</div>")
'SBBody.Append("<br/>")
'SBBody.Append("Para Activar su cuenta debera cambiar su contraseña.<br/><br/>")
'SBBody.Append("<div Class='nota'>")
'SBBody.Append("Nota Favor de NO responder este correo. ")
'SBBody.Append("</div><br/><br/>")
'SBBody.AppendFormat("<div class='logo'><img src='{0}Imagenes/LogoSinFondo.png' style='width:30px;'/>ADSistemas </div>", URL)
'SBBody.Append("</div>")
'SBBody.Append("</div>")
Dim SBBody As New StringBuilder()
SBBody.Append("<div>")
SBBody.Append("<div style ='border: none; border-bottom: solid #eef1f5 1.5pt; padding: 0in 0in 6.0pt 0in;'>")
SBBody.Append(" <table style='border-collapse: collapse;' border='0' cellspacing='0' cellpadding='0'>")
SBBody.Append(" <tbody>")
SBBody.Append(" <tr>")
SBBody.Append(" <td style='width: 65.55pt; padding: 0in 5.4pt 0in 5.4pt;' valign='top' width='87'>&nbsp;</td>")
SBBody.Append(" <td style='width: 376.5pt; padding: 0in 5.4pt 0in 5.4pt;' valign='bottom' width='502'>")
SBBody.Append(" <p class='MsoNormal' style='background: white;'><span style='font-size: 13.5pt; font-family: ' Avenir Next LT Pro Light',sans-serif; color: #c00000; text-transform: uppercase;'>DATOS DE ACCESO<u></u><u></u></span></p>")
SBBody.Append(" <p class='MsoNormal'><span style='font-size: 13.5pt; font-family: ' Avenir Next LT Pro Light',sans-serif; color: #c00000; text-transform: uppercase;'><u></u>&nbsp;<u></u></span></p>")
SBBody.Append(" </td>")
SBBody.Append(" </tr>")
SBBody.Append(" </tbody>")
SBBody.Append(" </table>")
SBBody.Append("</div>")
SBBody.AppendFormat(" <p Class='MsoNormal' style='margin-bottom: 12.0pt; background: white;'><span lang='ES-MX' style='font-size: 10.5pt; font-family: 'Avenir Next LT Pro Light',sans-serif; color: #404040;'><br /><strong>Estimado / a {0}:<u></u><u></u></strong></span></p>", TxtNombre.Text)
SBBody.Append(" <p Class='MsoNormal' style='margin-bottom: 12.0pt; background: white;'><span lang='ES-MX' style='font-size: 10.5pt; font-family: 'Avenir Next LT Pro Light',sans-serif; color: #333333;'>El presente correo es para informarle que se le han asignado los siguentes datos para el acceso</span><span lang='ES-MX' style='font-size: 10.5pt; font-family: 'Avenir Next LT Pro Light',sans-serif; color: black;'> a la plataforma </span><strong><span lang='ES-MX' style='font-size: 10.5pt; font-family: 'Avenir Next LT Pro Light',sans-serif; color: #c00000;'>SIGNALS GPS</span></strong><u></u><u></u></p>")
SBBody.Append(" <table style ='border-collapse: collapse;' border='0' cellspacing='0' cellpadding='0'>")
SBBody.Append(" <tbody>")
SBBody.Append(" <tr style='height: 21.25pt;'>")
SBBody.Append(" <td style='width: 441.4pt; border: none; border-bottom: solid #c00000 1.0pt; background: #e7e6e6; padding: 5.4pt 5.4pt 5.4pt 5.4pt; height: 21.25pt;' valign='bottom' width='589'>")
SBBody.Append(" <p class='MsoNormal' style='margin-bottom: 12.0pt; text-align: center;' align='center'><strong><span style='font-family: ' Avenir Next LT Pro Light',sans-serif; color: #c00000;'>USUARIO ASIGNADO</span></strong><u></u><u></u></p>")
SBBody.Append(" </td>")
SBBody.Append(" </tr>")
SBBody.Append(" <tr>")
SBBody.Append(" <td style='width: 441.4pt; border: none; border-bottom: solid #c00000 1.0pt; padding: 5.4pt 5.4pt 5.4pt 5.4pt;' valign='top' width='589'>")
SBBody.Append(" <p class='MsoNormal' style='margin-bottom: 12.0pt;'><strong><span style='font-family: ' Arial Nova Light',sans-serif; color: #c00000;'>Usuario</span></strong><span style='font-family: ' Arial Nova Light',sans-serif; color: #c00000;'>:<u></u><u></u></span></p>")
SBBody.AppendFormat(" <p class='MsoNormal' style='margin-bottom: 12.0pt;'><span style='font-family: ' Arial Nova Light',sans-serif;'><a href='mailto:{0}' target='_blank' rel='noopener'>{0}</a><u></u><u></u></span></p>", TxtEmail.Text)
SBBody.Append(" </td>")
SBBody.Append(" </tr>")
SBBody.Append(" <tr>")
SBBody.Append(" <td style='width: 441.4pt; padding: 5.4pt 5.4pt 5.4pt 5.4pt;' valign='top' width='589'>")
SBBody.Append(" <p class='MsoNormal' style='margin-bottom: 12.0pt;'><strong><span style='font-family: ' Arial Nova Light',sans-serif; color: #c00000;'>Contrase&ntilde;a</span></strong><span style='font-family: ' Arial Nova Light',sans-serif; color: #c00000;'>:<u></u><u></u></span></p>")
SBBody.Append(" <p class='MsoNormal' style='margin-bottom: 12.0pt;'><span style='font-size: 9.0pt; font-family: ' Arial',sans-serif; color: #333333; background: white;'>-acceso-</span><u></u><u></u></p>")
SBBody.Append(" </td>")
SBBody.Append(" </tr>")
SBBody.Append(" <tr>")
SBBody.Append(" <td style='width: 441.4pt; background: #c00000; padding: 5.4pt 5.4pt 5.4pt 5.4pt;' valign='top' width='589'>")
SBBody.AppendFormat(" <p class='MsoNormal' style='margin-bottom: 12.0pt; text-align: center;' align='center'><strong><span style='font-size: 22.0pt; font-family: ' Segoe UI Emoji',sans-serif; color: white;'><img class='CToWUd' style='margin: 0 0.2ex; vertical-align: middle; max-height: 24px;' src='https://mail.google.com/mail/e/1f446' alt='👆' data-goomoji='1f446' data-image-whitelisted=''/></span></strong><strong><span style='font-size: 22.0pt; font-family: ' Arial Nova Light',sans-serif; color: white;'><a href='{0}' target='_blank' rel='noopener' data-saferedirecturl='https://www.google.com/url?q={0}&amp;source=gmail&amp;ust=1617928195657000&amp;usg=AFQjCNGY8Tj8s35QxHYX-RPcqPlzZoBBFg'><span style='color: white;'>INGRESAR A SIGNALS GPS</span></a></span></strong><strong><span style='font-size: 22.0pt; font-family: ' Segoe UI Emoji',sans-serif; color: white;'><img class='CToWUd' style='margin: 0 0.2ex; vertical-align: middle; max-height: 24px;' src='https://mail.google.com/mail/e/1f446' alt='👆' data-goomoji='1f446' data-image-whitelisted=''/></span></strong><u></u><u></u></p>", LigaActivar)
SBBody.Append(" </td>")
SBBody.Append(" </tr>")
SBBody.Append("</tbody>")
SBBody.Append("</table>")
SBBody.Append("<div>")
SBBody.Append("<p Class='MsoNormal' style='margin-bottom: 12.0pt; background: white;'><span lang='ES-MX' style='font-size: 10.5pt; font-family: 'Arial Nova Light',sans-serif; color: #333333;'><br /></span><span lang='ES-MX' style='font-size: 10.5pt; font-family: 'Arial Nova Light',sans-serif; color: black;'>F</span><span lang='ES-MX' style='font-size: 10.5pt; font-family: 'Arial Nova Light',sans-serif; color: #333333;'>avor de NO responder este correo. <u></u><u></u></span></p>")
SBBody.Append("</div>")
SBBody.Append(" <p Class='MsoNormal' style='margin-bottom: 12.0pt; background: white;'><span lang='ES-MX' style='font-size: 10.5pt; font-family: 'Arial Nova Light',sans-serif; color: #333333;'><u></u>&nbsp;<u></u></span></p>")
SBBody.Append("</div>")
'Termino Cuerpo del correo
Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo(Asunto, Para, SBBody.ToString))
Hilo.Start()
'Dim JSBTN As String = ""
'If UsuarioActual.CveCliente > 0 Then
' JSBTN = $"document.location.href=""javascript: Ir2({CveCliente})"";"
'ElseIf CveCliente > 0 Then
' JSBTN = $"document.location.href=""javascript:Ir({CveCliente})"";"
'End If
'If UsuarioActual.Empresa.CvePlataforma = 3 Then
' Alert("El correo se ha enviado correctamente a: " + TxtEmail.Text + ".", TipoMensaje.MsgInformacion, JSBTN)
'End If
Retorno = $"El correo se ha enviado correctamente a: <b>{TxtEmail.Text}</b>."
Catch ex As Exception
OnError("Ocurrió error al mandar MAIL", ex)
End Try
Return Retorno
End Function
Private Sub MandaCorreo(Asunto As String, Para As String, Body As String) Private Sub MandaCorreo(Asunto As String, Para As String, Body As String)
Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para) Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para)
a.GuardaLog() a.GuardaLog()
Dim Mail As New ClsSisMail() Dim Mail As New ClsSisMail()
Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body)
Dim EmpresaEnvio As Empresa = ClsPaginas.EmpresaNotificaciones
If UsuarioActual.Empresa.CvePlataforma = 3 Then
EmpresaEnvio = ClsPaginas.EmpresaNotificacionesGPS
End If
Mail.SendMail(EmpresaEnvio, Para, Asunto, Body)
End Sub End Sub
#End Region #End Region