public void QueueSunscreenReminderForUser(Guid userId) { var reminder = new SunscreenReminder { UserId = userId, IsDryReminderTimeSeconds = DateTimeOffset.Now.ToUnixTimeSeconds() + DRY_TIME_SEC, ReapplyReminderTimeSeconds = DateTimeOffset.Now.ToUnixTimeSeconds() + REAPPLY_TIME_SEC, HasIsDryReminderBeenSent = false, HasReapplyReminderBeenSent = false }; _sunscreenReminders.Add(reminder); }
/** * Adds a new Sunscreen reminder to the Queue. If there is already a reminder for that User * it will be overrided with the new reminder. */ public void AddReminder(SunscreenReminder sunscreenReminder) { _logger.LogInformation("Adding a reminder...."); _logger.LogInformation("Dry reminder time: " + sunscreenReminder.IsDryReminderTimeSeconds); _logger.LogInformation("Reapply reminder time: " + sunscreenReminder.ReapplyReminderTimeSeconds); if (_reminderDict.ContainsKey(sunscreenReminder.UserId)) { // This User already has a reminder. Remove it before we add the new one. _logger.LogInformation("User %s already had a reminder. Replacing it with the new one.", sunscreenReminder.UserId); _reminderDict.Remove(sunscreenReminder.UserId); } _reminderDict.Add(sunscreenReminder.UserId, sunscreenReminder); }