8.1. Problem
For the Paid Time Off application, users should be notified whenever they become the "owner" of an issue, whenever a request they submitted changes state, or when a request goes to a specific state such as cancelled or denied. The last thing you want to do is give users an excuse about why they didn't follow up on a request. You can help Mary stay on top of the game by having the system nudge each user by sending them an e-mail letting them know they are supposed to do something.
This chapter creates a pattern for sending e-mails, registering for notifications, and even allowing users to customize the message that is sent for a specific notification. This chapter also uses a Windows service to work in the background to poll for unsent e-mails and fire them off behind the scenes without coupling this functionality with the actual website. Windows services can be quite handy in conjunction with a web application because not all situations should be handled using the web interface. There are plenty of situations in which a background process can be utilized to automate certain tasks such as sending e-mails.
The main goals of this chapter are as follows:
Understand how to create a Windows service and use a Timer object to automate tasks.
Define a pattern for sending e-mails that is not coupled with the design of the website.
Create functionality that enables users to register for predefined notifications in the system.
Enable users to customize the text of the e-mails that ...
Get ASP.NET 3.5 Enterprise Application Development with Visual Studio® 2008: Problem - Design - Solution now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.