A community member has associated this post with a similar question:
How to register same event for different times ASP.MVC C#

Only moderators can edit this content.

How to register same event for different times ASP.MVC C#

Saud Khan 26 Reputation points
2022-03-08T08:49:17.307+00:00

I'm building an Auction Web App in Asp.Net MVC and I have an auction expiration time for each auction item. It means whenever that time will reach the auction will be ended for that particular item and a flag of Auction Ended will be set in the database for the particular auction item.
Now I'm struggling with how I can initialize a timer or background job or something like that for each auction item so whenever the expiration time will reach it will change the item status to Auction Ended immediately in the database.
I have worked with Schedulers and Timers in the Winforms but I think it's not a better idea to have a separate scheduler for each auction item.
Looking forward to any suggestion and idea.
Thanks

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,398 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,271 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,279 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,846 Reputation points
    2022-03-08T17:55:15.557+00:00

    your database should have:

    AuctionStartDateTime
    AuctionEndDateTime
    AuctionProcessed

    the UI would use the current time and start / end time to know if a bid can be done. the processing of auction would be a background job, (typically a sqlagent job) that polled for closed auctions (now is past end), and not processed.

    note: the UI may use a countdown timer.

    0 comments No comments