Notificaciones de Trayectos P1
This commit is contained in:
@@ -183,7 +183,9 @@ Partial Class GPS_Trayectos
|
||||
ObjGPS.IniciaTransacSQL()
|
||||
|
||||
Try
|
||||
Dim CveTrayecto As Integer = ObjGPS.AddTrayecto(Nombre, DateTime.Now, "", CveDispositivo, UsuarioActual.CveCliente)
|
||||
Dim CveTrayecto As Integer = ObjGPS.AddTrayecto(Nombre, DateTime.Now, "", CveDispositivo, UsuarioActual.CveCliente, EnviarNotificacion:=ChkNotificacion.Checked,
|
||||
CorreosNotificacion:=TxtCorreoNot.Text, Intervalo:=If(ChkNotificacion.Checked, 0, DdlIntervalo.SelectedValue.ToEntero()),
|
||||
EnviarLiga:=ChkEnviarLiga.Checked)
|
||||
|
||||
If CveTrayecto > 0 Then
|
||||
For Each Row As GridViewRow In GvEstatus.Rows
|
||||
@@ -401,6 +403,115 @@ Partial Class GPS_Trayectos
|
||||
ObjGPS.Dispose()
|
||||
End If
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
End Function
|
||||
|
||||
Protected Sub ChkNotificacion_CheckedChanged(sender As Object, e As EventArgs)
|
||||
DivNotificaciones.Visible = ChkNotificacion.Checked
|
||||
UpAgregar.Update()
|
||||
End Sub
|
||||
Protected Sub LnkEnviar_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
Dim CveTrayecto As Integer = GvRow.DataKey("CveTrayecto").ToEntero()
|
||||
Dim EnviarLiga As Boolean = CBool(GvRow.DataKey("EnviarLiga"))
|
||||
If CveTrayecto > 0 Then
|
||||
Dim DtInfoTrayecto As DataTable = Nothing
|
||||
Using ObjGPS As New ClsGPS
|
||||
If ObjGPS.GetTrayectosDatos(CveTrayecto) Then
|
||||
DtInfoTrayecto = ObjGPS.DtSetResultados.Tables(0).Copy()
|
||||
End If
|
||||
End Using
|
||||
If DtInfoTrayecto IsNot Nothing AndAlso DtInfoTrayecto.Rows.Count > 0 Then
|
||||
Dim Row As DataRow = DtInfoTrayecto.Rows(0)
|
||||
GeneraCorreo(CveTrayecto, EnviarLiga, Row)
|
||||
End If
|
||||
End If
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user