Hi,
It was hard to write about my problem .. is a little twisted but please be patience and help me.
Introduction:
- The program is written in C # using Visual Studio 2010.
- I am writing a program that will check the database if there are any tasks to be performed, and execute them. Tasks will be stored in a database table.
So in a nutshell: In the timer, at a time: Check in the database if a task has a "past" date, if any - do it.
- The program will also have the opportunity to plan (add) these tasks to the database with a specific date of execution.
- The program will communicate with the BD through stored procedures (Entity Model).
Problem:
It's about adding tasks to the database - the problem lies in the fact that I wanted to be able to add (from C# app) a task with a specific 'execute plan' for example: "Send an e-mail first Monday of each month in 2012" - this is really 12 separate emails, but stored in one record.
I would like to make two tables: "Jobes" and "ToDo", and "adding process" is supposed to look like this:
- To the table "Jobes" adds one record with the task and the execution plan
- Trigger running when you add, calculate the exact date of the execution plan for the implementation of various e-mails. and will add to the table "ToDo" these 12 exact tasks with specific dates.
The "executing" application/algorithm will be just looking through an table "ToDo".
Because if this program is to browse through an array of "Jobs", you will have to count each time - the date of execution, and whether to perform. After that, each address has its own status - and if all 12 will be in one record, you will not like to assign this status - so I made a separate table "ToDo", which will be reviewed by the "executing" application/algorithm.
So, once again .. I have no idea how to save the schedule in a single column of the array, and already do not know how to add from within C# app.
Can you recommend me some sensible solution?
Thanks in advance, I hope that is understandable ..