private static void ProcessSummaryNotification()
{
SiteSettings s = SiteSettings.GetSharedSettings();
DateTime lastNotification = ClassifiedsHttpApplication.LastNotificationSent;
bool sendSummary = false;
if (s.AdminNotification == AdminNotificationSetting.Hourly)
{
// the thread is called once an hour, so send the latest notifications
sendSummary = true;
}
else if (s.AdminNotification == AdminNotificationSetting.Daily)
{
// check when the last notification was sent
DateTime oneDayAgo = DateTime.Now.Subtract(TimeSpan.FromDays(-1));
if (oneDayAgo >= lastNotification)
{
sendSummary = true;
}
}
if (sendSummary)
{
int numPendingNew = 0, numPendingTotal = 0;
SendSummaryMail(numPendingNew, numPendingTotal);
ClassifiedsHttpApplication.LastNotificationSent = DateTime.Now;
}
}