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
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Notificar" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="LnkEnviar" Visible='<%# CBool(Eval("EnviarNotificacion")) %>' runat="server" OnClick="LnkEnviar_Click" CausesValidation="False" CssClass="Texto" Text="<i class='fa fa-envelope fa-2'></i>" data-toggle="confirmation" data-popout="true" data-original-title="Desea enviar el estado del trayecto?" data-btn-ok-label="si" />
|
||||
<asp:LinkButton ID="LnkEnviar" runat="server" Visible="false" OnClick="LnkEnviar_Click" CssClass="Texto" Text="<i class='fa fa-envelope fa-2'></i>" data-toggle="confirmation" data-popout="true" data-original-title="Desea enviar el estado del trayecto?" data-btn-ok-label="si" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:HyperLinkField Text="Ver Detalle" Target="_blank" DataNavigateUrlFormatString="/GPS/TrayectoDetalle.aspx?CveTrayecto={0}" DataNavigateUrlFields="CveTrayecto" ItemStyle-Width="10%" />
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user