Ejemplo n.º 1
0
        public async Task Handle(OrderSubmittedEvent message, IMessageHandlerContext context)
        {
            Log.Info("Handle OrderSubmittedEvent");

            Data.IsOrderSubmitted = true;
            Data.OrderId = message.OrderId;
            Data.CustomerId = message.CustomerId;

            var projection = message.Products.Select(p => new ShippingSagaData.Product { Identifier = p });
            Data.Products = projection.ToList();

            await ProcessOrder(context);
        }
Ejemplo n.º 2
0
        public Task Handle(OrderSubmittedEvent message, IMessageHandlerContext context)
        {
            Data.OrderId    = message.OrderId;
            Data.CustomerId = message.CustomerId;

            Data.IsOrderSubmitted = true;

            var projection = message.Products.Select(p => new ShippingSagaData.Product {
                Identifier = p
            });

            Data.Products = projection.ToList();
            return(ProcessOrder(context));
        }
Ejemplo n.º 3
0
        public override bool SystemLocker(Order order)
        {
            var orderState = OrderStatesFactory.GetOrderState(OrderStatus.待支付);

            order.Status = orderState.Status;

            order.SetStateTo(orderState);

            var submmitted = new OrderSubmittedEvent()
            {
                Order = order
            };

            //触发事件
            DomainEvent.Raise(submmitted, "OrderSystemHandler");

            return(true);
        }
 public OrderShipmentStatusTrackerData FindBy(OrderSubmittedEvent message)
 {
     return(FindByOrderId(message.OrderId));
 }
 public void Handle(OrderSubmittedEvent @event)
 {
     Data.OrderId = @event.OrderId;
     // do some business
     CompleteIfPossible();
 }