Esempio n. 1
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IOrderItemStateMergePatched MapMergePatch(IMergePatchOrderItem c, IOrderCommand outerCommand, long version, IOrderState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new OrderItemEventId(c.OrderId, c.OrderItemSeqId, version);
            IOrderItemStateMergePatched e = NewOrderItemStateMergePatched(stateEventId);
            var s = outerState.OrderItems.Get(c.OrderItemSeqId);

            e.ProductId             = c.ProductId;
            e.ExternalProductId     = c.ExternalProductId;
            e.Quantity              = c.Quantity;
            e.CancelQuantity        = c.CancelQuantity;
            e.SelectedAmount        = c.SelectedAmount;
            e.ExternalId            = c.ExternalId;
            e.OrderItemTypeId       = c.OrderItemTypeId;
            e.OrderItemGroupSeqId   = c.OrderItemGroupSeqId;
            e.IsItemGroupPrimary    = c.IsItemGroupPrimary;
            e.FromInventoryItemId   = c.FromInventoryItemId;
            e.IsPromo               = c.IsPromo;
            e.QuoteId               = c.QuoteId;
            e.QuoteItemSeqId        = c.QuoteItemSeqId;
            e.ShoppingListId        = c.ShoppingListId;
            e.ShoppingListItemSeqId = c.ShoppingListItemSeqId;
            e.UnitPrice             = c.UnitPrice;
            e.UnitListPrice         = c.UnitListPrice;
            e.UnitAverageCost       = c.UnitAverageCost;
            e.UnitRecurringPrice    = c.UnitRecurringPrice;
            e.IsModifiedPrice       = c.IsModifiedPrice;
            e.RecurringFreqUomId    = c.RecurringFreqUomId;
            e.ItemDescription       = c.ItemDescription;
            e.Comments              = c.Comments;
            e.CorrespondingPoId     = c.CorrespondingPoId;
            e.StatusId              = c.StatusId;
            e.SyncStatusId          = c.SyncStatusId;
            e.EstimatedShipDate     = c.EstimatedShipDate;
            e.EstimatedDeliveryDate = c.EstimatedDeliveryDate;
            e.AutoCancelDate        = c.AutoCancelDate;
            e.DontCancelSetDate     = c.DontCancelSetDate;
            e.DontCancelSetBy       = c.DontCancelSetBy;
            e.ShipBeforeDate        = c.ShipBeforeDate;
            e.ShipAfterDate         = c.ShipAfterDate;
            e.CancelBackOrderDate   = c.CancelBackOrderDate;
            e.OverrideGlAccountId   = c.OverrideGlAccountId;
            e.Active = c.Active;
            e.IsPropertyProductIdRemoved             = c.IsPropertyProductIdRemoved;
            e.IsPropertyExternalProductIdRemoved     = c.IsPropertyExternalProductIdRemoved;
            e.IsPropertyQuantityRemoved              = c.IsPropertyQuantityRemoved;
            e.IsPropertyCancelQuantityRemoved        = c.IsPropertyCancelQuantityRemoved;
            e.IsPropertySelectedAmountRemoved        = c.IsPropertySelectedAmountRemoved;
            e.IsPropertyExternalIdRemoved            = c.IsPropertyExternalIdRemoved;
            e.IsPropertyOrderItemTypeIdRemoved       = c.IsPropertyOrderItemTypeIdRemoved;
            e.IsPropertyOrderItemGroupSeqIdRemoved   = c.IsPropertyOrderItemGroupSeqIdRemoved;
            e.IsPropertyIsItemGroupPrimaryRemoved    = c.IsPropertyIsItemGroupPrimaryRemoved;
            e.IsPropertyFromInventoryItemIdRemoved   = c.IsPropertyFromInventoryItemIdRemoved;
            e.IsPropertyIsPromoRemoved               = c.IsPropertyIsPromoRemoved;
            e.IsPropertyQuoteIdRemoved               = c.IsPropertyQuoteIdRemoved;
            e.IsPropertyQuoteItemSeqIdRemoved        = c.IsPropertyQuoteItemSeqIdRemoved;
            e.IsPropertyShoppingListIdRemoved        = c.IsPropertyShoppingListIdRemoved;
            e.IsPropertyShoppingListItemSeqIdRemoved = c.IsPropertyShoppingListItemSeqIdRemoved;
            e.IsPropertyUnitPriceRemoved             = c.IsPropertyUnitPriceRemoved;
            e.IsPropertyUnitListPriceRemoved         = c.IsPropertyUnitListPriceRemoved;
            e.IsPropertyUnitAverageCostRemoved       = c.IsPropertyUnitAverageCostRemoved;
            e.IsPropertyUnitRecurringPriceRemoved    = c.IsPropertyUnitRecurringPriceRemoved;
            e.IsPropertyIsModifiedPriceRemoved       = c.IsPropertyIsModifiedPriceRemoved;
            e.IsPropertyRecurringFreqUomIdRemoved    = c.IsPropertyRecurringFreqUomIdRemoved;
            e.IsPropertyItemDescriptionRemoved       = c.IsPropertyItemDescriptionRemoved;
            e.IsPropertyCommentsRemoved              = c.IsPropertyCommentsRemoved;
            e.IsPropertyCorrespondingPoIdRemoved     = c.IsPropertyCorrespondingPoIdRemoved;
            e.IsPropertyStatusIdRemoved              = c.IsPropertyStatusIdRemoved;
            e.IsPropertySyncStatusIdRemoved          = c.IsPropertySyncStatusIdRemoved;
            e.IsPropertyEstimatedShipDateRemoved     = c.IsPropertyEstimatedShipDateRemoved;
            e.IsPropertyEstimatedDeliveryDateRemoved = c.IsPropertyEstimatedDeliveryDateRemoved;
            e.IsPropertyAutoCancelDateRemoved        = c.IsPropertyAutoCancelDateRemoved;
            e.IsPropertyDontCancelSetDateRemoved     = c.IsPropertyDontCancelSetDateRemoved;
            e.IsPropertyDontCancelSetByRemoved       = c.IsPropertyDontCancelSetByRemoved;
            e.IsPropertyShipBeforeDateRemoved        = c.IsPropertyShipBeforeDateRemoved;
            e.IsPropertyShipAfterDateRemoved         = c.IsPropertyShipAfterDateRemoved;
            e.IsPropertyCancelBackOrderDateRemoved   = c.IsPropertyCancelBackOrderDateRemoved;
            e.IsPropertyOverrideGlAccountIdRemoved   = c.IsPropertyOverrideGlAccountIdRemoved;
            e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
Esempio n. 2
0
 void IOrderItemState.When(IOrderItemStateMergePatched e)
 {
     throw new NotSupportedException();
 }
Esempio n. 3
0
        public virtual void When(IOrderItemStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.ProductId == null)
            {
                if (e.IsPropertyProductIdRemoved)
                {
                    this.ProductId = default(string);
                }
            }
            else
            {
                this.ProductId = e.ProductId;
            }

            if (e.ExternalProductId == null)
            {
                if (e.IsPropertyExternalProductIdRemoved)
                {
                    this.ExternalProductId = default(string);
                }
            }
            else
            {
                this.ExternalProductId = e.ExternalProductId;
            }

            if (e.Quantity == null)
            {
                if (e.IsPropertyQuantityRemoved)
                {
                    this.Quantity = default(decimal?);
                }
            }
            else
            {
                this.Quantity = e.Quantity;
            }

            if (e.CancelQuantity == null)
            {
                if (e.IsPropertyCancelQuantityRemoved)
                {
                    this.CancelQuantity = default(decimal?);
                }
            }
            else
            {
                this.CancelQuantity = e.CancelQuantity;
            }

            if (e.SelectedAmount == null)
            {
                if (e.IsPropertySelectedAmountRemoved)
                {
                    this.SelectedAmount = default(decimal?);
                }
            }
            else
            {
                this.SelectedAmount = e.SelectedAmount;
            }

            if (e.ExternalId == null)
            {
                if (e.IsPropertyExternalIdRemoved)
                {
                    this.ExternalId = default(string);
                }
            }
            else
            {
                this.ExternalId = e.ExternalId;
            }

            if (e.OrderItemTypeId == null)
            {
                if (e.IsPropertyOrderItemTypeIdRemoved)
                {
                    this.OrderItemTypeId = default(string);
                }
            }
            else
            {
                this.OrderItemTypeId = e.OrderItemTypeId;
            }

            if (e.OrderItemGroupSeqId == null)
            {
                if (e.IsPropertyOrderItemGroupSeqIdRemoved)
                {
                    this.OrderItemGroupSeqId = default(string);
                }
            }
            else
            {
                this.OrderItemGroupSeqId = e.OrderItemGroupSeqId;
            }

            if (e.IsItemGroupPrimary == null)
            {
                if (e.IsPropertyIsItemGroupPrimaryRemoved)
                {
                    this.IsItemGroupPrimary = default(string);
                }
            }
            else
            {
                this.IsItemGroupPrimary = e.IsItemGroupPrimary;
            }

            if (e.FromInventoryItemId == null)
            {
                if (e.IsPropertyFromInventoryItemIdRemoved)
                {
                    this.FromInventoryItemId = default(string);
                }
            }
            else
            {
                this.FromInventoryItemId = e.FromInventoryItemId;
            }

            if (e.IsPromo == null)
            {
                if (e.IsPropertyIsPromoRemoved)
                {
                    this.IsPromo = default(string);
                }
            }
            else
            {
                this.IsPromo = e.IsPromo;
            }

            if (e.QuoteId == null)
            {
                if (e.IsPropertyQuoteIdRemoved)
                {
                    this.QuoteId = default(string);
                }
            }
            else
            {
                this.QuoteId = e.QuoteId;
            }

            if (e.QuoteItemSeqId == null)
            {
                if (e.IsPropertyQuoteItemSeqIdRemoved)
                {
                    this.QuoteItemSeqId = default(string);
                }
            }
            else
            {
                this.QuoteItemSeqId = e.QuoteItemSeqId;
            }

            if (e.ShoppingListId == null)
            {
                if (e.IsPropertyShoppingListIdRemoved)
                {
                    this.ShoppingListId = default(string);
                }
            }
            else
            {
                this.ShoppingListId = e.ShoppingListId;
            }

            if (e.ShoppingListItemSeqId == null)
            {
                if (e.IsPropertyShoppingListItemSeqIdRemoved)
                {
                    this.ShoppingListItemSeqId = default(string);
                }
            }
            else
            {
                this.ShoppingListItemSeqId = e.ShoppingListItemSeqId;
            }

            if (e.UnitPrice == null)
            {
                if (e.IsPropertyUnitPriceRemoved)
                {
                    this.UnitPrice = default(decimal?);
                }
            }
            else
            {
                this.UnitPrice = e.UnitPrice;
            }

            if (e.UnitListPrice == null)
            {
                if (e.IsPropertyUnitListPriceRemoved)
                {
                    this.UnitListPrice = default(decimal?);
                }
            }
            else
            {
                this.UnitListPrice = e.UnitListPrice;
            }

            if (e.UnitAverageCost == null)
            {
                if (e.IsPropertyUnitAverageCostRemoved)
                {
                    this.UnitAverageCost = default(decimal?);
                }
            }
            else
            {
                this.UnitAverageCost = e.UnitAverageCost;
            }

            if (e.UnitRecurringPrice == null)
            {
                if (e.IsPropertyUnitRecurringPriceRemoved)
                {
                    this.UnitRecurringPrice = default(decimal?);
                }
            }
            else
            {
                this.UnitRecurringPrice = e.UnitRecurringPrice;
            }

            if (e.IsModifiedPrice == null)
            {
                if (e.IsPropertyIsModifiedPriceRemoved)
                {
                    this.IsModifiedPrice = default(string);
                }
            }
            else
            {
                this.IsModifiedPrice = e.IsModifiedPrice;
            }

            if (e.RecurringFreqUomId == null)
            {
                if (e.IsPropertyRecurringFreqUomIdRemoved)
                {
                    this.RecurringFreqUomId = default(string);
                }
            }
            else
            {
                this.RecurringFreqUomId = e.RecurringFreqUomId;
            }

            if (e.ItemDescription == null)
            {
                if (e.IsPropertyItemDescriptionRemoved)
                {
                    this.ItemDescription = default(string);
                }
            }
            else
            {
                this.ItemDescription = e.ItemDescription;
            }

            if (e.Comments == null)
            {
                if (e.IsPropertyCommentsRemoved)
                {
                    this.Comments = default(string);
                }
            }
            else
            {
                this.Comments = e.Comments;
            }

            if (e.CorrespondingPoId == null)
            {
                if (e.IsPropertyCorrespondingPoIdRemoved)
                {
                    this.CorrespondingPoId = default(string);
                }
            }
            else
            {
                this.CorrespondingPoId = e.CorrespondingPoId;
            }

            if (e.StatusId == null)
            {
                if (e.IsPropertyStatusIdRemoved)
                {
                    this.StatusId = default(string);
                }
            }
            else
            {
                this.StatusId = e.StatusId;
            }

            if (e.SyncStatusId == null)
            {
                if (e.IsPropertySyncStatusIdRemoved)
                {
                    this.SyncStatusId = default(string);
                }
            }
            else
            {
                this.SyncStatusId = e.SyncStatusId;
            }

            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.AutoCancelDate == null)
            {
                if (e.IsPropertyAutoCancelDateRemoved)
                {
                    this.AutoCancelDate = default(DateTime?);
                }
            }
            else
            {
                this.AutoCancelDate = e.AutoCancelDate;
            }

            if (e.DontCancelSetDate == null)
            {
                if (e.IsPropertyDontCancelSetDateRemoved)
                {
                    this.DontCancelSetDate = default(DateTime?);
                }
            }
            else
            {
                this.DontCancelSetDate = e.DontCancelSetDate;
            }

            if (e.DontCancelSetBy == null)
            {
                if (e.IsPropertyDontCancelSetByRemoved)
                {
                    this.DontCancelSetBy = default(string);
                }
            }
            else
            {
                this.DontCancelSetBy = e.DontCancelSetBy;
            }

            if (e.ShipBeforeDate == null)
            {
                if (e.IsPropertyShipBeforeDateRemoved)
                {
                    this.ShipBeforeDate = default(DateTime?);
                }
            }
            else
            {
                this.ShipBeforeDate = e.ShipBeforeDate;
            }

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

            if (e.CancelBackOrderDate == null)
            {
                if (e.IsPropertyCancelBackOrderDateRemoved)
                {
                    this.CancelBackOrderDate = default(DateTime?);
                }
            }
            else
            {
                this.CancelBackOrderDate = e.CancelBackOrderDate;
            }

            if (e.OverrideGlAccountId == null)
            {
                if (e.IsPropertyOverrideGlAccountIdRemoved)
                {
                    this.OverrideGlAccountId = default(string);
                }
            }
            else
            {
                this.OverrideGlAccountId = e.OverrideGlAccountId;
            }

            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;
        }
        public virtual OrderItemStateMergePatchedDto ToOrderItemStateMergePatchedDto(IOrderItemStateMergePatched e)
        {
            var dto = new OrderItemStateMergePatchedDto();

            dto.OrderItemEventId      = e.OrderItemEventId;
            dto.CreatedAt             = e.CreatedAt;
            dto.CreatedBy             = e.CreatedBy;
            dto.Version               = e.Version;
            dto.CommandId             = e.CommandId;
            dto.ProductId             = e.ProductId;
            dto.ExternalProductId     = e.ExternalProductId;
            dto.Quantity              = e.Quantity;
            dto.CancelQuantity        = e.CancelQuantity;
            dto.SelectedAmount        = e.SelectedAmount;
            dto.ExternalId            = e.ExternalId;
            dto.OrderItemTypeId       = e.OrderItemTypeId;
            dto.OrderItemGroupSeqId   = e.OrderItemGroupSeqId;
            dto.IsItemGroupPrimary    = e.IsItemGroupPrimary;
            dto.FromInventoryItemId   = e.FromInventoryItemId;
            dto.IsPromo               = e.IsPromo;
            dto.QuoteId               = e.QuoteId;
            dto.QuoteItemSeqId        = e.QuoteItemSeqId;
            dto.ShoppingListId        = e.ShoppingListId;
            dto.ShoppingListItemSeqId = e.ShoppingListItemSeqId;
            dto.UnitPrice             = e.UnitPrice;
            dto.UnitListPrice         = e.UnitListPrice;
            dto.UnitAverageCost       = e.UnitAverageCost;
            dto.UnitRecurringPrice    = e.UnitRecurringPrice;
            dto.IsModifiedPrice       = e.IsModifiedPrice;
            dto.RecurringFreqUomId    = e.RecurringFreqUomId;
            dto.ItemDescription       = e.ItemDescription;
            dto.Comments              = e.Comments;
            dto.CorrespondingPoId     = e.CorrespondingPoId;
            dto.StatusId              = e.StatusId;
            dto.SyncStatusId          = e.SyncStatusId;
            dto.EstimatedShipDate     = e.EstimatedShipDate;
            dto.EstimatedDeliveryDate = e.EstimatedDeliveryDate;
            dto.AutoCancelDate        = e.AutoCancelDate;
            dto.DontCancelSetDate     = e.DontCancelSetDate;
            dto.DontCancelSetBy       = e.DontCancelSetBy;
            dto.ShipBeforeDate        = e.ShipBeforeDate;
            dto.ShipAfterDate         = e.ShipAfterDate;
            dto.CancelBackOrderDate   = e.CancelBackOrderDate;
            dto.OverrideGlAccountId   = e.OverrideGlAccountId;
            dto.Active = e.Active;
            dto.IsPropertyProductIdRemoved             = e.IsPropertyProductIdRemoved;
            dto.IsPropertyExternalProductIdRemoved     = e.IsPropertyExternalProductIdRemoved;
            dto.IsPropertyQuantityRemoved              = e.IsPropertyQuantityRemoved;
            dto.IsPropertyCancelQuantityRemoved        = e.IsPropertyCancelQuantityRemoved;
            dto.IsPropertySelectedAmountRemoved        = e.IsPropertySelectedAmountRemoved;
            dto.IsPropertyExternalIdRemoved            = e.IsPropertyExternalIdRemoved;
            dto.IsPropertyOrderItemTypeIdRemoved       = e.IsPropertyOrderItemTypeIdRemoved;
            dto.IsPropertyOrderItemGroupSeqIdRemoved   = e.IsPropertyOrderItemGroupSeqIdRemoved;
            dto.IsPropertyIsItemGroupPrimaryRemoved    = e.IsPropertyIsItemGroupPrimaryRemoved;
            dto.IsPropertyFromInventoryItemIdRemoved   = e.IsPropertyFromInventoryItemIdRemoved;
            dto.IsPropertyIsPromoRemoved               = e.IsPropertyIsPromoRemoved;
            dto.IsPropertyQuoteIdRemoved               = e.IsPropertyQuoteIdRemoved;
            dto.IsPropertyQuoteItemSeqIdRemoved        = e.IsPropertyQuoteItemSeqIdRemoved;
            dto.IsPropertyShoppingListIdRemoved        = e.IsPropertyShoppingListIdRemoved;
            dto.IsPropertyShoppingListItemSeqIdRemoved = e.IsPropertyShoppingListItemSeqIdRemoved;
            dto.IsPropertyUnitPriceRemoved             = e.IsPropertyUnitPriceRemoved;
            dto.IsPropertyUnitListPriceRemoved         = e.IsPropertyUnitListPriceRemoved;
            dto.IsPropertyUnitAverageCostRemoved       = e.IsPropertyUnitAverageCostRemoved;
            dto.IsPropertyUnitRecurringPriceRemoved    = e.IsPropertyUnitRecurringPriceRemoved;
            dto.IsPropertyIsModifiedPriceRemoved       = e.IsPropertyIsModifiedPriceRemoved;
            dto.IsPropertyRecurringFreqUomIdRemoved    = e.IsPropertyRecurringFreqUomIdRemoved;
            dto.IsPropertyItemDescriptionRemoved       = e.IsPropertyItemDescriptionRemoved;
            dto.IsPropertyCommentsRemoved              = e.IsPropertyCommentsRemoved;
            dto.IsPropertyCorrespondingPoIdRemoved     = e.IsPropertyCorrespondingPoIdRemoved;
            dto.IsPropertyStatusIdRemoved              = e.IsPropertyStatusIdRemoved;
            dto.IsPropertySyncStatusIdRemoved          = e.IsPropertySyncStatusIdRemoved;
            dto.IsPropertyEstimatedShipDateRemoved     = e.IsPropertyEstimatedShipDateRemoved;
            dto.IsPropertyEstimatedDeliveryDateRemoved = e.IsPropertyEstimatedDeliveryDateRemoved;
            dto.IsPropertyAutoCancelDateRemoved        = e.IsPropertyAutoCancelDateRemoved;
            dto.IsPropertyDontCancelSetDateRemoved     = e.IsPropertyDontCancelSetDateRemoved;
            dto.IsPropertyDontCancelSetByRemoved       = e.IsPropertyDontCancelSetByRemoved;
            dto.IsPropertyShipBeforeDateRemoved        = e.IsPropertyShipBeforeDateRemoved;
            dto.IsPropertyShipAfterDateRemoved         = e.IsPropertyShipAfterDateRemoved;
            dto.IsPropertyCancelBackOrderDateRemoved   = e.IsPropertyCancelBackOrderDateRemoved;
            dto.IsPropertyOverrideGlAccountIdRemoved   = e.IsPropertyOverrideGlAccountIdRemoved;
            dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved;

            return(dto);
        }