/// <summary> /// Refresh the data in the grid and the details after the database content was changed on the server /// The current filter is not changed. The highlighted row index remains the same (if possible) after the refresh. /// </summary> public void RefreshAllData() { // Remember our current row position int nCurrentRowIndex = GetSelectedRowIndex(); int nCurrentBatchNumber = -1; if (FPreviouslySelectedDetailRow != null) { nCurrentBatchNumber = FPreviouslySelectedDetailRow.BatchNumber; } TFrmGiftBatch parentForm = (TFrmGiftBatch)ParentForm; Cursor prevCursor = parentForm.Cursor; parentForm.Cursor = Cursors.WaitCursor; if ((FMainDS != null) && (FMainDS.AGiftBatch != null)) { // Remove all data from our DataSet object - the grid will go empty! FMainDS.AGiftBatch.Rows.Clear(); } try { FPetraUtilsObject.DisableDataChangedEvent(); // Calling ApplyFilter() will automatically load the data for the currently selected year // because our ApplyFilterManual() code will do that for us FFilterAndFindObject.ApplyFilter(); // Now we can select the gift batch we had before (if it still exists on the grid) if (!SelectBatchNumber(nCurrentBatchNumber)) { // If batch is no longer in the grid then select the batch that is in the same position SelectRowInGrid(nCurrentRowIndex); } UpdateRecordNumberDisplay(); TUC_GiftTransactions TransactionForm = parentForm.GetTransactionsControl(); if (TransactionForm != null) { parentForm.EnableTransactions(grdDetails.Rows.Count > 1); // if the batch number = -1 then this is not a valid instance of TUC_GiftTransactions and we do not need to refresh if (TransactionForm.FBatchNumber != -1) { // This will update the transactions to match the current batch TransactionForm.RefreshAllData(); } } } finally { FPetraUtilsObject.EnableDataChangedEvent(); parentForm.Cursor = prevCursor; } }
private void HashTotalChanged(object sender, EventArgs e) { TTxtNumericTextBox txn = (TTxtNumericTextBox)sender; if (txn.NumberValueDecimal == null) { return; } Decimal HashTotal = Convert.ToDecimal(txtDetailHashTotal.NumberValueDecimal); Form p = ParentForm; if (p != null) { TUC_GiftTransactions t = ((TFrmGiftBatch)ParentForm).GetTransactionsControl(); if (t != null) { t.UpdateHashTotal(HashTotal); } } }