Exemplo n.º 1
0
        public List <IncidentsDTO> GetLatestIncidents(int OldPeriodInHours)
        {
            var res = new List <IncidentsDTO>();
            var now = DateTime.Now;

            res = operationalDataContext.fn_GetRecentIncidentsNotification(OldPeriodInHours).Where(x => x.NotificationId.HasValue)
                  .Select(x => new IncidentsDTO
            {
                ArrivedTime     = x.ArrivedTime,
                CallerAddress   = x.CallerAddress,
                CallerLanguage  = x.CallerLanguage,
                CallerName      = x.CallerName,
                CallerNumber    = x.CallerNumber,
                CallTakerId     = x.CallTakerId,
                CallTakerName   = x.CallTakerName,
                CreatedTime     = x.CreatedTime,
                DispatcherId    = x.DispatcherId,
                DispatcherName  = x.DispatcherName,
                DispatcheTime   = x.DispatcheTime,
                EndTime         = x.EndTime,
                IncidentAddress = x.IncidentAddress,
                IncidentId      = x.IncidentId,
                IncidentNumber  = x.IncidentNumber,
                IncidentTypeId  = x.IncidentTypeId,
                IsCritical      = true,
                IsNoticed       = x.IsNoticed,
                Latitude        = x.Latitude,
                Longitude       = x.Longitude,
                NotificationId  = x.NotificationId.Value,
                StatusId        = x.StatusId,
                MessageId       = x.IncidentId.ToString(),
                MessageText     = "New Incident: " + x.IncidentId.ToString(),
                BackgroundColor = "Red",
                Notification    = new NotificationDTO
                {
                    DateCreated    = x.DateCreated,
                    IsNoticed      = x.NotificationIsNoticed.HasValue ? x.NotificationIsNoticed.Value : false,
                    LastModified   = x.LastModified,
                    LastModifiedBy = x.ModifiedBy,
                    LastStatus     = x.LastStatus,
                    NotificationId = x.NotificationId.Value,
                    OwnerId        = x.OwnerId
                }
            }).ToList();
            return(res);
        }