private void NotifyIfClosed(Order order)
 {
     if (order.IsClosed())
     {
         _orders.Remove(order);
         OrderClosed?.Invoke(this, new OrderArgs(order));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Close order
        /// </summary>
        /// <param name="orderId">Order id</param>
        /// <returns></returns>
        public async Task <OrderClosed> CloseOrder(long orderId)
        {
            Dictionary <string, string> routeParams = new Dictionary <string, string>();

            routeParams.Add("accountId", _accountId.ToString());
            routeParams.Add("orderId", orderId.ToString());

            OrderClosed orderClosed = await Delete <OrderClosed>(routeParams, _orderRoute);

            return(orderClosed);
        }
Ejemplo n.º 3
0
 public Task <AsyncTaskResult> HandleAsync(OrderClosed evnt)
 {
     return(TryUpdateRecordAsync(connection =>
     {
         return connection.UpdateAsync(new
         {
             Status = (int)OrderStatus.Closed,
             Version = evnt.Version
         }, new
         {
             OrderId = evnt.AggregateRootId,
             Version = evnt.Version - 1
         }, ConfigSettings.OrderTable);
     }));
 }
Ejemplo n.º 4
0
        public async Task CloseOrder()
        {
            OrderClosed order = await _orderEndpoints.CloseOrder(965875303);

            Assert.IsNotNull(order);
        }
Ejemplo n.º 5
0
 private void RaiseOrderClosed(Order order)
 {
     OrderClosed?.Invoke(this, new OrderArgs(order));
 }
Ejemplo n.º 6
0
 private void HandleEvent(OrderClosed @event)
 {
     this.IsClosed = true;
     this.Manager.RemoveOrder(this);
 }