Example #1
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IOrderShipGroupStateMergePatched MapMergePatch(IMergePatchOrderShipGroup c, IOrderCommand outerCommand, long version, IOrderState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new OrderShipGroupEventId(c.OrderId, c.ShipGroupSeqId, version);
            IOrderShipGroupStateMergePatched e = NewOrderShipGroupStateMergePatched(stateEventId);
            var s = outerState.OrderShipGroups.Get(c.ShipGroupSeqId);

            e.ShipmentMethodTypeId = c.ShipmentMethodTypeId;
            e.SupplierPartyId      = c.SupplierPartyId;
            e.VendorPartyId        = c.VendorPartyId;
            e.CarrierPartyId       = c.CarrierPartyId;
            e.CarrierRoleTypeId    = c.CarrierRoleTypeId;
            e.FacilityId           = c.FacilityId;
            e.ContactMechId        = c.ContactMechId;
            e.TelecomContactMechId = c.TelecomContactMechId;
            e.TrackingNumber       = c.TrackingNumber;
            e.ShippingInstructions = c.ShippingInstructions;
            e.MaySplit             = c.MaySplit;
            e.GiftMessage          = c.GiftMessage;
            e.IsGift                = c.IsGift;
            e.ShipAfterDate         = c.ShipAfterDate;
            e.ShipByDate            = c.ShipByDate;
            e.EstimatedShipDate     = c.EstimatedShipDate;
            e.EstimatedDeliveryDate = c.EstimatedDeliveryDate;
            e.PickwaveId            = c.PickwaveId;
            e.Active                = c.Active;
            e.IsPropertyShipmentMethodTypeIdRemoved = c.IsPropertyShipmentMethodTypeIdRemoved;
            e.IsPropertySupplierPartyIdRemoved      = c.IsPropertySupplierPartyIdRemoved;
            e.IsPropertyVendorPartyIdRemoved        = c.IsPropertyVendorPartyIdRemoved;
            e.IsPropertyCarrierPartyIdRemoved       = c.IsPropertyCarrierPartyIdRemoved;
            e.IsPropertyCarrierRoleTypeIdRemoved    = c.IsPropertyCarrierRoleTypeIdRemoved;
            e.IsPropertyFacilityIdRemoved           = c.IsPropertyFacilityIdRemoved;
            e.IsPropertyContactMechIdRemoved        = c.IsPropertyContactMechIdRemoved;
            e.IsPropertyTelecomContactMechIdRemoved = c.IsPropertyTelecomContactMechIdRemoved;
            e.IsPropertyTrackingNumberRemoved       = c.IsPropertyTrackingNumberRemoved;
            e.IsPropertyShippingInstructionsRemoved = c.IsPropertyShippingInstructionsRemoved;
            e.IsPropertyMaySplitRemoved             = c.IsPropertyMaySplitRemoved;
            e.IsPropertyGiftMessageRemoved          = c.IsPropertyGiftMessageRemoved;
            e.IsPropertyIsGiftRemoved                = c.IsPropertyIsGiftRemoved;
            e.IsPropertyShipAfterDateRemoved         = c.IsPropertyShipAfterDateRemoved;
            e.IsPropertyShipByDateRemoved            = c.IsPropertyShipByDateRemoved;
            e.IsPropertyEstimatedShipDateRemoved     = c.IsPropertyEstimatedShipDateRemoved;
            e.IsPropertyEstimatedDeliveryDateRemoved = c.IsPropertyEstimatedDeliveryDateRemoved;
            e.IsPropertyPickwaveIdRemoved            = c.IsPropertyPickwaveIdRemoved;
            e.IsPropertyActiveRemoved                = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();

            foreach (IOrderItemShipGroupAssociationCommand innerCommand in c.OrderItemShipGroupAssociationCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IOrderItemShipGroupAssociationEvent innerEvent = Map(innerCommand, c, version, s);
                e.AddOrderItemShipGroupAssociationEvent(innerEvent);
            }

            return(e);
        }// END Map(IMergePatch... ////////////////////////////
Example #2
0
        public virtual OrderShipGroupStateMergePatchedDto ToOrderShipGroupStateMergePatchedDto(IOrderShipGroupStateMergePatched e)
        {
            var dto = new OrderShipGroupStateMergePatchedDto();

            dto.OrderShipGroupEventId = e.OrderShipGroupEventId;
            dto.CreatedAt             = e.CreatedAt;
            dto.CreatedBy             = e.CreatedBy;
            dto.Version              = e.Version;
            dto.CommandId            = e.CommandId;
            dto.ShipmentMethodTypeId = e.ShipmentMethodTypeId;
            dto.SupplierPartyId      = e.SupplierPartyId;
            dto.VendorPartyId        = e.VendorPartyId;
            dto.CarrierPartyId       = e.CarrierPartyId;
            dto.CarrierRoleTypeId    = e.CarrierRoleTypeId;
            dto.FacilityId           = e.FacilityId;
            dto.ContactMechId        = e.ContactMechId;
            dto.TelecomContactMechId = e.TelecomContactMechId;
            dto.TrackingNumber       = e.TrackingNumber;
            dto.ContactPartyId       = e.ContactPartyId;
            dto.VehiclePlateNumber   = e.VehiclePlateNumber;
            dto.ShippingInstructions = e.ShippingInstructions;
            dto.MaySplit             = e.MaySplit;
            dto.GiftMessage          = e.GiftMessage;
            dto.IsGift                                       = e.IsGift;
            dto.ShipAfterDate                                = e.ShipAfterDate;
            dto.ShipByDate                                   = e.ShipByDate;
            dto.EstimatedShipDate                            = e.EstimatedShipDate;
            dto.EstimatedDeliveryDate                        = e.EstimatedDeliveryDate;
            dto.PickwaveId                                   = e.PickwaveId;
            dto.NumberOfPackages                             = e.NumberOfPackages;
            dto.NumberOfContainers                           = e.NumberOfContainers;
            dto.NumberOfPakagesPerContainer                  = e.NumberOfPakagesPerContainer;
            dto.OrderShipGroupStatusId                       = e.OrderShipGroupStatusId;
            dto.Active                                       = e.Active;
            dto.IsPropertyShipmentMethodTypeIdRemoved        = e.IsPropertyShipmentMethodTypeIdRemoved;
            dto.IsPropertySupplierPartyIdRemoved             = e.IsPropertySupplierPartyIdRemoved;
            dto.IsPropertyVendorPartyIdRemoved               = e.IsPropertyVendorPartyIdRemoved;
            dto.IsPropertyCarrierPartyIdRemoved              = e.IsPropertyCarrierPartyIdRemoved;
            dto.IsPropertyCarrierRoleTypeIdRemoved           = e.IsPropertyCarrierRoleTypeIdRemoved;
            dto.IsPropertyFacilityIdRemoved                  = e.IsPropertyFacilityIdRemoved;
            dto.IsPropertyContactMechIdRemoved               = e.IsPropertyContactMechIdRemoved;
            dto.IsPropertyTelecomContactMechIdRemoved        = e.IsPropertyTelecomContactMechIdRemoved;
            dto.IsPropertyTrackingNumberRemoved              = e.IsPropertyTrackingNumberRemoved;
            dto.IsPropertyContactPartyIdRemoved              = e.IsPropertyContactPartyIdRemoved;
            dto.IsPropertyVehiclePlateNumberRemoved          = e.IsPropertyVehiclePlateNumberRemoved;
            dto.IsPropertyShippingInstructionsRemoved        = e.IsPropertyShippingInstructionsRemoved;
            dto.IsPropertyMaySplitRemoved                    = e.IsPropertyMaySplitRemoved;
            dto.IsPropertyGiftMessageRemoved                 = e.IsPropertyGiftMessageRemoved;
            dto.IsPropertyIsGiftRemoved                      = e.IsPropertyIsGiftRemoved;
            dto.IsPropertyShipAfterDateRemoved               = e.IsPropertyShipAfterDateRemoved;
            dto.IsPropertyShipByDateRemoved                  = e.IsPropertyShipByDateRemoved;
            dto.IsPropertyEstimatedShipDateRemoved           = e.IsPropertyEstimatedShipDateRemoved;
            dto.IsPropertyEstimatedDeliveryDateRemoved       = e.IsPropertyEstimatedDeliveryDateRemoved;
            dto.IsPropertyPickwaveIdRemoved                  = e.IsPropertyPickwaveIdRemoved;
            dto.IsPropertyNumberOfPackagesRemoved            = e.IsPropertyNumberOfPackagesRemoved;
            dto.IsPropertyNumberOfContainersRemoved          = e.IsPropertyNumberOfContainersRemoved;
            dto.IsPropertyNumberOfPakagesPerContainerRemoved = e.IsPropertyNumberOfPakagesPerContainerRemoved;
            dto.IsPropertyOrderShipGroupStatusIdRemoved      = e.IsPropertyOrderShipGroupStatusIdRemoved;
            dto.IsPropertyActiveRemoved                      = e.IsPropertyActiveRemoved;
            var orderItemShipGroupAssociationEvents = new List <OrderItemShipGroupAssociationStateCreatedOrMergePatchedOrRemovedDto>();

            foreach (var ee in e.OrderItemShipGroupAssociationEvents)
            {
                OrderItemShipGroupAssociationStateCreatedOrMergePatchedOrRemovedDto eeDto = OrderItemShipGroupAssociationStateEventDtoConverter.ToOrderItemShipGroupAssociationStateEventDto(ee);
                orderItemShipGroupAssociationEvents.Add(eeDto);
            }
            dto.OrderItemShipGroupAssociationEvents = orderItemShipGroupAssociationEvents.ToArray();


            return(dto);
        }
Example #3
0
 void IOrderShipGroupState.When(IOrderShipGroupStateMergePatched e)
 {
     throw new NotSupportedException();
 }
Example #4
0
        public virtual void When(IOrderShipGroupStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.ShipmentMethodTypeId == null)
            {
                if (e.IsPropertyShipmentMethodTypeIdRemoved)
                {
                    this.ShipmentMethodTypeId = default(string);
                }
            }
            else
            {
                this.ShipmentMethodTypeId = e.ShipmentMethodTypeId;
            }

            if (e.SupplierPartyId == null)
            {
                if (e.IsPropertySupplierPartyIdRemoved)
                {
                    this.SupplierPartyId = default(string);
                }
            }
            else
            {
                this.SupplierPartyId = e.SupplierPartyId;
            }

            if (e.VendorPartyId == null)
            {
                if (e.IsPropertyVendorPartyIdRemoved)
                {
                    this.VendorPartyId = default(string);
                }
            }
            else
            {
                this.VendorPartyId = e.VendorPartyId;
            }

            if (e.CarrierPartyId == null)
            {
                if (e.IsPropertyCarrierPartyIdRemoved)
                {
                    this.CarrierPartyId = default(string);
                }
            }
            else
            {
                this.CarrierPartyId = e.CarrierPartyId;
            }

            if (e.CarrierRoleTypeId == null)
            {
                if (e.IsPropertyCarrierRoleTypeIdRemoved)
                {
                    this.CarrierRoleTypeId = default(string);
                }
            }
            else
            {
                this.CarrierRoleTypeId = e.CarrierRoleTypeId;
            }

            if (e.FacilityId == null)
            {
                if (e.IsPropertyFacilityIdRemoved)
                {
                    this.FacilityId = default(string);
                }
            }
            else
            {
                this.FacilityId = e.FacilityId;
            }

            if (e.DestinationFacilityId == null)
            {
                if (e.IsPropertyDestinationFacilityIdRemoved)
                {
                    this.DestinationFacilityId = default(string);
                }
            }
            else
            {
                this.DestinationFacilityId = e.DestinationFacilityId;
            }

            if (e.ContactMechId == null)
            {
                if (e.IsPropertyContactMechIdRemoved)
                {
                    this.ContactMechId = default(string);
                }
            }
            else
            {
                this.ContactMechId = e.ContactMechId;
            }

            if (e.TelecomContactMechId == null)
            {
                if (e.IsPropertyTelecomContactMechIdRemoved)
                {
                    this.TelecomContactMechId = default(string);
                }
            }
            else
            {
                this.TelecomContactMechId = e.TelecomContactMechId;
            }

            if (e.TrackingNumber == null)
            {
                if (e.IsPropertyTrackingNumberRemoved)
                {
                    this.TrackingNumber = default(string);
                }
            }
            else
            {
                this.TrackingNumber = e.TrackingNumber;
            }

            if (e.ContactPartyId == null)
            {
                if (e.IsPropertyContactPartyIdRemoved)
                {
                    this.ContactPartyId = default(string);
                }
            }
            else
            {
                this.ContactPartyId = e.ContactPartyId;
            }

            if (e.VehiclePlateNumber == null)
            {
                if (e.IsPropertyVehiclePlateNumberRemoved)
                {
                    this.VehiclePlateNumber = default(string);
                }
            }
            else
            {
                this.VehiclePlateNumber = e.VehiclePlateNumber;
            }

            if (e.ShippingInstructions == null)
            {
                if (e.IsPropertyShippingInstructionsRemoved)
                {
                    this.ShippingInstructions = default(string);
                }
            }
            else
            {
                this.ShippingInstructions = e.ShippingInstructions;
            }

            if (e.MaySplit == null)
            {
                if (e.IsPropertyMaySplitRemoved)
                {
                    this.MaySplit = default(string);
                }
            }
            else
            {
                this.MaySplit = e.MaySplit;
            }

            if (e.GiftMessage == null)
            {
                if (e.IsPropertyGiftMessageRemoved)
                {
                    this.GiftMessage = default(string);
                }
            }
            else
            {
                this.GiftMessage = e.GiftMessage;
            }

            if (e.IsGift == null)
            {
                if (e.IsPropertyIsGiftRemoved)
                {
                    this.IsGift = default(string);
                }
            }
            else
            {
                this.IsGift = e.IsGift;
            }

            if (e.ShipAfterDate == null)
            {
                if (e.IsPropertyShipAfterDateRemoved)
                {
                    this.ShipAfterDate = default(DateTime?);
                }
            }
            else
            {
                this.ShipAfterDate = e.ShipAfterDate;
            }

            if (e.ShipByDate == null)
            {
                if (e.IsPropertyShipByDateRemoved)
                {
                    this.ShipByDate = default(DateTime?);
                }
            }
            else
            {
                this.ShipByDate = e.ShipByDate;
            }

            if (e.EstimatedShipDate == null)
            {
                if (e.IsPropertyEstimatedShipDateRemoved)
                {
                    this.EstimatedShipDate = default(DateTime?);
                }
            }
            else
            {
                this.EstimatedShipDate = e.EstimatedShipDate;
            }

            if (e.EstimatedDeliveryDate == null)
            {
                if (e.IsPropertyEstimatedDeliveryDateRemoved)
                {
                    this.EstimatedDeliveryDate = default(DateTime?);
                }
            }
            else
            {
                this.EstimatedDeliveryDate = e.EstimatedDeliveryDate;
            }

            if (e.PickwaveId == null)
            {
                if (e.IsPropertyPickwaveIdRemoved)
                {
                    this.PickwaveId = default(long?);
                }
            }
            else
            {
                this.PickwaveId = e.PickwaveId;
            }

            if (e.NumberOfPackages == null)
            {
                if (e.IsPropertyNumberOfPackagesRemoved)
                {
                    this.NumberOfPackages = default(int);
                }
            }
            else
            {
                this.NumberOfPackages = (e.NumberOfPackages != null && e.NumberOfPackages.HasValue) ? e.NumberOfPackages.Value : default(int);
            }

            if (e.NumberOfContainers == null)
            {
                if (e.IsPropertyNumberOfContainersRemoved)
                {
                    this.NumberOfContainers = default(int);
                }
            }
            else
            {
                this.NumberOfContainers = (e.NumberOfContainers != null && e.NumberOfContainers.HasValue) ? e.NumberOfContainers.Value : default(int);
            }

            if (e.NumberOfPakagesPerContainer == null)
            {
                if (e.IsPropertyNumberOfPakagesPerContainerRemoved)
                {
                    this.NumberOfPakagesPerContainer = default(int);
                }
            }
            else
            {
                this.NumberOfPakagesPerContainer = (e.NumberOfPakagesPerContainer != null && e.NumberOfPakagesPerContainer.HasValue) ? e.NumberOfPakagesPerContainer.Value : default(int);
            }

            if (e.OrderShipGroupStatusId == null)
            {
                if (e.IsPropertyOrderShipGroupStatusIdRemoved)
                {
                    this.OrderShipGroupStatusId = default(string);
                }
            }
            else
            {
                this.OrderShipGroupStatusId = e.OrderShipGroupStatusId;
            }

            if (e.Active == null)
            {
                if (e.IsPropertyActiveRemoved)
                {
                    this.Active = default(bool);
                }
            }
            else
            {
                this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);
            }


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;


            foreach (IOrderItemShipGroupAssociationEvent innerEvent in e.OrderItemShipGroupAssociationEvents)
            {
                IOrderItemShipGroupAssociationState innerState = this.OrderItemShipGroupAssociations.Get(innerEvent.GlobalId.OrderItemSeqId);

                innerState.Mutate(innerEvent);
                var removed = innerEvent as IOrderItemShipGroupAssociationStateRemoved;
                if (removed != null)
                {
                    this.OrderItemShipGroupAssociations.Remove(innerState);
                }
            }
        }