Ejemplo n.º 1
0
 private void transactionEventHandler(object sender, GetAllTransactionsEventArgs args)
 {
     if (listView_transactions.InvokeRequired)
     {
         listView_transactions.Invoke(new populateTransactionsViewDelegate(populateView), new object[] { sender, args });
     }
     else
     {
         populateView(sender, args);
     }
 }
Ejemplo n.º 2
0
        private void populateView(object sender, GetAllTransactionsEventArgs args)
        {
            showBusyIndicator();

            // tell the listView it is being updated
            listView_transactions.BeginUpdate();

            // clear the list
            foreach (ListViewItem item in listView_transactions.Items)
            {
                listView_transactions.Items.Remove(item);
            }

            // populate it
            foreach (var transaction in args.getList())
            {
                string[] itemArr = new string[9];

                itemArr[0] = transaction.TransactionID.ToString();
                itemArr[1] = transaction.Timestamp;

                if (transaction.customer != null)
                {
                    itemArr[2] = transaction.customer.CustomerID.ToString();
                    itemArr[3] = transaction.customer.FullName;
                }

                itemArr[4] = transaction.staff.StaffID.ToString();
                itemArr[5] = transaction.staff.FullName;
                itemArr[6] = transaction.product.ProductIDNumber;
                itemArr[7] = transaction.product.Description;
                itemArr[8] = transaction.product.price.ToString();

                ListViewItem transactionItem = new ListViewItem(itemArr);
                transactionItem.Font = new Font(transactionItem.Font, FontStyle.Regular);
                listView_transactions.Items.Add(transactionItem);
            }

            // tell the listView it is ready
            listView_transactions.EndUpdate();

            removeBusyIndicator();
        }
Ejemplo n.º 3
0
 // event handler for model events
 private void loadDataEventHandler(object sender, GetAllTransactionsEventArgs args)
 {
     transactionList = args.getList().ToList();
 }