Reparrastre
This commit is contained in:
@@ -121,7 +121,39 @@ Public Class ClsGPS
|
||||
Public Sub Commit()
|
||||
SqlTransacc.Commit()
|
||||
End Sub
|
||||
#Region "Arrastre"
|
||||
|
||||
Public Function GPS_ArrastreGET(CveDispositivo As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_GPS_ArrastreGET")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
addParameters("@CveDispositivo", SqlDbType.Int, CveDispositivo)
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener los datos de Arrastre", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function GPS_ArrastreActivarDesactivar(CveDispositivo As Integer, ArrastreActivo As Boolean) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_GPS_ArrastreActivarDesactivar")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
addParameters("@CveDispositivo", SqlDbType.Int, CveDispositivo)
|
||||
addParameters("@ArrastreActivo", SqlDbType.Bit, ArrastreActivo)
|
||||
End With
|
||||
Try
|
||||
Dataset = New DataSet()
|
||||
SqlAdapter.Fill(Dataset)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al activar o desactivar la alerta de Arrastre", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
#End Region
|
||||
Public Function GetTemperatura(CveDispositivo As Integer, CveSensor As Integer, strFechaInicio As String, strFechaFin As String, CveUsuario As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_GPS_TramaData")
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
<style>
|
||||
#map {
|
||||
height: 450px;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
Reporte de Arrastre
|
||||
@@ -10,6 +15,9 @@
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkApagarvehiculo" runat="server">Apagar vehiculo</asp:LinkButton>
|
||||
</li>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
@@ -42,42 +50,168 @@
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="portlet-title">
|
||||
</div>
|
||||
<div class="portlet light smmallpadding traspasorow bordered" style="margin-top: 48px">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-red">
|
||||
<i class="fa fa-clock-o font-red"></i>
|
||||
<span class="caption-subject bold uppercase">TIEMPOS OPERATIVOS</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
<asp:UpdatePanel ID="UpInfo" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="portlet-title">
|
||||
</div>
|
||||
<div class="portlet light smmallpadding traspasorow bordered" style="">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-red">
|
||||
<i class="fa fa-clock-o font-red"></i>
|
||||
<span class="caption-subject bold uppercase">datos vehiculo</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="C_bodyreportes" class="portlet-body rowpadding">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<label style="font-weight: bold;">¿Activar alerta de arrastre?</label>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
|
||||
<div id="C_bodyreportes" class="portlet-body rowpadding">
|
||||
<asp:TextBox ID="TxtFunciones" CssClass="hidden EvalRun" runat="server"></asp:TextBox>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<label style="font-weight: bold;">¿Activar funcion de arrastre?</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<asp:CheckBox ID="chkActivarArrastre" CssClass="chksino " AutoPostBack="true" OnCheckedChanged="chkActivarArrastre_CheckedChanged" Text=" " runat="server" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<label style="font-weight: bold;">Velocidad</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<asp:Label ID="LblVelocidad" runat="server" Text="Sin Información"></asp:Label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<label style="font-weight: bold;">¿Encendido / Apagado?</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<asp:Label ID="LblEncApa" runat="server" Text="Sin Información"></asp:Label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<label style="font-weight: bold;">Fecha ultima Conexion</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<asp:Label ID="LblFechaInfo" runat="server" Text="Sin Información"></asp:Label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<div id="map">
|
||||
</div>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAF7s8wwhzCVXDUYopc9mXxqaWB33cDro4&libraries=places"></script>
|
||||
<script>
|
||||
var image = '/Imagenes/rsz_11rsz_car.png';
|
||||
var geocoder;
|
||||
var map;
|
||||
var markerArrastre;
|
||||
var markerActual;
|
||||
var directionsService;
|
||||
var directionsDisplay;
|
||||
var polylinesRoute = [];
|
||||
var directionsDisplayArray = [];
|
||||
|
||||
var retorno;
|
||||
function setCenter(myLatLn) {
|
||||
map.setCenter(myLatLn);
|
||||
}
|
||||
function addmarkerarrastre(myLatLn) {//myLatLn = { lat: -25.363, lng: 131.044 }
|
||||
if (markerArrastre) {
|
||||
markerArrastre.setMap(null);
|
||||
}
|
||||
markerArrastre = new google.maps.Marker({
|
||||
position: myLatLn,
|
||||
map: map,
|
||||
title: 'Estacionado'
|
||||
});
|
||||
}
|
||||
|
||||
function addmarkerActual(myLatLn,Encencido) {//myLatLn = { lat: -25.363, lng: 131.044 } ,addmarkerActual({ lat: -25.363, lng: 131.044 })
|
||||
|
||||
var imagen = Encencido ==1? '/Imagenes/rsz_11rsz_cargreen.png' :'/Imagenes/rsz_11rsz_car.png';
|
||||
var markerIcon = { url: imagen, labelOrigin: new google.maps.Point(26, 43) };
|
||||
if (markerActual) {
|
||||
markerActual.setMap(null);
|
||||
}
|
||||
markerActual = new google.maps.Marker({
|
||||
position: myLatLn,
|
||||
map: map,
|
||||
title: 'Posición Actual',
|
||||
icon: markerIcon
|
||||
});
|
||||
}
|
||||
function initMap() {
|
||||
map = new google.maps.Map(document.getElementById('map'), {
|
||||
center: { lat: 29.0628417, lng: -110.9872448 },
|
||||
zoom: 13
|
||||
|
||||
});
|
||||
//var ShowDiv1 = document.createElement('div');
|
||||
//var ShowDivControl = new ShowDiv(ShowDiv1, map);
|
||||
|
||||
|
||||
//ShowDiv1.index = 1;
|
||||
//ShowDiv1.id = "showdiv1"
|
||||
|
||||
//map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(ShowDiv1);
|
||||
|
||||
|
||||
//var upControlDiv = document.createElement('div');
|
||||
//var upControl = new ControlLabels(upControlDiv, map);
|
||||
|
||||
//upControlDiv.index = 1;
|
||||
//map.controls[google.maps.ControlPosition.TOP_LEFT].push(upControlDiv);
|
||||
|
||||
//var upGeoDiv = document.createElement('div');
|
||||
//var upGeo = new ControlGeocercas(upGeoDiv, map);
|
||||
|
||||
//map.controls[google.maps.ControlPosition.TOP_LEFT].push(upGeoDiv);
|
||||
|
||||
geocoder = new google.maps.Geocoder();
|
||||
|
||||
//google.maps.event.addListener(map, "click", function (event) {
|
||||
// closeLastOpenedInfoWindow();
|
||||
//});
|
||||
|
||||
directionsService = new google.maps.DirectionsService;
|
||||
directionsDisplay = new google.maps.DirectionsRenderer;
|
||||
directionsDisplay.setOptions({ suppressMarkers: true });
|
||||
directionsDisplay.setMap(map);
|
||||
}
|
||||
|
||||
|
||||
function ADSBegin() {
|
||||
eval($('.EvalRun').val());
|
||||
}
|
||||
initMap();
|
||||
//$(document).ready(function () {
|
||||
|
||||
// initMap();
|
||||
//});
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
|
||||
@@ -1,25 +1,98 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Extensiones;
|
||||
|
||||
public partial class GPS_RepArrastre : ClsPaginas
|
||||
{
|
||||
|
||||
public int CveDispositivo
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ViewState["CveDispositivo"] != null)
|
||||
{
|
||||
return ViewState["CveDispositivo"].ToString().ToEntero();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
set { ViewState["CveDispositivo"] = value; }
|
||||
}
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
|
||||
DdlDispositivo.DataSource = get_GlobalDTDispositivosUsuarios(UsuarioActual.CveCliente, UsuarioActual.CveUsuario) ;
|
||||
// fijo borrar
|
||||
DdlDispositivo.DataSource = get_GlobalDTDispositivosUsuarios(263965, 1928) ;
|
||||
//DdlDispositivo.DataSource = get_GlobalDTDispositivosUsuarios(UsuarioActual.CveCliente, UsuarioActual.CveUsuario) ;
|
||||
DdlDispositivo.DataBind();
|
||||
getArrastre();
|
||||
}
|
||||
|
||||
}
|
||||
private void getArrastre()
|
||||
{
|
||||
CveDispositivo = DdlDispositivo.SelectedValue.ToEntero();
|
||||
using (ClsGPS objgps = new ClsGPS())
|
||||
{
|
||||
if (objgps.GPS_ArrastreGET(CveDispositivo) && objgps.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
DataRow dtrow = objgps.DtResultados.Rows[0];
|
||||
upInfo(dtrow);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public void upInfo(DataRow dtrow)
|
||||
{
|
||||
if ( dtrow != null)
|
||||
{
|
||||
LblVelocidad.Text = $"{dtrow["Speed"]:N0}";
|
||||
LblEncApa.Text = $"{dtrow["EncendidoText"]}";
|
||||
LblFechaInfo.Text = $"{dtrow["FechaTrama"]:dd/MM/yyyy}";
|
||||
//LblVelocidad.Text = $"{dtrow[""]}";
|
||||
//LblVelocidad.Text = $"{dtrow[""]}";addmarkerActual({ lat: -25.363, lng: 131.044 })
|
||||
string pVehiculo = string.Format("{{ lat: {0}, lng: {1}}}", dtrow["Lat"], dtrow["Lng"]);
|
||||
string parrastre = string.Format("{{ lat: {0}, lng: {1}}}", dtrow["LatArrastre"], dtrow["LngArrastre"]);
|
||||
TxtFunciones.Text = string.Format("addmarkerActual({0},{3}){1};setCenter({2})", pVehiculo, (dtrow["ArrastreActivo"].ToString() == "1" ? $" ;addmarkerarrastre({parrastre})" : ";addmarkerarrastre()"), (dtrow["ArrastreActivo"].ToString() == "1" ? parrastre : pVehiculo), dtrow["Encendido"].ToString().ToEntero());
|
||||
UpInfo.Update();
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnConsultar_Click(object sender, EventArgs e)
|
||||
{
|
||||
getArrastre();
|
||||
}
|
||||
|
||||
protected void chkActivarArrastre_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
using (ClsGPS objgps = new ClsGPS())
|
||||
{
|
||||
if (objgps.GPS_ArrastreActivarDesactivar(CveDispositivo, chkActivarArrastre.Checked)){
|
||||
|
||||
if (objgps.GPS_ArrastreGET(CveDispositivo) && objgps.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
DataRow dtrow = objgps.DtResultados.Rows[0];
|
||||
upInfo(dtrow);
|
||||
}
|
||||
if (chkActivarArrastre.Checked)
|
||||
{
|
||||
Alert("se ha activado la funcion de arrastre");
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert("se ha desactivado la funcion de arrastre");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user