fix(domain): use DateTime.Now instead of DateTime.UtcNow for legacy compatibility
CRITICAL FIX: Replace all DateTime.UtcNow with DateTime.Now throughout the application. Reason: Legacy VB.NET system uses local server time, and database stores all timestamps as local time. Using UTC breaks compatibility and causes incorrect time comparisons. Changes: - EmailProcessedEvent: ProcessedDate now uses DateTime.Now - EmailHistory.MarkAsProcessed(): ProcessedDate now uses DateTime.Now - EmailHistory.MarkAsFailed(): ProcessedDate now uses DateTime.Now - EmailProfile.UpdateLastPollTime(): LastPollTime now uses DateTime.Now - EmailProfile.ShouldPoll(): Poll interval comparison now uses DateTime.Now Documentation: - Added critical note to agents.md about DateTime usage - Includes examples and detailed explanation for future developers This ensures all date/time operations remain compatible with legacy database.
This commit is contained in:
@@ -3,20 +3,11 @@ using DigitalData.EmailProfiler.Domain.Enums;
|
||||
|
||||
namespace DigitalData.EmailProfiler.Domain.Events;
|
||||
|
||||
public class EmailProcessedEvent : INotification
|
||||
public class EmailProcessedEvent(int emailHistoryId, int profileId, string messageId, EmailStatus status) : INotification
|
||||
{
|
||||
public int EmailHistoryId { get; }
|
||||
public int ProfileId { get; }
|
||||
public string MessageId { get; }
|
||||
public EmailStatus Status { get; }
|
||||
public DateTime ProcessedDate { get; }
|
||||
|
||||
public EmailProcessedEvent(int emailHistoryId, int profileId, string messageId, EmailStatus status)
|
||||
{
|
||||
EmailHistoryId = emailHistoryId;
|
||||
ProfileId = profileId;
|
||||
MessageId = messageId;
|
||||
Status = status;
|
||||
ProcessedDate = DateTime.UtcNow;
|
||||
}
|
||||
public int EmailHistoryId { get; } = emailHistoryId;
|
||||
public int ProfileId { get; } = profileId;
|
||||
public string MessageId { get; } = messageId;
|
||||
public EmailStatus Status { get; } = status;
|
||||
public DateTime ProcessedDate { get; } = DateTime.Now;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user