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
Dim ObjMail As New ClsSisMail()
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)
End If
End If
@@ -418,7 +418,7 @@ Public Class ClsSisNotificaciones
End If
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)
End If
End If
@@ -467,7 +467,7 @@ Public Class ClsSisNotificaciones
If LSRutasMail.Count > 0 Then
Dim ObjMail As New ClsSisMail()
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)
End If
End If
@@ -509,7 +509,7 @@ Public Class ClsSisNotificaciones
If LSRutasMail.Count > 0 Then
Dim ObjMail As New ClsSisMail()
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)
End If
End If
@@ -557,7 +557,7 @@ Public Class ClsSisNotificaciones
If LSRutasMail.Count > 0 Then
Dim ObjMail As New ClsSisMail()
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)
End If
End If
@@ -596,7 +596,7 @@ Public Class ClsSisNotificaciones
If LSRutasMail.Count > 0 Then
Dim ObjMail As New ClsSisMail()
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)
End If
End If
@@ -635,7 +635,7 @@ Public Class ClsSisNotificaciones
If LSRutasMail.Count > 0 Then
Dim ObjMail As New ClsSisMail()
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)
End If
End If

View File

@@ -1,7 +1,7 @@
Imports Extensiones
Imports System.Data
Partial Class Sistemas_PopUpAddUsuario
Inherits ClsPaginas
Inherits ClsPaginas
#Region "PROPIEDADES"
Public Property CveCliente As Integer
Get
@@ -51,7 +51,7 @@ Partial Class Sistemas_PopUpAddUsuario
Set(value As Integer)
ViewState("CvePlataforma") = value
End Set
End Property
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
@@ -164,8 +164,14 @@ Partial Class Sistemas_PopUpAddUsuario
If ObjUsuario.UpdateUsuario(LtlUsuario.Text, TxtNombre.Text, -1, TxtEmail.Text, -1, -1, True, True, -1, CveUsuario, -1, -1) Then
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 LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsuario & "&Clave=" & "-acceso-" & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks& & "&CveE=" & UsuarioActual.CveEmpresa)
EnviaCorreo(Liga, LigaActivar)
Dim LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsuario & "&Clave=" & "-acceso-" & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks& & "&CveE=" & UsuarioActual.CveEmpresa)
If UsuarioActual.Empresa.CvePlataforma = 3 Then
EnviaCorreoGPS(Liga, LigaActivar)
Else
EnviaCorreo(Liga, LigaActivar)
End If
End If
End If
ObjUsuario.Dispose()
@@ -251,8 +257,14 @@ Partial Class Sistemas_PopUpAddUsuario
'ENVIA CORREO
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 LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsuario & "&Clave=" & "-acceso-" & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks& & "&CveE=" & UsuarioActual.CveEmpresa)
Mensaje = EnviaCorreo(Liga, LigaActivar)
Dim LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsuario & "&Clave=" & "-acceso-" & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks& & "&CveE=" & UsuarioActual.CveEmpresa)
If UsuarioActual.Empresa.CvePlataforma = 3 Then
Mensaje = EnviaCorreoGPS(Liga, LigaActivar)
Else
Mensaje = EnviaCorreo(Liga, LigaActivar)
End If
Else
HuboError = True
End If
@@ -651,16 +663,139 @@ Partial Class Sistemas_PopUpAddUsuario
OnError("Ocurrió error al mandar MAIL", ex)
End Try
Return Retorno
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)
Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para)
a.GuardaLog()
Dim Mail As New ClsSisMail()
Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body)
End Sub
#End Region
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 Region
#Region "M O D U L O S"
Public Sub CargaModulosAcceso()
Dim ObjPermisos As New ClsSisUsuarios
@@ -808,11 +943,11 @@ Partial Class Sistemas_PopUpAddUsuario
End If
End If
End Sub
End Sub
#End Region
#Region "V E H I C U L O S"
Private Sub CargaDispositivos()
GvDispositivos.DataSource = GlobalDTDispositivos(CveCliente).FiltraParametros("Estatus = 1 ")
@@ -826,10 +961,10 @@ Partial Class Sistemas_PopUpAddUsuario
End If
End If
End If
End Sub
End Sub
#End Region
#Region "N O T I F I C A C I O N E S"
Private Sub CargarNotificaciones()
Dim ObjNotificaciones As New ClsSisNotificaciones
@@ -851,11 +986,11 @@ Partial Class Sistemas_PopUpAddUsuario
e.Row.FCCheckBox("chkApp").Checked = If(DtNotificacionesUsuarios.FiltroPrimeroValor("Alerta_App", $"CveNotificacion = {e.Row.DBCampo("CveNotificacion")}").ToString = "True", True, False)
End If
End If
End Sub
End Sub
#End Region
Protected Sub BtnCambiarUsuario_Click(sender As Object, e As EventArgs)
CveUsuario = -1