Reputation: 697
I am writing a simple app in ASP.NET MVC 4. I've researched my issue to no result.
What I need is basic thing. I have got events in the database, which have their deadline. How do I make the application mark them as finished when the deadline is over? I suppose, the app should be checking every deadline all the time and when the time matches a deadline, it changes the event's status.
I'm not asking for a solution or anything, just a nod in which direction should I go or where should I look.
Upvotes: 0
Views: 229
Reputation: 124716
An alternative is to generate the status whenever you read from the database. E.g. something like:
SELECT
...
CASE WHEN GETUTCDATE() < DeadLineUtc AND Status = "ACTIVE" THEN "EXPIRED"
ELSE Status
END AS Status
...
FROM ...
Upvotes: 0
Reputation: 1250
there's a few solutions:
1) if you have access to the server where application is hosted - you can create windows service that would check states of events
2) you can create mvc timer job - check this out: ASP .NET MVC - Should I run a background timer
3) I'm not sure about it since I'm not SQL Pro - but I belive that it's possible to do it on DB side.
Upvotes: 0