Example #1
0
 public void Visit(IVisitable pVisitable)
 {
     if (pVisitable is DeliveryCompletedInfo)
     {
         DeliveryCompletedInfo lMsg = pVisitable as DeliveryCompletedInfo;
         Result = new DeliveryCompletedMessage()
         {
             SourceAddress               = lMsg.DeliveryInfo.SourceAddress,
             DestinationAddress          = lMsg.DeliveryInfo.DestinationAddress,
             OrderNumber                 = lMsg.DeliveryInfo.OrderNumber,
             DeliveryIdentifier          = lMsg.DeliveryInfo.DeliveryIdentifier,
             DeliveryNotificationAddress = lMsg.DeliveryInfo.DeliveryNotificationAddress,
             Status = lMsg.DeliveryInfo.Status,
             Topic  = lMsg.Topic
         };
     }
 }
Example #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;
                    lContainer.SaveChanges();

                    DeliveryCompletedInfo lItem = new DeliveryCompletedInfo {
                        DeliveryInfo = pDeliveryInfo
                    };
                    DeliveryCompletedInfoToDeliveryCompletedNotification lVisitor = new DeliveryCompletedInfoToDeliveryCompletedNotification();
                    lVisitor.Visit(lItem);
                    PublisherServiceClient lClient = new PublisherServiceClient();
                    lClient.Publish(lVisitor.Result);

                    lScope.Complete();
                }
            }
        }