I am developing one winforms application for which i want to generate monthly, weekly, yearly reports automatically at the end of the week, month, year. and if user changes the date it should not generate report.
I can generate on button click(manually) but i want it to generate at the end of week, month, year how should i do it?
Thanks in advance.
1. Enhance your program to accept a commandline parameter that tells it which report to generate without requiring user interaction.
2. For each type of report, create an item in the Windows Task Scheduler to run your program with an appropriate commandline parameter at the required frequency. Windows Task Scheduler is available on Windows client PCs and Windows Servers. You need to discuss with your client where to run the scheduled tasks is the best option. I have some that run on the server. I have some that run on a client. It depends....
I also have applications where it is the user's responsibility to generate the weekly, monthly, annual reports. Why? Because they may not be done entering all the data for that time period at the time when I would have scheduled the report to run automatically. All of my report generation routines are designed so that they can be generated for a desired time period anytime during or after that time period. That way, if they forget, they can generate the report for the required timeframe at any later time.
Edited 15-Feb-13 3:52am
You can generate report when your application starts. Every time the application starts, it should check if report of the last week, month or year has been generated or not. For that you can store a flag values in db or a in a file for week, month and year. When the report is generated, change the respective flag value.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)