public void PublishToSubscriber(Common.Model.Message pMessage)
        {
            if (pMessage is Common.Model.DeliverProcessedMessage)
            {
                Common.Model.DeliverProcessedMessage lMessage = pMessage as Common.Model.DeliverProcessedMessage;
                string         orderNumber = lMessage.orderNumber;
                Guid           pDeliveryId = lMessage.pDeliveryId;
                DeliveryStatus status      = (DeliveryStatus)lMessage.status;
                string         errorMsg    = lMessage.errorMsg;
                NotificationProvider.NotifyDeliveryProcessed(orderNumber, pDeliveryId, status, errorMsg);
            }

            else if (pMessage is Common.Model.DeliverCompleteMessage)
            {
                Common.Model.DeliverCompleteMessage lMessage = pMessage as Common.Model.DeliverCompleteMessage;
                Guid           pDeliveryId = lMessage.pDeliveryId;
                DeliveryStatus status      = (DeliveryStatus)lMessage.status;
                NotificationProvider.NotifyDeliveryCompletion(pDeliveryId, status);
            }

            else if (pMessage is Common.Model.TransferResultMessage)
            {
                Common.Model.TransferResultMessage lMessage = pMessage as Common.Model.TransferResultMessage;
                Boolean success = lMessage.Success;
                String  Msg     = lMessage.Message;
                Guid    orderId = lMessage.OrderNumber;

                OrderProvider.AfterTransferResultReturns(success, orderId, Msg);
            }
        }
Exemple #2
0
 private void ScheduleDelivery(DeliveryInfo pDeliveryInfo)
 {
     Console.WriteLine("Delivering to" + pDeliveryInfo.DestinationAddress);
     Thread.Sleep(3000);
     //notifying of delivery completion
     using (TransactionScope lScope = new TransactionScope())
         using (DeliveryDataModelContainer lContainer = new DeliveryDataModelContainer())
         {
             pDeliveryInfo.Status = 1;
             //IDeliveryNotificationService lService = DeliveryNotificationServiceFactory.GetDeliveryNotificationService(pDeliveryInfo.DeliveryNotificationAddress);
             //lService.NotifyDeliveryCompletion(pDeliveryInfo.DeliveryIdentifier, DeliveryInfoStatus.Delivered);
             Common.Model.DeliverCompleteMessage deliverCompleteMessage = new Common.Model.DeliverCompleteMessage()
             {
                 Topic       = "VideoStore",
                 pDeliveryId = pDeliveryInfo.DeliveryIdentifier,
                 status      = (int)DeliveryInfoStatus.Delivered
             };
             PublisherServiceClient lClient = new PublisherServiceClient();
             lClient.Publish(deliverCompleteMessage);
             lScope.Complete();
         }
 }