public virtual void When(IOrderShipGroupStateCreated e) { ThrowOnWrongEvent(e); this.ShipmentMethodTypeId = e.ShipmentMethodTypeId; this.SupplierPartyId = e.SupplierPartyId; this.VendorPartyId = e.VendorPartyId; this.CarrierPartyId = e.CarrierPartyId; this.CarrierRoleTypeId = e.CarrierRoleTypeId; this.FacilityId = e.FacilityId; this.ContactMechId = e.ContactMechId; this.TelecomContactMechId = e.TelecomContactMechId; this.TrackingNumber = e.TrackingNumber; this.ShippingInstructions = e.ShippingInstructions; this.MaySplit = e.MaySplit; this.GiftMessage = e.GiftMessage; this.IsGift = e.IsGift; this.ShipAfterDate = e.ShipAfterDate; this.ShipByDate = e.ShipByDate; this.EstimatedShipDate = e.EstimatedShipDate; this.EstimatedDeliveryDate = e.EstimatedDeliveryDate; this.PickwaveId = e.PickwaveId; this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.Deleted = false; this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; foreach (IOrderItemShipGroupAssociationStateCreated innerEvent in e.OrderItemShipGroupAssociationEvents) { IOrderItemShipGroupAssociationState innerState = this.OrderItemShipGroupAssociations.Get(innerEvent.GlobalId.OrderItemSeqId, true); innerState.Mutate(innerEvent); } }
protected virtual IOrderShipGroupStateCreated MapCreate(ICreateOrderShipGroup c, IOrderCommand outerCommand, long version, IOrderState outerState) { c.RequesterId = outerCommand.RequesterId; var stateEventId = new OrderShipGroupEventId(c.OrderId, c.ShipGroupSeqId, version); IOrderShipGroupStateCreated e = NewOrderShipGroupStateCreated(stateEventId); var s = outerState.OrderShipGroups.Get(c.ShipGroupSeqId, true); 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.DestinationFacilityId = c.DestinationFacilityId; e.ContactMechId = c.ContactMechId; e.TelecomContactMechId = c.TelecomContactMechId; e.TrackingNumber = c.TrackingNumber; e.ContactPartyId = c.ContactPartyId; e.VehiclePlateNumber = c.VehiclePlateNumber; 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.NumberOfPackages = c.NumberOfPackages; e.NumberOfContainers = c.NumberOfContainers; e.NumberOfPakagesPerContainer = c.NumberOfPakagesPerContainer; NewOrderShipGroupOrderShipGroupActionCommandAndExecute(c, s, e); e.Active = c.Active; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); foreach (ICreateOrderItemShipGroupAssociation innerCommand in c.OrderItemShipGroupAssociations) { ThrowOnInconsistentCommands(c, innerCommand); IOrderItemShipGroupAssociationStateCreated innerEvent = MapCreate(innerCommand, c, version, s); e.AddOrderItemShipGroupAssociationEvent(innerEvent); } return(e); }// END Map(ICreate... ////////////////////////////
public virtual OrderShipGroupStateCreatedDto ToOrderShipGroupStateCreatedDto(IOrderShipGroupStateCreated e) { var dto = new OrderShipGroupStateCreatedDto(); 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.DestinationFacilityId = e.DestinationFacilityId; 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; var orderItemShipGroupAssociationEvents = new List <OrderItemShipGroupAssociationStateCreatedDto>(); foreach (var ee in e.OrderItemShipGroupAssociationEvents) { OrderItemShipGroupAssociationStateCreatedDto eeDto = OrderItemShipGroupAssociationStateEventDtoConverter.ToOrderItemShipGroupAssociationStateCreatedDto(ee); orderItemShipGroupAssociationEvents.Add(eeDto); } dto.OrderItemShipGroupAssociationEvents = orderItemShipGroupAssociationEvents.ToArray(); return(dto); }
void IOrderStateCreated.AddOrderShipGroupEvent(IOrderShipGroupStateCreated e) { this._orderShipGroupEvents.AddOrderShipGroupEvent(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); }
protected void NewOrderShipGroupOrderShipGroupActionCommandAndExecute(ICreateOrderShipGroup c, IOrderShipGroupState s, IOrderShipGroupStateCreated e) { var pCommandHandler = this.OrderShipGroupOrderShipGroupActionCommandHandler; var pCmdContent = default(string); var pCmd = new PropertyCommand <string, string> { Content = pCmdContent, GetState = () => s.OrderShipGroupStatusId, SetState = p => e.OrderShipGroupStatusId = p, OuterCommandType = CommandType.Create }; pCmd.Context = this.State; pCommandHandler.Execute(pCmd); }
void IOrderShipGroupState.When(IOrderShipGroupStateCreated e) { throw new NotSupportedException(); }
public virtual void AddOrderShipGroupEvent(IOrderShipGroupStateCreated e) { ThrowOnInconsistentEventIds(e); this._orderShipGroupEvents[e.OrderShipGroupEventId] = e; }