Merge branch 'master' of http://agonzalez@192.168.10.111:8383/SIG.git
This commit is contained in:
152
Ashx/SIGGPS.ashx
152
Ashx/SIGGPS.ashx
@@ -19,6 +19,8 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState
|
|||||||
GetImgInstalacion(context)
|
GetImgInstalacion(context)
|
||||||
Case "EjecutarNotificaciones"
|
Case "EjecutarNotificaciones"
|
||||||
EjecutarNotificaciones(context)
|
EjecutarNotificaciones(context)
|
||||||
|
Case "EjecutaTrayectos"
|
||||||
|
EnviarCorreoTrayectos(context, context.Request("CveTrayecto").ToString().ToEntero())
|
||||||
End Select
|
End Select
|
||||||
ElseIf context.Request.InputStream IsNot Nothing Then
|
ElseIf context.Request.InputStream IsNot Nothing Then
|
||||||
Using reader As New StreamReader(context.Request.InputStream)
|
Using reader As New StreamReader(context.Request.InputStream)
|
||||||
@@ -225,4 +227,154 @@ Public Class SIGGPS : Implements IHttpHandler, IRequiresSessionState
|
|||||||
|
|
||||||
Return Json
|
Return Json
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
#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", ""))
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
context.Response.Write(Retorno.ToString())
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Protected Function GeneraCorreo(CveTrayecto As Integer, EnviarLiga As Boolean, Row As DataRow) As String
|
||||||
|
Dim strBody As New StringBuilder
|
||||||
|
Try
|
||||||
|
strBody.Append("<html xmlns=""http://www.w3.org/1999/xhtml""> ")
|
||||||
|
strBody.Append("<head> ")
|
||||||
|
strBody.Append(" <style type=""text/css""> ")
|
||||||
|
strBody.Append(" body ")
|
||||||
|
strBody.Append(" { ")
|
||||||
|
strBody.Append(" margin:0px; ")
|
||||||
|
strBody.Append(" padding:0px 0px 0px 0px; ")
|
||||||
|
strBody.Append(" font-family: Verdana, Arial, Helvetica, sans-serif; ")
|
||||||
|
strBody.Append(" font-size: 10px; ")
|
||||||
|
strBody.Append(" background-color:#F0F0F0; ")
|
||||||
|
strBody.Append(" } ")
|
||||||
|
strBody.Append(" a.Texto ")
|
||||||
|
strBody.Append(" { ")
|
||||||
|
strBody.Append(" font-size:11px; ")
|
||||||
|
strBody.Append(" background-color:#F7F6F3; ")
|
||||||
|
strBody.Append(" text-decoration:none; ")
|
||||||
|
strBody.Append(" font-weight:bold; ")
|
||||||
|
strBody.Append(" } ")
|
||||||
|
strBody.Append(" .Texto ")
|
||||||
|
strBody.Append(" { ")
|
||||||
|
strBody.Append(" background-color:#F7F6F3; color:Black; font-family:Verdana; font-size:10px; text-align:center; vertical-align:middle; height:20px;")
|
||||||
|
strBody.Append(" } ")
|
||||||
|
strBody.Append(" .TextoAlterno ")
|
||||||
|
strBody.Append(" { ")
|
||||||
|
strBody.Append(" background-color:White; color:Black; font-family:Verdana; font-size:10px; text-align:center; ")
|
||||||
|
strBody.Append(" vertical-align:middle; height:20px;")
|
||||||
|
strBody.Append(" } ")
|
||||||
|
strBody.Append(" .BarraIdentidad ")
|
||||||
|
strBody.Append(" { ")
|
||||||
|
strBody.Append(" color:#FFFFFF; ")
|
||||||
|
strBody.Append(" background:#F0F0F0; ")
|
||||||
|
strBody.Append(" font-weight:bold; ")
|
||||||
|
strBody.Append(" font-size:19px; ")
|
||||||
|
strBody.Append(" font-style:oblique; ")
|
||||||
|
strBody.Append(" } ")
|
||||||
|
strBody.Append(" .Titulos ")
|
||||||
|
strBody.Append(" { ")
|
||||||
|
strBody.Append(" background-color: Gray;")
|
||||||
|
strBody.Append(" color:White; ")
|
||||||
|
strBody.Append(" font-family:Verdana; font-size:12px; text-align:center; ")
|
||||||
|
strBody.Append(" vertical-align:middle; font-weight:bold; height:30px; ")
|
||||||
|
strBody.Append(" text-decoration:none; ")
|
||||||
|
strBody.Append(" } ")
|
||||||
|
strBody.Append(" .Verde {color: #00CC00;} ")
|
||||||
|
strBody.Append(" .Negro {color: #000000;} ")
|
||||||
|
strBody.Append(" .Rojo {color: #FF0000;} ")
|
||||||
|
strBody.Append(" </style> ")
|
||||||
|
strBody.Append("</head> ")
|
||||||
|
strBody.Append("<body> ")
|
||||||
|
strBody.Append(" <h5> ")
|
||||||
|
strBody.Append(" ")
|
||||||
|
strBody.Append(" </h5> ")
|
||||||
|
strBody.Append(" <div id=""C_divOC"" > ")
|
||||||
|
strBody.Append("<div><fieldset><legend><strong> Datos del Trayecto</strong></legend>")
|
||||||
|
strBody.Append("<table style=""width: 726.5px;"" border=""0"" cellspacing=""0"" cellpadding=""0"">")
|
||||||
|
strBody.Append("<tbody>")
|
||||||
|
strBody.Append("<tr>")
|
||||||
|
strBody.Append("<td style=""width: 36.5px;""> Trayecto:</td>")
|
||||||
|
strBody.AppendFormat("<td style=""width: 167px;"" colspan=""3""><strong> {0}</strong></td>", Row("Trayecto"))
|
||||||
|
strBody.Append("</tr>")
|
||||||
|
strBody.Append("<tr>")
|
||||||
|
strBody.Append("<td style=""width: 36.5px;""> Vehículo:</td>")
|
||||||
|
strBody.AppendFormat("<td style=""width: 167px;"" colspan=""3""><strong> {0}strong></td>", Row("Vehiculo"))
|
||||||
|
strBody.Append("</tr>")
|
||||||
|
strBody.Append("<tr>")
|
||||||
|
strBody.Append("<td style=""width: 36.5px;""> Estatus:</td>")
|
||||||
|
strBody.AppendFormat("<td style=""width: 167px;"" colspan=""3""><strong> {0}</strong></td>", Row("Estatus"))
|
||||||
|
strBody.Append("</tr>")
|
||||||
|
strBody.Append("<tr>")
|
||||||
|
strBody.Append("<tr>")
|
||||||
|
strBody.Append("<td style=""width: 36.5px;""> Latitud:</td>")
|
||||||
|
strBody.AppendFormat("<td style=""width: 167px;"" colspan=""3""><strong> {0}</strong></td>", Row("LatitudActual"))
|
||||||
|
strBody.Append("</tr>")
|
||||||
|
strBody.Append("<tr>")
|
||||||
|
strBody.Append("<td style=""width: 36.5px;""> Longitud:</td>")
|
||||||
|
strBody.AppendFormat("<td style=""width: 167px;"" colspan=""3""><strong> {0}</strong></td>", Row("LongitudActual"))
|
||||||
|
strBody.Append("</tr>")
|
||||||
|
strBody.Append("<tr>")
|
||||||
|
strBody.Append("<td style=""width: 36.5px;""> Posición:</td>")
|
||||||
|
strBody.AppendFormat("<td style=""width: 187px;"" colspan=""3""><strong> <a href=""https://www.google.com/maps/search/{0},{1}/\"" target=""_blank"" rel=""noopener"">Ver en google maps</a></strong></td>", Row("LatitudActual"), Row("LongitudActual"))
|
||||||
|
strBody.Append("</tr>")
|
||||||
|
If EnviarLiga Then
|
||||||
|
strBody.Append("<tr>")
|
||||||
|
strBody.Append("<td style=""width: 36.5px;""> Rastreo:</td>")
|
||||||
|
strBody.AppendFormat("<td style=""width: 187px;"" colspan=""3""><strong> <a href=""http://gps.signalsgps.com/GPS/RastreoTrayectos.aspx?P={0}"" target=""_blank"" rel=""noopener"">Rastrear Vehículo</a></strong></td>", Encripta($"CveTrayecto={Row("CveTrayecto").ToString()}"))
|
||||||
|
strBody.Append("</tr>")
|
||||||
|
End If
|
||||||
|
strBody.Append("<tr>")
|
||||||
|
strBody.Append("<td style=""width: 187px;"" colspan=""3""><img src=""https://maps.googleapis.com/maps/api/staticmap?size=700x340&zoom=14&center=20.5269,-100.868&path=&markers=icon:http://gps.signalsgps.com/Imagenes/rsz_11rsz_car.png|20.5269,-100.868&sensor=false&key=AIzaSyAF7s8wwhzCVXDUYopc9mXxqaWB33cDro4"" /></td>")
|
||||||
|
strBody.Append("</tr>")
|
||||||
|
strBody.Append("</tbody>")
|
||||||
|
strBody.Append("</table>")
|
||||||
|
strBody.Append("</fieldset></div>")
|
||||||
|
strBody.Append(" <h5> ")
|
||||||
|
strBody.Append(" ")
|
||||||
|
strBody.Append(" </h5> ")
|
||||||
|
strBody.Append(" </div> ")
|
||||||
|
strBody.Append("</body></html>")
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrio un error al general el correo.", ex)
|
||||||
|
End Try
|
||||||
|
Return strBody.ToString()
|
||||||
|
End Function
|
||||||
|
#End Region
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
@@ -13,6 +13,14 @@ Partial Class GPS_RastreoTrayectos
|
|||||||
Inherits Page
|
Inherits Page
|
||||||
|
|
||||||
#Region "P R O P I E D A D E S"
|
#Region "P R O P I E D A D E S"
|
||||||
|
Private Property RastreoValido As Boolean
|
||||||
|
Get
|
||||||
|
Return CType(ViewState("RastreoValido"), Boolean)
|
||||||
|
End Get
|
||||||
|
Set(value As Boolean)
|
||||||
|
ViewState("RastreoValido") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
Private Property TrazarLineaContinuo As Boolean
|
Private Property TrazarLineaContinuo As Boolean
|
||||||
Get
|
Get
|
||||||
Return CType(ViewState("TrazarLineaContinuo"), Boolean)
|
Return CType(ViewState("TrazarLineaContinuo"), Boolean)
|
||||||
@@ -87,12 +95,19 @@ Partial Class GPS_RastreoTrayectos
|
|||||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||||
If Not Page.IsPostBack Then
|
If Not Page.IsPostBack Then
|
||||||
RegistraScript("$('#SideNav').click();initMap();")
|
RegistraScript("$('#SideNav').click();initMap();")
|
||||||
Me.CveTrayecto = 97
|
If Request("P") IsNot Nothing Then
|
||||||
|
Dim URLParametros = Parametros(Decripta((Request("P").ToString)))
|
||||||
|
Me.CveTrayecto = URLParametros("CVETRAYECTO").ToString().ToEntero()
|
||||||
|
CargaDatos()
|
||||||
|
If RastreoValido Then
|
||||||
|
TrazarLineaContinuo = True
|
||||||
|
CreaDTCoordenadas()
|
||||||
|
CreaDTPosiciones()
|
||||||
|
RastrearEquipos()
|
||||||
|
CargaTabla()
|
||||||
|
End If
|
||||||
|
|
||||||
CreaDTPosiciones()
|
End If
|
||||||
CargaDatos()
|
|
||||||
RastrearEquipos()
|
|
||||||
CargaTabla()
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub CreaDTPosiciones()
|
Private Sub CreaDTPosiciones()
|
||||||
@@ -123,16 +138,19 @@ Partial Class GPS_RastreoTrayectos
|
|||||||
Using ObjGPS As New ClsGPS
|
Using ObjGPS As New ClsGPS
|
||||||
If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
||||||
Dim Row As DataRow = ObjGPS.DtResultados.Rows(0)
|
Dim Row As DataRow = ObjGPS.DtResultados.Rows(0)
|
||||||
|
|
||||||
Me.CveDispositivo = Row("CveDispositivo").ToString().ToEntero()
|
Me.CveDispositivo = Row("CveDispositivo").ToString().ToEntero()
|
||||||
Me.CveCliente = Row("CveCliente").ToString().ToEntero()
|
Me.CveCliente = Row("CveCliente").ToString().ToEntero()
|
||||||
|
Me.RastreoValido = Not CBool(Row("EsFin"))
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Using
|
End Using
|
||||||
TrazarLineaContinuo = True
|
|
||||||
CreaDTCoordenadas()
|
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub TimmerRefresh_Tick(sender As Object, e As EventArgs)
|
Protected Sub TimmerRefresh_Tick(sender As Object, e As EventArgs)
|
||||||
DtPosiciones.Rows.Clear()
|
DtPosiciones.Rows.Clear()
|
||||||
RegistraScript("DeleteMarkers();")
|
RegistraScript("DeleteMarkers();")
|
||||||
|
|
||||||
|
|
||||||
Dim LastCoord As String = ""
|
Dim LastCoord As String = ""
|
||||||
Dim TmpDT As New DataTable
|
Dim TmpDT As New DataTable
|
||||||
Dim Info = ""
|
Dim Info = ""
|
||||||
@@ -143,6 +161,14 @@ Partial Class GPS_RastreoTrayectos
|
|||||||
|
|
||||||
Dim ObjGPS As New ClsGPS
|
Dim ObjGPS As New ClsGPS
|
||||||
Try
|
Try
|
||||||
|
If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
||||||
|
Dim Row As DataRow = ObjGPS.DtResultados.Rows(0)
|
||||||
|
Me.RastreoValido = Not CBool(Row("EsFin"))
|
||||||
|
End If
|
||||||
|
If Not RastreoValido Then
|
||||||
|
Alert("El trayecto ha sido finalizado.", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
Dim RowVehiculo As DataRow = GlobalDTDispositivos(CveCliente).FiltroPrimero($"CveDispositivo = {CveDispositivo}")
|
Dim RowVehiculo As DataRow = GlobalDTDispositivos(CveCliente).FiltroPrimero($"CveDispositivo = {CveDispositivo}")
|
||||||
|
|
||||||
If ObjGPS.UltimaPosicionEquipoGet(CveDispositivo, MinFecha, MaxFecha) Then
|
If ObjGPS.UltimaPosicionEquipoGet(CveDispositivo, MinFecha, MaxFecha) Then
|
||||||
@@ -179,6 +205,11 @@ Partial Class GPS_RastreoTrayectos
|
|||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub RastrearEquipos()
|
Private Sub RastrearEquipos()
|
||||||
|
If Not RastreoValido Then
|
||||||
|
Alert("El trayecto ha sido finalizado.", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
Dim LastCoord As String = ""
|
Dim LastCoord As String = ""
|
||||||
Dim TmpDT As New DataTable
|
Dim TmpDT As New DataTable
|
||||||
Dim Info = ""
|
Dim Info = ""
|
||||||
@@ -217,7 +248,6 @@ Partial Class GPS_RastreoTrayectos
|
|||||||
End Try
|
End Try
|
||||||
ObjGPS.Dispose()
|
ObjGPS.Dispose()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub CargaTabla()
|
Private Sub CargaTabla()
|
||||||
If DtPosiciones IsNot Nothing Then
|
If DtPosiciones IsNot Nothing Then
|
||||||
GvBarra.DataSource = DtPosiciones
|
GvBarra.DataSource = DtPosiciones
|
||||||
@@ -229,7 +259,6 @@ Partial Class GPS_RastreoTrayectos
|
|||||||
GvBarra.HeaderRow.Cells(4).Style.Add("display", "none !important")
|
GvBarra.HeaderRow.Cells(4).Style.Add("display", "none !important")
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub AddRowCoordenadasContinuas(Coord As String, CveDispositivo As Integer)
|
Private Sub AddRowCoordenadasContinuas(Coord As String, CveDispositivo As Integer)
|
||||||
Dim dr As DataRow = DtCoordenadasContinuas.NewRow()
|
Dim dr As DataRow = DtCoordenadasContinuas.NewRow()
|
||||||
dr("CveDispositivo") = CveDispositivo
|
dr("CveDispositivo") = CveDispositivo
|
||||||
@@ -333,8 +362,19 @@ Partial Class GPS_RastreoTrayectos
|
|||||||
|
|
||||||
RegistraScript("setTimeout(function(){OpcionesHistorico();},500);")
|
RegistraScript("setTimeout(function(){OpcionesHistorico();},500);")
|
||||||
End Sub
|
End Sub
|
||||||
|
Private Function Parametros(Cadena As String) As Hashtable
|
||||||
|
Dim P1() As String = Cadena.Split("&"c)
|
||||||
|
Dim Tmp As String
|
||||||
|
Dim P2() As String
|
||||||
|
|
||||||
|
Dim URLParametros As New Hashtable
|
||||||
|
|
||||||
|
For Each Tmp In P1
|
||||||
|
P2 = Tmp.Replace("%26%", "&").Split("="c)
|
||||||
|
URLParametros.Add(P2(0).ToString.ToUpper, P2(1))
|
||||||
|
Next
|
||||||
|
Return URLParametros
|
||||||
|
End Function
|
||||||
Public Sub RegistraScript(Script As String, Optional valuetick As String = "")
|
Public Sub RegistraScript(Script As String, Optional valuetick As String = "")
|
||||||
Dim Rdm As Random = New Random()
|
Dim Rdm As Random = New Random()
|
||||||
ScriptManager.RegisterStartupScript(Page, Me.GetType(), String.Format("{0}{1}{2}", (DateTime.Now.Ticks + 1), Rdm.Next(), valuetick), String.Format("<script type='text/javascript' language='javascript'>{0}</script>", Script), False)
|
ScriptManager.RegisterStartupScript(Page, Me.GetType(), String.Format("{0}{1}{2}", (DateTime.Now.Ticks + 1), Rdm.Next(), valuetick), String.Format("<script type='text/javascript' language='javascript'>{0}</script>", Script), False)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ Imports Extensiones
|
|||||||
Imports Microsoft.Reporting.WebForms
|
Imports Microsoft.Reporting.WebForms
|
||||||
Imports Newtonsoft.Json.Linq
|
Imports Newtonsoft.Json.Linq
|
||||||
Imports System.Linq
|
Imports System.Linq
|
||||||
|
Imports System.Net.Http
|
||||||
|
|
||||||
Partial Class GPS_Trayectos
|
Partial Class GPS_Trayectos
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
@@ -413,105 +414,29 @@ Partial Class GPS_Trayectos
|
|||||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||||
|
|
||||||
Dim CveTrayecto As Integer = GvRow.DataKey("CveTrayecto").ToEntero()
|
Dim CveTrayecto As Integer = GvRow.DataKey("CveTrayecto").ToEntero()
|
||||||
Dim EnviarLiga As Boolean = CBool(GvRow.DataKey("EnviarLiga"))
|
|
||||||
If CveTrayecto > 0 Then
|
If CveTrayecto > 0 Then
|
||||||
Dim DtInfoTrayecto As DataTable = Nothing
|
Dim Url = New Uri(String.Format("{0}/ashx/SIGGPS.ashx?metodo=EjecutaTrayectos&CveTrayecto={1}", "https://gps.signalsgps.com", CveTrayecto))
|
||||||
Using ObjGPS As New ClsGPS
|
Dim Retorno As String = "{}"
|
||||||
If ObjGPS.GetTrayectosDatos(CveTrayecto) Then
|
Try
|
||||||
DtInfoTrayecto = ObjGPS.DtSetResultados.Tables(0).Copy()
|
Using httpClient = New HttpClient()
|
||||||
|
httpClient.Timeout = New TimeSpan(0, 0, 15)
|
||||||
|
Using request = New HttpRequestMessage(HttpMethod.Get, Url)
|
||||||
|
Dim response = httpClient.SendAsync(request).Result
|
||||||
|
If response.StatusCode = Net.HttpStatusCode.OK Then
|
||||||
|
Retorno = response.Content.ReadAsStringAsync().Result
|
||||||
|
End If
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
|
||||||
|
Dim Resp = JObject.Parse(Retorno)
|
||||||
|
If CBool(Resp("EnvioCorreo").ToString()) Then
|
||||||
|
Alert(Resp("Mensaje").ToString(), TipoMensaje.MsgInformacion)
|
||||||
|
Else
|
||||||
|
Alert(Resp("Mensaje").ToString(), TipoMensaje.MsgError)
|
||||||
End If
|
End If
|
||||||
End Using
|
Catch ex As Exception
|
||||||
If DtInfoTrayecto IsNot Nothing AndAlso DtInfoTrayecto.Rows.Count > 0 Then
|
OnError("Ocurrió un error al descargar la factura", ex)
|
||||||
Dim Row As DataRow = DtInfoTrayecto.Rows(0)
|
End Try
|
||||||
GeneraCorreo(CveTrayecto, EnviarLiga, Row)
|
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Function GeneraCorreo(CveTrayecto As Integer, EnviarLiga As Boolean, Row As DataRow) As String
|
|
||||||
Dim strBody As New StringBuilder
|
|
||||||
Try
|
|
||||||
strBody.Append("<html xmlns=""http://www.w3.org/1999/xhtml""> ")
|
|
||||||
strBody.Append("<head> ")
|
|
||||||
strBody.Append(" <style type=""text/css""> ")
|
|
||||||
strBody.Append(" body ")
|
|
||||||
strBody.Append(" { ")
|
|
||||||
strBody.Append(" margin:0px; ")
|
|
||||||
strBody.Append(" padding:0px 0px 0px 0px; ")
|
|
||||||
strBody.Append(" font-family: Verdana, Arial, Helvetica, sans-serif; ")
|
|
||||||
strBody.Append(" font-size: 10px; ")
|
|
||||||
strBody.Append(" background-color:#F0F0F0; ")
|
|
||||||
strBody.Append(" } ")
|
|
||||||
strBody.Append(" a.Texto ")
|
|
||||||
strBody.Append(" { ")
|
|
||||||
strBody.Append(" font-size:11px; ")
|
|
||||||
strBody.Append(" background-color:#F7F6F3; ")
|
|
||||||
strBody.Append(" text-decoration:none; ")
|
|
||||||
strBody.Append(" font-weight:bold; ")
|
|
||||||
strBody.Append(" } ")
|
|
||||||
strBody.Append(" .Texto ")
|
|
||||||
strBody.Append(" { ")
|
|
||||||
strBody.Append(" background-color:#F7F6F3; color:Black; font-family:Verdana; font-size:10px; text-align:center; vertical-align:middle; height:20px;")
|
|
||||||
strBody.Append(" } ")
|
|
||||||
strBody.Append(" .TextoAlterno ")
|
|
||||||
strBody.Append(" { ")
|
|
||||||
strBody.Append(" background-color:White; color:Black; font-family:Verdana; font-size:10px; text-align:center; ")
|
|
||||||
strBody.Append(" vertical-align:middle; height:20px;")
|
|
||||||
strBody.Append(" } ")
|
|
||||||
strBody.Append(" .BarraIdentidad ")
|
|
||||||
strBody.Append(" { ")
|
|
||||||
strBody.Append(" color:#FFFFFF; ")
|
|
||||||
strBody.Append(" background:#F0F0F0; ")
|
|
||||||
strBody.Append(" font-weight:bold; ")
|
|
||||||
strBody.Append(" font-size:19px; ")
|
|
||||||
strBody.Append(" font-style:oblique; ")
|
|
||||||
strBody.Append(" } ")
|
|
||||||
strBody.Append(" .Titulos ")
|
|
||||||
strBody.Append(" { ")
|
|
||||||
strBody.Append(" background-color: Gray;")
|
|
||||||
strBody.Append(" color:White; ")
|
|
||||||
strBody.Append(" font-family:Verdana; font-size:12px; text-align:center; ")
|
|
||||||
strBody.Append(" vertical-align:middle; font-weight:bold; height:30px; ")
|
|
||||||
strBody.Append(" text-decoration:none; ")
|
|
||||||
strBody.Append(" } ")
|
|
||||||
strBody.Append(" .Verde {color: #00CC00;} ")
|
|
||||||
strBody.Append(" .Negro {color: #000000;} ")
|
|
||||||
strBody.Append(" .Rojo {color: #FF0000;} ")
|
|
||||||
strBody.Append(" </style> ")
|
|
||||||
strBody.Append("</head> ")
|
|
||||||
strBody.Append("<body> ")
|
|
||||||
strBody.Append(" <h5> ")
|
|
||||||
strBody.Append(" ")
|
|
||||||
strBody.Append(" </h5> ")
|
|
||||||
strBody.Append(" <div id=""C_divOC"" > <fieldset> <legend><b> Datos del Trayecto</b></legend> ")
|
|
||||||
strBody.Append(" <table border=""0"" cellpadding=""0"" cellspacing=""0"" width=""550px""> ")
|
|
||||||
strBody.Append(" <tr style=""height: 22px""> ")
|
|
||||||
strBody.AppendFormat(" <td> Trayecto:</td><td colspan=""3""><b>{0}</b></td> ", Row("Trayecto"))
|
|
||||||
strBody.Append(" </tr> ")
|
|
||||||
strBody.Append(" <tr style=""height: 22px""> ")
|
|
||||||
strBody.AppendFormat(" <td> Vehículo:</td><td colspan=""3""><b>{0}</b></td> ", Row("Vehiculo"))
|
|
||||||
strBody.Append(" </tr> ")
|
|
||||||
strBody.Append(" <tr style=""height: 22px""> ")
|
|
||||||
strBody.AppendFormat(" <td>Estatus:</td><td colspan='3'><b>{0}</b></td> ", Row("Estatus"))
|
|
||||||
strBody.Append(" </tr> ")
|
|
||||||
If EnviarLiga Then
|
|
||||||
strBody.Append(" <tr style=""height: 22px""> ")
|
|
||||||
strBody.AppendFormat(" <td>Rastrea Equipo:</td><td colspan='3'><b>{0}</b></td> ", String.Format("http://gps.signalsgps.com/GPS/RastreoTrayectos.aspx?P={0}", Encripta($"CveTrayecto={CveTrayecto}")))
|
|
||||||
strBody.Append(" </tr> ")
|
|
||||||
End If
|
|
||||||
strBody.Append(" <tr > ")
|
|
||||||
strBody.AppendFormat(" <td>Posición:</td><td colspan='3'><img src=""{0}""></td> ", Row("LigaImagen"))
|
|
||||||
strBody.Append(" </tr> ")
|
|
||||||
strBody.Append(" </table> ")
|
|
||||||
strBody.Append(" </fieldset> ")
|
|
||||||
strBody.Append(" <h5> ")
|
|
||||||
strBody.Append(" ")
|
|
||||||
strBody.Append(" </h5> ")
|
|
||||||
strBody.Append(" </div> ")
|
|
||||||
strBody.Append("</body></html>")
|
|
||||||
Catch ex As Exception
|
|
||||||
OnError("Ocurrio un error al general el correo.", ex)
|
|
||||||
End Try
|
|
||||||
Return strBody.ToString()
|
|
||||||
End Function
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user