diff --git a/Ashx/SIGGPS.ashx b/Ashx/SIGGPS.ashx index a58642f67..600e75669 100644 --- a/Ashx/SIGGPS.ashx +++ b/Ashx/SIGGPS.ashx @@ -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 diff --git a/GPS/Trayectos.aspx b/GPS/Trayectos.aspx index 0d42e5047..087839253 100644 --- a/GPS/Trayectos.aspx +++ b/GPS/Trayectos.aspx @@ -159,7 +159,7 @@ - + diff --git a/GPS/Trayectos.aspx.vb b/GPS/Trayectos.aspx.vb index ac950d613..8e0b5654e 100644 --- a/GPS/Trayectos.aspx.vb +++ b/GPS/Trayectos.aspx.vb @@ -295,7 +295,9 @@ Partial Class GPS_Trayectos ElseIf e.Row.DBCampo("EsInicio") = "False" AndAlso e.Row.DBCampo("EsFin") = "False" Then e.Row.FCLabel("LblEstatus").CssClass = "badge badge-secondary" End If - + If CBool(e.Row.DBCampo("EnviarNotificacion")) Then + e.Row.FCLinkButton("LnkEnviar").Visible = True + End If End If End Sub Protected Sub DdlTrayecto_SelectedIndexChanged(sender As Object, e As EventArgs) @@ -415,7 +417,7 @@ Partial Class GPS_Trayectos Dim CveTrayecto As Integer = GvRow.DataKey("CveTrayecto").ToEntero() If CveTrayecto > 0 Then - Dim Url = New Uri(String.Format("{0}/ashx/SIGGPS.ashx?metodo=EjecutaTrayectos&CveTrayecto={1}", "https://gps.signalsgps.com", CveTrayecto)) + Dim Url = New Uri(String.Format("{0}/ashx/SIGGPS.ashx?metodo=EjecutaTrayectos&CveTrayecto={1}", "http://gps.signalsgps.com", CveTrayecto)) Dim Retorno As String = "{}" Try Using httpClient = New HttpClient() @@ -435,8 +437,10 @@ Partial Class GPS_Trayectos Alert(Resp("Mensaje").ToString(), TipoMensaje.MsgError) End If Catch ex As Exception - OnError("Ocurrió un error al descargar la factura", ex) + OnError("Ocurrió un error al enviar el correo", ex) End Try + Else + Alert("No se pudo identificar el trayecto", TipoMensaje.MsgError) End If End Sub End Class