Exemple #1
0
        /// <summary>
        /// Logs the given data.
        /// </summary>
        /// <typeparam name="T">Type of payload.</typeparam>
        /// <param name="logger"><see cref="ILogger"/> instance.</param>
        /// <param name="logLevel"><see cref="ILogger"/> value.</param>
        /// <param name="payload">Payload to log.</param>
        /// <param name="eventType"><see cref="EventType"/> value.</param>
        /// <param name="eventStatus"><see cref="EventStatusType"/> value.</param>
        /// <param name="eventId">Event ID.</param>
        /// <param name="spanType"><see cref="SpanType"/> value.</param>
        /// <param name="spanStatus"><see cref="SpanStatusType"/> value.</param>
        /// <param name="spanId">Span ID.</param>
        /// <param name="interfaceType"><see cref="InterfaceType"/> value.</param>
        /// <param name="correlationId">Correlation ID.</param>
        /// <param name="clientRequestId">Client request ID from Table Storage transaction.</param>
        /// <param name="messageId">Message ID for Service Bus.</param>
        /// <param name="recordId">Record ID of Cosmos DB.</param>
        /// <param name="ex"><see cref="Exception"/> instance.</param>
        /// <param name="message">Log message.</param>
        public static void LogData <T>(this ILogger logger,
                                       LogLevel logLevel, T payload,
                                       EventType eventType, EventStatusType eventStatus, Guid eventId,
                                       SpanType spanType, SpanStatusType spanStatus, Guid spanId,
                                       InterfaceType interfaceType, Guid correlationId,
                                       string clientRequestId = null,
                                       string messageId       = null,
                                       string recordId        = null,
                                       Exception ex           = null,
                                       string message         = null)
        {
            var @event     = new EventId((int)eventType, eventType.ToString());
            var entityType = payload.GetType().Name;

            if (ex == null)
            {
                logger.Log(logLevel, @event, template, logLevel, message, eventType, eventStatus, eventId, entityType, spanType, spanStatus, spanId, interfaceType, correlationId, clientRequestId, messageId, recordId);

                return;
            }

            logger.Log(logLevel, @event, ex, template, logLevel, message, eventType, eventStatus, eventId, entityType, spanType, spanStatus, spanId, interfaceType, correlationId, clientRequestId, messageId, recordId);
        }
        /// <summary>
        ///  Get a list of all events that have this specifc status
        /// </summary>
        /// <param name="eventStatus"></param>
        /// <returns></returns>
        public async Task <IEnumerable <EventInformation> > GetEventsByStatusAsync(EventStatusType eventStatus)
        {
            var status = eventStatus.ToString();

            var events = await _database.EVENTS
                         .Where(e => e.STATUS == status)
                         .Select(e => new EventInformation
            {
                EventId     = e.ID_PK,
                Name        = e.NAME,
                Description = e.DESCRIPTION,
                Location    = e.LOCATION,
                Room        = e.ROOM,
                TimeBegin   = e.TIME_BEGIN,
                TimeEnd     = e.TIME_END,
                Type        = e.TYPE,
                Status      = e.STATUS
            })
                         .OrderByDescending(e => e.TimeBegin)
                         .ToListAsync();

            return(events);
        }
 public SettingsMigrationEventArgs(EventStatusType eventStatus)
 {
     EventStatus = eventStatus;
 }
 public SettingsMigrationEventArgs(EventStatusType eventStatus)
 {
     EventStatus = eventStatus;
 }