To provide better services, the website can provide the Notification mechanism and communicate with your own customers. This article discusses an implementation method for Notification services.
Since the top, the Notification service can be divided into three layers: - The implementation of the specific Notification service is responsible for achieving the construction of specific notification content; - NOTIFICATION services management, responsible for obtaining Notification data, distributing to concrete implementation, etc .; - Notification Service Communication layer, responsible for network transmission, such as email, short message, etc.
1. Factory communication layer using the communication layer model, NotifyServiceManager of GetNotifyService (NotifyServiceEnum type) method returns the interface object: public interface INotifyService {int Send (string sender, string receiver, string subject, string content); int BatchSend (string sender, string [] Receivers, String Subject, String Content;} Current NotifyServiceEnum includes both Email_Service and SMS_Service.
2. Management Management provides the following three features: : Use a similar prototype mode, a notification service corresponds to an object that implements iSndNotification;
2.1 Get the following data call WebService: myNotificationService.Notification service = new myNotificationService.Notification (); object [] rc = service.GetInstantNotification (); 2.2 ISendNotification dissemination of notification Send method call for each column of each type of notification content: for (int NotifyType = 0; NotifyType 3. The core of the specific business implementation is to convert the System.Data.DataRow object to the String object, which can be implemented in the way. 4. The main advantages of advantages and disadvantages are expansion, including the expansion of communication methods, and expansion of the communication method; the disadvantage is that only the notification of the more simple content, ie the notification content needs to be placed in system.data.Datarow. If the notification content is more complicated, if the notification consists of several DataSet, then the method is not applicable. For example, the small chicken shooter is used to handle multiple DataSet content notifications, but such a notification content can only be sent to email, and the short message is can't be caught, let us wait for MMS popularity,: )