Reputation: 3
I am creating a web application for bidding that needs to check for the users last bid time and ensures that if there is no other bid at the particular interval, that user should win and this entry is added automatically to the database.
For checking the time I need to create a webservice that runs at particular interval and checks for the last bid time and do the work after bid time expires.
Upvotes: 0
Views: 5798
Reputation: 5727
Use window services + Timer, Below mentioned is the reference :
http://www.codeguru.com/columns/dotnet/article.php/c6919
Upvotes: 0
Reputation: 482
Can you not use a timer control on a window form or schedule an exe which will make calls to the webservice on load. so you exe/winforms will have call to the specific method in your webservice on its Load Event, and you schedule the exe to run at specific interval.
Upvotes: 0
Reputation: 1438
Probably the best option is self-hosted WCF which will allow you to serve a web-service and to run some background thread.
Simplest options looks like a some command like, to be run by Task Scheduler often enough (once a minute?).
You may also merge checking for bids and winning into one web-method, so each time user checks for auction state you will also try to close it, if expired. This is however worst dB access scenario.
I'd prefer WCF + background thread + queue of new bids.
Upvotes: 0
Reputation: 5672
You should add all bids to the database to track mutiple users.
To notify the users you could setup a web service that requires in parameters for user and auction and returns a small object that contains information about the auction, including information about the highest offer (bid value, timestamp and maybe user) and the auction(status(open/closed), winner and the highest bid etc.).
If it´s been, lets say, 15 minutes since the highest bid was offered you close the bidding and announce a winner. This check could be done within the web service.
Then use Javascript to make frequently AJAX requests against the service and update the HTML/DOM depending on the returned result.
Upvotes: 0