Пример #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
        internal void FixupVideoStoreEntityModel_DeliveryOrder_DeliveryKeys(Delivery value, bool forceRemove)
        {
            const string IdKeyName = "Navigate(VideoStoreEntityModel.DeliveryOrder.Delivery).Id";

            if (ChangeTracker.ChangeTrackingEnabled &&
                ChangeTracker.ExtendedProperties.ContainsKey(IdKeyName))
            {
                if (forceRemove ||
                    !Equals(ChangeTracker.ExtendedProperties[IdKeyName], value == null ? null : (object)value.Id))
                {
                    ChangeTracker.RecordOriginalValue(IdKeyName, ChangeTracker.ExtendedProperties[IdKeyName]);
                    if (value == null)
                    {
                        ChangeTracker.ExtendedProperties.Remove(IdKeyName);
                    }
                    else
                    {
                        ChangeTracker.ExtendedProperties[IdKeyName] = value.Id;
                    }
                }
            }
        }
Пример #3
0
        private void FixupDelivery(Delivery previousValue)
        {
            if (IsDeserializing)
            {
                return;
            }

            if (previousValue != null && ReferenceEquals(previousValue.Order, this))
            {
                previousValue.Order = null;
            }

            if (Delivery != null)
            {
                Delivery.Order = this;
            }

            if (ChangeTracker.ChangeTrackingEnabled)
            {
                if (ChangeTracker.OriginalValues.ContainsKey("Delivery")
                    && (ChangeTracker.OriginalValues["Delivery"] == Delivery))
                {
                    ChangeTracker.OriginalValues.Remove("Delivery");
                }
                else
                {
                    ChangeTracker.RecordOriginalValue("Delivery", previousValue);
                }
                if (Delivery != null && !Delivery.ChangeTracker.ChangeTrackingEnabled)
                {
                    Delivery.StartTracking();
                }
            }
        }