private static void PedirFoto(LogMensajeBase log) { log.TieneFoto = true; //var sender = new Sender.Sender(log.Dispositivo.TipoDispositivo.ColaDeComandos); DateTime from; DateTime to; if (log.FechaFin.HasValue) { to = log.FechaFin.Value; from = log.FechaFin.Value.AddSeconds(-log.Accion.SegundosFoto); if (log.Fecha > from) { from = log.Fecha; } } else { to = log.Fecha; from = log.Fecha.AddSeconds(-log.Accion.SegundosFoto); } //sender.SendRetrievePictures(log.Dispositivo.Id, from, to); MessageSender.CreateRetrievePictures(log.Dispositivo, new LogMensajeSaver()).AddDateRange(from, to).Send(); }
/// <summary> /// Filters the givenn messages collection to return only those wich applies to the givenn message context. /// </summary> /// <param name="actions"></param> /// <param name="mensaje"></param> /// <returns></returns> private IEnumerable <Accion> FilterActions(ICollection <Accion> actions, LogMensajeBase mensaje) { if (actions == null || actions.Count.Equals(0)) { return(new List <Accion>()); } var actionsToCheck = GetMatchingActions(actions, mensaje); var actionsToApply = actionsToCheck.Where(action => ApplyAction(mensaje, action)); var filteredActions = new List <Accion>(actionsToCheck.Count()); var poi = mensaje.IdPuntoDeInteres.HasValue ? DaoFactory.ReferenciaGeograficaDAO.FindById(mensaje.IdPuntoDeInteres.Value) : null; filteredActions.AddRange(poi != null ? actionsToApply.Where(action => action.TipoReferenciaGeografica == null || action.TipoReferenciaGeografica.Id.Equals(poi.TipoReferenciaGeografica.Id)) : actionsToApply); if (filteredActions.Any(accion => accion.EvaluaGeocerca) && mensaje.Coche != null) { filteredActions = filteredActions.Where(accion => CheckGeofence(mensaje.Coche, accion)).ToList(); } return(filteredActions); }
private LogUltimoLogin UpdateLogin(LogUltimoLoginVo lastLogin, LogMensajeBase login) { var log = DaoFactory.LogUltimoLoginDAO.FindById(lastLogin.Id); log.Latitud = login.Latitud; log.Longitud = login.Longitud; log.Dispositivo = login.Dispositivo; log.Horario = login.Horario; log.DetalleHorario = login.DetalleHorario; log.Usuario = login.Usuario; log.Fecha = login.Fecha; log.Texto = login.Texto; log.Coche = login.Coche; log.Accion = login.Accion; log.Chofer = login.Chofer; log.Expiracion = login.Expiracion; log.Estado = login.Estado; log.Mensaje = login.Mensaje; log.FechaFin = login.FechaFin; log.LatitudFin = login.LatitudFin; log.LongitudFin = login.LongitudFin; log.VelocidadPermitida = login.VelocidadPermitida; log.VelocidadAlcanzada = login.VelocidadAlcanzada; log.IdPuntoDeInteres = login.IdPuntoDeInteres; return(log); }
private void ReportarAssistCargo(LogMensajeBase log, string assistCargoCode) { try { if (!log.Coche.ReportaAssistCargo) { return; } STrace.Debug(GetType().FullName, log.Dispositivo.Id, String.Format("AssistCargo Event: {0} -> {1}: {2}", log.Coche.Patente, Config.AssistCargo.AssistCargoEventQueue, assistCargoCode)); var queue = new IMessageQueue(Config.AssistCargo.AssistCargoEventQueue); if (queue.LoadResources()) { var data = new TextEvent(log.Dispositivo.Id, 0, DateTime.UtcNow) { Text = assistCargoCode, GeoPoint = new GPSPoint(log.Fecha, (float)log.Latitud, (float)log.Longitud) }; queue.Send(data, MessageQueueTransactionType.Automatic); } else { STrace.Error(GetType().FullName, log.Dispositivo.Id, String.Format("Problemas cargando la cola: {0}", Config.AssistCargo.AssistCargoEventQueue)); } } catch (Exception e) { STrace.Exception(GetType().FullName, e, log.Dispositivo.Id); } }
public SharedPopup(LogMensajeBase msg) { Id = msg.Id; Interno = msg.Coche.Interno; IdVehiculo = msg.Coche.Id; IdTransportista = msg.Coche.Transportista != null ? msg.Coche.Transportista.Id : -1; CodigoMensaje = msg.Mensaje.Codigo; DateTime = msg.Fecha; DateTimeAlta = msg.FechaAlta.Value; RequiereAtencion = msg.Accion.RequiereAtencion; IdPerfil = msg.Accion.PerfilHabilitado != null ? msg.Accion.PerfilHabilitado.Id : -1; Text = msg.Texto; if (msg.Accion != null) { Color = "#" + msg.Accion.RGB; if (msg.Accion.Sonido != null) { Sound = msg.Accion.Sonido.URL; } } else { Color = "#CCCCCC"; } }
private static string GetEstado(LogMensajeBase evento) { var estado = string.Empty; if (evento.Mensaje.Codigo == MessageCode.CicloLogisticoIniciado.GetMessageCode()) { estado = "En viaje"; } else if (evento.Mensaje.Codigo == MessageCode.CicloLogisticoCerrado.GetMessageCode()) { estado = "En base"; } else if (evento.Texto.ToUpperInvariant().Contains("ENTRADA")) { estado = "En cliente"; } else if (evento.Texto.ToUpperInvariant().Contains("SALIDA")) { estado = "En viaje"; } else if (evento.Texto.ToUpperInvariant().Contains("MANUAL")) { estado = "En tarea"; } return(estado); }
private IEnumerable <Accion> FilterActions(ICollection <Accion> actions, LogMensajeBase mensaje) { if (actions == null || actions.Count.Equals(0)) { return(new List <Accion>()); } var actionsToCheck = from action in actions.ToList() where mensaje.Coche != null where action.Empresa == null || mensaje.Coche.Empresa == null || action.Empresa.Id.Equals(mensaje.Coche.Empresa.Id) where action.Linea == null || mensaje.Coche.Linea == null || action.Linea.Id.Equals(mensaje.Coche.Linea.Id) where action.TipoVehiculo == null || action.TipoVehiculo.Id.Equals(mensaje.Coche.TipoCoche.Id) where action.Transportista == null || (mensaje.Coche.Transportista != null && action.Transportista.Id.Equals(mensaje.Coche.Transportista.Id)) || (mensaje.Chofer != null && mensaje.Chofer.Transportista != null && action.Transportista.Id.Equals(mensaje.Chofer.Transportista.Id)) where action.Departamento == null || (mensaje.Coche.CentroDeCostos != null && mensaje.Coche.CentroDeCostos.Departamento != null && action.Departamento.Id.Equals(mensaje.Coche.CentroDeCostos.Departamento.Id)) where action.CentroDeCostos == null || (mensaje.Coche.CentroDeCostos != null && action.CentroDeCostos.Id.Equals(mensaje.Coche.CentroDeCostos.Id)) select action; var actionsToApply = actionsToCheck.Where(action => ApplyAction(mensaje, action)); var filteredActions = new List <Accion>(actionsToCheck.Count()); var poi = mensaje.IdPuntoDeInteres.HasValue ? DaoFactory.ReferenciaGeograficaDAO.FindById(mensaje.IdPuntoDeInteres.Value) : null; filteredActions.AddRange(poi != null ? actionsToApply.Where(action => action.TipoReferenciaGeografica == null || action.TipoReferenciaGeografica.Id.Equals(poi.TipoReferenciaGeografica.Id)) : actionsToApply); if (filteredActions.Any(accion => accion.EvaluaGeocerca) && mensaje.Coche != null) { filteredActions = filteredActions.Where(accion => CheckGeofence(mensaje.Coche, accion, DaoFactory)).ToList(); } return(filteredActions); }
private void SetLastLogin(LogMensajeBase lastLogin) { var lastLoginVo = new LogUltimoLoginVo(lastLogin); Coche.StoreLastLogin(lastLoginVo); Dispositivo.StoreLastLogin(lastLoginVo); }
private static void SendMail(LogMensajeBase log) { const int minutes = 15; var monitor = Config.Monitor.HistoricMonitorLink; var link = log.Coche != null ? String.Format(@"{0}?Planta={1}&TypeMobile={2}&Movil={3}&InitialDate={4}&FinalDate={5}&MessageCenterIndex={6}&ShowMessages=1&Empresa={7}&ShowPOIS=1", monitor, log.Coche.Linea != null?log.Coche.Linea.Id : -1, log.Coche.TipoCoche.Id, log.Coche.Id, log.Fecha.AddMinutes(-minutes).ToString(CultureInfo.InvariantCulture), log.Fecha.AddMinutes(minutes).ToString(CultureInfo.InvariantCulture), log.Id, log.Coche.Empresa != null?log.Coche.Empresa.Id : log.Coche.Linea != null?log.Coche.Linea.Empresa.Id : -1) : monitor; var chofer = log.Chofer != null?string.Format("Chofer: {0}", log.Chofer.Entidad.Descripcion) : "Sin Chofer Identificado"; var responsable = log.Coche != null && log.Coche.Chofer != null && log.Coche.Chofer.Entidad != null ? log.Coche.Chofer.Entidad.Descripcion : "Sin Responsable Asignado"; var parameters = log.Coche != null ? new List <string> { log.Coche.Linea != null ? log.Coche.Linea.Descripcion : log.Coche.Empresa != null ? log.Coche.Empresa.RazonSocial : "Sistema", string.Concat(log.Coche.Interno, " - ", chofer), responsable, log.Coche.ToLocalString(log.Fecha, true), GeocoderHelper.GetDescripcionEsquinaMasCercana(log.Latitud, log.Longitud), log.Texto, link } : new List <string> { "Sistema", "(Ninguno)", responsable, string.Format("{0} {1}", log.Fecha.ToShortDateString(), log.Fecha.ToShortTimeString()), GeocoderHelper.GetDescripcionEsquinaMasCercana(log.Latitud, log.Longitud), log.Texto, link }; var destinatarios = log.Accion.DestinatariosMail; if (log.Accion.ReportaDepartamento && log.Accion.Departamento.Empleado != null && log.Accion.Departamento.Empleado.Mail != string.Empty) { destinatarios = destinatarios + ";" + log.Accion.Departamento.Empleado.Mail; } if (log.Accion.ReportaCentroDeCostos && log.Accion.CentroDeCostos.Empleado != null && log.Accion.CentroDeCostos.Empleado.Mail != string.Empty) { destinatarios = destinatarios + ";" + log.Accion.CentroDeCostos.Empleado.Mail; } var asunto = log.Accion.AsuntoMail.Trim() != string.Empty ? log.Accion.AsuntoMail.Trim() : log.Texto; SendMailToAllDestinations(destinatarios, log.Chofer, asunto, parameters); }
/// <summary> /// Instanciates a new vo login based in a login event. /// </summary> /// <param name="mensaje"></param> public LogUltimoLoginVo(LogMensajeBase mensaje) { Id = mensaje.Id; IdDispositivo = mensaje.Dispositivo.Id; Fecha = mensaje.Fecha; IdCoche = mensaje.Coche.Id; IdChofer = mensaje.Chofer != null ? mensaje.Chofer.Id : 0; Chofer = mensaje.Chofer != null ? mensaje.Chofer.Entidad.Descripcion : String.Empty; }
/// <summary> /// Gets the vehicles drivers bosses. /// </summary> /// <param name="log"></param> /// <returns></returns> private static Empleado GetEmpleadoEvento(LogMensajeBase log) { if (log.Chofer != null) { return(log.Chofer); } var coche = log.Coche; return(coche == null || coche.Transportista == null ? null : coche.Chofer); }
private string SerializeMessage(LogMensajeBase x) { return(string.Format("{{ \"lat\": {0},\"lon\": {1}, \"date\": {2}, \"enddate\": {3}, \"icon\": \"{4}\", \"id\": {5}, \"endlat\": {6}, \"endlon\": {7} }}", x.Latitud.ToString(CultureInfo.InvariantCulture), x.Longitud.ToString(CultureInfo.InvariantCulture), SerializeDate(x.Fecha.ToDisplayDateTime()), x.FechaFin.HasValue ? SerializeDate(x.FechaFin.Value.ToDisplayDateTime()).ToString() : "null", string.IsNullOrEmpty(x.GetIconUrl()) ? string.Concat(ApplicationPath, "OpenLayers/img/marker-gold.png") : string.Concat(IconDir, x.GetIconUrl()), x.Id, x.LatitudFin.HasValue ? x.LatitudFin.Value.ToString(CultureInfo.InvariantCulture) : "null", x.LongitudFin.HasValue ? x.LongitudFin.Value.ToString(CultureInfo.InvariantCulture) : "null" )); }
/// <summary> /// Applyes the user configured gmt to the message. /// </summary> /// <param name="mensaje"></param> private static void ApplyUserGmt(LogMensajeBase mensaje) { if (mensaje.Expiracion.HasValue) { mensaje.Expiracion = mensaje.Expiracion.Value.ToDisplayDateTime(); } mensaje.Fecha = mensaje.Fecha.ToDisplayDateTime(); if (mensaje.FechaFin.HasValue) { mensaje.FechaFin = mensaje.FechaFin.Value.ToDisplayDateTime(); } }
/// <summary> /// Gets all actions that matches the current message context. /// </summary> /// <param name="actions"></param> /// <param name="mensaje"></param> /// <returns></returns> private static IEnumerable <Accion> GetMatchingActions(IEnumerable actions, LogMensajeBase mensaje) { if (actions == null) { return(new List <Accion>()); } return(from action in actions.OfType <Accion>().ToList() where mensaje.Coche != null where action.Empresa == null || mensaje.Coche.Empresa == null || action.Empresa.Id.Equals(mensaje.Coche.Empresa.Id) where action.Linea == null || mensaje.Coche.Linea == null || action.Linea.Id.Equals(mensaje.Coche.Linea.Id) where action.TipoVehiculo == null || action.TipoVehiculo.Id.Equals(mensaje.Coche.TipoCoche.Id) where action.Transportista == null || (mensaje.Coche.Transportista != null && action.Transportista.Id.Equals(mensaje.Coche.Transportista.Id)) select action); }
private void UpdateLastLogin(LogUltimoLoginVo lastLogin, LogMensajeBase login) { var log = GetNewLastLogin(lastLogin, login); if (lastLogin == null) { DaoFactory.LogUltimoLoginDAO.Save(log); } else { DaoFactory.LogUltimoLoginDAO.Update(log); } SetLastLogin(log); }
/// <summary> /// Gets the date and time of the message in the corresponding time zone. /// </summary> /// <param name="log"></param> /// <param name="includeGmt"></param> /// <returns></returns> private static string GetFecha(LogMensajeBase log, bool includeGmt) { var timeZoneId = log.Coche.Linea != null ? log.Coche.Linea.TimeZoneId : log.Coche.Empresa != null ? log.Coche.Empresa.TimeZoneId : null; if (timeZoneId == null) { return(string.Concat(log.Fecha.ToString(), " (GMT)")); } var culture = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId); var referencia = log.Fecha.AddHours(culture.BaseUtcOffset.TotalHours); var fecha = string.Format("{0} {1}", referencia.ToShortDateString(), referencia.ToShortTimeString()); return(includeGmt ? string.Concat(fecha, string.Format(" ({0})", culture.DisplayName)) : fecha); }
/// <summary> /// Sends a SMS with info about the event. /// </summary> /// <param name="log"></param> private static void SendSms(LogMensajeBase log) { var configFile = Config.Mailing.MailingSmsConfiguration; if (string.IsNullOrEmpty(configFile)) { throw new Exception("No pudo cargarse configuracion de envio de sms."); } var sender = new MailSender(configFile); var parameters = new List <string> { log.Coche.Linea != null ? log.Coche.Linea.Descripcion : log.Coche.Empresa != null ? log.Coche.Empresa.RazonSocial : "Sistema", log.Coche.Interno, GetFecha(log, false), log.Texto }; SendSmsToAllDestinations(log, sender, parameters); }
private static Boolean ApplyAction(LogMensajeBase log, Accion accion) { if (accion == null || accion.Condicion == null || accion.Condicion.Trim() == string.Empty) { return(true); } try { var context = new EventContext { Dispositivo = log.Dispositivo.Codigo, Duracion = log.Duracion, Exceso = log.Exceso, Interno = log.Coche.Interno, Legajo = log.Chofer != null ? log.Chofer.Legajo : string.Empty, Texto = log.Texto, TieneTicket = log.Horario != null, VelocidadAlcanzada = log.VelocidadAlcanzada.HasValue ? log.VelocidadAlcanzada.Value : -1, VelocidadPermitida = log.VelocidadPermitida.HasValue ? log.VelocidadPermitida.Value : -1, Fecha = log.Fecha, FechaFin = log.FechaFin }; var expression = ExpressionContext.CreateExpression(accion.Condicion, context); var cachedResult = LogicCache.Retrieve <Object>(typeof(Boolean), expression); if (cachedResult != null) { return(Convert.ToBoolean(cachedResult)); } var result = Logictracker.ExpressionEvaluator.ExpressionEvaluator.Evaluate <bool>(expression); LogicCache.Store(typeof(Boolean), expression, result); return(result); } catch (Exception e) { STrace.Exception(typeof(BaseEventSaver).FullName, e, String.Format("Error procesando condicion: {0} | Accion: {1}", accion.Condicion, accion.Descripcion)); return(false); } }
private static string GetRowText(LogMensajeBase mensaje) { const string template = "<table o='{8}' style='background-color:#{5};color:#{6};' onclick='s({7});'><tr><td class='r1'><h6>{0}</h6> {1}</td><td class='r2'>{2}</td><td class='r3'>{3}</td><td>{4}</td><td class='r4'>{9}</td></tr></table>"; var col = mensaje.Accion != null ? Color.FromArgb(100, mensaje.Accion.Red, mensaje.Accion.Green, mensaje.Accion.Blue) : Color.White; var fecha = mensaje.Fecha.ToDisplayDateTime(); return(string.Format(template, fecha.ToString("dd-MM"), fecha.ToString("HH:mm:ss"), mensaje.Coche.Interno, mensaje.Chofer != null ? mensaje.Chofer.Entidad.Descripcion : string.Empty, mensaje.Texto.Replace("\"", "\\\""), mensaje.Accion != null ? mensaje.Accion.RGB : "DDDDDD", col.GetBrightness() > 0.45 ? "000000" : "FFFFFF", mensaje.Id, fecha.ToString("yyyyMMddHHmmss"), mensaje.TieneFoto ? "<div class='withPhoto' onclick='showFoto(" + mensaje.Id + ");'></div>" : string.Empty )); }
/// <summary> /// Sends a SMS message to all recipients. /// </summary> /// <param name="log"></param> /// <param name="sender"></param> /// <param name="parameters"></param> private static void SendSmsToAllDestinations(LogMensajeBase log, MailSender sender, List <string> parameters) { if (string.IsNullOrEmpty(log.Accion.DestinatariosSMS)) { return; } var destinatariosSms = log.Accion.DestinatariosSMS.Replace(',', ';'); var destinos = destinatariosSms.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); if (destinos.Count().Equals(0)) { return; } foreach (var destinatario in destinos.Where(destinatario => !string.IsNullOrEmpty(destinatario))) { sender.Config.ToAddress = destinatario.Trim(); sender.SendMail(parameters.ToArray()); } }
public LogUltimoLogin(LogMensajeBase mensaje) { Latitud = mensaje.Latitud; Longitud = mensaje.Longitud; Dispositivo = mensaje.Dispositivo; Horario = mensaje.Horario; DetalleHorario = mensaje.DetalleHorario; Usuario = mensaje.Usuario; Fecha = mensaje.Fecha; Texto = mensaje.Texto; Coche = mensaje.Coche; Accion = mensaje.Accion; Chofer = mensaje.Chofer; Expiracion = mensaje.Expiracion; Estado = mensaje.Estado; Mensaje = mensaje.Mensaje; FechaFin = mensaje.FechaFin; LatitudFin = mensaje.LatitudFin; LongitudFin = mensaje.LongitudFin; VelocidadPermitida = mensaje.VelocidadPermitida; VelocidadAlcanzada = mensaje.VelocidadAlcanzada; IdPuntoDeInteres = mensaje.IdPuntoDeInteres; }
protected static Boolean ApplyAction(LogMensajeBase log, Accion accion) { if (String.IsNullOrEmpty(accion.Condicion)) { return(true); } var context = new EventContext { Dispositivo = log.Dispositivo.Codigo, Duracion = log.Duracion, Exceso = log.Exceso, Interno = log.Coche.Interno, Legajo = log.Chofer != null ? log.Chofer.Legajo : string.Empty, Texto = log.Texto, TieneTicket = log.Horario != null, VelocidadAlcanzada = log.VelocidadAlcanzada.HasValue ? log.VelocidadAlcanzada.Value : -1, VelocidadPermitida = log.VelocidadPermitida.HasValue ? log.VelocidadPermitida.Value : -1, Fecha = log.Fecha, FechaFin = log.FechaFin }; return(ApplyAction(context, accion)); }
private void PedirFoto(LogMensajeBase log) { log.TieneFoto = true; DateTime from; DateTime to; if (log.FechaFin.HasValue) { to = log.FechaFin.Value; from = log.FechaFin.Value.AddSeconds(-log.Accion.SegundosFoto); if (log.Fecha > from) { from = log.Fecha; } } else { to = log.Fecha; from = log.Fecha.AddSeconds(-log.Accion.SegundosFoto); } MessageSender.CreateRetrievePictures(log.Dispositivo, this).AddDateRange(from, to).Send(); }
/// <summary> /// Sends a SMS with info about the event. /// </summary> /// <param name="log"></param> private static void SendSms(LogMensajeBase log) { var parameters = log.Coche != null ? new List <string> { log.Coche.Linea != null? log.Coche.Linea.Descripcion : log.Coche.Empresa != null ? log.Coche.Empresa.RazonSocial : "Sistema", log.Coche.Interno, log.Coche.ToLocalString(log.Fecha, false), log.Texto, GeocoderHelper.GetDescripcionEsquinaMasCercana(log.Latitud, log.Longitud), log.Coche.Chofer != null ? log.Coche.Chofer.Entidad.Descripcion : string.Empty } : new List <string> { "Sistema", "(Ninguno)", string.Format("{0} {1}", log.Fecha.ToShortDateString(), log.Fecha.ToShortTimeString()), log.Texto, GeocoderHelper.GetDescripcionEsquinaMasCercana(log.Latitud, log.Longitud), string.Empty }; SendSms(log.Accion.DestinatariosSms, parameters); }
private static string GetRow(LogMensajeBase mensaje) { const string template = "\"{0}\""; return(string.Format(template, GetRowText(mensaje))); }
private LogUltimoLogin GetNewLastLogin(LogUltimoLoginVo lastLogin, LogMensajeBase login) { return(lastLogin == null ? new LogUltimoLogin(login) : UpdateLogin(lastLogin, login)); }
/// <summary> /// Enables the user /// </summary> /// <param name="log"></param> private void HabilitarUsuario(LogMensajeBase log) { DaoFactory.UsuarioDAO.HabilitarUsuario(log.Accion.UsuarioHabilitado, log.Accion.HorasHabilitado); }
/// <summary> /// Disables the user /// </summary> /// <param name="log"></param> private void InhabilitarUsuario(LogMensajeBase log) { DaoFactory.UsuarioDAO.InhabilitarUsuario(log.Accion.UsuarioInhabilitado); }
/// <summary> /// Get s amobile position. /// </summary> /// <param name="coche"></param> /// <param name="dispositivo"></param> /// <param name="lastPosition"></param> /// <param name="lastRfid"></param> /// <returns></returns> private static MobilePosition GetPosition(Coche coche, Dispositivo dispositivo, LogPosicionBase lastPosition, LogMensajeBase lastRfid) { return(new MobilePosition { Dispositivo = dispositivo.Codigo, Interno = coche.Interno, Fecha = lastPosition.FechaMensaje.ToDisplayDateTime(), IdDispositivo = dispositivo.Id, FechaAlta = lastPosition.FechaRecepcion.ToDisplayDateTime(), Latitud = lastPosition.Latitud, Longitud = lastPosition.Longitud, Responsable = coche.Chofer != null ? coche.Chofer.Entidad.Descripcion : string.Empty, IdMovil = coche.Id, IdBase = coche.Linea != null ? coche.Linea.Id : 0, Velocidad = lastPosition.Velocidad, IdPosicion = lastPosition.Id, //Firmware = dispositivo.FullFirmwareVersion, EstadoMovil = GetStatusDescription(coche.Estado), EstadoDispositivo = GetStatusDescription(dispositivo.Estado), ReferenciaVehiculo = coche.Referencia, TipoDispositivo = GetDeviceTypeDescription(dispositivo), EstadoReporte = GetReportStatus(lastPosition), Distrito = MobilePosition.GetDistrito(coche), Base = MobilePosition.GetBase(coche), TipoVehiculo = coche.TipoCoche.Descripcion, IdDistrito = coche.Empresa != null ? coche.Empresa.Id : 0, //Qtree = dispositivo.QtreeRevision, Chofer = lastRfid != null ? lastRfid.Chofer != null ? lastRfid.Chofer.Entidad.Descripcion : string.Empty : string.Empty, UltimoLogin = lastRfid != null?lastRfid.Fecha.ToDisplayDateTime() : DateTime.MinValue }); }