118 lines
5.9 KiB
VB.net
118 lines
5.9 KiB
VB.net
Option Strict On
|
|
|
|
Imports System.Data
|
|
Imports Extensiones
|
|
Partial Class GPS_Busqueda
|
|
Inherits ClsPaginas
|
|
|
|
'Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
' If Not Page.IsPostBack Then
|
|
' End If
|
|
'End Sub
|
|
|
|
Protected Sub BtnBuscarEquipoC_Click(sender As Object, e As EventArgs)
|
|
Dim GPS As New ClsGPS
|
|
Dim punto As String
|
|
If DdlTipoRastreo.SelectedValue = "Dir" Then
|
|
punto = $"POINT({CommandArg.Value})"
|
|
If GPS.GetPuntoMasCercano(punto, UsuarioActual.CveCliente) Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
RegistraScript("$('#divAgregarTipo').modal('hide')", "1")
|
|
|
|
Dim CveDispositivo As Integer = GPS.DtResultados.Rows(0)("CveEquipoPosicion").ToString().ToEntero()
|
|
Dim coord As String = SQLToGmaps(GPS.DtResultados.Rows(0)("Posicion").ToString, "POINT")
|
|
Dim origin As String = SQLToGmaps(punto, "POINT")
|
|
Dim Icono As String = "/Imagenes/rsz_11rsz_car.png"
|
|
If GPS.DtResultados.Rows(0)("SPD").ToString.ToDouble > 1 Then
|
|
Icono = $"/Imagenes/{GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimeroValor("Icono", $"CveDispositivo = {CveDispositivo}")}green.png"
|
|
Else
|
|
Icono = $"/Imagenes/{GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimeroValor("Icono", $"CveDispositivo = {CveDispositivo}")}.png"
|
|
End If
|
|
|
|
Dim Info = InfoWindow($"Vehículo: {GPS.DtResultados.Rows(0)("Vehiculo").ToString}", $"<tr><td>Distancia: {GPS.DtResultados.Rows(0)("Distancia").ToString.ToDouble().FormatoNumero()} Metros</td></tr>", GPS.DtResultados.Rows(0)("CveEquipoPosicion").ToString.ToEntero, GPS.DtResultados.Rows(0))
|
|
RegistraScript($"EquipoMasCercano({origin}, {coord}, '{GPS.DtResultados.Rows(0)("Vehiculo").ToString}', '{Info}', '{Icono}');", "2")
|
|
End If
|
|
End If
|
|
ElseIf DdlTipoRastreo.SelectedValue = "Coord" Then
|
|
punto = $"POINT({TxtLng.Text} {TxtLat.Text})"
|
|
If GPS.GetPuntoMasCercano(punto, UsuarioActual.CveCliente) Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
RegistraScript("$('#divAgregarTipo').modal('hide')", "1")
|
|
|
|
Dim CveDispositivo As Integer = GPS.DtResultados.Rows(0)("CveEquipoPosicion").ToString().ToEntero()
|
|
Dim coord As String = SQLToGmaps(GPS.DtResultados.Rows(0)("Posicion").ToString, "POINT")
|
|
Dim origin As String = SQLToGmaps(punto, "POINT")
|
|
|
|
Dim Icono As String = "/Imagenes/rsz_11rsz_car.png"
|
|
If GPS.DtResultados.Rows(0)("SPD").ToString.ToDouble > 1 Then
|
|
Icono = $"/Imagenes/{GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimeroValor("Icono", $"CveDispositivo = {CveDispositivo}")}green.png"
|
|
Else
|
|
Icono = $"/Imagenes/{GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimeroValor("Icono", $"CveDispositivo = {CveDispositivo}")}.png"
|
|
End If
|
|
Dim Info = InfoWindow($"Vehículo: {GPS.DtResultados.Rows(0)("Vehiculo").ToString}", $"<tr><td>Distancia: {GPS.DtResultados.Rows(0)("Distancia").ToString.FormatoNumero} Metros</td></tr>", GPS.DtResultados.Rows(0)("CveEquipoPosicion").ToString.ToEntero, GPS.DtResultados.Rows(0))
|
|
RegistraScript($"EquipoMasCercano({origin}, {coord}, '{GPS.DtResultados.Rows(0)("Vehiculo").ToString}', '{Info}', '{Icono}');", "2")
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
GPS.Dispose()
|
|
End Sub
|
|
Protected Sub DdlTipoRastreo_SelectedIndexChanged(sender As Object, e As EventArgs)
|
|
If DdlTipoRastreo.SelectedValue = "Dir" Then
|
|
dvDireccion.Style.Add("display", "")
|
|
dvLatLng.Style.Add("display", "none")
|
|
RFVDireccion.ValidationGroup = "GrpObligatorio"
|
|
RequiredFieldValidator1.ValidationGroup = ""
|
|
RequiredFieldValidator2.ValidationGroup = ""
|
|
ElseIf DdlTipoRastreo.SelectedValue = "Coord" Then
|
|
dvDireccion.Style.Add("display", "none")
|
|
dvLatLng.Style.Add("display", "")
|
|
RFVDireccion.ValidationGroup = ""
|
|
RequiredFieldValidator1.ValidationGroup = "GrpObligatorio"
|
|
RequiredFieldValidator2.ValidationGroup = "GrpObligatorio"
|
|
End If
|
|
End Sub
|
|
#Region "Herramientas - GPS"
|
|
|
|
Protected Sub BtnCargaComandos_Click(sender As Object, e As EventArgs) Handles BtnCargaComandos.Click
|
|
CargaComandos()
|
|
End Sub
|
|
Private Sub CargaComandos()
|
|
Dim ObjGPS As New ClsGPS
|
|
If ObjGPS.GetComandosModeloDispositivoUsuarios(HdnCveDipositivo.Value.ToEntero, UsuarioActual.CveUsuario, 1) Then
|
|
GvComandos.DataSource = ObjGPS.DtResultados
|
|
End If
|
|
ObjGPS.Dispose()
|
|
GvComandos.DataBind()
|
|
|
|
UpHidden.Update()
|
|
UpComandos.Update()
|
|
End Sub
|
|
|
|
Private Sub GvComandos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvComandos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.DataKey("RequiereValor").ToEntero = 1 Then
|
|
e.Row.FCTextBox("TxtValor").Visible = True
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub GvComandos_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvComandos.RowCommand
|
|
If (e.CommandName = "EnviarComando") Then
|
|
|
|
Dim ObjHerramientas As New ClsGPSHerramientas
|
|
|
|
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
|
|
Dim row As GridViewRow = GvComandos.Rows(index)
|
|
|
|
ObjHerramientas.EjecutarComandoGPRS(row.DataKey("CveComando").ToEntero, HdnCveDipositivo.Value.ToEntero, UsuarioActual.CveUsuario, row.FCTextBox("TxtValor").Text)
|
|
|
|
ObjHerramientas.Dispose()
|
|
|
|
End If
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
End Class
|