public void CancelOrder(Guid id)
        {
            using (_databaseContextFactory.Create(ProcessManagementData.ConnectionStringName))
            {
                var row = _orderProcessViewQuery.Find(id);

                if (row == null)
                {
                    return;
                }

                _bus.Send(new CancelOrderProcessCommand
                {
                    OrderProcessId = id
                }, c =>
                {
                    c.WithRecipient(OrderProcessViewColumns.TargetSystemUri.MapFrom(row));
                    c.WithCorrelationId(id.ToString("N"));
                    c.Headers.Add(new TransportHeader
                    {
                        Key   = "TargetSystem",
                        Value = OrderProcessViewColumns.TargetSystem.MapFrom(row)
                    });
                });

                _orderProcessViewQuery.SaveStatus(id, "Cancelling");
            }
        }
Beispiel #2
0
 public void ProcessMessage(IHandlerContext <OrderCreatedEvent> context)
 {
     using (_databaseContextFactory.Create(ProcessManagementData.ConnectionStringName))
     {
         _orderProcessViewQuery.SaveStatus(context.TransportMessage.OrderProcessId(), "Order Created");
     }
 }
 public void ProcessMessage(IHandlerContext <CancelOrderProcessRejectedEvent> context)
 {
     using (_databaseContextFactory.Create(ProcessManagementData.ConnectionStringName))
     {
         _orderProcessViewQuery.SaveStatus(context.Message.OrderProcessId, context.Message.Status);
     }
 }