Beispiel #1
0
        public virtual void Notify(Notification notification)
        {
            var envelope = new NotificationEnvelope(
                notification.Sender.Path,
                notification.Message
                );

            endpoint.ReceiveNotify(envelope);
        }
        public NotificationEnvelope Mail(NotificationBase notification)
        {
            
            if(notification is NotificationOrderSale)
            {
                var envelope = new NotificationEnvelope();
                envelope.MailMessage= FormatOrderSale(notification as NotificationOrderSale);
                envelope.SmsMessage = FormatOrderSaleSms(notification as NotificationOrderSale);
                return envelope;
            }
            if (notification is NotificationInvoice)
            {
                var envelope = new NotificationEnvelope();
                envelope.MailMessage = FormatInvoice(notification as NotificationInvoice);
                envelope.SmsMessage = FormatInvoiceSms(notification as NotificationInvoice);

                return envelope;
            }
            if (notification is NotificationReceipt)
            {
                var envelope = new NotificationEnvelope();
                envelope.MailMessage = FormatReceipt(notification as NotificationReceipt);
                envelope.SmsMessage = FormatReceiptSms(notification as NotificationReceipt);
                return envelope;
            }
            if (notification is NotificationPurchase)
            {
                var envelope = new NotificationEnvelope();
                envelope.MailMessage = FormatPurchase(notification as NotificationPurchase);
                envelope.SmsMessage = FormatPurchaseSms(notification as NotificationPurchase);
                return envelope;
            }
            if (notification is NotificationDispatch)
            {
                var envelope = new NotificationEnvelope();
                envelope.MailMessage = FormatDispatch(notification as NotificationDispatch);
                envelope.SmsMessage = FormatDispatchSms(notification as NotificationDispatch);
                return envelope;
            }
            if (notification is NotificationDelivery)
            {
                var envelope = new NotificationEnvelope();
                envelope.MailMessage = FormatDelivery(notification as NotificationDelivery);
                envelope.SmsMessage = FormatDeliverySms(notification as NotificationDelivery);
                return envelope;
            }
            return null;
        }