Ejemplo n.º 1
0
 private void bgwGetRecords_DoWork(object sender, DoWorkEventArgs e)
 {
     dgv_CustomerTransactions.Invoke(new MethodInvoker(delegate
     {
         dgv_CustomerTransactions.DataSource = _TransactionRepo.GetDebitTransactions().Where(x => x.CustomerId == selectedID && x.CreatedBy == Utilities.USERNAME).ToList();
     }));
     lb_Total.Invoke(new MethodInvoker(delegate { lb_Total.Text = dgv_CustomerTransactions.RowCount.ToString(); }));
     e.Result       = "Done";
     Cursor.Current = Cursors.Default;
 }
Ejemplo n.º 2
0
        private void bgw_PullData_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            lb_TotalSubAdmin.Invoke(new MethodInvoker(delegate
            {
                try
                {
                    var count             = _SubAdminRepo.GetAllRecords().Count();
                    lb_TotalSubAdmin.Text = CurrencyFormat(count.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"{ERRORMESSAGE} \n Error details: {ex.Message}", "Superior Investment!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }));

            lb_TotalCustomers.Invoke(new MethodInvoker(delegate
            {
                try
                {
                    var count = _CustomerRepo.GetAllRecords().Count();
                    lb_TotalCustomers.Text = CurrencyFormat(count.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"{ERRORMESSAGE} \n Error details: {ex.Message}", "Superior Investment!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }));

            lb_TotalAmountContributed.Invoke(new MethodInvoker(delegate
            {
                try
                {
                    var count = _TransactionRepo.GetCreditTransactions().Sum(x => x.AmountContributed) == null ? 0 : _TransactionRepo.GetCreditTransactions().Sum(x => x.AmountContributed);
                    lb_TotalAmountContributed.Text = CurrencyFormat(count.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"{ERRORMESSAGE} \n Error details: {ex.Message}", "Superior Investment!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }));

            lb_TotalAmountCollected.Invoke(new MethodInvoker(delegate
            {
                try
                {
                    var count = _TransactionRepo.GetDebitTransactions().Sum(x => x.AmountCollected) == null ? 0 : _TransactionRepo.GetDebitTransactions().Sum(x => x.AmountCollected);
                    lb_TotalAmountCollected.Text = CurrencyFormat(count.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"{ERRORMESSAGE} \n Error details: {ex.Message}", "Superior Investment!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }));
            Cursor.Current = Cursors.Default;
        }