예제 #1
0
        private void PlaceDeliveryForOrder(Order pOrder)
        {
            Delivery lDelivery = new Delivery()
            {
                DeliveryStatus = DeliveryStatus.Submitted, SourceAddress = "Video Store Address", DestinationAddress = pOrder.Customer.Address, Order = pOrder
            };
            DeliveryServiceClient lClient = new DeliveryServiceClient();

            /**
             *          Guid lDeliveryIdentifier = lClient.SubmitDelivery(new DeliveryInfo()
             * {
             *  OrderNumber = lDelivery.Order.OrderNumber.ToString(),
             *  SourceAddress = lDelivery.SourceAddress,
             *  DestinationAddress = lDelivery.DestinationAddress,
             *  DeliveryNotificationAddress = "net.tcp://localhost:9010/DeliveryNotificationService"
             * });
             **/
            Guid lDeliveryIdentifier = Guid.NewGuid();

            lClient.SubmitDelivery(new DeliveryInfo()
            {
                DeliveryIdentifier          = lDeliveryIdentifier,
                OrderNumber                 = lDelivery.Order.OrderNumber.ToString(),
                SourceAddress               = lDelivery.SourceAddress,
                DestinationAddress          = lDelivery.DestinationAddress,
                DeliveryNotificationAddress = "net.tcp://localhost:9010/DeliveryNotificationService/mex"
            });

            lDelivery.ExternalDeliveryIdentifier = lDeliveryIdentifier;
            pOrder.Delivery = lDelivery;
        }
예제 #2
0
        public void PlaceDeliveryForOrder(Order pOrder)
        {
            using (TransactionScope lScope = new TransactionScope())
                using (VideoStoreEntityModelContainer lContainer = new VideoStoreEntityModelContainer())
                {
                    Delivery lDelivery = new Delivery()
                    {
                        ExternalDeliveryIdentifier = Guid.NewGuid(),
                        DeliveryStatus             = DeliveryStatus.Submitted,
                        SourceAddress      = "Video Store Address",
                        DestinationAddress = pOrder.Customer.Address,
                        Order = pOrder
                    };
                    DeliveryServiceClient lClient = new DeliveryServiceClient();

                    lClient.SubmitDelivery(new DeliveryInfo()
                    {
                        DeliveryIdentifier          = lDelivery.ExternalDeliveryIdentifier,
                        OrderNumber                 = lDelivery.Order.OrderNumber.ToString(),
                        SourceAddress               = lDelivery.SourceAddress,
                        DestinationAddress          = lDelivery.DestinationAddress,
                        DeliveryNotificationAddress = "net.msmq://localhost/private/DeliveryNotificationService"
                    });

                    // update the number of stock corresponding to this order and save the delivery with the order
                    //pOrder.UpdateStockLevels();  We are not updating the stock levels with putting deliver any more
                    pOrder.Delivery = lDelivery;
                    lContainer.Orders.ApplyChanges(pOrder);
                    lContainer.Deliveries.ApplyChanges(lDelivery);
                    lContainer.SaveChanges();
                    lScope.Complete();
                }
        }
예제 #3
0
        private void PlaceDeliveryForOrder(Order pOrder)
        {
            Delivery lDelivery = new Delivery() { DeliveryStatus = DeliveryStatus.Submitted, SourceAddress = "Video Store Address", DestinationAddress = pOrder.Customer.Address, Order = pOrder };
            DeliveryServiceClient lClient = new DeliveryServiceClient();
            /**
            Guid lDeliveryIdentifier = lClient.SubmitDelivery(new DeliveryInfo()
            {
                OrderNumber = lDelivery.Order.OrderNumber.ToString(),
                SourceAddress = lDelivery.SourceAddress,
                DestinationAddress = lDelivery.DestinationAddress,
                DeliveryNotificationAddress = "net.tcp://localhost:9010/DeliveryNotificationService"
            });
            **/
            Guid lDeliveryIdentifier = Guid.NewGuid();
            lClient.SubmitDelivery(new DeliveryInfo()
            {
                DeliveryIdentifier = lDeliveryIdentifier,
                OrderNumber = lDelivery.Order.OrderNumber.ToString(),
                SourceAddress = lDelivery.SourceAddress,
                DestinationAddress = lDelivery.DestinationAddress,
                DeliveryNotificationAddress = "net.tcp://localhost:9010/DeliveryNotificationService/mex"
            });

            lDelivery.ExternalDeliveryIdentifier = lDeliveryIdentifier;
            pOrder.Delivery = lDelivery;
        }