public async Task <List <GeolocationProxy> > Get(FilterPayload filter) { var logs = _logRepository.GetAll().Include(i => i.Device).OrderBy(o => o.LogDate).Where(w => w.DeviceId == filter.DeviceId); if (filter.Start.HasValue) { logs = logs.Where(w => w.LogDate > filter.Start.Value); } if (filter.End.HasValue) { logs = logs.Where(w => w.LogDate < filter.End.Value); } return(logs.Select(s => new GeolocationProxy() { LogDate = s.LogDate, Latitude = s.Latitude.ToString(), Longitude = s.Longitude.ToString(), Speed = s.Speed.ToString(), Height = s.Height.ToString(), DeviceId = s.Device.DeviceId }).ToList()); }
public Task <IActionResult> Get([FromBody] FilterPayload payload) { return(RunDefaultAsync(async() => { var logs = await _geolocationBusiness.Get(payload); return Ok(logs); })); }
private void ReceiveMessage(FilterPayload filterPayload) { lock (_messageQueue) { ProcessEventItem processEvent = new ProcessEventItem() { Number = ++_messageCount, Type = (MonitoringType)filterPayload.Type, Operation = (Operations)filterPayload.Operation, ProcessInfo = new ProcessInfoItem() { ProcessId = filterPayload.ProcessInfo.ProcessId, ParentProcessId = filterPayload.ProcessInfo.ParentProcessId, RawPath = filterPayload.ProcessInfo.RawPath, DosPath = filterPayload.ProcessInfo.DosPath, FileName = filterPayload.ProcessInfo.FileName }, ThreadId = filterPayload.ThreadId, TargetId = filterPayload.TargetId, RawPath = filterPayload.RawPath, DosPath = filterPayload.DosPath, IoResult = filterPayload.IoResult, IoResultText = ConversionHelper.ConvertHResultToHexString(filterPayload.IoResult), DetailText = string.Empty, TimeStamp = filterPayload.CurrentTime, DateTimeText = ConversionHelper.ConvertTimeStempToStringFormat(filterPayload.CurrentTime) }; switch (processEvent.Operation) { case Operations.ProcessCreate: processEvent.DetailText = $"Created Process ID : {processEvent.TargetId}"; break; case Operations.ThreadCreate: processEvent.DetailText = $"Created Thread ID : {processEvent.TargetId}"; break; } _messageQueue.Enqueue(processEvent); } }
public async Task <List <GeolocationProxy> > Get(FilterPayload filter) { var logsEntity = _logRepository.GetAll().Include(i => i.Device).OrderBy(o => o.LogDate).Where(w => w.DeviceId == filter.DeviceId); if (filter.Start.HasValue) { logsEntity = logsEntity.Where(w => w.LogDate > filter.Start.Value); } if (filter.End.HasValue) { logsEntity = logsEntity.Where(w => w.LogDate < filter.End.Value); } var logs = new List <LogEntity>(); foreach (var entity in logsEntity) { if (!logs.Any(f => f.Latitude == entity.Latitude && f.Longitude == entity.Longitude)) { logs.Add(entity); } } return(logs.Select(s => new GeolocationProxy() { LogDate = s.LogDate, Latitude = s.Latitude, Longitude = s.Longitude, Speed = s.Speed.ToString(), Height = s.Height.ToString(), DeviceId = s.Device.DeviceId }).ToList()); }