public static string GetEncoded(NotificationLogId notificationLogId) { if (notificationLogId != null) { return(notificationLogId.Encoded); } return(null); }
public NotificationLogId Previous(int notificationsPerLog) { var previousLow = Math.Max(this.Low - notificationsPerLog, 1); var previousHigh = previousLow + notificationsPerLog - 1; var previous = new NotificationLogId(previousLow, previousHigh); if (Equals(previous)) previous = null; return previous; }
public NotificationLogId Next(int notificationsPerLog) { var nextLow = this.High + 1; var nextHigh = nextLow + notificationsPerLog; var next = new NotificationLogId(nextLow, nextHigh); if (Equals(next)) next = null; return next; }
public NotificationLogId Previous(int notificationsPerLog) { var previousLow = Math.Max(Low - notificationsPerLog, 1); var previousHigh = previousLow + notificationsPerLog - 1; var previous = new NotificationLogId(previousLow, previousHigh); if (Equals(previous)) { previous = null; } return(previous); }
public NotificationLogId Next(int notificationsPerLog) { var nextLow = High + 1; var nextHigh = nextLow + notificationsPerLog; var next = new NotificationLogId(nextLow, nextHigh); if (Equals(next)) { next = null; } return(next); }
NotificationLog CreateNotificationLog(NotificationLogInfo notificationLogInfo) { var storedEvents = this.eventStore.GetAllStoredEventsBetween(notificationLogInfo.NotificationLogId.Low, notificationLogInfo.NotificationLogId.High); var isArchived = notificationLogInfo.NotificationLogId.High > notificationLogInfo.TotalLogged; var next = isArchived ? notificationLogInfo.NotificationLogId.Next(NOTIFICATIONS_PER_LOG) : null; var previous = notificationLogInfo.NotificationLogId.Previous(NOTIFICATIONS_PER_LOG); return(new NotificationLog( notificationLogInfo.NotificationLogId.Encoded, NotificationLogId.GetEncoded(next), NotificationLogId.GetEncoded(previous), GetNotificationsFrom(storedEvents), isArchived)); }
public static string GetEncoded(NotificationLogId notificationLogId) { if (notificationLogId != null) return notificationLogId.Encoded; else return null; }
public NotificationLogInfo(NotificationLogId notificationLogId, long totalLogged) { this.notificationLogId = notificationLogId; this.totalLogged = totalLogged; }
public NotificationLog CreateNotificationLog(NotificationLogId notificationLogId) { var count = eventStore.CountStoredEvents(); return(CreateNotificationLog(new NotificationLogInfo(notificationLogId, count))); }
public NotificationLog CreateNotificationLog(NotificationLogId notificationLogId) { var count = this.eventStore.CountStoredEvents(); return CreateNotificationLog(new NotificationLogInfo(notificationLogId, count)); }