public virtual void Initialize(IOrderItemMvoStateCreated stateCreated)
        {
            var aggregateId = stateCreated.OrderItemMvoEventId.OrderItemId;
            var state       = new OrderItemMvoState();

            state.OrderItemId = aggregateId;
            var aggregate = (OrderItemMvoAggregate)GetOrderItemMvoAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
예제 #2
0
        public virtual void When(IOrderItemMvoStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.ProductId = e.ProductId;

            this.ExternalProductId = e.ExternalProductId;

            this.Quantity = e.Quantity;

            this.CancelQuantity = e.CancelQuantity;

            this.SelectedAmount = e.SelectedAmount;

            this.ExternalId = e.ExternalId;

            this.OrderItemTypeId = e.OrderItemTypeId;

            this.OrderItemGroupSeqId = e.OrderItemGroupSeqId;

            this.IsItemGroupPrimary = e.IsItemGroupPrimary;

            this.FromInventoryItemId = e.FromInventoryItemId;

            this.IsPromo = e.IsPromo;

            this.QuoteId = e.QuoteId;

            this.QuoteItemSeqId = e.QuoteItemSeqId;

            this.ShoppingListId = e.ShoppingListId;

            this.ShoppingListItemSeqId = e.ShoppingListItemSeqId;

            this.UnitPrice = e.UnitPrice;

            this.UnitListPrice = e.UnitListPrice;

            this.UnitAverageCost = e.UnitAverageCost;

            this.UnitRecurringPrice = e.UnitRecurringPrice;

            this.IsModifiedPrice = e.IsModifiedPrice;

            this.RecurringFreqUomId = e.RecurringFreqUomId;

            this.ItemDescription = e.ItemDescription;

            this.Comments = e.Comments;

            this.CorrespondingPoId = e.CorrespondingPoId;

            this.StatusId = e.StatusId;

            this.SyncStatusId = e.SyncStatusId;

            this.EstimatedShipDate = e.EstimatedShipDate;

            this.EstimatedDeliveryDate = e.EstimatedDeliveryDate;

            this.AutoCancelDate = e.AutoCancelDate;

            this.DontCancelSetDate = e.DontCancelSetDate;

            this.DontCancelSetBy = e.DontCancelSetBy;

            this.ShipBeforeDate = e.ShipBeforeDate;

            this.ShipAfterDate = e.ShipAfterDate;

            this.CancelBackOrderDate = e.CancelBackOrderDate;

            this.OverrideGlAccountId = e.OverrideGlAccountId;

            this.Version = (e.Version != null && e.Version.HasValue) ? e.Version.Value : default(long);

            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.OrderOrderTypeId = e.OrderOrderTypeId;

            this.OrderOrderName = e.OrderOrderName;

            this.OrderExternalId = e.OrderExternalId;

            this.OrderSalesChannelEnumId = e.OrderSalesChannelEnumId;

            this.OrderOrderDate = e.OrderOrderDate;

            this.OrderPriority = e.OrderPriority;

            this.OrderEntryDate = e.OrderEntryDate;

            this.OrderPickSheetPrintedDate = e.OrderPickSheetPrintedDate;

            this.OrderStatusId = e.OrderStatusId;

            this.OrderCurrencyUom = e.OrderCurrencyUom;

            this.OrderSyncStatusId = e.OrderSyncStatusId;

            this.OrderBillingAccountId = e.OrderBillingAccountId;

            this.OrderOriginFacilityId = e.OrderOriginFacilityId;

            this.OrderWebSiteId = e.OrderWebSiteId;

            this.OrderProductStoreId = e.OrderProductStoreId;

            this.OrderTerminalId = e.OrderTerminalId;

            this.OrderTransactionId = e.OrderTransactionId;

            this.OrderAutoOrderShoppingListId = e.OrderAutoOrderShoppingListId;

            this.OrderNeedsInventoryIssuance = e.OrderNeedsInventoryIssuance;

            this.OrderIsRushOrder = e.OrderIsRushOrder;

            this.OrderInternalCode = e.OrderInternalCode;

            this.OrderRemainingSubTotal = e.OrderRemainingSubTotal;

            this.OrderGrandTotal = e.OrderGrandTotal;

            this.OrderInvoicePerShipment = e.OrderInvoicePerShipment;

            this.OrderCreatedBy = e.OrderCreatedBy;

            this.OrderCreatedAt = (e.OrderCreatedAt != null && e.OrderCreatedAt.HasValue) ? e.OrderCreatedAt.Value : default(DateTime);

            this.OrderUpdatedBy = e.OrderUpdatedBy;

            this.OrderUpdatedAt = (e.OrderUpdatedAt != null && e.OrderUpdatedAt.HasValue) ? e.OrderUpdatedAt.Value : default(DateTime);

            this.OrderActive = (e.OrderActive != null && e.OrderActive.HasValue) ? e.OrderActive.Value : default(bool);

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
예제 #3
0
        protected virtual IOrderItemMvoStateCreated Map(ICreateOrderItemMvo c)
        {
            var stateEventId            = new OrderItemMvoEventId(c.OrderItemId, c.OrderVersion);
            IOrderItemMvoStateCreated e = NewOrderItemMvoStateCreated(stateEventId);

            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.Version               = c.Version;
            e.Active                       = c.Active;
            e.OrderOrderTypeId             = c.OrderOrderTypeId;
            e.OrderOrderName               = c.OrderOrderName;
            e.OrderExternalId              = c.OrderExternalId;
            e.OrderSalesChannelEnumId      = c.OrderSalesChannelEnumId;
            e.OrderOrderDate               = c.OrderOrderDate;
            e.OrderPriority                = c.OrderPriority;
            e.OrderEntryDate               = c.OrderEntryDate;
            e.OrderPickSheetPrintedDate    = c.OrderPickSheetPrintedDate;
            e.OrderStatusId                = c.OrderStatusId;
            e.OrderCurrencyUom             = c.OrderCurrencyUom;
            e.OrderSyncStatusId            = c.OrderSyncStatusId;
            e.OrderBillingAccountId        = c.OrderBillingAccountId;
            e.OrderOriginFacilityId        = c.OrderOriginFacilityId;
            e.OrderWebSiteId               = c.OrderWebSiteId;
            e.OrderProductStoreId          = c.OrderProductStoreId;
            e.OrderTerminalId              = c.OrderTerminalId;
            e.OrderTransactionId           = c.OrderTransactionId;
            e.OrderAutoOrderShoppingListId = c.OrderAutoOrderShoppingListId;
            e.OrderNeedsInventoryIssuance  = c.OrderNeedsInventoryIssuance;
            e.OrderIsRushOrder             = c.OrderIsRushOrder;
            e.OrderInternalCode            = c.OrderInternalCode;
            e.OrderRemainingSubTotal       = c.OrderRemainingSubTotal;
            e.OrderGrandTotal              = c.OrderGrandTotal;
            e.OrderInvoicePerShipment      = c.OrderInvoicePerShipment;
            e.OrderCreatedBy               = c.OrderCreatedBy;
            e.OrderCreatedAt               = c.OrderCreatedAt;
            e.OrderUpdatedBy               = c.OrderUpdatedBy;
            e.OrderUpdatedAt               = c.OrderUpdatedAt;
            e.OrderActive                  = c.OrderActive;
            e.CommandId                    = c.CommandId;


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


            return(e);
        }
예제 #4
0
        public virtual void Create(ICreateOrderItemMvo c)
        {
            IOrderItemMvoStateCreated e = Map(c);

            Apply(e);
        }
예제 #5
0
        public virtual OrderItemMvoStateCreatedDto ToOrderItemMvoStateCreatedDto(IOrderItemMvoStateCreated e)
        {
            var dto = new OrderItemMvoStateCreatedDto();

            dto.OrderItemMvoEventId   = e.OrderItemMvoEventId;
            dto.CreatedAt             = e.CreatedAt;
            dto.CreatedBy             = e.CreatedBy;
            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.Version               = e.Version;
            dto.Active                       = e.Active;
            dto.OrderOrderTypeId             = e.OrderOrderTypeId;
            dto.OrderOrderName               = e.OrderOrderName;
            dto.OrderExternalId              = e.OrderExternalId;
            dto.OrderSalesChannelEnumId      = e.OrderSalesChannelEnumId;
            dto.OrderOrderDate               = e.OrderOrderDate;
            dto.OrderPriority                = e.OrderPriority;
            dto.OrderEntryDate               = e.OrderEntryDate;
            dto.OrderPickSheetPrintedDate    = e.OrderPickSheetPrintedDate;
            dto.OrderStatusId                = e.OrderStatusId;
            dto.OrderCurrencyUom             = e.OrderCurrencyUom;
            dto.OrderSyncStatusId            = e.OrderSyncStatusId;
            dto.OrderBillingAccountId        = e.OrderBillingAccountId;
            dto.OrderOriginFacilityId        = e.OrderOriginFacilityId;
            dto.OrderWebSiteId               = e.OrderWebSiteId;
            dto.OrderProductStoreId          = e.OrderProductStoreId;
            dto.OrderTerminalId              = e.OrderTerminalId;
            dto.OrderTransactionId           = e.OrderTransactionId;
            dto.OrderAutoOrderShoppingListId = e.OrderAutoOrderShoppingListId;
            dto.OrderNeedsInventoryIssuance  = e.OrderNeedsInventoryIssuance;
            dto.OrderIsRushOrder             = e.OrderIsRushOrder;
            dto.OrderInternalCode            = e.OrderInternalCode;
            dto.OrderRemainingSubTotal       = e.OrderRemainingSubTotal;
            dto.OrderGrandTotal              = e.OrderGrandTotal;
            dto.OrderInvoicePerShipment      = e.OrderInvoicePerShipment;
            dto.OrderCreatedBy               = e.OrderCreatedBy;
            dto.OrderCreatedAt               = e.OrderCreatedAt;
            dto.OrderUpdatedBy               = e.OrderUpdatedBy;
            dto.OrderUpdatedAt               = e.OrderUpdatedAt;
            dto.OrderActive                  = e.OrderActive;
            return(dto);
        }