Exemplo n.º 1
0
        private void getOrdersWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            List <BestellingOrderItem> todaysOrdersList = new List <BestellingOrderItem>();

            // Continue only if our ordersListView is not currently being used by something else.
            if (ordersListView.InvokeRequired)
            {
                // Tell the rest that you are busy with ordersListView
                ordersListView.Invoke((MethodInvoker) delegate()
                {
                    // If the users work position is bar call GetAllBarOrders else call GetAllKitchenOrders
                    if (isBar == true)
                    {
                        // Fill our list with GetAllBarOrders method, statusFilter says if we want the data with finished orders.
                        todaysOrdersList = order_Service.GetAllBarOrders(statusFilter);
                    }
                    else
                    {
                        // Fill our list with GetAllKitchenOrders method, statusFilter says if we want the data with finished orders.
                        todaysOrdersList = order_Service.GetAllKitchenOrders(statusFilter);
                    }
                });
            }
            e.Result = todaysOrdersList;
        }