0

I'm making a financial app and I run into some problems with recurring money like fixed payment, salary, bank saving, ... I tried to add these payments on a certain day by comparing the current day and day of payments. The code is something like this:

If Date.Now.Day = GetPayDate(date) then
//code here //

It's in a start up event and it works but the problem is if users don't open the app on that day, the app will ignore and nothing will be added.

I'm using ADO.net with sql database. It's an app on local client without real time data.

In order to work correctly, users don't have to log on but the app must be run, so I tried to fix it by adding an auto start function on it. But it's not an option because users may not use computer for few days.

Is there any other way to resolve this problem? I just need some solutions or ideas about it, so even if users don't use the app in 2 or 3 months, it still calculate everything once they log on.

rekire
  • 47,260
  • 30
  • 167
  • 264

1 Answers1

0

Sounds like you really need a windows service that runs on startup, or a scheduled task. A windows service is a type of C# / VB.Net application that's designed to run in the background, and has no UI. The Windows task scheduler can start a program on a regular basis.

For more info about windows services, see https://msdn.microsoft.com/en-us/library/zt39148a%28v=vs.110%29.aspx. For more information on scheduled tasks, see http://www.7tutorials.com/task-scheduler. For a discussion about which is better, see Which is better to use for a recurring job: Service or Scheduled Task?

Or you could compare the current date to >= the pay date if you don't mind paying a few days late.

Community
  • 1
  • 1
CindyH
  • 2,986
  • 2
  • 24
  • 38
  • Thank you. But can you be more specific about windows service. Because like i said, I have no idea what to do now. And I already tried your 2nd idea but look like it didn't work for me. Thanks again, – user3672351 Mar 23 '15 at 06:23