private void UpdateRowHighlights(CashBookTransactionEventArgs e) { foreach (DataGridViewRow row in transactionsDataGridView.Rows) { if ((int)row.Cells[AccountTransaction.fVerificationNo].Value == e.VerificationNo) { using (var core = new StandardBusinessLayer(DataCache)) { core.Connect(); UnbalancedVerificationNumbers = DataCache.GetUnbalancedAndEmptyVerifications().Select(v => v.No).ToArray(); //core.GetUnbalancedVerificationNumbers(); } UpdateRowHighlightsNoDatabase(ApplicationEvents.LastCashBookTransactionSelectionChangedEventArgs); } } }
private void UpdateRowHighlightsNoDatabase(CashBookTransactionEventArgs e) { if (e != null) { foreach (DataGridViewRow row in transactionsDataGridView.Rows) { if ((int)row.Cells[AccountTransaction.fVerificationNo].Value == e.VerificationNo) { row.DefaultCellStyle = new DataGridViewCellStyle() { ForeColor = System.Drawing.Color.Blue }; } else { row.DefaultCellStyle = new DataGridViewCellStyle() { ForeColor = System.Drawing.Color.Black }; } } } if (UnbalancedVerificationNumbers != null) { foreach (DataGridViewRow row in transactionsDataGridView.Rows) { if (UnbalancedVerificationNumbers.Contains((int)row.Cells[AccountTransaction.fVerificationNo].Value)) { row.DefaultCellStyle = new DataGridViewCellStyle() { ForeColor = System.Drawing.Color.Red }; } } } }
void CurrentApplication_CashBookTransactionDeleted(object sender, CashBookTransactionEventArgs e) { // If the deleted transaction is in the list, then reload the grid. foreach (DataGridViewRow row in transactionsDataGridView.Rows) { if ((int)row.Cells[CashBookTransaction.fNo].Value == e.CashBookTransactionNo) { LoadTransactionGrid(); return; } } // If the deleted transaction's verification is represented in the list, then update the highlights foreach (DataGridViewRow row in transactionsDataGridView.Rows) { if ((int)row.Cells[CashBookTransaction.fVerificationNo].Value == (int)e.VerificationNo) { UpdateRowHighlights(ApplicationEvents.LastAccountTransactionSelectionChangedEventArgs); return; } } }
void CurrentApplication_CashBookTransactionUpdated(object sender, CashBookTransactionEventArgs e) { // If the updated transaction is in the list, then update the row highlights. UpdateRowHighlights(e); }
void ApplicationEvents_CashBookTransactionCreated(object sender, CashBookTransactionEventArgs e) { UpdateRowHighlights(e); }
void CurrentApplication_CashBookTransactionSelectionChanged(object sender, CashBookTransactionEventArgs e) { UpdateRowHighlightsNoDatabase(e); }
private void CurrentApplication_CashBookTransactionCreated(object sender, CashBookTransactionEventArgs e) { LoadTransactionGrid(); SelectGridTransaction(e.CashBookTransactionNo); }