3

I've been trying to design support for recurring events (like you would see in Outlook, or a task manager, etc). I've been doing a lot of digging on Google and StackOverflow, but not much luck.

Wondering if anyone has any pointers or resources.

'Requirements'

  • Support for daily events (occurring Mon, Tues, Thurs at 10am or every 15 mins)
  • Monthly events

Anything more is a bonus but those would be the minimum.

Thanks!

Matt Millican
  • 4,044
  • 4
  • 38
  • 55
  • 1
    You want an outlook solution or just something in general that manages recurring events? Some examples of the events would help. – EKet Feb 04 '12 at 00:58

5 Answers5

2

Take a look at Quartz .NET:

http://quartznet.sourceforge.net/features.html

roken
  • 3,946
  • 1
  • 19
  • 32
2

What I've used for this is the built in TaskScheduler. There's an easy to use wrapper for it here: http://taskscheduler.codeplex.com/

If you haven't already, search Task Scheduler in the start menu and play with it. That wrapper essentially lets you programmatically do everything you can with the GUI.

Dharun
  • 613
  • 8
  • 26
  • 1
    I like this idea and am marking it as the answer because I think it's leading int he direction I'd like to go - thanks! – Matt Millican Feb 06 '12 at 16:08
2

The answer that Bob gave for this question is a pretty good one. He based his solution on the SQL Server team's work on sysschedules.

http://technet.microsoft.com/en-us/library/ms178644.aspx.

Community
  • 1
  • 1
Brad Crandell
  • 850
  • 1
  • 8
  • 22
1

Check iCal Wiki and iCal RFC (especially sections on "Duration" and "Recurrence Rule"). I think it will provide you some good starting point on how to represent such events.

Excerpt from the RFC:

 ... For example "the last work day of the month" could be represented as:
   FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1
Community
  • 1
  • 1
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
-1

If the problem that you are trying to solve is that you can only respond to such events when your program is running, that is true. The most practical solution to this problem is to run you program in the background, most often with a notification icon on the taskbar.

If the problem is that you are unsure how to track such events, you can either use an existing framework (see roken's answer), set timers (research System.Threading.Timer), or periodically compare DateTime.Now against various DateTime objects. With the latter two, you will need to serialize DateTime objects to save them to the disk between sessions.

Zenexer
  • 18,788
  • 9
  • 71
  • 77
  • Thanks! I'm looking for ways to track the events (ie create the record for an event and save it in the database (with the recurrence information). I just downloaded Quartz and am going to look at it now. – Matt Millican Feb 04 '12 at 01:13
  • I'd probably go about solving the problem by serializing a Dictionary/List of DateTime objects with BinaryFormatter, then setting timers each time the program launches. – Zenexer Feb 04 '12 at 01:17