0
Completed

Functions to know Order Status

Natalia da Fontoura 1 year ago updated by Андрей Ринас2 (ATAS developer) 1 year ago 1

Hi,

I need function that returns if there are orders active but not filled yet.  I developed this function:

private bool ActiveOrders()
{
        foreach (var order in Orders.Where(t => t.State == OrderStates.Active))
        {
                 return true;
         }
         return false;
}

Is correct?

Completed

Hello

Yes, It should work.

You can also simplify it :

private bool ActiveOrders()
{
   return Orders.Any(t => t.State == OrderStates.Active);
}