Envio de correo en trayectos
This commit is contained in:
@@ -231,40 +231,43 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState
|
||||
#Region "N O T F I C A C I O N - T R A Y E C T O S"
|
||||
Private Sub EnviarCorreoTrayectos(ByVal context As HttpContext, CveTrayecto As Integer)
|
||||
Dim Retorno As JObject = New JObject(New JProperty("EnvioCorreo", False), New JProperty("Mensaje", ""))
|
||||
Try
|
||||
Dim DtInfoTrayecto As DataTable = Nothing
|
||||
Dim DtTrayecto As DataTable = Nothing
|
||||
|
||||
Dim DtInfoTrayecto As DataTable = Nothing
|
||||
Dim DtTrayecto As DataTable = Nothing
|
||||
Using ObjGPS As New ClsGPS
|
||||
If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
||||
DtTrayecto = ObjGPS.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
If ObjGPS.GetTrayectosDatos(CveTrayecto) Then
|
||||
DtInfoTrayecto = ObjGPS.DtSetResultados.Tables(0).Copy()
|
||||
End If
|
||||
End Using
|
||||
|
||||
If DtTrayecto IsNot Nothing AndAlso DtInfoTrayecto IsNot Nothing AndAlso DtInfoTrayecto.Rows.Count > 0 Then
|
||||
Dim RowTrayecto As DataRow = DtTrayecto.Rows(0)
|
||||
Dim RowInfo As DataRow = DtInfoTrayecto.Rows(0)
|
||||
|
||||
Dim EnviarLiga As Boolean = CBool(RowTrayecto("EnviarLiga").ToString())
|
||||
|
||||
Dim Asunto As String = "Estatus de Trayecto"
|
||||
Dim Cuerpo As String = GeneraCorreo(CveTrayecto, EnviarLiga, RowInfo)
|
||||
Dim Correos As String = RowTrayecto("CorreosNotificacion").ToString()
|
||||
|
||||
Dim ObjMail As New ClsSisMail
|
||||
If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, Asunto, Cuerpo) Then
|
||||
Retorno("EnvioCorreo") = True
|
||||
Retorno("Mensaje") = "El correo fue enviado correctamente"
|
||||
Else
|
||||
Retorno("EnvioCorreo") = False
|
||||
Retorno("Mensaje") = "Ocurrió un error al enviar el correo"
|
||||
End If
|
||||
|
||||
Using ObjGPS As New ClsGPS
|
||||
If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
||||
DtTrayecto = ObjGPS.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
If ObjGPS.GetTrayectosDatos(CveTrayecto) Then
|
||||
DtInfoTrayecto = ObjGPS.DtSetResultados.Tables(0).Copy()
|
||||
End If
|
||||
End Using
|
||||
|
||||
If DtTrayecto IsNot Nothing AndAlso DtInfoTrayecto IsNot Nothing AndAlso DtInfoTrayecto.Rows.Count > 0 Then
|
||||
Dim RowTrayecto As DataRow = DtTrayecto.Rows(0)
|
||||
Dim RowInfo As DataRow = DtInfoTrayecto.Rows(0)
|
||||
|
||||
Dim EnviarLiga As Boolean = CBool(RowTrayecto("EnviarLiga").ToString())
|
||||
|
||||
Dim Asunto As String = "Estatus de Trayecto"
|
||||
Dim Cuerpo As String = GeneraCorreo(CveTrayecto, EnviarLiga, RowInfo)
|
||||
Dim Correos As String = RowTrayecto("CorreosNotificacion").ToString()
|
||||
|
||||
Dim ObjMail As New ClsSisMail
|
||||
If ObjMail.SendMail(ClsPaginas.EmpresaNotificaciones, Correos, Asunto, Cuerpo) Then
|
||||
Retorno("EnvioCorreo") = True
|
||||
Retorno("Mensaje") = "El correo fue enviado correctamente"
|
||||
Else
|
||||
Retorno("EnvioCorreo") = False
|
||||
Retorno("Mensaje") = "Ocurrió un error al enviar el correo"
|
||||
End If
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al enviar el correo", ex)
|
||||
End Try
|
||||
|
||||
context.Response.Write(Retorno.ToString())
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user