protected virtual IOrderItemStateCreated MapCreate(ICreateOrderItem c, IOrderCommand outerCommand, long version, IOrderState outerState) { c.RequesterId = outerCommand.RequesterId; var stateEventId = new OrderItemEventId(c.OrderId, c.OrderItemSeqId, version); IOrderItemStateCreated e = NewOrderItemStateCreated(stateEventId); var s = outerState.OrderItems.Get(c.OrderItemSeqId, true); 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.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); return(e); }// END Map(ICreate... ////////////////////////////
public virtual OrderItemStateCreatedDto ToOrderItemStateCreatedDto(IOrderItemStateCreated e) { var dto = new OrderItemStateCreatedDto(); 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; return(dto); }
void IOrderStateCreated.AddOrderItemEvent(IOrderItemStateCreated e) { this._orderItemEvents.AddOrderItemEvent(e); }
protected virtual IOrderStateCreated Map(ICreateOrder c) { var stateEventId = new OrderEventId(c.OrderId, c.Version); IOrderStateCreated e = NewOrderStateCreated(stateEventId); e.OrderTypeId = c.OrderTypeId; e.OrderName = c.OrderName; e.ExternalId = c.ExternalId; e.SalesChannelEnumId = c.SalesChannelEnumId; e.OrderDate = c.OrderDate; e.Priority = c.Priority; e.EntryDate = c.EntryDate; e.PickSheetPrintedDate = c.PickSheetPrintedDate; e.StatusId = c.StatusId; e.CurrencyUomId = c.CurrencyUomId; e.SyncStatusId = c.SyncStatusId; e.BillingAccountId = c.BillingAccountId; e.OriginFacilityId = c.OriginFacilityId; e.WebSiteId = c.WebSiteId; e.ProductStoreId = c.ProductStoreId; e.TerminalId = c.TerminalId; e.TransactionId = c.TransactionId; e.AutoOrderShoppingListId = c.AutoOrderShoppingListId; e.NeedsInventoryIssuance = c.NeedsInventoryIssuance; e.IsRushOrder = c.IsRushOrder; e.InternalCode = c.InternalCode; e.RemainingSubTotal = c.RemainingSubTotal; e.GrandTotal = c.GrandTotal; e.InvoicePerShipment = c.InvoicePerShipment; e.Active = c.Active; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var version = c.Version; foreach (ICreateOrderRole innerCommand in c.OrderRoles) { ThrowOnInconsistentCommands(c, innerCommand); IOrderRoleStateCreated innerEvent = MapCreate(innerCommand, c, version, _state); e.AddOrderRoleEvent(innerEvent); } foreach (ICreateOrderItem innerCommand in c.OrderItems) { ThrowOnInconsistentCommands(c, innerCommand); IOrderItemStateCreated innerEvent = MapCreate(innerCommand, c, version, _state); e.AddOrderItemEvent(innerEvent); } foreach (ICreateOrderShipGroup innerCommand in c.OrderShipGroups) { ThrowOnInconsistentCommands(c, innerCommand); IOrderShipGroupStateCreated innerEvent = MapCreate(innerCommand, c, version, _state); e.AddOrderShipGroupEvent(innerEvent); } return(e); }
public virtual void When(IOrderItemStateCreated 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.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; }
void IOrderItemState.When(IOrderItemStateCreated e) { throw new NotSupportedException(); }
public virtual void AddOrderItemEvent(IOrderItemStateCreated e) { ThrowOnInconsistentEventIds(e); this._orderItemEvents[e.OrderItemEventId] = e; }