Example #1
0
 public void SubmitDelivery(DeliveryCo.Business.Entities.DeliveryInfo pDeliveryInfo)
 {
     using(TransactionScope lScope = new TransactionScope())
     using(DeliveryDataModelContainer lContainer = new DeliveryDataModelContainer())
     {
         //pDeliveryInfo.DeliveryIdentifier = Guid.NewGuid();
         pDeliveryInfo.Status = 0;
         lContainer.DeliveryInfoes.AddObject(pDeliveryInfo);
         lContainer.SaveChanges();
         ThreadPool.QueueUserWorkItem(new WaitCallback((pObj) => ScheduleDelivery(pDeliveryInfo)));
         lScope.Complete();
     }
     //return pDeliveryInfo.DeliveryIdentifier;
 }
Example #2
0
        private void ScheduleDelivery(DeliveryInfo pDeliveryInfo)
        {
            Console.WriteLine("Delivering to" + pDeliveryInfo.DestinationAddress);
            Thread.Sleep(1000);
            //notifying of delivery completion
            using (TransactionScope lScope = new TransactionScope())
            using (DeliveryDataModelContainer lContainer = new DeliveryDataModelContainer())
            {
                pDeliveryInfo.Status = 1;

                /**
                INotificationService lService = DeliveryNotificationServiceFactory.GetDeliveryNotificationService(pDeliveryInfo.DeliveryNotificationAddress);
                lService.NotifyDeliveryCompletion(pDeliveryInfo.DeliveryIdentifier, DeliveryInfoStatus.Delivered);
                **/

                NotificationService.NotificationServiceClient IClient = new NotificationService.NotificationServiceClient();
                IClient.NotifyDeliveryCompletion(pDeliveryInfo.DeliveryIdentifier, DeliveryStatus.Delivered);

                lScope.Complete();
            }
        }