SenseNet.Messaging.Event.DeleteOldEvents C# (CSharp) Метод

DeleteOldEvents() статический приватный Метод

static private DeleteOldEvents ( System.DateTime now ) : void
now System.DateTime
Результат void
        internal static void DeleteOldEvents(DateTime now)
        {
            using (var context = new DataHandler())
            {
                context.ExecuteCommand(String.Format("DELETE FROM [Messaging.Events] WHERE [When] < '{0}'", now.AddMonths(-2).ToString("yyyy-MM-dd HH:mm:ss")));
            }
        }

Usage Example

Пример #1
0
        private static void Cleanup(NotificationFrequency freq, DateTime now)
        {
            switch (freq)
            {
            case NotificationFrequency.Immediately:
                if (Configuration.DailyEnabled || Configuration.WeeklyEnabled || Configuration.MonthlyEnabled)
                {
                    return;
                }
                break;

            case NotificationFrequency.Daily:
                if (Configuration.WeeklyEnabled || Configuration.MonthlyEnabled)
                {
                    return;
                }
                break;

            case NotificationFrequency.Weekly:
                if (Configuration.MonthlyEnabled)
                {
                    return;
                }
                break;

            case NotificationFrequency.Monthly:
                break;

            default:
                throw GetUnknownFrequencyException(freq);
            }
            Event.DeleteOldEvents(now);
        }