예제 #1
0
        protected virtual void AddProductToState(Product product, IOrderState orderState)
        {
            var products = new List<Product>(orderState.Products);
            products.Add(product);

            orderState.Products = products;
        }
예제 #2
0
        // we should use event based for this
        internal void MagicBoxCompleted()
        {
            // should create default state
            expiracyTimer.Finish();
            expiracyTimer.Expired -= expiracyTimer_Expired;

            state = null;
            OnOrderClosed();
        }
예제 #3
0
 public Order(IOrderState orderState)
 {
     _orderState = orderState;
 }
예제 #4
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IOrderShipGroupStateMergePatched MapMergePatch(IMergePatchOrderShipGroup c, IOrderCommand outerCommand, long version, IOrderState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new OrderShipGroupEventId(c.OrderId, c.ShipGroupSeqId, version);
            IOrderShipGroupStateMergePatched e = NewOrderShipGroupStateMergePatched(stateEventId);
            var s = outerState.OrderShipGroups.Get(c.ShipGroupSeqId);

            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;
            e.Active                                       = c.Active;
            e.IsPropertyShipmentMethodTypeIdRemoved        = c.IsPropertyShipmentMethodTypeIdRemoved;
            e.IsPropertySupplierPartyIdRemoved             = c.IsPropertySupplierPartyIdRemoved;
            e.IsPropertyVendorPartyIdRemoved               = c.IsPropertyVendorPartyIdRemoved;
            e.IsPropertyCarrierPartyIdRemoved              = c.IsPropertyCarrierPartyIdRemoved;
            e.IsPropertyCarrierRoleTypeIdRemoved           = c.IsPropertyCarrierRoleTypeIdRemoved;
            e.IsPropertyFacilityIdRemoved                  = c.IsPropertyFacilityIdRemoved;
            e.IsPropertyDestinationFacilityIdRemoved       = c.IsPropertyDestinationFacilityIdRemoved;
            e.IsPropertyContactMechIdRemoved               = c.IsPropertyContactMechIdRemoved;
            e.IsPropertyTelecomContactMechIdRemoved        = c.IsPropertyTelecomContactMechIdRemoved;
            e.IsPropertyTrackingNumberRemoved              = c.IsPropertyTrackingNumberRemoved;
            e.IsPropertyContactPartyIdRemoved              = c.IsPropertyContactPartyIdRemoved;
            e.IsPropertyVehiclePlateNumberRemoved          = c.IsPropertyVehiclePlateNumberRemoved;
            e.IsPropertyShippingInstructionsRemoved        = c.IsPropertyShippingInstructionsRemoved;
            e.IsPropertyMaySplitRemoved                    = c.IsPropertyMaySplitRemoved;
            e.IsPropertyGiftMessageRemoved                 = c.IsPropertyGiftMessageRemoved;
            e.IsPropertyIsGiftRemoved                      = c.IsPropertyIsGiftRemoved;
            e.IsPropertyShipAfterDateRemoved               = c.IsPropertyShipAfterDateRemoved;
            e.IsPropertyShipByDateRemoved                  = c.IsPropertyShipByDateRemoved;
            e.IsPropertyEstimatedShipDateRemoved           = c.IsPropertyEstimatedShipDateRemoved;
            e.IsPropertyEstimatedDeliveryDateRemoved       = c.IsPropertyEstimatedDeliveryDateRemoved;
            e.IsPropertyPickwaveIdRemoved                  = c.IsPropertyPickwaveIdRemoved;
            e.IsPropertyNumberOfPackagesRemoved            = c.IsPropertyNumberOfPackagesRemoved;
            e.IsPropertyNumberOfContainersRemoved          = c.IsPropertyNumberOfContainersRemoved;
            e.IsPropertyNumberOfPakagesPerContainerRemoved = c.IsPropertyNumberOfPakagesPerContainerRemoved;
            e.IsPropertyActiveRemoved                      = c.IsPropertyActiveRemoved;

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

            foreach (IOrderItemShipGroupAssociationCommand innerCommand in c.OrderItemShipGroupAssociationCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IOrderItemShipGroupAssociationEvent innerEvent = Map(innerCommand, c, version, s);
                e.AddOrderItemShipGroupAssociationEvent(innerEvent);
            }

            return(e);
        }// END Map(IMergePatch... ////////////////////////////
예제 #5
0
 public void SetState(IOrderState s)
 {
     _current = s;
 }
예제 #6
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IOrderRoleStateMergePatched MapMergePatch(IMergePatchOrderRole c, IOrderCommand outerCommand, long version, IOrderState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new OrderRoleEventId(c.OrderId, c.PartyRoleId, version);
            IOrderRoleStateMergePatched e = NewOrderRoleStateMergePatched(stateEventId);
            var s = outerState.OrderRoles.Get(c.PartyRoleId);

            e.Active = c.Active;
            e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
예제 #7
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... ////////////////////////////
예제 #8
0
        // we should use event based for this
        internal void OrderRunning(Order order, ITrailingMethod trailing)
        {
            ResetExpiracy();

            state = new OrderAlreadyRunning(this, order, trailing);
        }
예제 #9
0
 private void Change(IOrderState orderState)
 {
     _orderState = orderState;
 }
예제 #10
0
 internal void SetStateTo(IOrderState state)
 {
     this._state = state;
 }
예제 #11
0
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, IOrderAggregate aggregate, IOrderState state)
 {
     EventStore.AppendEvents(eventStoreAggregateId, ((IOrderStateProperties)state).Version, aggregate.Changes, () => { StateRepository.Save(state); });
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <IOrderAggregate, IOrderState>(aggregate, state, aggregate.Changes));
     }
 }
예제 #12
0
 public OrderStateDtoWrapper()
 {
     this._state = new OrderState();
 }
예제 #13
0
 public OrderStateDtoWrapper(IOrderState state)
 {
     this._state = state;
 }
예제 #14
0
        public static TMergePatchOrder ToMergePatchOrder <TMergePatchOrder, TCreateOrderRole, TMergePatchOrderRole, TCreateOrderItem, TMergePatchOrderItem, TCreateOrderShipGroup, TMergePatchOrderShipGroup, TCreateOrderItemShipGroupAssociation, TMergePatchOrderItemShipGroupAssociation>(this IOrderState state)
            where TMergePatchOrder : IMergePatchOrder, new()
            where TCreateOrderRole : ICreateOrderRole, new()
            where TMergePatchOrderRole : IMergePatchOrderRole, new()
            where TCreateOrderItem : ICreateOrderItem, new()
            where TMergePatchOrderItem : IMergePatchOrderItem, new()
            where TCreateOrderShipGroup : ICreateOrderShipGroup, new()
            where TMergePatchOrderShipGroup : IMergePatchOrderShipGroup, new()
            where TCreateOrderItemShipGroupAssociation : ICreateOrderItemShipGroupAssociation, new()
            where TMergePatchOrderItemShipGroupAssociation : IMergePatchOrderItemShipGroupAssociation, new()
        {
            var cmd = new TMergePatchOrder();

            cmd.Version = ((IOrderStateProperties)state).Version;

            cmd.OrderId                 = state.OrderId;
            cmd.OrderTypeId             = state.OrderTypeId;
            cmd.OrderName               = state.OrderName;
            cmd.ExternalId              = state.ExternalId;
            cmd.SalesChannelEnumId      = state.SalesChannelEnumId;
            cmd.OrderDate               = state.OrderDate;
            cmd.Priority                = state.Priority;
            cmd.EntryDate               = state.EntryDate;
            cmd.PickSheetPrintedDate    = state.PickSheetPrintedDate;
            cmd.StatusId                = state.StatusId;
            cmd.CurrencyUom             = state.CurrencyUom;
            cmd.SyncStatusId            = state.SyncStatusId;
            cmd.BillingAccountId        = state.BillingAccountId;
            cmd.OriginFacilityId        = state.OriginFacilityId;
            cmd.WebSiteId               = state.WebSiteId;
            cmd.ProductStoreId          = state.ProductStoreId;
            cmd.TerminalId              = state.TerminalId;
            cmd.TransactionId           = state.TransactionId;
            cmd.AutoOrderShoppingListId = state.AutoOrderShoppingListId;
            cmd.NeedsInventoryIssuance  = state.NeedsInventoryIssuance;
            cmd.IsRushOrder             = state.IsRushOrder;
            cmd.InternalCode            = state.InternalCode;
            cmd.RemainingSubTotal       = state.RemainingSubTotal;
            cmd.GrandTotal              = state.GrandTotal;
            cmd.InvoicePerShipment      = state.InvoicePerShipment;
            cmd.Active = ((IOrderStateProperties)state).Active;

            if (state.OrderTypeId == null)
            {
                cmd.IsPropertyOrderTypeIdRemoved = true;
            }
            if (state.OrderName == null)
            {
                cmd.IsPropertyOrderNameRemoved = true;
            }
            if (state.ExternalId == null)
            {
                cmd.IsPropertyExternalIdRemoved = true;
            }
            if (state.SalesChannelEnumId == null)
            {
                cmd.IsPropertySalesChannelEnumIdRemoved = true;
            }
            if (state.OrderDate == null)
            {
                cmd.IsPropertyOrderDateRemoved = true;
            }
            if (state.Priority == null)
            {
                cmd.IsPropertyPriorityRemoved = true;
            }
            if (state.EntryDate == null)
            {
                cmd.IsPropertyEntryDateRemoved = true;
            }
            if (state.PickSheetPrintedDate == null)
            {
                cmd.IsPropertyPickSheetPrintedDateRemoved = true;
            }
            if (state.StatusId == null)
            {
                cmd.IsPropertyStatusIdRemoved = true;
            }
            if (state.CurrencyUom == null)
            {
                cmd.IsPropertyCurrencyUomRemoved = true;
            }
            if (state.SyncStatusId == null)
            {
                cmd.IsPropertySyncStatusIdRemoved = true;
            }
            if (state.BillingAccountId == null)
            {
                cmd.IsPropertyBillingAccountIdRemoved = true;
            }
            if (state.OriginFacilityId == null)
            {
                cmd.IsPropertyOriginFacilityIdRemoved = true;
            }
            if (state.WebSiteId == null)
            {
                cmd.IsPropertyWebSiteIdRemoved = true;
            }
            if (state.ProductStoreId == null)
            {
                cmd.IsPropertyProductStoreIdRemoved = true;
            }
            if (state.TerminalId == null)
            {
                cmd.IsPropertyTerminalIdRemoved = true;
            }
            if (state.TransactionId == null)
            {
                cmd.IsPropertyTransactionIdRemoved = true;
            }
            if (state.AutoOrderShoppingListId == null)
            {
                cmd.IsPropertyAutoOrderShoppingListIdRemoved = true;
            }
            if (state.NeedsInventoryIssuance == null)
            {
                cmd.IsPropertyNeedsInventoryIssuanceRemoved = true;
            }
            if (state.IsRushOrder == null)
            {
                cmd.IsPropertyIsRushOrderRemoved = true;
            }
            if (state.InternalCode == null)
            {
                cmd.IsPropertyInternalCodeRemoved = true;
            }
            if (state.RemainingSubTotal == null)
            {
                cmd.IsPropertyRemainingSubTotalRemoved = true;
            }
            if (state.GrandTotal == null)
            {
                cmd.IsPropertyGrandTotalRemoved = true;
            }
            if (state.InvoicePerShipment == null)
            {
                cmd.IsPropertyInvoicePerShipmentRemoved = true;
            }
            foreach (var d in state.OrderRoles)
            {
                var c = d.ToCreateOrMergePatchOrderRole <TCreateOrderRole, TMergePatchOrderRole>();
                cmd.OrderRoleCommands.Add(c);
            }
            foreach (var d in state.OrderItems)
            {
                var c = d.ToCreateOrMergePatchOrderItem <TCreateOrderItem, TMergePatchOrderItem>();
                cmd.OrderItemCommands.Add(c);
            }
            foreach (var d in state.OrderShipGroups)
            {
                var c = d.ToCreateOrMergePatchOrderShipGroup <TCreateOrderShipGroup, TMergePatchOrderShipGroup, TCreateOrderItemShipGroupAssociation, TMergePatchOrderItemShipGroupAssociation>();
                cmd.OrderShipGroupCommands.Add(c);
            }
            return(cmd);
        }
예제 #15
0
        public static IOrderCommand ToCreateOrMergePatchOrder <TCreateOrder, TMergePatchOrder, TCreateOrderRole, TMergePatchOrderRole, TCreateOrderItem, TMergePatchOrderItem, TCreateOrderShipGroup, TMergePatchOrderShipGroup, TCreateOrderItemShipGroupAssociation, TMergePatchOrderItemShipGroupAssociation>(this IOrderState state)
            where TCreateOrder : ICreateOrder, new()
            where TMergePatchOrder : IMergePatchOrder, new()
            where TCreateOrderRole : ICreateOrderRole, new()
            where TMergePatchOrderRole : IMergePatchOrderRole, new()
            where TCreateOrderItem : ICreateOrderItem, new()
            where TMergePatchOrderItem : IMergePatchOrderItem, new()
            where TCreateOrderShipGroup : ICreateOrderShipGroup, new()
            where TMergePatchOrderShipGroup : IMergePatchOrderShipGroup, new()
            where TCreateOrderItemShipGroupAssociation : ICreateOrderItemShipGroupAssociation, new()
            where TMergePatchOrderItemShipGroupAssociation : IMergePatchOrderItemShipGroupAssociation, new()
        {
            bool bUnsaved = ((IOrderState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateOrder <TCreateOrder, TCreateOrderRole, TCreateOrderItem, TCreateOrderShipGroup, TCreateOrderItemShipGroupAssociation>());
            }
            else
            {
                return(state.ToMergePatchOrder <TMergePatchOrder, TCreateOrderRole, TMergePatchOrderRole, TCreateOrderItem, TMergePatchOrderItem, TCreateOrderShipGroup, TMergePatchOrderShipGroup, TCreateOrderItemShipGroupAssociation, TMergePatchOrderItemShipGroupAssociation>());
            }
        }
예제 #16
0
        // we should use event based for this
        internal void OrderRunning(Order order, IProfitProtector trailing)
        {
            ResetExpiracy();

            state = new OrderAlreadyRunning(this, order, trailing);
        }
예제 #17
0
파일: Order.cs 프로젝트: gyb333/Patterns
 internal void Change(IOrderState orderState)
 {
     _orderState = orderState;
 }
예제 #18
0
파일: Order.cs 프로젝트: gyb333/Patterns
 public Order(IOrderState orderState)
 {
     _orderState = orderState;
 }
예제 #19
0
파일: Order.cs 프로젝트: gobixm/learn
 public void ChangeState(IOrderState newState)
 {
     State = newState;
     Console.WriteLine("order state changed to {0}", State.GetType().Name);
 }
예제 #20
0
 public OrderState()
 {
     _CurrentState = new NewOrder(this);
 }
 // 設定下一關卡的狀態
 public void setState(IOrderState state)
 {
     current_state = state;
 }
예제 #22
0
        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.ContactMechId        = c.ContactMechId;
            e.TelecomContactMechId = c.TelecomContactMechId;
            e.TrackingNumber       = c.TrackingNumber;
            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.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... ////////////////////////////
예제 #23
0
 private void AddOneCancelAnother(Order buyOrder, Order sellOrder)
 {
     state = new MagicBoxCreated(this, buyOrder, sellOrder, mbConfig);
 }
예제 #24
0
 public Order()
 {
     _orderState = new NewState();
 }
예제 #25
0
 public OrderContext(IOrderState orderState)
 {
     _orderState = orderState;
 }
예제 #26
0
 public void Change(IOrderState state)
 {
     _orderState = state;
 }
예제 #27
0
 public OrderAggregate(IOrderState state)
 {
     _state = state;
 }
예제 #28
0
 public Order(IOrderState orderState)
 {
     this._orderState = orderState;
 }
예제 #29
0
        }// END Map(IMergePatch... ////////////////////////////

        protected virtual IOrderShipGroupEvent Map(IOrderShipGroupCommand c, IOrderCommand outerCommand, long version, IOrderState outerState)
        {
            var create = (c.CommandType == CommandType.Create) ? (c as ICreateOrderShipGroup) : null;

            if (create != null)
            {
                return(MapCreate(create, outerCommand, version, outerState));
            }

            var merge = (c.CommandType == CommandType.MergePatch || c.CommandType == null) ? (c as IMergePatchOrderShipGroup) : null;

            if (merge != null)
            {
                return(MapMergePatch(merge, outerCommand, version, outerState));
            }

            var remove = (c.CommandType == CommandType.Remove) ? (c as IRemoveOrderShipGroup) : null;

            if (remove != null)
            {
                return(MapRemove(remove, outerCommand, version));
            }
            throw new NotSupportedException();
        }
예제 #30
0
 public void Change(IOrderState orderState)
 {
     this._orderState = orderState;
 }
예제 #31
0
 public OrderShipGroupStates(IOrderState outerState)
 {
     this._orderState    = outerState;
     this._forReapplying = outerState.ForReapplying;
 }
예제 #32
0
 public OrderItemStates(IOrderState outerState)
 {
     this._orderState    = outerState;
     this._forReapplying = outerState.ForReapplying;
 }
예제 #33
0
 public Order()
 {
     _current = new WaitForAcceptance();
     IsCancel = false;
 }
예제 #34
0
        internal void SetStateTo(IOrderState state)
        {
            this._orderState = state;

            this.Status = this._orderState.Status;
        }
예제 #35
0
 public void AddProductsToOrder(IEnumerable<Product> products, IOrderState orderState)
 {
     foreach (var product in products)
         AddProductToState(product, orderState);
 }
예제 #36
0
 public Order(IOrderState baseState)
 {
     _orderState = baseState;
 }
예제 #37
0
 public Order()
 {
     _created = DateTime.Now;
     _items   = new List <OrderItem>();
     _state   = OrderStates.Open;
 }
예제 #38
0
 /// <summary>
 /// Order类的核心是这个方法,通过这个方法实现根据传入的某接口的 实现类来改变当前类中的实现类的方式!!
 /// </summary>
 /// <param name="OrderState"></param>
 internal void Change(IOrderState OrderState)
 {
     _orderState = OrderState;
 }
예제 #39
0
 public abstract IOrderAggregate GetOrderAggregate(IOrderState state);
예제 #40
0
 public void ChangeState(Order order, IOrderState newState)
 {
     order.ChangeState(newState);
 }
예제 #41
0
        protected bool IsRepeatedCommand(IOrderCommand command, IEventStoreAggregateId eventStoreAggregateId, IOrderState state)
        {
            bool repeated = false;

            if (((IOrderStateProperties)state).Version > command.AggregateVersion)
            {
                var lastEvent = EventStore.GetEvent(typeof(IOrderEvent), eventStoreAggregateId, command.AggregateVersion);
                if (lastEvent != null && lastEvent.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
 // constructor
 public OrderStateContext()
 {
     current_state = new NewOrderState();        // 訂單建立時的初始狀態為 'NEW_ORDER'
 }