Reputation: 53
When a user saves change to data, my Asp.Net MVC 4.5 site sends out alert email (from database) to other users. My problem is that users click the save button multiple times within a few minutes, and the site sends out multiple emails.
I want to wait for 30 minutes after the first save, and only then send out the email. How can I do this?
TIA
Upvotes: 0
Views: 227
Reputation: 53
I found a simpler solution, "Creating cache item callbacks". It's described in this post: http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc
Upvotes: 0
Reputation: 324
Every time a user clicks save, you could add a row to your database (say, an EmailQueue table, with a SendDateTime and other relevant fields). The row would only be added where necessary, i.e. there isn't already a matching row within the table.
You could then approach the sending of the email in several ways - for example a job in the database, which calls an SP or a SQL Server Integration Services package to send any emails it needs to, and delete the EmailQueue rows or mark them as processed.
Upvotes: 1