Notificaciones Trayectos
This commit is contained in:
@@ -13,6 +13,14 @@ Partial Class GPS_RastreoTrayectos
|
||||
Inherits Page
|
||||
|
||||
#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
|
||||
Get
|
||||
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
|
||||
If Not Page.IsPostBack Then
|
||||
RegistraScript("$('#SideNav').click();initMap();")
|
||||
Me.CveTrayecto = 97
|
||||
|
||||
CreaDTPosiciones()
|
||||
CargaDatos()
|
||||
RastrearEquipos()
|
||||
CargaTabla()
|
||||
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
|
||||
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CreaDTPosiciones()
|
||||
@@ -123,16 +138,19 @@ Partial Class GPS_RastreoTrayectos
|
||||
Using ObjGPS As New ClsGPS
|
||||
If ObjGPS.GetTrayectos(CveTrayecto, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
||||
Dim Row As DataRow = ObjGPS.DtResultados.Rows(0)
|
||||
|
||||
Me.CveDispositivo = Row("CveDispositivo").ToString().ToEntero()
|
||||
Me.CveCliente = Row("CveCliente").ToString().ToEntero()
|
||||
Me.RastreoValido = Not CBool(Row("EsFin"))
|
||||
|
||||
End If
|
||||
End Using
|
||||
TrazarLineaContinuo = True
|
||||
CreaDTCoordenadas()
|
||||
End Sub
|
||||
Protected Sub TimmerRefresh_Tick(sender As Object, e As EventArgs)
|
||||
DtPosiciones.Rows.Clear()
|
||||
RegistraScript("DeleteMarkers();")
|
||||
|
||||
|
||||
Dim LastCoord As String = ""
|
||||
Dim TmpDT As New DataTable
|
||||
Dim Info = ""
|
||||
@@ -143,6 +161,14 @@ Partial Class GPS_RastreoTrayectos
|
||||
|
||||
Dim ObjGPS As New ClsGPS
|
||||
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}")
|
||||
|
||||
If ObjGPS.UltimaPosicionEquipoGet(CveDispositivo, MinFecha, MaxFecha) Then
|
||||
@@ -178,7 +204,12 @@ Partial Class GPS_RastreoTrayectos
|
||||
OnError("Ocurrió un error al rastrear equipo", ex)
|
||||
End Try
|
||||
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 TmpDT As New DataTable
|
||||
Dim Info = ""
|
||||
@@ -217,7 +248,6 @@ Partial Class GPS_RastreoTrayectos
|
||||
End Try
|
||||
ObjGPS.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaTabla()
|
||||
If DtPosiciones IsNot Nothing Then
|
||||
GvBarra.DataSource = DtPosiciones
|
||||
@@ -229,7 +259,6 @@ Partial Class GPS_RastreoTrayectos
|
||||
GvBarra.HeaderRow.Cells(4).Style.Add("display", "none !important")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub AddRowCoordenadasContinuas(Coord As String, CveDispositivo As Integer)
|
||||
Dim dr As DataRow = DtCoordenadasContinuas.NewRow()
|
||||
dr("CveDispositivo") = CveDispositivo
|
||||
@@ -333,8 +362,19 @@ Partial Class GPS_RastreoTrayectos
|
||||
|
||||
RegistraScript("setTimeout(function(){OpcionesHistorico();},500);")
|
||||
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 = "")
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user