public virtual void Initialize(IOrderRoleMvoStateCreated stateCreated) { var aggregateId = stateCreated.OrderRoleMvoEventId.OrderRoleId; var state = new OrderRoleMvoState(); state.OrderRoleId = aggregateId; var aggregate = (OrderRoleMvoAggregate)GetOrderRoleMvoAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
protected virtual IOrderRoleMvoStateCreated Map(ICreateOrderRoleMvo c) { var stateEventId = new OrderRoleMvoEventId(c.OrderRoleId, c.OrderVersion); IOrderRoleMvoStateCreated e = NewOrderRoleMvoStateCreated(stateEventId); 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); }
public virtual OrderRoleMvoStateCreatedDto ToOrderRoleMvoStateCreatedDto(IOrderRoleMvoStateCreated e) { var dto = new OrderRoleMvoStateCreatedDto(); dto.OrderRoleMvoEventId = e.OrderRoleMvoEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; 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); }
void IOrderRoleMvoState.When(IOrderRoleMvoStateCreated e) { throw new NotSupportedException(); }
public virtual void Create(ICreateOrderRoleMvo c) { IOrderRoleMvoStateCreated e = Map(c); Apply(e); }
public virtual void When(IOrderRoleMvoStateCreated e) { ThrowOnWrongEvent(e); 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.Deleted = false; this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; }