1784 lines
83 KiB
VB.net
1784 lines
83 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports Extensiones
|
|
Imports System.Data
|
|
Imports Newtonsoft.Json.Linq
|
|
|
|
Partial Class GPS_Vehiculos
|
|
Inherits ClsPaginas
|
|
|
|
#Region "P R O P I E D A D E S"
|
|
Private Property TmpDT As DataTable
|
|
Get
|
|
Return CType(ViewState("TmpDT"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("TmpDT") = value
|
|
End Set
|
|
End Property
|
|
'Private Property DtGeoreferencias As DataTable
|
|
' Get
|
|
' Return CType(ViewState("DtGeoreferencias"), DataTable)
|
|
' End Get
|
|
' Set(value As DataTable)
|
|
' ViewState("DtGeoreferencias") = value
|
|
' End Set
|
|
'End Property
|
|
|
|
Private Property CoordActual As String
|
|
Get
|
|
Return CType(ViewState("CoordActual"), String)
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("CoordActual") = value
|
|
End Set
|
|
End Property
|
|
Private Property IconoCanBus As String
|
|
Get
|
|
Return CType(ViewState("IconoCanBus"), String)
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("IconoCanBus") = value
|
|
End Set
|
|
End Property
|
|
Private Property ColorTrazoCanBus As String
|
|
Get
|
|
Return CType(ViewState("ColorTrazoCanBus"), String)
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("ColorTrazoCanBus") = value
|
|
End Set
|
|
End Property
|
|
Private Property CveDispositivo As Integer
|
|
Get
|
|
Return CType(ViewState("CveDispositivo"), Integer)
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveDispositivo") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private StrArreglo As StringBuilder
|
|
|
|
Public Property FechaI As DateTime
|
|
Get
|
|
Return ViewState("FechaI").ToString().ToDateTime
|
|
End Get
|
|
Set(value As DateTime)
|
|
ViewState("FechaI") = value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property FechaF As DateTime
|
|
Get
|
|
Return ViewState("FechaF").ToString().ToDateTime
|
|
End Get
|
|
Set(value As DateTime)
|
|
ViewState("FechaF") = value
|
|
End Set
|
|
End Property
|
|
#End Region
|
|
|
|
#Region "C O N S U L T A"
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
If Not Page.IsPostBack Then
|
|
If Request("CveDispositivo") IsNot Nothing AndAlso IsNumeric(Request("CveDispositivo")) AndAlso Request("CveDispositivo").ToEntero > 0 Then
|
|
ViewState("CveDispositivo") = Request("CveDispositivo")
|
|
Dim DtDIS = GlobalDTDispositivosUsuarios(UsuarioActual.CveCliente, UsuarioActual.CveUsuario).FiltraParametros($"CveDispositivo = {CveDispositivo} And Estatus = 1")
|
|
If DtDIS.Rows.Count = 1 Then
|
|
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
|
|
Dim RowDis As DataRow = DtDIS.Rows(0)
|
|
Dim EsCanBus As Boolean = RowDis("CveModelo").ToString().ToEntero.Contiene(15, 16, 30)
|
|
FechaI = New DateTime(Now.Year, Now.Month, 1)
|
|
FechaF = DateTime.Now
|
|
StrArreglo = New StringBuilder()
|
|
CargaRutas()
|
|
CargaDatos(CveDispositivo)
|
|
CargaEventos(CveDispositivo, 10)
|
|
' CargaTanqueGasolina()
|
|
CargaComandos()
|
|
CargaPlacas()
|
|
CargaLicencias()
|
|
CargaProveedor()
|
|
CargaSeguros()
|
|
CargaIncidentes()
|
|
CargaServicios()
|
|
CargaEventos(CveDispositivo, 10)
|
|
CargaControles()
|
|
CargaDashboard()
|
|
CreaDTImagenes()
|
|
CargaParadas()
|
|
'CargaEstadoIgnicion()
|
|
CargaLog()
|
|
CargaImagenes()
|
|
''15 16
|
|
TabCanBus.Visible = EsCanBus
|
|
If EsCanBus Then
|
|
IconoCanBus = RowDis("Icono").ToString()
|
|
ColorTrazoCanBus = RowDis("ColorTrazo").ToString()
|
|
CargaCanBus()
|
|
End If
|
|
If UsuarioActual.TienePermisoProceso(226) Then
|
|
GVLog.Columns(2).Visible = True
|
|
End If
|
|
UpGVLog.Update()
|
|
RegistraScript($"GetDirecciones({CoordActual})", "DIR")
|
|
If Request("ATI") IsNot Nothing AndAlso IsNumeric(Request("ATI")) AndAlso Request("ATI").ToEntero > 0 Then
|
|
Tab.ActiveTabIndex = Request("ATI").ToEntero
|
|
End If
|
|
End If
|
|
'CargaComandos()
|
|
End If
|
|
End If
|
|
End Sub
|
|
Protected Sub CargaImagenes()
|
|
|
|
Dim TienePermisoImagenes As Boolean = False
|
|
Dim ObjUsuarios = New ClsSisUsuarios()
|
|
If ObjUsuarios.GetUsuariosModulos(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CvePlataforma:=5) Then
|
|
TienePermisoImagenes = ObjUsuarios.DtResultados.COUNT("CveModulo", "CveModulo = 5010 AND Permitir = 1") = 1
|
|
TabImagenes.Visible = TienePermisoImagenes
|
|
End If
|
|
ObjUsuarios.Dispose()
|
|
|
|
If TienePermisoImagenes Then
|
|
Dim ObjGPS = New ClsGPS()
|
|
|
|
If ObjGPS.GetImagenesDispositivo(CveDispositivo) Then
|
|
RptFotos.DataSource = ObjGPS.DtResultados
|
|
End If
|
|
|
|
ObjGPS.Dispose()
|
|
RptFotos.DataBind()
|
|
UpGaleria.Update()
|
|
End If
|
|
|
|
End Sub
|
|
Private Sub CargaDatos(CveDipositivo As Integer)
|
|
|
|
Using ObjGPS As New ClsGPS
|
|
If ObjGPS.DispositivosGet(CveDispositivo, -1, -1) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
Dim Row As DataRow = ObjGPS.DtResultados.Rows(0)
|
|
|
|
LtlVehiculo.Text = Row("Display").ToString()
|
|
TxtSerie.Text = Row("SerieVehiculo").ToString()
|
|
TxtNoEconomico.Text = Row("NoEconomico").ToString()
|
|
TxtPlacas.Text = Row("PlacasVehiculo").ToString()
|
|
TxtNombre.Text = Row("NombreVehiculo").ToString()
|
|
TxtModelo.Text = Row("ModeloVehiculo").ToString()
|
|
TxtAño.Text = Row("AñoVehiculo").ToString()
|
|
TxtDetalles.Text = Row("DetallesVehiculo").ToString()
|
|
TxtMaxVelocidad.Text = Row("VelocidadMaxima").ToString()
|
|
TxtEstatus.Text = If(Row("Estatus").ToString() = "1", "Activo", "Inactivo")
|
|
TxtEstatus.Style.Add("color", If(Row("Estatus").ToString() = "1", "green", "red"))
|
|
TxtCostoCombustible.Text = Row("CostoCombustible").ToString().FormatoNumero
|
|
TxtCostoKM.Text = Row("CostoKilometro").ToString().FormatoNumero
|
|
'TxtFechaReinstalacion.Text = Row("FechaReinstalacion").ToString()
|
|
bodydatos.Visible = True
|
|
|
|
TxtNoEconomicoE.Text = Row("NoEconomico").ToString()
|
|
TxtNombreV.Text = Row("NombreVehiculo").ToString()
|
|
TxtModeloV.Text = Row("ModeloVehiculo").ToString()
|
|
TxtColorV.Text = Row("ColorVehiculo").ToString()
|
|
TxtAñoV.Text = Row("AñoVehiculo").ToString()
|
|
TxtDetallesE.Text = Row("DetallesVehiculo").ToString()
|
|
TxtLimiteVelocidad.Text = Row("VelocidadMaxima").ToString()
|
|
chkLimiteVelocidad.Checked = CBool(Row("LimiteVelocidad"))
|
|
TxtLimiteVelocidad.Enabled = CBool(Row("LimiteVelocidad"))
|
|
TxtClaseVehiculo.Text = Row("ClaseVehiculo").ToString()
|
|
TxtSerieV.Text = Row("SerieVehiculo").ToString()
|
|
TxtRendimiento.Text = Row("Rendimiento").ToString()
|
|
TxtColorTrazo.Text = Row("ColorTrazo").ToString()
|
|
TxtMaximos.Text = Row("PasajerosMax").ToString()
|
|
TxtMinimos.Text = Row("PasajerosMin").ToString()
|
|
DdlRuta.SelectedValue = Row("CveRuta").ToString()
|
|
|
|
hdnColorTrazo.Value = Row("ColorTrazo").ToString()
|
|
hdnIconoURL.Value = Row("Icono").ToString()
|
|
|
|
If ObjGPS.ConductoresGet(-1, "-1", -1, UsuarioActual.CveCliente) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
DdlConductor.DataSource = ObjGPS.DtResultados
|
|
DdlConductor.DataBind()
|
|
DdlConductor.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
DdlConductor.SelectedValueExist(ObjGPS.DtResultados.FiltroPrimeroValor("CveConductor", $"CveDispositivo = {CveDispositivo}"))
|
|
Else
|
|
DdlConductor.DataSource = Nothing
|
|
End If
|
|
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
|
|
End Using
|
|
CargaReportes("1")
|
|
UpInfo.Update()
|
|
|
|
End Sub
|
|
Private Sub CargaParadas()
|
|
Dim ObjGPS As New ClsGPS
|
|
If ObjGPS.GetReferenciaDetalle(-1, -1, CveDispositivo, UsuarioActual.CveCliente) Then
|
|
Dim DtGeoreferencias = ObjGPS.DtResultados.FiltraParametros($"Estatus = True")
|
|
GvParadas.DataSource = DtGeoreferencias.FiltraParametros($"EsParada = True")
|
|
DdlGeocerca.DataSource = DtGeoreferencias.FiltraParametros($"EsParada = False")
|
|
Else
|
|
GvParadas.DataSource = Nothing
|
|
End If
|
|
ObjGPS.Dispose()
|
|
GvParadas.DataBind()
|
|
DdlGeocerca.DataBind()
|
|
DdlGeocerca.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
UpGvParadas.Update()
|
|
End Sub
|
|
|
|
Private Sub CargaProveedor()
|
|
'DdlProveedor.Items.Clear()
|
|
'DdlProveedor.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
'DdlProveedor.DataSource = GlobalDTCompProveedores(2)
|
|
'DdlProveedor.DataBind()
|
|
|
|
'DdlProveedorS.Items.Clear()
|
|
'DdlProveedorS.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
'DdlProveedorS.DataSource = GlobalDTCompProveedores(2)
|
|
'DdlProveedorS.DataBind()
|
|
|
|
UpAddPolizas.Update()
|
|
UpAddServicios.Update()
|
|
End Sub
|
|
Private Sub CargaRutas()
|
|
Dim ObjGPS As New ClsGPS
|
|
If ObjGPS.GetRutas(-1, UsuarioActual.CveCliente) Then
|
|
DdlRuta.DataSource = ObjGPS.DtResultados
|
|
End If
|
|
ObjGPS.Dispose()
|
|
DdlRuta.DataBind()
|
|
DdlRuta.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
UpPasajeros.Update()
|
|
UpPorletPasajeros.Update()
|
|
End Sub
|
|
Private Sub CargaReportes(Valor As String)
|
|
Dim Icono As String = "/Imagenes/rsz_11rsz_car.png"
|
|
Dim GPS As New ClsGPS
|
|
RegistraScript("DeleteMarkers();")
|
|
If Valor.ToEntero = 1 Then
|
|
If GPS.UltimaPosicionEquipoGet(CveDispositivo, MinFecha, MaxFecha, Valor.ToEntero) Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
Dim Coord As String = SQLToGmaps(GPS.DtResultados.Rows(0)("Posicion").ToString(), "POINT")
|
|
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
|
|
RegistraScript($"CreaMarcador({Coord},'{GPS.DtResultados.Rows(0)("Vehiculo")}', '{Icono}');", "SX")
|
|
' GvReportes.DataSource = GPS.DtResultados
|
|
' GvVLog.DataSource = GPS.DtResultados
|
|
bodyreportes.Visible = True
|
|
CoordActual = Coord
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ElseIf Valor.ToEntero = 10 Then
|
|
Dim POLYPATH = ""
|
|
Dim lastCoord = ""
|
|
If GPS.UltimaPosicionEquipoGet(CveDispositivo, MinFecha, MaxFecha, Valor.ToEntero) Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
For Each row As DataRow In GPS.DtResultados.Rows
|
|
Dim Coord As String = SQLToGmaps(row("Posicion").ToString(), "POINT")
|
|
'RegistraScript($"CreaMarcador({Coord},'{GPS.DtResultados.Rows(0)("Vehiculo")}: {row("FechaTrama").ToString()}');", row("CveTrama"))
|
|
POLYPATH = $"{POLYPATH}{Coord},"
|
|
lastCoord = Coord
|
|
Next
|
|
POLYPATH = $"[{POLYPATH.Substring(0, POLYPATH.Length - 1)}]"
|
|
Icono = If(GPS.DtResultados.FiltraParametros("1=1", "CveTrama DESC").Rows(0)("SPD").ToString().ToDouble > 1, $"/Imagenes/{GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimeroValor("Icono", $"CveDispositivo = {CveDispositivo}")}green.png", $"/Imagenes/{GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimeroValor("Icono", $"CveDispositivo = {CveDispositivo}")}.png")
|
|
RegistraScript($"creaPolyline({POLYPATH}, '{GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimeroValor("ColorTrazo", $"CveDispositivo = {CveDispositivo}")}', {lastCoord}, '{GPS.DtResultados(0)("Vehiculo").ToString()}', '{Icono}')", "SXX")
|
|
'' GvReportes.DataSource = GPS.DtResultados
|
|
''GvVLog.DataSource = GPS.DtResultados
|
|
bodyreportes.Visible = True
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
Else
|
|
Dim POLYPATH = ""
|
|
Dim lastCoord = ""
|
|
If GPS.GetPosicionEquipo(CveDispositivo, DateTime.Today, DateTime.Now) Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
For Each row As DataRow In GPS.DtResultados.Rows
|
|
Dim Coord As String = SQLToGmaps(row("Posicion").ToString(), "POINT")
|
|
'RegistraScript($"CreaMarcador({Coord},'{GPS.DtResultados.Rows(0)("Vehiculo")}: {row("FechaTrama").ToString()}');", row("CveTrama"))
|
|
POLYPATH = $"{POLYPATH}{Coord},"
|
|
lastCoord = Coord
|
|
Next
|
|
POLYPATH = $"[{POLYPATH.Substring(0, POLYPATH.Length - 1)}]"
|
|
Icono = If(GPS.DtResultados.FiltraParametros("1=1", "CveTrama DESC").Rows(0)("SPD").ToString().ToDouble > 1, $"/Imagenes/{GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimeroValor("Icono", $"CveDispositivo = {CveDispositivo}")}green.png", $"/Imagenes/{GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimeroValor("Icono", $"CveDispositivo = {CveDispositivo}")}.png")
|
|
RegistraScript($"creaPolyline({POLYPATH}, '#157BD4', {lastCoord}, '{GPS.DtResultados(0)("Vehiculo").ToString()}', '{Icono}')", "SXS")
|
|
'' GvReportes.DataSource = GPS.DtResultados
|
|
''GvVLog.DataSource = GPS.DtResultados
|
|
bodyreportes.Visible = True
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
End If
|
|
#Region "comentado"
|
|
'ElseIf Opcion = "Today" Then
|
|
' If GPS.GetRepDispositivo(CveDispositivo, DateTime.Today.AddHours(-1), DateTime.Today.AddDays(1)) Then
|
|
' If GPS.DtResultados.Rows.Count > 0 Then
|
|
' For Each row As DataRow In GPS.DtResultados.Rows
|
|
' Dim Coord As String = SQLToGmaps(row("Punto"), "POINT")
|
|
' RegistraScript($"CreaMarcador({Coord},'{CveDispositivo}: {row("FechaIng")}');")
|
|
' Next
|
|
' GvReportes.DataSource = GPS.DtResultados
|
|
' GvVLog.DataSource = GPS.DtResultados
|
|
' bodyreportes.Visible = True
|
|
' Else
|
|
' Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
' End If
|
|
' End If
|
|
'ElseIf Opcion = "Yesterday" Then
|
|
' If GPS.GetRepDispositivo(CveDispositivo, DateTime.Today.AddDays(-1).AddHours(-1), DateTime.Today) Then
|
|
' If GPS.DtResultados.Rows.Count > 0 Then
|
|
' For Each row As DataRow In GPS.DtResultados.Rows
|
|
' Dim Coord As String = SQLToGmaps(row("Punto"), "POINT")
|
|
' RegistraScript($"CreaMarcador({Coord},'{CveDispositivo}: {row("FechaIng")}');")
|
|
' Next
|
|
' GvReportes.DataSource = GPS.DtResultados
|
|
' GvVLog.DataSource = GPS.DtResultados
|
|
' bodyreportes.Visible = True
|
|
' Else
|
|
' Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
' End If
|
|
' End If
|
|
'ElseIf Opcion = "Week" Then
|
|
' If GPS.GetRepDispositivo(CveDispositivo, DateTime.Today.AddDays(-7).AddHours(-1), DateTime.Today.AddDays(1)) Then
|
|
' If GPS.DtResultados.Rows.Count > 0 Then
|
|
' Dim dr As DataRow = TmpDT.NewRow
|
|
' For Each row As DataRow In GPS.DtResultados.Rows
|
|
' Dim Coord As String = SQLToGmaps(row("Punto"), "POINT")
|
|
' RegistraScript($"CreaMarcador({Coord},'{CveDispositivo}: {row("FechaIng")}');")
|
|
' Next
|
|
' GvReportes.DataSource = GPS.DtResultados
|
|
' GvVLog.DataSource = GPS.DtResultados
|
|
' bodyreportes.Visible = True
|
|
' Else
|
|
' Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
' End If
|
|
' End If
|
|
'ElseIf Opcion = "All" Then
|
|
' ' Dim FechaI = If(txtFechaI.Text.Trim = "", MinFecha, txtFechaI.Text.Trim.ToDateTime.AddHours(-1))
|
|
' ' Dim FechaF = If(txtFechaF.Text.Trim = "", MaxFecha, txtFechaF.Text.Trim.ToDateTime.AddDays(1))
|
|
' ' If GPS.GetRepDispositivo(CveDispositivo, FechaI.AddHours(-1), FechaF.AddDays(1)) Then
|
|
' ' If GPS.DtResultados.Rows.Count > 0 Then
|
|
' ' Dim dr As DataRow = TmpDT.NewRow
|
|
' ' For Each row As DataRow In GPS.DtResultados.Rows
|
|
' ' Dim Coord As String = SQLToGmaps(row("Punto"), "POINT")
|
|
' ' RegistraScript($"CreaMarcador({Coord},'{CveDispositivo}: {row("FechaIng")}');")
|
|
' ' Next
|
|
' ' GvReportes.DataSource = GPS.DtResultados
|
|
' ' GvVLog.DataSource = GPS.DtResultados
|
|
' ' bodyreportes.Visible = True
|
|
' ' Else
|
|
' ' Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
' ' End If
|
|
' ' End If
|
|
'End If
|
|
|
|
''If GPS.DtResultados.Rows.Count > 0 Then
|
|
'' Dim CveTrama = GPS.DtResultados.Rows(0)("CvePosicion").ToString().ToEntero
|
|
'' If GPS.RepEventosDispositivosGet(CveTrama) Then
|
|
'' Dim nRows As Double = (GPS.DtResultados.Rows.Count / 3)
|
|
'' If nRows > 0 Then
|
|
'' If Math.Abs(nRows Mod 1) < Double.Epsilon Then
|
|
'' gvH1.DataSource = GPS.DtResultados().FiltraParametros($"RowNumber <= {nRows}")
|
|
'' gvH2.DataSource = GPS.DtResultados().FiltraParametros($"RowNumber > {nRows} AND RowNumber <= {nRows * 2} ")
|
|
'' gvH3.DataSource = GPS.DtResultados().FiltraParametros($"RowNumber > {nRows * 2} AND RowNumber <= {nRows * 3} ")
|
|
'' Else
|
|
'' nRows = Math.Ceiling(nRows)
|
|
'' gvH1.DataSource = GPS.DtResultados().FiltraParametros($"RowNumber <= {nRows}")
|
|
'' gvH2.DataSource = GPS.DtResultados().FiltraParametros($"RowNumber > {nRows} AND RowNumber <= {nRows * 2} ")
|
|
'' gvH3.DataSource = GPS.DtResultados().FiltraParametros($"RowNumber > {nRows * 2} AND RowNumber <= {GPS.DtResultados.Rows.Count} ")
|
|
'' End If
|
|
'' Else
|
|
'' gvH1.DataSource = Nothing
|
|
'' gvH2.DataSource = Nothing
|
|
'' gvH3.DataSource = Nothing
|
|
'' gvH2.Visible = False
|
|
'' gvH3.Visible = False
|
|
'' End If
|
|
'' Else
|
|
'' gvH1.DataSource = Nothing
|
|
'' gvH2.DataSource = Nothing
|
|
'' gvH3.DataSource = Nothing
|
|
'' gvH2.Visible = False
|
|
'' gvH3.Visible = False
|
|
'' End If
|
|
''End If
|
|
#End Region
|
|
GPS.Dispose()
|
|
UpReportes.Update()
|
|
End Sub
|
|
|
|
Private Sub CargaEventos(CveDispositivo As Integer, Opcion As Integer)
|
|
Dim Gps As New ClsGPS
|
|
If Gps.TopEventosGet(CveDispositivo, Opcion) Then
|
|
GvEventos.DataSource = Gps.DtResultados
|
|
End If
|
|
Gps.Dispose()
|
|
GvEventos.DataBind()
|
|
End Sub
|
|
|
|
Private Sub CargaTanqueGasolina()
|
|
Dim ObjGPS As New ClsGPS
|
|
If DdlControles.SelectedValue <> "" Then
|
|
If ObjGPS.GetCombustible(CveDispositivo, DdlControles.SelectedValue.ToEntero) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
RegistraScript($"UnidadesReportando(""{ObjGPS.DtResultados.Rows(0)("LitrosCombustible")}"",""{ObjGPS.DtResultados.Rows(0)("Capacidad")}"", {"chartdivTank"});", "2sss")
|
|
Else
|
|
displayCombustible.Style.Add("display", "none !important")
|
|
End If
|
|
Else
|
|
displayCombustible.Style.Add("display", "none !important")
|
|
End If
|
|
|
|
UPTanque.Update()
|
|
ObjGPS.Dispose()
|
|
End Sub
|
|
|
|
Private Sub CargaControles()
|
|
Dim ObjGPS As New ClsGPS()
|
|
Dim dt As New DataTable
|
|
If ObjGPS.ControlesGet(UsuarioActual.CveCliente) Then
|
|
dt = ObjGPS.DtResultados.FiltraParametros($"CveDispositivo = {CveDispositivo}")
|
|
DdlControles.DataSource = dt
|
|
Else
|
|
DdlControles.DataSource = Nothing
|
|
End If
|
|
ObjGPS.Dispose()
|
|
DdlControles.DataBind()
|
|
|
|
If dt.Rows.Count > 0 Then
|
|
DdlControles.Items.Insert(0, New ListItem("Todos los Sensores", "-1"))
|
|
End If
|
|
End Sub
|
|
|
|
'Private Sub CargaEstadoIgnicion()
|
|
' MuestraIndicador(pbIgnicion, "red", "fa fa-power-off", "Apagado", $"{15} Minutos detenido", "", "", Style:="style=""width:100%"" ")
|
|
'End Sub
|
|
|
|
Protected Sub GvBarra_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvEventos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
e.Row.Attributes.Add("onClick", $"CargaDatosSeleccionados({e.Row.RowIndex}, '{e.Row.DBCampo("Vehiculo").ToString()}', {SQLToGmaps(e.Row.DBCampo("Posicion").ToString(), "POINT")}, '{e.Row.DBCampo("Imagen").ToString()}');")
|
|
End If
|
|
End Sub
|
|
Private Function SQLToGmaps(CoordsSQL As String, Tipo As String) As String
|
|
Dim CoordsPoligono As String = CoordsSQL.Replace($"{Tipo}", "").Replace(")", "").Replace("(", "")
|
|
Dim CoordsPuntos() As String = CoordsPoligono.Split(","c)
|
|
Dim Var As String = ""
|
|
For Each coordenada As String In CoordsPuntos
|
|
If coordenada Is CoordsPuntos.Last Then
|
|
Dim latlng() As String = coordenada.Trim.Split(" "c)
|
|
Var = $"{Var}{{lat: {latlng(1)}, lng: {latlng(0)} }}"
|
|
Else
|
|
Dim latlng() As String = coordenada.Trim.Split(" "c)
|
|
Var = $"{Var}{{lat: {latlng(1)}, lng: {latlng(0)} }},"
|
|
End If
|
|
Next
|
|
Return Var
|
|
End Function
|
|
Private Function SQLToGmapsJArray(CoordsSQL As String, Tipo As String) As JArray
|
|
Dim CoordsPoligono As String = CoordsSQL.Replace($"{Tipo}", "").Replace(")", "").Replace("(", "")
|
|
Dim CoordsPuntos() As String = CoordsPoligono.Split(","c)
|
|
|
|
Dim Json As New JArray(From coord In CoordsPuntos
|
|
Let c = coord.Trim.Split(" "c)
|
|
Select New JObject(
|
|
New JProperty("lat", c(1).ToDouble),
|
|
New JProperty("lng", c(0).ToDouble)
|
|
)
|
|
)
|
|
|
|
Return Json
|
|
End Function
|
|
|
|
Private Sub CreaTmpDT(Opcion As String)
|
|
TmpDT = New DataTable
|
|
If Opcion = "1" Then
|
|
TmpDT.Columns.Add("Fecha", GetType(String))
|
|
TmpDT.Columns.Add("Valor", GetType(String))
|
|
TmpDT.Columns.Add("CveTrama", GetType(Integer))
|
|
ElseIf Opcion = "2" Then
|
|
TmpDT.Columns.Add("Trama", GetType(String))
|
|
TmpDT.Columns.Add("CveTrama", GetType(Integer))
|
|
End If
|
|
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region "B O T O N E R A"
|
|
|
|
Protected Sub DdlConsulta_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConsulta.SelectedIndexChanged
|
|
CargaReportes(DdlConsulta.SelectedValue)
|
|
End Sub
|
|
Private Sub CargaComandos()
|
|
If UsuarioActual.CveRol = 1198 Then
|
|
Dim ObjGps As New ClsGPS
|
|
|
|
If ObjGps.GetComandosModeloDispositivo(CveDispositivo) AndAlso ObjGps.DtResultados.Rows.Count > 0 Then
|
|
GvComandos.DataSource = ObjGps.DtResultados
|
|
End If
|
|
ObjGps.Dispose()
|
|
|
|
GvComandos.DataBind()
|
|
UpComandos.Update()
|
|
Else
|
|
Dim ObjGps As New ClsGPS
|
|
|
|
If ObjGps.GetComandosModeloDispositivoUsuarios(CveDispositivo, UsuarioActual.CveUsuario, -1) AndAlso ObjGps.DtResultados.Rows.Count > 0 Then
|
|
GvComandos.DataSource = ObjGps.DtResultados
|
|
End If
|
|
|
|
ObjGps.Dispose()
|
|
|
|
GvComandos.DataBind()
|
|
UpComandos.Update()
|
|
End If
|
|
|
|
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)
|
|
If RadioButtonList1.SelectedValue = "SMS" Then
|
|
ObjHerramientas.EjecutarComandoSMS(row.DataKey("CveComando").ToEntero, CveDispositivo, UsuarioActual.CveUsuario, row.FCTextBox("TxtValor").Text)
|
|
Else
|
|
ObjHerramientas.EjecutarComandoGPRS(row.DataKey("CveComando").ToEntero, CveDispositivo, UsuarioActual.CveUsuario, row.FCTextBox("TxtValor").Text)
|
|
End If
|
|
|
|
ObjHerramientas.Dispose()
|
|
|
|
End If
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "D A S H B O A R D"
|
|
|
|
Private Sub CargaDashboard()
|
|
CargarKilometrajeUnidades(1)
|
|
CargarPuntosInteresVisitados(10)
|
|
CargarTiempoPuntosInteres(10)
|
|
CargarRendimientoCombustible(10)
|
|
CargarEventos()
|
|
End Sub
|
|
|
|
Private Sub CargarKilometrajeUnidades(Top As Integer, Optional Div As String = "chartdivKilometrajeUnidades")
|
|
Dim ObjGPS As New ClsGPS
|
|
Dim Contador As Integer = 0
|
|
StrArreglo.Clear()
|
|
If ObjGPS.GetKilometrajeDispositivos(UsuarioActual.CveCliente, FechaI, FechaF, Top, CveDispositivo) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
StrArreglo.Append("[")
|
|
For Each row As DataRow In ObjGPS.DtResultados.Rows
|
|
If Contador > 0 Then
|
|
StrArreglo.Append(", {")
|
|
Else
|
|
StrArreglo.Append("{")
|
|
End If
|
|
StrArreglo.Append($"""dispositivos"": ""KM"",""kilometros"": {row("Dist").ToString()},""color"": ""#337ab7""")
|
|
StrArreglo.Append("}")
|
|
Contador += 1
|
|
Next
|
|
StrArreglo.Append("]")
|
|
RegistraScript($"KilometrajeDispositivos({StrArreglo.ToString()}, {Div});", "2")
|
|
If ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
CargarTiemposOperacion(1, ObjGPS.DtResultados.Rows(0)("Vehiculo").ToString(), ObjGPS.DtResultados.Rows(0)("TiempoOperativo").ToString().ToDouble)
|
|
End If
|
|
End If
|
|
ObjGPS.Dispose()
|
|
End Sub
|
|
Private Sub CargarTiemposOperacion(Top As Integer, Vehiculo As String, TiempoOperativo As Double, Optional Div As String = "chartdivTiempoOperacion")
|
|
|
|
Dim Contador As Integer = 0
|
|
Dim minutesDiff = DateDiff(DateInterval.Minute, FechaI, FechaF) / 3
|
|
StrArreglo.Clear()
|
|
StrArreglo.Append("[")
|
|
StrArreglo.Append("{")
|
|
StrArreglo.Append($"""dispositivo"": ""{Vehiculo}"",""apagado"": {Math.Round((minutesDiff - TiempoOperativo) / 60, 2)},""encendido"": {Math.Round(TiempoOperativo / 60, 2)}")
|
|
StrArreglo.Append("}")
|
|
StrArreglo.Append("]")
|
|
RegistraScript($"TiempoDeOperacion({StrArreglo.ToString()}, {Div});", "3")
|
|
|
|
End Sub
|
|
Private Sub CargarPuntosInteresVisitados(Top As Integer, Optional Div As String = "chartdivPIVisitados")
|
|
Dim ObjGPS As New ClsGPS
|
|
Dim Contador As Integer = 0
|
|
Dim Total As Integer = 0
|
|
StrArreglo.Clear()
|
|
If ObjGPS.GetPuntosDeInteresDispositivos(UsuarioActual.CveCliente, FechaI, FechaF, -1, CveDispositivo.ToString(), 10) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
Total = ObjGPS.DtResultados(0)("Visitas").ToString().ToEntero
|
|
StrArreglo.Append("{ """ + Total.ToString() + """: [")
|
|
For Each row As DataRow In ObjGPS.DtResultados.Rows
|
|
If Contador = 0 Then
|
|
Contador += 1
|
|
Continue For
|
|
Else
|
|
If Contador > 1 Then
|
|
StrArreglo.Append(", {")
|
|
Else
|
|
StrArreglo.Append("{")
|
|
End If
|
|
StrArreglo.Append($"""title"": ""{row("PuntoDeInteres").ToString()}"",""size"": {row("Visitas").ToString()},""color"": ""{ObtenerColor(CType(Contador, Colores))}""")
|
|
StrArreglo.Append("}")
|
|
End If
|
|
Contador += 1
|
|
Next
|
|
StrArreglo.Append("]}")
|
|
RegistraScript($"PuntosDeInteresDispositivos({Total}, {StrArreglo.ToString()}, {Div});", "2")
|
|
End If
|
|
ObjGPS.Dispose()
|
|
End Sub
|
|
|
|
Private Sub CargarRendimientoCombustible(Top As Integer, Optional Div As String = "chartdivRendimientoCombustible")
|
|
Dim ObjGPS As New ClsGPS
|
|
Dim Contador As Integer = 0
|
|
StrArreglo.Clear()
|
|
If ObjGPS.GetKilometrajeDispositivos(UsuarioActual.CveCliente, FechaI, FechaF, Top, CveDispositivo) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
StrArreglo.Append("[")
|
|
For Each row As DataRow In ObjGPS.DtResultados.Rows
|
|
If Contador > 0 Then
|
|
StrArreglo.Append(", {")
|
|
Else
|
|
StrArreglo.Append("{")
|
|
End If
|
|
StrArreglo.Append($"""dispositivo"": ""{(row("Dist").ToString().ToDouble / Math.Round(row("Dist").ToString().ToDouble / 9.5, 2)).ToString().FormatoNumero} KM/L"",""combustible"": {Math.Round(row("Dist").ToString().ToDouble / 9.5, 2)},""kilometraje"": {row("Dist").ToString()}")
|
|
StrArreglo.Append("}")
|
|
Contador += 1
|
|
Next
|
|
StrArreglo.Append("]")
|
|
RegistraScript($"RendimientoCombustible({StrArreglo.ToString()},{Div});", "2")
|
|
End If
|
|
ObjGPS.Dispose()
|
|
End Sub
|
|
|
|
Private Sub CargarTiempoPuntosInteres(Top As Integer, Optional Div As String = "chartdivTiempoPI")
|
|
|
|
Dim ObjGPS As New ClsGPS
|
|
Dim Contador As Integer = 0
|
|
Dim Total As Integer = 0
|
|
StrArreglo.Clear()
|
|
|
|
If ObjGPS.GetPuntosDeInteresTiempo(UsuarioActual.CveCliente, FechaI, FechaF, -1, CveDispositivo.ToString(), Top) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
StrArreglo.Append("[")
|
|
For Each row As DataRow In ObjGPS.DtResultados.Rows
|
|
If Contador > 0 Then
|
|
StrArreglo.Append(", {")
|
|
Else
|
|
StrArreglo.Append("{")
|
|
End If
|
|
StrArreglo.Append($"""pi"": ""{row("PuntoDeInteres").ToString()}"",""duracion"": {row("Duracion").ToString().ToDouble.FormatoNumero(2)},""color"": ""{ObtenerColor(CType(2, Colores))}""")
|
|
StrArreglo.Append("}")
|
|
Contador += 1
|
|
Next
|
|
StrArreglo.Append("]")
|
|
RegistraScript($"TiempoPuntosInteres({StrArreglo.ToString()},{Div});", "2")
|
|
End If
|
|
ObjGPS.Dispose()
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub CargarEventos()
|
|
Dim ObjGPS As New ClsGPS
|
|
If ObjGPS.GetEventosDashboard(UsuarioActual.CveCliente, FechaI, FechaF, CveDispositivo) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
MuestraIndicador(DivIndicadores, "red-intense", "fa fa-exclamation-triangle", "Botones de Pánico", $"{ObjGPS.DtResultados(0)("BotonPanico").ToString().ToEntero.ToString()} Eventos", "", "")
|
|
MuestraIndicador(DivIndicadores, "yellow", "fa fa-plug", "Desc. de batería", $"{ObjGPS.DtResultados(0)("DesconexionBateria").ToString().ToEntero.ToString()} Desconexiones", "", "")
|
|
End If
|
|
If ObjGPS.GetRalentiDashboard(UsuarioActual.CveCliente, FechaI, FechaF, CveDispositivo) AndAlso ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
MuestraIndicador(DivIndicadores, "blue", "fa fa-clock-o", "Ralentís", $"{ObjGPS.DtResultados(0)("Ralenti").ToString().ToEntero.ToString()} Eventos", "", "")
|
|
MuestraIndicador(DivIndicadores, "purple-plum", "fa fa-clock-o", "Tiempos Muertos", $"{(ObjGPS.DtResultados(0)("Ralenti").ToString().ToEntero).ToString()} Eventos", "", "")
|
|
End If
|
|
ObjGPS.Dispose()
|
|
End Sub
|
|
|
|
Private Function ObtenerColor(color As Colores) As String
|
|
Select Case color
|
|
Case Colores.AzulFuerte
|
|
Return "#337ab7"
|
|
|
|
Case Colores.Azul
|
|
Return "#08A3CC"
|
|
|
|
Case Colores.Verde
|
|
Return "#1BA39C"
|
|
|
|
Case Colores.Amarillo
|
|
Return "#F1C40F"
|
|
|
|
Case Colores.Naranja
|
|
Return "#E87E04"
|
|
|
|
Case Colores.Rojo
|
|
Return "#ed6b75"
|
|
|
|
Case Colores.Morado
|
|
Return "#8E44AD"
|
|
|
|
Case Colores.Negro
|
|
Return "#22313F"
|
|
|
|
Case Else
|
|
Return "#337ab7"
|
|
|
|
End Select
|
|
End Function
|
|
Public Enum Colores As Integer
|
|
AzulFuerte = 1
|
|
Azul = 2
|
|
Verde = 3
|
|
Amarillo = 4
|
|
Naranja = 5
|
|
Rojo = 6
|
|
Morado = 7
|
|
Negro = 8
|
|
End Enum
|
|
|
|
Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, Comentario As String, Link As String, TitleComentario As String, Optional Style As String = "")
|
|
Dim htmldiv As New StringBuilder
|
|
htmldiv.AppendFormat("{0}<div class='col-lg-4 col-md-4 col-sm-6 col-xs-12' {3}><div class='dashboard-stat {1}'><div class='visual'><i class='{2}' '=''></i></div>", DIV.InnerHtml, Color, Icono, Style)
|
|
htmldiv.AppendFormat("<div class='details'><div class='number'>{0}</div><div class='desc'><label class='indicadortipo1 tooltips' data-original-title='{1}'>{2}", Titulo, TitleComentario, Comentario)
|
|
htmldiv.AppendFormat("</label></div></div></div></div>")
|
|
DIV.InnerHtml = htmldiv.ToString()
|
|
End Sub
|
|
|
|
Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, C1 As String, CL1 As String, CT1 As String, C2 As String, CL2 As String, CT2 As String)
|
|
Dim htmldiv As New StringBuilder
|
|
htmldiv.AppendFormat("{0}<div class='col-lg-4 col-md-4 col-sm-6 col-xs-12'><div class='dashboard-stat {1}'><div class='visual'><i class='{2}' '=''></i></div>", DIV.InnerHtml, Color, Icono)
|
|
htmldiv.AppendFormat("<div class='details'><div class='number'>{0}</div><div class='desc'>", Titulo)
|
|
htmldiv.AppendFormat("<label class='indicadortipo2 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT1, C1)
|
|
htmldiv.AppendFormat("<label class='indicadortipo2 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT2, C2)
|
|
htmldiv.Append("</div></div><a class='more' href='javascript:;' data-toggle='dropdown' data-hover='dropdown' data-close-others='true' >Ver Más <i class='m-icon-swapright m-icon-white'></i></a>")
|
|
htmldiv.AppendFormat("<ul class='dropdown-menu pull-right' style='margin:0px;' ><li><a href='{0}'>{1}</a></li><li><a href='{2}'>{3}</a></li>", CL1, CT1, CL2, CT2)
|
|
htmldiv.Append("</ul></div></div>")
|
|
DIV.InnerHtml = htmldiv.ToString()
|
|
End Sub
|
|
|
|
Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, C1 As String, CL1 As String, CT1 As String, C2 As String, CL2 As String, CT2 As String, C3 As String, CL3 As String, CT3 As String)
|
|
Dim htmldiv As New StringBuilder
|
|
htmldiv.AppendFormat("{0}<div class='col-lg-4 col-md-4 col-sm-6 col-xs-12'><div class='dashboard-stat {1}'><div class='visual'><i class='{2}' '=''></i></div>", DIV.InnerHtml, Color, Icono)
|
|
htmldiv.AppendFormat("<div class='details'><div class='number'>{0}</div><div class='desc'><label class='indicadortipo4 col-md-6 tooltips' data-original-title=''></label>", Titulo)
|
|
htmldiv.AppendFormat("<label class='indicadortipo4 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT1, C1)
|
|
htmldiv.AppendFormat("<label class='indicadortipo4 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT2, C2)
|
|
htmldiv.AppendFormat("<label class='indicadortipo4 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT3, C3)
|
|
htmldiv.Append("</div></div><a class='more' href='javascript:;' data-toggle='dropdown' data-hover='dropdown' data-close-others='true' >Ver Más <i class='m-icon-swapright m-icon-white'></i></a>")
|
|
htmldiv.AppendFormat("<ul class='dropdown-menu pull-right' style='margin:0px;' ><li><a href='{0}'>{1}</a></li><li><a href='{2}'>{3}</a></li><li><a href='{4}'>{5}</a></li>", CL1, CT1, CL2, CT2, CL3, CT3)
|
|
htmldiv.Append("</ul></div></div>")
|
|
DIV.InnerHtml = htmldiv.ToString()
|
|
End Sub
|
|
|
|
Private Sub MuestraIndicador(DIV As HtmlGenericControl, Color As String, Icono As String, Titulo As String, C1 As String, CL1 As String, CT1 As String, C2 As String, CL2 As String, CT2 As String, C3 As String, CL3 As String, CT3 As String, C4 As String, CL4 As String, CT4 As String)
|
|
Dim htmldiv As New StringBuilder
|
|
htmldiv.AppendFormat("{0}<div class='col-lg-4 col-md-4 col-sm-6 col-xs-12'><div class='dashboard-stat {1}'><div class='visual'><i class='{2}' '=''></i></div>", DIV.InnerHtml, Color, Icono)
|
|
htmldiv.AppendFormat("<div class='details'><div class='number'>{0}</div><div class='desc'><label class='indicadortipo4 col-md-6 tooltips' data-original-title='{1}'>{2}</label>", Titulo, CT1, C1)
|
|
htmldiv.AppendFormat("<label class='indicadortipo4 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT2, C2)
|
|
htmldiv.AppendFormat("<label class='indicadortipo4 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT3, C3)
|
|
htmldiv.AppendFormat("<label class='indicadortipo4 col-md-6 tooltips' data-original-title='{0}'>{1}</label>", CT4, C4)
|
|
htmldiv.AppendFormat("</div></div><a class='more' href='{0}'>Ver Más <i class='m-icon-swapright m-icon-white'></i></a></div></div>", CL1)
|
|
DIV.InnerHtml = htmldiv.ToString()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "P L A C A S"
|
|
Public Sub CargaPlacas()
|
|
Dim ObjAF As New ClsAF()
|
|
|
|
If ObjAF.GetPlacas(-1, -1, -1, CveDispositivo, UsuarioActual.CveCliente) Then
|
|
GvPlacas.DataSource = ObjAF.DtResultados
|
|
End If
|
|
ObjAF.Dispose()
|
|
|
|
GvPlacas.DataBind()
|
|
UpPlacas.Update()
|
|
End Sub
|
|
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
HdnModalidad.Value = "U"
|
|
HdnID.Value = GvRow.DataKey("CvePlaca")
|
|
BtnAgregarPlaca.Text = "Actualizar"
|
|
myModalLabel.InnerText = "Actualizar Placa"
|
|
TxtPlaca.Text = GvRow.DataKey("Placa")
|
|
|
|
TxtFechaExpedicion.Text = GvRow.DataKey("FechaExpedicion")
|
|
TxtFechaVencimiento.Text = GvRow.DataKey("FechaVencimiento")
|
|
|
|
UpPlacas.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddPlacas"))
|
|
|
|
End Sub
|
|
Public Sub Delete_Click(sender As Object, e As EventArgs)
|
|
Dim ObjAF As New ClsAF()
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
HdnID.Value = GvRow.DataKey("CvePlaca")
|
|
|
|
If ObjAF.RemovePlaca(HdnID.Value.ToEntero) Then
|
|
Alert("La placa se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ObjAF.Dispose()
|
|
|
|
CargaPlacas()
|
|
End Sub
|
|
Private Sub LnkAddPlacas_Click(sender As Object, e As EventArgs) Handles LnkAddPlacas.Click
|
|
HdnModalidad.Value = "A"
|
|
BtnAgregarPlaca.Text = "Agregar"
|
|
myModalLabel.InnerText = "Agregar Placa"
|
|
|
|
TxtPlaca.Text = ""
|
|
TxtFechaExpedicion.Text = ""
|
|
TxtFechaVencimiento.Text = ""
|
|
|
|
UpPlacas.Update()
|
|
UpBodyPlacas.Update()
|
|
UpLnkAddPlacas.Update()
|
|
End Sub
|
|
Private Sub BtnAgregarPlaca_Click(sender As Object, e As EventArgs) Handles BtnAgregarPlaca.Click
|
|
Dim ObjAF As New ClsAF
|
|
|
|
If HdnModalidad.Value = "A" Then
|
|
If ObjAF.AddPlacas(-1, TxtPlaca.Text.Trim, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveDispositivo, UsuarioActual.CveCliente, "", "", TxtFechaExpedicion.Text, TxtFechaVencimiento.Text) Then
|
|
Alert("La placa se agegó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ElseIf HdnModalidad.Value = "U" Then
|
|
If ObjAF.UpdatePlacas(HdnID.Value.ToEntero, TxtPlaca.Text.Trim, TxtFechaExpedicion.Text, TxtFechaVencimiento.Text) Then
|
|
Alert("La placa se actualizó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
End If
|
|
|
|
ObjAF.Dispose()
|
|
CargaPlacas()
|
|
RegistraScript("$('#DivAddPlacas').modal('hide');")
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "L I C E N C I A S"
|
|
Public Sub CargaLicencias()
|
|
Dim ObjAF As New ClsAF()
|
|
|
|
If ObjAF.GetLicencias(-1, -1, -1, CveDispositivo, UsuarioActual.CveCliente) Then
|
|
GvLicencias.DataSource = ObjAF.DtResultados
|
|
End If
|
|
ObjAF.Dispose()
|
|
|
|
GvLicencias.DataBind()
|
|
UpLicencias.Update()
|
|
End Sub
|
|
|
|
Public Sub EditLicencia_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
HdnModalidadLicencia.Value = "U"
|
|
HdnIDLicencia.Value = GvRow.DataKey("CveLicencia")
|
|
BtnAgregarLicencia.Text = "Actualizar"
|
|
LabelLicencia.InnerText = "Actualizar Licencia"
|
|
TxtLicencia.Text = GvRow.DataKey("Licencia")
|
|
TxtFechaExpLicencia.Text = GvRow.DataKey("FechaExpedicion")
|
|
TxtFechaVencLicencia.Text = GvRow.DataKey("FechaVencimiento")
|
|
|
|
UpAddLicencias.Update()
|
|
UpLicencias.Update()
|
|
|
|
RegistraScript("$('#DivAddLicencias').modal('show');")
|
|
End Sub
|
|
|
|
Public Sub DeleteLicencia_Click(sender As Object, e As EventArgs)
|
|
Dim ObjAF As New ClsAF()
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
HdnIDLicencia.Value = GvRow.DataKey("CveLicencia")
|
|
Dim continuar As Boolean = ObjAF.RemoveLicencia(HdnIDLicencia.Value.ToEntero)
|
|
ObjAF.Dispose()
|
|
If continuar Then
|
|
CargaLicencias()
|
|
Alert("La licencia se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
UpLicencias.Update()
|
|
End Sub
|
|
|
|
Private Sub LnkAddLicencias_Click(sender As Object, e As EventArgs) Handles LnkAddLicencias.Click
|
|
HdnModalidadLicencia.Value = "A"
|
|
BtnAgregarLicencia.Text = "Agregar"
|
|
LabelLicencia.InnerText = "Agregar Licencia"
|
|
|
|
TxtLicencia.Text = ""
|
|
TxtFechaExpLicencia.Text = ""
|
|
TxtFechaVencLicencia.Text = ""
|
|
|
|
UpLicencias.Update()
|
|
UpAddLicencias.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddLicencias"))
|
|
End Sub
|
|
|
|
Private Sub BtnAgregarLicencia_Click(sender As Object, e As EventArgs) Handles BtnAgregarLicencia.Click
|
|
Dim ObjAF As New ClsAF
|
|
|
|
If HdnModalidadLicencia.Value = "A" Then
|
|
If ObjAF.AddLicencia(-1, TxtLicencia.Text.Trim, TxtFechaExpLicencia.Text.ToDateTime, TxtFechaVencLicencia.Text.ToDateTime, UsuarioActual.CveUsuario, -1, CveDispositivo, UsuarioActual.CveCliente) Then
|
|
Alert("La licencia se agregó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ElseIf HdnModalidadLicencia.Value = "U" Then
|
|
If ObjAF.UpdateLicencia(HdnIDLicencia.Value.ToEntero, TxtLicencia.Text.Trim, TxtFechaExpLicencia.Text.ToDateTime, TxtFechaVencLicencia.Text.ToDateTime) Then
|
|
Alert("La licencia se actualizó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
End If
|
|
ObjAF.Dispose()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddLicencias"))
|
|
|
|
CargaLicencias()
|
|
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region "S E G U R O S"
|
|
Public Sub CargaSeguros()
|
|
Dim ObjAF As New ClsAF()
|
|
|
|
If ObjAF.GetPolizasSeguro(-1, -1, -1, -1, CveDispositivo, UsuarioActual.CveCliente) Then
|
|
GvPolizas.DataSource = ObjAF.DtResultados
|
|
End If
|
|
ObjAF.Dispose()
|
|
|
|
GvPolizas.DataBind()
|
|
UpSeguros.Update()
|
|
End Sub
|
|
|
|
Public Sub EditPoliza_Click(sender As Object, e As EventArgs)
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
HdnModalidadPoliza.Value = "U"
|
|
HdnIDPoliza.Value = GvRow.DataKey("CvePolizaSeguro")
|
|
BtnAgregarPoliza.Text = "Actualizar"
|
|
LabelPolizas.InnerText = "Actualizar Poliza"
|
|
|
|
TxtProveedor.Text = GvRow.DataKey("ProveedorServicio")
|
|
TxtPolizaSeguro.Text = GvRow.DataKey("PolizaSeguro")
|
|
TxtFechaExpPoliza.Text = GvRow.DataKey("FechaExpedicion")
|
|
TxtFechaVenPoliza.Text = GvRow.DataKey("FechaVencimiento")
|
|
|
|
UpSeguros.Update()
|
|
UpAddLicencias.Update()
|
|
UpBodyPoliza.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddPolizas"))
|
|
End Sub
|
|
Public Sub DeletePoliza_Click(sender As Object, e As EventArgs)
|
|
Dim ObjAF As New ClsAF()
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
HdnIDPoliza.Value = GvRow.DataKey("CvePolizaSeguro")
|
|
Dim continuar As Boolean = ObjAF.RemovePoliza(HdnIDPoliza.Value.ToEntero)
|
|
ObjAF.Dispose()
|
|
If continuar Then
|
|
CargaSeguros()
|
|
Alert("La póliza se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
UpSeguros.Update()
|
|
End Sub
|
|
Private Sub LnkAddPolizaSeguro_Click(sender As Object, e As EventArgs) Handles LnkAddPolizaSeguro.Click
|
|
HdnModalidadPoliza.Value = "A"
|
|
|
|
BtnAgregarPoliza.Text = "Agregar"
|
|
LabelPolizas.InnerText = "Agregar Póliza de seguro"
|
|
TxtProveedor.Text = ""
|
|
TxtPolizaSeguro.Text = ""
|
|
TxtFechaExpPoliza.Text = ""
|
|
TxtFechaVenPoliza.Text = ""
|
|
|
|
UpSeguros.Update()
|
|
UpAddPolizas.Update()
|
|
|
|
RegistraScript("$('#DivAddPolizas').modal('show');")
|
|
End Sub
|
|
Private Sub BtnAgregarPoliza_Click(sender As Object, e As EventArgs) Handles BtnAgregarPoliza.Click
|
|
Dim ObjAF As New ClsAF
|
|
|
|
If HdnModalidadPoliza.Value = "A" Then
|
|
If ObjAF.AddPolizasSeguro(-1, -1, TxtPolizaSeguro.Text.Trim, TxtFechaExpPoliza.Text.ToDateTime, TxtFechaVenPoliza.Text.ToDateTime, UsuarioActual.CveUsuario, -1, CveDispositivo, UsuarioActual.CveCliente, Proveedor:=TxtProveedor.Text) Then
|
|
Alert("La póliza se agregó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ElseIf HdnModalidadPoliza.Value = "U" Then
|
|
If ObjAF.UpdatePolizaSeguro(HdnIDPoliza.Value.ToEntero, -1, TxtPolizaSeguro.Text.Trim, TxtFechaExpPoliza.Text.ToDateTime, TxtFechaVenPoliza.Text.ToDateTime, Proveedor:=TxtProveedor.Text) Then
|
|
Alert("La póliza se actualizó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
End If
|
|
ObjAF.Dispose()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddPolizas"))
|
|
CargaSeguros()
|
|
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "I N C I D E N T E S"
|
|
Public Sub CargaIncidentes()
|
|
Dim ObjAF As New ClsAF()
|
|
|
|
If ObjAF.GetIncidentes(-1, -1, -1, CveDispositivo, UsuarioActual.CveCliente) Then
|
|
GvIncidentes.DataSource = ObjAF.DtResultados
|
|
End If
|
|
ObjAF.Dispose()
|
|
|
|
GvIncidentes.DataBind()
|
|
UpIncidentes.Update()
|
|
End Sub
|
|
Public Sub EditIndicente_Click(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
HdnModalidadIncidente.Value = "U"
|
|
HdnIDIndicente.Value = GvRow.DataKey("CveIncidente")
|
|
|
|
BtnAgregarIncidente.Text = "Actualizar"
|
|
LabelPolizas.InnerText = "Actualizar Incidente"
|
|
DdlPrioridad.SelectedValueExist(GvRow.DataKey("Prioridad"))
|
|
TxtAsuntoIncidente.Text = GvRow.DataKey("Asunto")
|
|
TxtDescripcionIncidente.Text = GvRow.DataKey("Descripcion")
|
|
TxtHorometro.Text = GvRow.DataKey("Horometro")
|
|
TxtFechaIncidente.Text = GvRow.DataKey("FechaIncidente")
|
|
|
|
UpIncidentes.Update()
|
|
UpAddIncidentes.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddIndicentes"))
|
|
End Sub
|
|
Public Sub DeleteIncidente_Click(sender As Object, e As EventArgs)
|
|
Dim ObjAF As New ClsAF()
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
HdnIDIndicente.Value = GvRow.DataKey("CveIncidente")
|
|
Dim continuar = ObjAF.RemoveIncidente(HdnIDIndicente.Value.ToEntero)
|
|
ObjAF.Dispose()
|
|
If continuar Then
|
|
CargaIncidentes()
|
|
Alert("El incidente se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
UpIncidentes.Update()
|
|
End Sub
|
|
Private Sub LnkAddIncidente_Click(sender As Object, e As EventArgs) Handles LnkAddIncidente.Click
|
|
HdnModalidadIncidente.Value = "A"
|
|
BtnAgregarIncidente.Text = "Agregar"
|
|
LabelIndicente.InnerText = "Agregar Incidente"
|
|
DdlPrioridad.SelectedIndex = 0
|
|
TxtAsuntoIncidente.Text = ""
|
|
TxtDescripcionIncidente.Text = ""
|
|
TxtHorometro.Text = ""
|
|
TxtFechaIncidente.Text = ""
|
|
|
|
UpIncidentes.Update()
|
|
UpAddIncidentes.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddIndicentes"))
|
|
End Sub
|
|
Private Sub BtnAgregarIncidente_Click(sender As Object, e As EventArgs) Handles BtnAgregarIncidente.Click
|
|
Dim ObjAF As New ClsAF
|
|
|
|
If HdnModalidadIncidente.Value = "A" Then
|
|
If ObjAF.AddIncidente(-1, TxtAsuntoIncidente.Text.Trim, TxtDescripcionIncidente.Text.Trim, 0, TxtHorometro.Text.ToDouble, DdlPrioridad.SelectedValue.ToEntero, TxtFechaIncidente.Text.ToDate, UsuarioActual.CveUsuario, -1, CveDispositivo, UsuarioActual.CveCliente) Then
|
|
Alert("El incidente se agregó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ElseIf HdnModalidadIncidente.Value = "U" Then
|
|
If ObjAF.UpdateIncidente(HdnIDIndicente.Value.ToEntero, TxtAsuntoIncidente.Text.Trim, TxtDescripcionIncidente.Text.Trim, 0, TxtHorometro.Text.ToDouble, DdlPrioridad.SelectedValue.ToEntero, TxtFechaIncidente.Text.ToDate) Then
|
|
Alert("El incidente se actualizó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
End If
|
|
ObjAF.Dispose()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddIndicentes"))
|
|
|
|
CargaIncidentes()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "S E R V I C I O S - M A N T E M I E N T O"
|
|
Public Sub CargaServicios()
|
|
Dim ObjAF As New ClsAF()
|
|
|
|
If ObjAF.GetServicios(-1, -1, -1, CveDispositivo, UsuarioActual.CveCliente) Then
|
|
GvServiciosMant.DataSource = ObjAF.DtResultados
|
|
GvServiciosMant.DataBind()
|
|
End If
|
|
|
|
If ObjAF.GetServiciosTotal(-1, -1, -1, CveDispositivo, UsuarioActual.CveCliente) Then
|
|
LblTotalServicios.Text = $"Total Servicios: ${ObjAF.DtResultados(0)("Total").ToString().ToDouble.FormatoNumero(2)}"
|
|
End If
|
|
ObjAF.Dispose()
|
|
|
|
UpServMant.Update()
|
|
End Sub
|
|
Public Sub EditServicio_Click(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
HdnModalidadServicio.Value = "U"
|
|
HdnIdServicio.Value = GvRow.DataKey("CveServicio")
|
|
|
|
BtnAgregarServicio.Text = "Actualizar"
|
|
LabelServicio.InnerText = "Actualizar Servicio"
|
|
|
|
'Cuerpo Modal CveServicio,CveAF, CveTipoServicio, TipoServicio, FechaServicio, CveProveedor, CveCompra, Horometro, Observaciones
|
|
DdlTIpoServicio.SelectedValue = GvRow.DataKey("CveTipoServicio")
|
|
TxtFechaServicio.Text = GvRow.DataKey("FechaServicio")
|
|
TxtProveedorS.Text = GvRow.DataKey("ProveedorServicio")
|
|
TxtImporteServicio.Text = GvRow.DataKey("Importe")
|
|
'DdlProveedorS.SelectedValue = GvRow.DataKey("CveProveedor")
|
|
'DdlProveedorS_SelectedIndexChanged(Nothing, Nothing)
|
|
'DdlCompra.SelectedValue = GvRow.DataKey("CveCompra")
|
|
TxtHoroOdoMetroS.Text = GvRow.DataKey("Horometro")
|
|
TxtObsS.Text = GvRow.DataKey("Observaciones")
|
|
|
|
UpServMant.Update()
|
|
UpAddServicios.Update()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddServicios"))
|
|
End Sub
|
|
Public Sub DeleteServicio_Click(sender As Object, e As EventArgs)
|
|
Dim ObjAF As New ClsAF()
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
|
|
|
HdnIdServicio.Value = GvRow.DataKey("CveServicio")
|
|
Dim continuar As Boolean = ObjAF.RemoveServicio(HdnIdServicio.Value.ToEntero)
|
|
ObjAF.Dispose()
|
|
If continuar Then
|
|
CargaServicios()
|
|
Alert("El servicio se eliminó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
UpServMant.Update()
|
|
End Sub
|
|
Private Sub LnkAddServicio_Click(sender As Object, e As EventArgs) Handles LnkAddServicio.Click
|
|
HdnModalidadServicio.Value = "A"
|
|
BtnAgregarServicio.Text = "Agregar"
|
|
LabelServicio.InnerText = "Agregar Servicio"
|
|
|
|
'Cuerpo Modal
|
|
DdlTIpoServicio.SelectedIndex = 0
|
|
TxtFechaServicio.Text = Now.ToShortDateString
|
|
TxtProveedorS.Text = ""
|
|
TxtImporteServicio.Text = ""
|
|
'DdlCompra.DataBind()
|
|
TxtHoroOdoMetroS.Text = ""
|
|
TxtObsS.Text = ""
|
|
|
|
UpServMant.Update()
|
|
UpAddServicios.Update()
|
|
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddServicios"))
|
|
End Sub
|
|
Private Sub BtnAgregarServicio_Click(sender As Object, e As EventArgs) Handles BtnAgregarServicio.Click
|
|
Dim ObjAF As New ClsAF
|
|
|
|
If HdnModalidadServicio.Value = "A" Then
|
|
If ObjAF.AddServicio(-1, DdlTIpoServicio.SelectedValue.ToEntero, TxtFechaServicio.Text.ToDateTime, -1, -1, TxtHoroOdoMetroS.Text.ToDouble, TxtObsS.Text, UsuarioActual.CveUsuario, -1, CveDispositivo, UsuarioActual.CveCliente, Proveedor:=TxtProveedorS.Text, Importe:=TxtImporteServicio.Text.ToDouble()) Then
|
|
Alert("El servicio se agregó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ElseIf HdnModalidadServicio.Value = "U" Then
|
|
If ObjAF.UpdateServicio(HdnIdServicio.Value.ToEntero, DdlTIpoServicio.SelectedValue.ToEntero, TxtFechaServicio.Text.ToDateTime, -1, -1, TxtHoroOdoMetroS.Text.ToDouble, TxtObsS.Text, Proveedor:=TxtProveedorS.Text, Importe:=TxtImporteServicio.Text.ToDouble()) Then
|
|
Alert("El servicio se actualizó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
End If
|
|
ObjAF.Dispose()
|
|
|
|
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddServicios"))
|
|
|
|
CargaServicios()
|
|
End Sub
|
|
|
|
'Private Sub DdlProveedorS_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProveedorS.SelectedIndexChanged
|
|
' Dim ObjCompras As New ClsCompras
|
|
|
|
' DdlCompra.Items.Clear()
|
|
|
|
' If ObjCompras.GetCompras(-1, "-1", "-1", DdlProveedorS.SelectedValue.ToEntero, -1, 2) Then
|
|
' DdlCompra.DataSource = ObjCompras.DtResultados
|
|
' DdlCompra.DataBind()
|
|
' End If
|
|
|
|
' DdlCompra.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
|
|
' UpAddServicios.Update()
|
|
' ObjCompras.Dispose()
|
|
'End Sub
|
|
#End Region
|
|
|
|
#Region "C O N F I G"
|
|
Private Sub CreaDTImagenes()
|
|
TmpDT = New DataTable()
|
|
TmpDT.Columns.Add("Imagen", GetType(String))
|
|
TmpDT.Columns.Add("URL", GetType(String))
|
|
|
|
Dim dr As DataRow = TmpDT.NewRow
|
|
dr("Imagen") = "Motocicleta"
|
|
dr("URL") = "motorcycle"
|
|
TmpDT.Rows.Add(dr)
|
|
|
|
dr = TmpDT.NewRow
|
|
dr("Imagen") = "Camión de Envios"
|
|
dr("URL") = "shipping"
|
|
TmpDT.Rows.Add(dr)
|
|
|
|
dr = TmpDT.NewRow
|
|
dr("Imagen") = "Pickup"
|
|
dr("URL") = "truck"
|
|
TmpDT.Rows.Add(dr)
|
|
|
|
dr = TmpDT.NewRow
|
|
dr("Imagen") = "Camioneta"
|
|
dr("URL") = "van"
|
|
TmpDT.Rows.Add(dr)
|
|
|
|
dr = TmpDT.NewRow
|
|
dr("Imagen") = "Pipa"
|
|
dr("URL") = "concrete-mixer"
|
|
|
|
dr = TmpDT.NewRow
|
|
dr("Imagen") = "Auto Default"
|
|
dr("URL") = "rsz_11rsz_car"
|
|
|
|
TmpDT.Rows.Add(dr)
|
|
|
|
GvIconos.DataSource = TmpDT
|
|
GvIconos.DataBind()
|
|
End Sub
|
|
Protected Sub chkLimiteVelocidad_CheckedChanged(sender As Object, e As EventArgs) Handles chkLimiteVelocidad.CheckedChanged
|
|
TxtLimiteVelocidad.Enabled = chkLimiteVelocidad.Checked
|
|
UpConfiguracion.Update()
|
|
End Sub
|
|
|
|
Protected Sub GvIcono_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvIconos.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
If e.Row.DBCampo("URL") = hdnIconoURL.Value Then
|
|
RegistraScript($"CargaDatosSeleccionadosIcono({e.Row.RowIndex}, '{e.Row.DBCampo("URL").ToString()}');", e.Row.RowIndex.ToString())
|
|
End If
|
|
e.Row.Attributes.Add("onClick", $"CargaDatosSeleccionadosIcono({e.Row.RowIndex}, '{e.Row.DBCampo("URL").ToString()}');")
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
|
|
Dim GPS As New ClsGPS()
|
|
|
|
If GPS.DispositivosUpdatePorCliente(CveDispositivo, TxtModeloV.Text, TxtAñoV.Text, TxtClaseVehiculo.Text, TxtPlacasV.Text, chkLimiteVelocidad.Checked, TxtLimiteVelocidad.Text.ToDouble,
|
|
TxtDetallesE.Text, TxtRendimiento.Text.ToDouble, hdnIconoURL.Value, hdnColorTrazo.Value, TxtNombreV.Text, TxtNoEconomicoE.Text, TxtColorV.Text, TxtCostoCombustible.Text.ToDecimal, TxtCostoKM.Text.ToDecimal, TxtSerieV.Text) AndAlso GPS.ConductorDispositivoUpdate(DdlConductor.SelectedValue.ToEntero, CveDispositivo) Then
|
|
|
|
Alert("El dispositivo se actualizó correctamente")
|
|
RecargaGlobal(GPS)
|
|
End If
|
|
GPS.Dispose()
|
|
End Sub
|
|
Private Sub RecargaGlobal(ByRef GPS As ClsGPS)
|
|
If GPS.DispositivosGet(-1, -1, -1, -1) Then
|
|
GlobalDTDispositivos(-1) = GPS.DtResultados
|
|
End If
|
|
|
|
If GPS.DispositivosUsuariosGet(-1, -1, -1, -1, -1) Then
|
|
GlobalDTDispositivosUsuarios(-1, -1) = GPS.DtResultados
|
|
End If
|
|
GPS.Dispose()
|
|
End Sub
|
|
#End Region
|
|
|
|
#Region "T R A M A S"
|
|
Private Sub CargaLog()
|
|
Dim GPS As New ClsGPS
|
|
If DdlTipoConsultaLog.SelectedValue = "Last" Then
|
|
If GPS.GetRepDispositivo(CveDispositivo, MinFecha, MaxFecha, "TOP 1") Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
GVLog.DataSource = GPS.DtResultados
|
|
bodyreportes.Visible = True
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ElseIf DdlTipoConsultaLog.SelectedValue = "Last10" Then
|
|
If GPS.GetRepDispositivo(CveDispositivo, MinFecha, MaxFecha, "TOP 10") Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
GVLog.DataSource = GPS.DtResultados
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ElseIf DdlTipoConsultaLog.SelectedValue = "Today" Then
|
|
If GPS.GetRepDispositivo(CveDispositivo, ($"{DateTime.Now.ToString("dd/MM/yyyy")} 0:00").ToDateTime, ($"{DateTime.Now.ToString("dd/MM/yyyy")} 23:59").ToDateTime) Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
GVLog.DataSource = GPS.DtResultados
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ElseIf DdlTipoConsultaLog.SelectedValue = "Yesterday" Then
|
|
If GPS.GetRepDispositivo(CveDispositivo, ($"{DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy")} 0:00").ToDateTime, ($"{DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy")} 23:59").ToDateTime) Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
GVLog.DataSource = GPS.DtResultados
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ElseIf DdlTipoConsultaLog.SelectedValue = "Week" Then
|
|
If GPS.GetRepDispositivo(CveDispositivo, ($"{DateTime.Now.AddDays(-7).ToString("dd/MM/yyyy")} 0:00").ToDateTime, DateTime.Now) Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
GVLog.DataSource = GPS.DtResultados
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
GPS.Dispose()
|
|
GVLog.DataBind()
|
|
UpGVLog.Update()
|
|
End Sub
|
|
Private Sub CargaRespuestas()
|
|
Dim GPS As New ClsGPS
|
|
If DdlLogRespuestas.SelectedValue = "Last" Then
|
|
If GPS.GetRespuestasDispositivo(CveDispositivo, MinFecha, MaxFecha, "TOP 1") Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
GVRespuestas.DataSource = GPS.DtResultados
|
|
bodyreportes.Visible = True
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ElseIf DdlLogRespuestas.SelectedValue = "Last10" Then
|
|
If GPS.GetRespuestasDispositivo(CveDispositivo, MinFecha, MaxFecha, "TOP 10") Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
GVRespuestas.DataSource = GPS.DtResultados
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ElseIf DdlLogRespuestas.SelectedValue = "Today" Then
|
|
If GPS.GetRespuestasDispositivo(CveDispositivo, ($"{DateTime.Now.ToString("dd/MM/yyyy")} 0:00").ToDateTime, ($"{DateTime.Now.ToString("dd/MM/yyyy")} 23:59").ToDateTime) Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
GVRespuestas.DataSource = GPS.DtResultados
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ElseIf DdlLogRespuestas.SelectedValue = "Yesterday" Then
|
|
If GPS.GetRespuestasDispositivo(CveDispositivo, ($"{DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy")} 0:00").ToDateTime, ($"{DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy")} 23:59").ToDateTime) Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
GVRespuestas.DataSource = GPS.DtResultados
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ElseIf DdlLogRespuestas.SelectedValue = "Week" Then
|
|
If GPS.GetRespuestasDispositivo(CveDispositivo, ($"{DateTime.Now.AddDays(-7).ToString("dd/MM/yyyy")} 0:00").ToDateTime, DateTime.Now) Then
|
|
If GPS.DtResultados.Rows.Count > 0 Then
|
|
GVRespuestas.DataSource = GPS.DtResultados
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
GPS.Dispose()
|
|
GVRespuestas.DataBind()
|
|
UpGVRespuestas.Update()
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
Protected Sub botonTrampa_Click(sender As Object, e As EventArgs) Handles botonTrampa.Click
|
|
CargaTanqueGasolina()
|
|
End Sub
|
|
Protected Sub BtnCargaLog_Click(sender As Object, e As EventArgs)
|
|
CargaLog()
|
|
End Sub
|
|
Protected Sub DdlControles_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlControles.SelectedIndexChanged
|
|
CargaTanqueGasolina()
|
|
End Sub
|
|
Private Sub BtnCargaRespuestas_Command(sender As Object, e As CommandEventArgs) Handles BtnCargaRespuestas.Command
|
|
CargaRespuestas()
|
|
End Sub
|
|
Protected Sub BtnRefrescar_Click(sender As Object, e As EventArgs) Handles BtnRefresh.Click
|
|
CargaComandos()
|
|
End Sub
|
|
Protected Sub BtnAgregarPasajero_Click(sender As Object, e As EventArgs)
|
|
If CveDispositivo <= 0 Then
|
|
Alert("Debe guardar el vehiculo primero.", TipoMensaje.MsgAdvertencia)
|
|
Return
|
|
End If
|
|
Dim CveRuta As Integer = DdlRuta.SelectedValue.ToEntero
|
|
Dim Min = TxtMinimos.Text.ToEntero
|
|
Dim Max = TxtMaximos.Text.ToEntero
|
|
If CveRuta <= 0 Then
|
|
Alert("Debe asignar una ruta.", TipoMensaje.MsgAdvertencia)
|
|
Return
|
|
End If
|
|
If String.IsNullOrEmpty(TxtMinimos.Text) Then
|
|
Alert("Debe asignar una cantidad minima de pasajeros.", TipoMensaje.MsgAdvertencia)
|
|
Return
|
|
End If
|
|
If String.IsNullOrEmpty(TxtMaximos.Text) Then
|
|
Alert("Debe asignar una cantidad maximas de pasajeros.", TipoMensaje.MsgAdvertencia)
|
|
Return
|
|
End If
|
|
|
|
Dim ObjGPS As New ClsGPS
|
|
If ObjGPS.UpdateDispositivosPasajeros(CveDispositivo, Min, Max, CveRuta) Then
|
|
Alert("El dispositivo se actualizó correctamente")
|
|
RecargaGlobal(ObjGPS)
|
|
End If
|
|
ObjGPS.Dispose()
|
|
End Sub
|
|
Protected Sub BtnComando_Click(sender As Object, e As EventArgs) Handles BtnComando.Click
|
|
If CveDispositivo > 0 Then
|
|
Dim cmd As String = TxtComandoTexto.Text.Trim
|
|
If Not String.IsNullOrEmpty(cmd) Then
|
|
Dim Telefono As String = ""
|
|
|
|
Dim ArrayCmd = cmd.Split(";"c)
|
|
|
|
If ArrayCmd.Length > 1 Then
|
|
Dim DeviceIDCMD = ArrayCmd(1)
|
|
Dim DeviceIDDispositivo As String = ""
|
|
|
|
Dim ObjGPS As New ClsGPS()
|
|
If ObjGPS.DispositivosGet(CveDispositivo, 1, -1) Then
|
|
Dim Row = ObjGPS.DtResultados(0)
|
|
Telefono = Row("NumeroTelefono").ToString()
|
|
DeviceIDDispositivo = Row("DevID").ToString()
|
|
End If
|
|
ObjGPS.Dispose()
|
|
|
|
If DeviceIDCMD = DeviceIDDispositivo Then
|
|
Dim TipoComando = RblTipoComandoLOG.SelectedValue
|
|
Select Case TipoComando
|
|
Case "GPRS"
|
|
Dim ObjHerra As New ClsGPSHerramientas
|
|
If ObjHerra.EjecutarComandoManualGPRS(cmd, Telefono, CveDispositivo, UsuarioActual.CveUsuario) Then
|
|
Alert("El comando se envió correctamente", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ObjHerra.Dispose()
|
|
|
|
Case "SMS"
|
|
Dim ObjHerra As New ClsGPSHerramientas
|
|
If ObjHerra.EjecutarComandoManualSMS(cmd, Telefono, CveDispositivo, UsuarioActual.CveUsuario) Then
|
|
Alert("El comando se envió correctamente", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ObjHerra.Dispose()
|
|
|
|
End Select
|
|
|
|
Else
|
|
Alert("El 'Device Id' no corresponde a este dispositivo.", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
Private Sub CargaCanBus()
|
|
Dim ObjGPS As New ClsGPS
|
|
Dim TipoConsulta = DdlFechaCanBus.SelectedValue
|
|
|
|
If TipoConsulta = "Last" Then
|
|
If ObjGPS.GetRepDispositivoCanBus(CveDispositivo, MinFecha, MaxFecha, "TOP 1") Then
|
|
If ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
GvCanBus.DataSource = ObjGPS.DtResultados
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ElseIf TipoConsulta = "Last10" Then
|
|
If ObjGPS.GetRepDispositivoCanBus(CveDispositivo, MinFecha, MaxFecha, "TOP 10") Then
|
|
If ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
GvCanBus.DataSource = ObjGPS.DtResultados
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ElseIf TipoConsulta = "Today" Then
|
|
If ObjGPS.GetRepDispositivoCanBus(CveDispositivo, ($"{DateTime.Now.ToString("dd/MM/yyyy")} 0:00").ToDateTime, ($"{DateTime.Now.ToString("dd/MM/yyyy")} 23:59").ToDateTime) Then
|
|
If ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
GvCanBus.DataSource = ObjGPS.DtResultados
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ElseIf TipoConsulta = "Yesterday" Then
|
|
If ObjGPS.GetRepDispositivoCanBus(CveDispositivo, ($"{DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy")} 0:00").ToDateTime, ($"{DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy")} 23:59").ToDateTime) Then
|
|
If ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
GvCanBus.DataSource = ObjGPS.DtResultados
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
ElseIf TipoConsulta = "Week" Then
|
|
If ObjGPS.GetRepDispositivoCanBus(CveDispositivo, ($"{DateTime.Now.AddDays(-7).ToString("dd/MM/yyyy")} 0:00").ToDateTime, DateTime.Now) Then
|
|
If ObjGPS.DtResultados.Rows.Count > 0 Then
|
|
GvCanBus.DataSource = ObjGPS.DtResultados
|
|
Else
|
|
Alert("No se encontraron resultados con el equipo seleccionado", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
ObjGPS.Dispose()
|
|
GvCanBus.DataBind()
|
|
UpGvCanBus.Update()
|
|
End Sub
|
|
Protected Sub BtnCargaCanBus_Click(sender As Object, e As EventArgs)
|
|
CargaCanBus()
|
|
End Sub
|
|
Protected Sub LnkTrama_Click(sender As Object, e As EventArgs)
|
|
Dim Lnk As LinkButton = DirectCast(sender, LinkButton)
|
|
Dim GvRow = DirectCast(Lnk.Parent.Parent, GridViewRow)
|
|
|
|
Dim Odometro As String = GvRow.DataKey("TO").FormatoNumero
|
|
Dim TotalCombus As String = GvRow.DataKey("TF").FormatoNumero
|
|
Dim Velo As String = GvRow.DataKey("VS").FormatoNumero
|
|
Dim RPM As String = GvRow.DataKey("E_RPM").FormatoNumero
|
|
Dim Presion As String = GvRow.DataKey("OIL_PRE").FormatoNumero
|
|
Dim Tmp As String = GvRow.DataKey("E_TMP").FormatoNumero
|
|
Dim ComIdle As String = GvRow.DataKey("IF").FormatoNumero
|
|
|
|
Dim T_CRU As String = GvRow.DataKey("T_CRU").FormatoNumero
|
|
Dim TMotor As String = GvRow.DataKey("E_IDLE").FormatoNumero
|
|
Dim Eco As String = GvRow.DataKey("F_ECO").FormatoNumero
|
|
Dim DTC As String = GvRow.DataKey("DTC")
|
|
Dim Pos As String = GvRow.DataKey("Posicion")
|
|
|
|
LblOdo.Text = $"{Odometro} Km/h"
|
|
LblCombus.Text = $"{TotalCombus} Lts"
|
|
LblVelocActual.Text = $"{Velo} Km/h"
|
|
LblRPM.Text = $"{RPM} RPM"
|
|
LblOIL.Text = $"{Presion} kPa"
|
|
LblTA.Text = $"{Tmp} °C"
|
|
LblComIDLE.Text = $"{ComIdle} Hr"
|
|
LblCRU.Text = $"{T_CRU} sec"
|
|
LblMotorIDLE.Text = $"{TMotor} sec"
|
|
LblECO.Text = $"{Eco} Km/L"
|
|
LblDTC.Text = $"{Convert.ToInt32(DTC, 16)}"
|
|
|
|
Dim CoordCanBus As String = SQLToGmaps(Pos, "POINT")
|
|
'Dim POLYPATH = $"[{CoordCanBus.Substring(0, CoordCanBus.Length - 1)}]"
|
|
UpModalCanBus.Update()
|
|
|
|
'Dim jsPoly = $""
|
|
'RegistraScript(jsPoly)
|
|
RegistraScript("$('#DivCanBus').modal('show');setTimeout(function(){initMapCanBus();creaPolylineCanBus(" + CoordCanBus + "," + " ' " + ColorTrazoCanBus + "'," + CoordCanBus + ", '" + LtlVehiculo.Text + "', 'http://sig.adsistemas.mx/Imagenes/rsz_11rsz_car.png');},2000);")
|
|
End Sub
|
|
|
|
|
|
#Region "P A S A J E R O S"
|
|
Protected Sub ImgEditarParada_Click(sender As Object, e As EventArgs)
|
|
Dim Boton = CType(sender, LinkButton)
|
|
'DivUtilizarGeocerca.Visible = False
|
|
Dim CveGeoReferencia = Boton.CommandArgument
|
|
BtnAgregarGeoreferencia.CommandArgument = CveGeoReferencia
|
|
|
|
Dim GvRow As GridViewRow = DirectCast(Boton.NamingContainer, GridViewRow)
|
|
|
|
Dim NombreParada = GvRow.DataKey("GeoReferencia").ToString()
|
|
Dim Importe = GvRow.DataKey("Importe").FormatoNumero()
|
|
TxtNombreGeo.Text = NombreParada
|
|
TxtImporte.Text = Importe
|
|
|
|
Dim SbJS As New StringBuilder
|
|
|
|
If GvRow.DataKey("Tipo") = "Geocerca" Then
|
|
Dim Coords = SQLToGmapsJArray(GvRow.DataKey("Coordenadas").ToString(), "POLYGON")
|
|
SbJS.Append(" $('#DivGeocercas').modal('show'); $('#DivUtilizarGeocerca').css('display', 'none'); setTimeout(function(){ initMapGeo(); DeletemarkersGeo(); ")
|
|
For Each Cord As JObject In Coords
|
|
SbJS.AppendFormat("addLatLngCoords({0});", Cord.ToString())
|
|
Next
|
|
'Dim JsPoly = $"creaPoligonoGeo([{Coord}], '{GvRow.DataKey("Color").ToString()}', '{GvRow.DataKey("GeoReferencia")}');"
|
|
SbJS.Append(" },500); setTimeout(function(){ setCenterMapGeo();},1000);")
|
|
|
|
End If
|
|
H2.InnerHtml = $"<i class='fa fa-bell-o'></i> Editar Parada : {NombreParada} </h4>"
|
|
'BtnAgregarGeoreferencia.Text = " <i class='material-icons'>done_all</i> Agregar"
|
|
HdnModalidadParada.Value = "U"
|
|
UpTools.Update()
|
|
UpGeocercas.Update()
|
|
RegistraScript(SbJS.ToString())
|
|
End Sub
|
|
|
|
Protected Sub GvParadas_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvParadas.RowDataBound
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
e.Row.FCLinkButton("imgColor").Style.Add("background-color", e.Row.DBCampo("Color").ToString())
|
|
e.Row.FCLinkButton("imgE").CommandArgument = e.Row.DBCampo("CveGeoReferencia").ToString()
|
|
If e.Row.DBCampo("Estatus").ToString() = "True" Then
|
|
e.Row.FCLabel("LblEstatus").Text = "Activo"
|
|
e.Row.FCLabel("LblEstatus").ForeColor = Drawing.Color.Green
|
|
|
|
Else
|
|
e.Row.FCLabel("LblEstatus").Text = "Inactivo"
|
|
e.Row.FCLabel("LblEstatus").ForeColor = Drawing.Color.Red
|
|
End If
|
|
End If
|
|
End Sub
|
|
Protected Sub BtnAgregarGeoreferencia_Click(sender As Object, e As EventArgs)
|
|
If String.IsNullOrEmpty(TxtNombre.Text.Trim) Then
|
|
Alert("El campo 'Nombre' es necesario favor de introducirlo.", TipoMensaje.MsgAdvertencia)
|
|
RegistraScript("setTimeout(function(){ initMapGeo(); DeletemarkersGeo();},1000);")
|
|
Return
|
|
End If
|
|
If String.IsNullOrEmpty(TxtImporte.Text.Trim) Then
|
|
Alert("El campo 'Importe' es necesario favor de introducirlo.", TipoMensaje.MsgAdvertencia)
|
|
RegistraScript("setTimeout(function(){ initMapGeo(); DeletemarkersGeo();},1000);")
|
|
Return
|
|
End If
|
|
If String.IsNullOrEmpty(GeoCerca.Value.Trim) Then
|
|
Alert("La parada no tiene una geocerca dibujada.", TipoMensaje.MsgAdvertencia)
|
|
RegistraScript("setTimeout(function(){ initMapGeo(); DeletemarkersGeo();},1000);")
|
|
Return
|
|
End If
|
|
|
|
Dim TieneError As Boolean = False
|
|
Dim ObjGPS As New ClsGPS
|
|
ObjGPS.IniciaTransacSQL()
|
|
|
|
If HdnTipo.Value = "Geocerca" Then
|
|
Dim Importe As Decimal = TxtImporte.Text.ToDecimal
|
|
Dim GeoRefString = $"POLYGON(({GeoCerca.Value} {CommandArg.Value}))"
|
|
|
|
Select Case HdnModalidadParada.Value
|
|
Case "A"
|
|
If ObjGPS.AddGeoReferencia(TxtNombreGeo.Text, CveDispositivo, GeoRefString, "Geocerca", True, "-1", "-1", -1, -1, -1, -1, -1, -1, -1, "-1", "-1", hdnColor.Value, -1, Importe, UsuarioActual.CveCliente) Then
|
|
If Not ObjGPS.AddGeoReferenciaDetalle(ObjGPS.CveGeoReferencia, CveDispositivo) Then
|
|
TieneError = True
|
|
End If
|
|
Else
|
|
TieneError = True
|
|
End If
|
|
Case "U"
|
|
Dim CveGeoReferencia = BtnAgregarGeoreferencia.CommandArgument.ToEntero
|
|
If CveGeoReferencia > 0 Then
|
|
If ObjGPS.UpdateParadaGeoReferencia(CveGeoReferencia, TxtNombreGeo.Text, GeoRefString, Importe) Then
|
|
Alert("La parada actualizó correctamente.", TipoMensaje.MsgInformacion)
|
|
End If
|
|
End If
|
|
End Select
|
|
|
|
End If
|
|
If TieneError Then
|
|
ObjGPS.RollBack()
|
|
Alert("Ocurrió un error al crear la parada", TipoMensaje.MsgInformacion)
|
|
Else
|
|
ObjGPS.Commit()
|
|
Alert("La parada se agregó correctamente", TipoMensaje.MsgInformacion)
|
|
End If
|
|
ObjGPS.Dispose()
|
|
CargaParadas()
|
|
UpGvParadas.Update()
|
|
RegistraScript("$('#DivGeocercas').modal('hide');")
|
|
UpGeocercas.Update()
|
|
End Sub
|
|
Protected Sub GvParadas_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvParadas.RowDeleting
|
|
Dim ObjGPS As New ClsGPS
|
|
Dim CveGeoReferencia As Integer = GvParadas.Rows(e.RowIndex).DataKey("CveGeoReferencia").ToEntero()
|
|
Dim continuar As Boolean = ObjGPS.GeoReferenciaDelete(CveGeoReferencia, UsuarioActual.CveCliente)
|
|
ObjGPS.Dispose()
|
|
If continuar Then
|
|
Alert("La parada fue eliminada correctamente", TipoMensaje.MsgInformacion)
|
|
CargaParadas()
|
|
End If
|
|
UpGvParadas.Update()
|
|
UpGeocercas.Update()
|
|
End Sub
|
|
|
|
|
|
<Web.Services.WebMethod()> <Script.Services.ScriptMethodAttribute()>
|
|
Public Shared Function WsGeocercas(ByVal Id As System.String) As System.String
|
|
Dim CveGeoReferencia As Integer = Id.ToEntero
|
|
Dim Retorno As String = "{}"
|
|
|
|
If CveGeoReferencia > 0 Then
|
|
Dim ObjGPS As New ClsGPS
|
|
If ObjGPS.GeoReferenciaGet(CveGeoReferencia, 1, "-1", -1) Then
|
|
Try
|
|
Dim DrGeocercas As DataRow = ObjGPS.DtResultados.Rows(0)
|
|
If DrGeocercas IsNot Nothing Then
|
|
Dim Coords = ModExtensiones.SQLToGmapsJArray(DrGeocercas("Coordenadas").ToString(), "POLYGON")
|
|
Dim Json As New JObject(New JProperty("Posiciones", Coords))
|
|
Retorno = Json.ToString()
|
|
End If
|
|
Catch ex As Exception
|
|
ModExtensiones.GuardaLog("Ocurrió un error al obtener la geocerca " + ex.ToString())
|
|
End Try
|
|
End If
|
|
ObjGPS.Dispose()
|
|
End If
|
|
Return Retorno
|
|
End Function
|
|
|
|
#End Region
|
|
Protected Sub BtnRecargarCanBus_Click(sender As Object, e As EventArgs)
|
|
Dim Dr As DataRow = GlobalDTDispositivosUsuarios(UsuarioActual.CveCliente, UsuarioActual.CveUsuario).FiltroPrimero($"CveDispositivo={Me.CveDispositivo}")
|
|
Dim Comando As String = $"ST300GED;{Dr("DevID").ToString()};02"
|
|
Dim Telefono As String = Dr("NumeroTelefono").ToString()
|
|
Dim CveDispositivo As Integer = Dr("CveDispositivo").ToString().ToEntero
|
|
|
|
Dim ObjHerra As New ClsGPSHerramientas()
|
|
Dim continuar As Boolean = ObjHerra.EjecutarComandoManualGPRS(Comando, Telefono, CveDispositivo, UsuarioActual.CveUsuario)
|
|
ObjHerra.Dispose()
|
|
If continuar Then
|
|
CargaCanBus()
|
|
Alert("El envío de solicitud de información ha sido enviado correctamente.")
|
|
End If
|
|
'Select Case Tipo
|
|
' Case "GPRS"
|
|
' If ObjHerra.EjecutarComandoManualGPRS(Comando, Telefono, CveDispositivo, -1) Then
|
|
' LblFecha.Text = Now.ToString("dd/MM/yyyy")
|
|
' GuardaLog($"Se ejecuto el comando correctamente vía GPRS. ")
|
|
' End If
|
|
' Case "SMS"
|
|
' If ObjHerra.EjecutarComandoManualSMS(Comando, Telefono, CveDispositivo, -1) Then
|
|
' LblFecha.Text = Now.ToString("dd/MM/yyyy")
|
|
' GuardaLog($"Se ejecuto el comando correctamente vía SMS Fecha. ")
|
|
' End If
|
|
'End Select
|
|
End Sub
|
|
Protected Sub GVLog_RowDeleting(sender As Object, e As GridViewDeleteEventArgs)
|
|
If UsuarioActual.TienePermisoProceso(226) Then
|
|
Dim ObjGPS As New ClsGPS
|
|
Dim CveTrama As Integer = GVLog.Rows(e.RowIndex).DataKey("CveTrama").ToEntero()
|
|
Dim continuar As Boolean = ObjGPS.RemoveTrama(CveTrama)
|
|
ObjGPS.Dispose()
|
|
If continuar Then
|
|
Alert("La Trama se eliminó correctamente", TipoMensaje.MsgInformacion)
|
|
End If
|
|
|
|
CargaLog()
|
|
Else
|
|
Alert("No tiene permiso para realizar esta acción.", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
|
|
End Sub
|
|
End Class
|
|
|