/// <summary> /// Elimina el estado de todas las geocercas de este ticket de la cache /// </summary> protected void ClearGeocercasCache() { foreach (var key in Geocercas.Select(g => GetKeyGeocerca(g)).Where(key => LogicCache.KeyExists(typeof(EstadosEntrega), key))) { LogicCache.Delete(typeof(EstadosEntrega), key); } }
/// <summary> /// Setea el estado inicial (dentro/fuera) de todas las geocercas del ticket a partir de la ultima posicion del vehiculo. /// </summary> protected void FirstPosition() { try { var position = DaoFactory.LogPosicionDAO.GetLastOnlineVehiclePosition(Vehiculo); if (position == null) { return; } // Pongo todas las geocercas en Desconocido var geocercas = Geocercas.Select(geocerca => GetKeyGeocerca(geocerca)); foreach (var key in geocercas) { LogicCache.Store(typeof(EstadosEntrega), key, new EstadosEntrega(EstadosGeocerca.Desconocido), DateTime.UtcNow.AddHours(5)); } // Proceso la primera posicion var positionEvent = new PositionEvent(position.FechaMensaje, position.Latitud, position.Longitud); ProcessGeocercas(positionEvent); } catch (Exception ex) { STrace.Exception(typeof(CicloLogisticoFactory).FullName, ex); } }
public static string WLeerGeocercasDelMunicipio(string IdMunicipio) { JavaScriptSerializer scriptSerializer = new JavaScriptSerializer(); List <string> Lista = new List <string>(); Usuario usr = new Usuario(); if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current)) { return(scriptSerializer.Serialize(Lista.ToArray())); } try { Geocercas geo = new Geocercas(usr); geo.ReadAll_Geocerca_del_Municipio(IdMunicipio); UtilWeb.AddElementSeleccioneALista(geo.Datos); UtilWeb util = new UtilWeb(); string jsonMun = util.GetJson(geo.Datos); string html = ""; WLeerGeocerca_Internal(usr, ref html, IdMunicipio); Lista.Add("Exito"); //Lista.Add(jsonMun); Lista.Add(html); //Lista.Add(jsonCamiones); } catch (Exception ex) { Lista.Add("Exception"); Lista.Add(ex.Message); Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor."); } return(scriptSerializer.Serialize(Lista.ToArray())); }
public static string WEliminarGeocerca(string Id) { JavaScriptSerializer scriptSerializer = new JavaScriptSerializer(); List <string> Lista = new List <string>(); Usuario usr = new Usuario(); if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current)) { return(scriptSerializer.Serialize(Lista.ToArray())); } try { if (Id.Trim().Length != 0) { Geocercas geo = new Geocercas(usr); geo.Delete(Id); string html = ""; WLeerGeocerca_Internal(usr, ref html, ""); Lista.Add("Exito"); Lista.Add(html); } } catch (Exception ex) { Lista.Add("Exception"); Lista.Add(ex.Message); Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor."); } return(scriptSerializer.Serialize(Lista.ToArray())); }
private static void WLeerGeocerca_Internal(Usuario usr, ref string html, string IdMunicipio) { Geocercas geo = new Geocercas(usr); //geo.ReadAll(); if (IdMunicipio.Trim().Length == 0) { geo.ReadAll_con_Municipio(); } else { geo.ReadAll_Geocerca_del_Municipio(IdMunicipio); } //Se genera la tabla HTML List <ColumnaHtml> lista = new List <ColumnaHtml>(); lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreMunic")); lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreGeocerca")); lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Ubicacion")); //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "RutUserMunic")); lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Coordenadas")); lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Observacion")); //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Telefono")); //Aca va IMAGEN lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageEdit, "Id", "", "Edit", "EditGeocerca")); lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageDelete, "Id", "", "Delete", "DeleteGeocerca")); UtilWeb util = new UtilWeb(); html = util.GetHtmlTableBasica(geo.Datos, lista); }
public static string WLeerParaEditarGeocerca(string Id) { JavaScriptSerializer scriptSerializer = new JavaScriptSerializer(); List <string> Lista = new List <string>(); Usuario usr = new Usuario(); if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current)) { return(scriptSerializer.Serialize(Lista.ToArray())); } try { //ClienteMunicipio cliente = new ClienteMunicipio(usr); Geocercas geo = new Geocercas(usr); geo.Read(Id); //Camiones camion = new Camiones(usr); //camion.Read(Id); //cliente.Read(Id); Lista.Add("Exito"); Lista.Add(geo.Datos.Rows[0]["NombreGeocerca"].ToString()); Lista.Add(geo.Datos.Rows[0]["Ubicacion"].ToString()); Lista.Add(geo.Datos.Rows[0]["Coordenadas"].ToString()); Lista.Add(geo.Datos.Rows[0]["Observacion"].ToString()); Lista.Add(geo.Datos.Rows[0]["IdClienteMunicipio"].ToString()); //Lista.Add(geo.Datos.Rows[0]["NombreMunicipio"].ToString()); //Lista.Add(camion.Datos.Rows[0]["Telefono"].ToString()); } catch (Exception ex) { Lista.Add("Exception"); Lista.Add(ex.Message); Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor."); } return(scriptSerializer.Serialize(Lista.ToArray())); }
public static string WGrabarGeocerca(string sId, string sNombreGeocerca, string sUbicacion, string sCoordenadas, string sObservacion, string sIdClienteMunicipio) { JavaScriptSerializer scriptSerializer = new JavaScriptSerializer(); List <string> Lista = new List <string>(); Usuario usr = new Usuario(); if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current)) { return(scriptSerializer.Serialize(Lista.ToArray())); } try { Geocercas geo = new Geocercas(usr); if (sId.Trim().Length == 0) { geo.Create(sNombreGeocerca, sUbicacion, sCoordenadas, sObservacion, sIdClienteMunicipio); } else { geo.Update(sId, sNombreGeocerca, sUbicacion, sCoordenadas, sObservacion, sIdClienteMunicipio); } string html = ""; WLeerGeocerca_Internal(usr, ref html, sIdClienteMunicipio); Lista.Add("Exito"); Lista.Add(html); } catch (Exception ex) { Lista.Add("Exception"); Lista.Add(ex.Message); Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor."); } return(scriptSerializer.Serialize(Lista.ToArray())); }