Esempio n. 1
0
        private bool DeleteRowManual(ARecurringGiftBatchRow ARowToDelete, ref string ACompletionMessage)
        {
            bool DeletionSuccessful = false;

            if (ARowToDelete == null)
            {
                return(false);
            }

            //Notify of deletion process
            TFrmRecurringGiftBatch MainForm = (TFrmRecurringGiftBatch)this.ParentForm;

            try
            {
                MainForm.FCurrentGiftBatchAction = TExtraGiftBatchChecks.GiftBatchAction.DELETING;

                FDeletedBatchRowIndex = grdDetails.GetFirstHighlightedRowIndex();

                DeletionSuccessful = FDeleteLogicObject.DeleteRowManual(ARowToDelete, ref FPreviouslySelectedDetailRow, ref ACompletionMessage);
            }
            finally
            {
                MainForm.FCurrentGiftBatchAction = TExtraGiftBatchChecks.GiftBatchAction.NONE;
            }

            return(DeletionSuccessful);
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public TUC_RecurringGiftBatches_Submit(TFrmPetraEditUtils APetraUtilsObject, Int32 ALedgerNumber, GiftBatchTDS AMainDS)
        {
            FPetraUtilsObject = APetraUtilsObject;
            FLedgerNumber     = ALedgerNumber;
            FMainDS           = AMainDS;

            FMyForm = (TFrmRecurringGiftBatch)FPetraUtilsObject.GetForm();
        }
Esempio n. 3
0
        /// <summary>
        /// load the batches into the grid
        /// </summary>
        /// <param name="ALedgerNumber"></param>
        public void LoadRecurringBatches(Int32 ALedgerNumber)
        {
            TFrmRecurringGiftBatch MyParentForm = (TFrmRecurringGiftBatch)this.ParentForm;

            MyParentForm.ClearCurrentSelections();

            // Get the data, populate the grid and re-select the current row (or first row if none currently selected) ...
            RefreshAllData();

            FBatchLoaded = true;
        }
Esempio n. 4
0
        /// <summary>
        /// Refresh the data in the grid and the details after the database content was changed on the server
        /// </summary>
        public void RefreshAllData(bool AShowStatusDialogOnLoad = true, bool AIsMessageRefresh = false)
        {
            TFrmRecurringGiftBatch myParentForm = (TFrmRecurringGiftBatch)ParentForm;

            // Remember our current row position
            int nCurrentRowIndex    = GetSelectedRowIndex();
            int nCurrentBatchNumber = -1;

            if ((myParentForm != null) && (myParentForm.InitialBatchNumber > 0))
            {
                nCurrentBatchNumber             = myParentForm.InitialBatchNumber;
                myParentForm.InitialBatchNumber = -1;
            }
            else if (AIsMessageRefresh)
            {
                if (FPetraUtilsObject.HasChanges && !myParentForm.SaveChanges())
                {
                    string msg = String.Format(Catalog.GetString("A validation error has occured on the Recurring Gift Batches" +
                                                                 " form while trying to refresh.{0}{0}" +
                                                                 "You will need to close and reopen the Recurring Gift Batches form to see the new batch" +
                                                                 " after you have fixed the validation error."),
                                               Environment.NewLine);

                    MessageBox.Show(msg, "Refresh Recurring Gift Batches");
                    return;
                }

                nCurrentBatchNumber = 1;
            }
            else if (FPreviouslySelectedDetailRow != null)
            {
                nCurrentBatchNumber = FPreviouslySelectedDetailRow.BatchNumber;
            }

            TFrmRecurringGiftBatch parentForm = (TFrmRecurringGiftBatch)ParentForm;
            Cursor prevCursor = null;

            if (parentForm != null)
            {
                prevCursor = parentForm.Cursor;
            }
            else
            {
                prevCursor = this.Cursor;
            }

            parentForm.Cursor = Cursors.WaitCursor;

            if ((FMainDS != null) && (FMainDS.ARecurringGiftBatch != null))
            {
                // Remove all data from our DataSet object - the grid will go empty!
                FMainDS.ARecurringGiftBatch.Rows.Clear();
            }

            try
            {
                FPetraUtilsObject.DisableDataChangedEvent();

                FMainDS.Merge(TRemote.MFinance.Gift.WebConnectors.LoadARecurringGiftBatch(FLedgerNumber));

                // Now we can select the gift batch we had before (if it still exists on the grid)
                for (int i = 0; (i < FMainDS.ARecurringGiftBatch.Rows.Count); i++)
                {
                    if (FMainDS.ARecurringGiftBatch[i].BatchNumber == nCurrentBatchNumber)
                    {
                        DataView dv            = ((DevAge.ComponentModel.BoundDataView)grdDetails.DataSource).DataView;
                        Int32    RowNumberGrid = DataUtilities.GetDataViewIndexByDataTableIndex(dv, FMainDS.ARecurringGiftBatch, i) + 1;

                        nCurrentRowIndex = RowNumberGrid;
                        break;
                    }
                }

                ShowDetails(nCurrentRowIndex);

                UpdateRecordNumberDisplay();

                TUC_RecurringGiftTransactions 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)
                    {
                        TransactionForm.ShowStatusDialogOnLoad = AShowStatusDialogOnLoad;

                        // This will update the transactions to match the current batch
                        TransactionForm.RefreshData();

                        TransactionForm.ShowStatusDialogOnLoad = true;
                    }
                }
            }
            finally
            {
                FPetraUtilsObject.EnableDataChangedEvent();
                parentForm.Cursor = prevCursor;
            }
        }
        private void DeleteAllGifts(System.Object sender, EventArgs e)
        {
            TFrmRecurringGiftBatch FMyForm = (TFrmRecurringGiftBatch)this.ParentForm;

            string CompletionMessage  = string.Empty;
            int    BatchNumberToClear = FBatchNumber;

            if ((FPreviouslySelectedDetailRow == null))
            {
                return;
            }
            else if (!FFilterAndFindObject.IsActiveFilterEqualToBase)
            {
                MessageBox.Show(Catalog.GetString("Please remove the filter before attempting to delete all Recurring Gifts in this batch."),
                                Catalog.GetString("Delete All Recurring Gifts"));

                return;
            }

            //Backup the Dataset for reversion purposes
            GiftBatchTDS BackupDS = (GiftBatchTDS)FMainDS.Copy();

            BackupDS.Merge(FMainDS);

            if (MessageBox.Show(String.Format(Catalog.GetString(
                                                  "You have chosen to delete all Gifts from Recurring Batch: {0}.{1}{1}Are you sure you want to delete all?"),
                                              BatchNumberToClear,
                                              Environment.NewLine),
                                Catalog.GetString("Confirm Delete All"),
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question,
                                MessageBoxDefaultButton.Button2) != System.Windows.Forms.DialogResult.Yes)
            {
                return;
            }

            try
            {
                this.Cursor = Cursors.WaitCursor;
                //Specify current action
                FMyForm.FCurrentGiftBatchAction = Logic.TExtraGiftBatchChecks.GiftBatchAction.DELETINGTRANS;

                //clear any transactions currently being editied in the Transaction Tab
                ClearCurrentSelection(0, false);

                //Now delete all Recurring Gift data for current batch
                DeleteRecurringBatchGiftData(BatchNumberToClear);

                FBatchRow.BatchTotal             = 0;
                txtBatchTotal.NumberValueDecimal = 0;

                // Be sure to set the last Recurring Gift number in the parent table before saving all the changes
                FBatchRow.LastGiftNumber = 0;

                FPetraUtilsObject.SetChangedFlag();

                // save changes
                if (((TFrmRecurringGiftBatch)ParentForm).SaveChangesManual())
                {
                    CompletionMessage = Catalog.GetString("All Recurring Gifts and their details deleted successfully.");

                    MessageBox.Show(CompletionMessage,
                                    Catalog.GetString("Recurring Gifts Deletion"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
                else
                {
                    CompletionMessage = Catalog.GetString("All Recurring Gifts and their details have been deleted but saving the changes failed!");

                    MessageBox.Show(CompletionMessage,
                                    Catalog.GetString("All Gifts Deletion"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                //Revert to previous state
                RevertDataSet(FMainDS, BackupDS);

                TLogging.LogException(ex, Utilities.GetMethodSignature());
                throw;
            }
            finally
            {
                FMyForm.FCurrentGiftBatchAction = Logic.TExtraGiftBatchChecks.GiftBatchAction.NONE;
                this.Cursor = Cursors.Default;
            }

            SetGiftDetailDefaultView();
            FFilterAndFindObject.ApplyFilter();

            if (grdDetails.Rows.Count < 2)
            {
                ShowDetails(null);
                UpdateControlsProtection();
            }

            UpdateRecordNumberDisplay();
        }
        private bool OnDeleteRowManual(GiftBatchTDSARecurringGiftDetailRow ARowToDelete, ref string ACompletionMessage)
        {
            //TODO: Make this like deleton on GL Transactions form
            // e.g. pass copy to delete method on server...
            //GiftBatchTDS TempDS = (GiftBatchTDS)FMainDS.Copy();
            //TempDS.Merge(FMainDS);

            bool DeletionSuccessful = false;

            ACompletionMessage = string.Empty;

            if (FBatchRow == null)
            {
                FBatchRow = GetRecurringBatchRow();
            }

            if (ARowToDelete == null)
            {
                return(false);
            }

            int  CurrentBatchNo   = ARowToDelete.BatchNumber;
            bool RowToDeleteIsNew = (ARowToDelete.RowState == DataRowState.Added);
            int  CurrentRowIndex  = GetSelectedRowIndex();

            TFrmRecurringGiftBatch FMyForm = (TFrmRecurringGiftBatch)this.ParentForm;

            GiftBatchTDS BackupMainDS = null;

            int    SelectedDetailNumber                 = ARowToDelete.DetailNumber;
            int    RecurringGiftToDeleteTransNo         = 0;
            string FilterAllRecurringGiftsOfBatch       = String.Empty;
            string FilterAllRecurringGiftDetailsOfBatch = String.Empty;

            int DetailRowCount = FGiftDetailView.Count;

            try
            {
                this.Cursor = Cursors.WaitCursor;
                //Specify current action
                FMyForm.FCurrentGiftBatchAction = Logic.TExtraGiftBatchChecks.GiftBatchAction.DELETINGTRANS;
                //Speeds up deletion of larger gift sets
                FMainDS.EnforceConstraints = false;
                // temporarily disable  New Donor Warning
                FMyForm.NewDonorWarning = false;

                //Backup the Dataset for reversion purposes
                BackupMainDS = (GiftBatchTDS)FMainDS.GetChangesTyped(false);

                //Don't run an inactive fields check on this batch
                FMyForm.GetBatchControl().UpdateRecurringBatchDictionary(CurrentBatchNo);

                //Delete current row
                ARowToDelete.RejectChanges();

                if (!RowToDeleteIsNew)
                {
                    ShowDetails(ARowToDelete);
                }

                ARowToDelete.Delete();

                //If there existed (before the delete row above) more than one detail row, then no need to delete Recurring Gift header row
                if (DetailRowCount > 1)
                {
                    ACompletionMessage = Catalog.GetString("Recurring Gift Detail row deleted successfully!");

                    FGiftSelectedForDeletionFlag = false;

                    foreach (DataRowView rv in FGiftDetailView)
                    {
                        GiftBatchTDSARecurringGiftDetailRow row = (GiftBatchTDSARecurringGiftDetailRow)rv.Row;

                        if (row.DetailNumber > SelectedDetailNumber)
                        {
                            row.DetailNumber--;
                        }
                    }

                    FGift.LastDetailNumber--;
                }
                else
                {
                    ACompletionMessage = Catalog.GetString("Recurring Gift deleted successfully!");

                    RecurringGiftToDeleteTransNo = FGift.GiftTransactionNumber;

                    // Reduce all Recurring Gift Detail row Transaction numbers by 1 if they are greater then Recurring Gift to be deleted
                    FilterAllRecurringGiftDetailsOfBatch = String.Format("{0}={1} And {2}>{3}",
                                                                         ARecurringGiftDetailTable.GetBatchNumberDBName(),
                                                                         FBatchNumber,
                                                                         ARecurringGiftDetailTable.GetGiftTransactionNumberDBName(),
                                                                         RecurringGiftToDeleteTransNo);

                    DataView RecurringGiftDetailView = new DataView(FMainDS.ARecurringGiftDetail);
                    RecurringGiftDetailView.RowFilter = FilterAllRecurringGiftDetailsOfBatch;
                    RecurringGiftDetailView.Sort      = String.Format("{0} ASC", ARecurringGiftDetailTable.GetGiftTransactionNumberDBName());

                    foreach (DataRowView rv in RecurringGiftDetailView)
                    {
                        GiftBatchTDSARecurringGiftDetailRow row = (GiftBatchTDSARecurringGiftDetailRow)rv.Row;

                        row.GiftTransactionNumber--;
                    }

                    //Cannot delete the Recurring Gift row, just copy the data of rows above down by 1 row
                    // and then mark the top row for deletion
                    //In other words, bubble the Recurring Gift row to be deleted to the top
                    FilterAllRecurringGiftsOfBatch = String.Format("{0}={1} And {2}>={3}",
                                                                   ARecurringGiftTable.GetBatchNumberDBName(),
                                                                   FBatchNumber,
                                                                   ARecurringGiftTable.GetGiftTransactionNumberDBName(),
                                                                   RecurringGiftToDeleteTransNo);

                    DataView RecurringGiftView = new DataView(FMainDS.ARecurringGift);
                    RecurringGiftView.RowFilter = FilterAllRecurringGiftsOfBatch;
                    RecurringGiftView.Sort      = String.Format("{0} ASC", ARecurringGiftTable.GetGiftTransactionNumberDBName());

                    ARecurringGiftRow RecurringGiftRowToReceive  = null;
                    ARecurringGiftRow RecurringGiftRowToCopyDown = null;
                    ARecurringGiftRow RecurringGiftRowCurrent    = null;

                    int currentRecurringGiftTransNo = 0;

                    foreach (DataRowView gv in RecurringGiftView)
                    {
                        RecurringGiftRowCurrent = (ARecurringGiftRow)gv.Row;

                        currentRecurringGiftTransNo = RecurringGiftRowCurrent.GiftTransactionNumber;

                        if (currentRecurringGiftTransNo > RecurringGiftToDeleteTransNo)
                        {
                            RecurringGiftRowToCopyDown = RecurringGiftRowCurrent;

                            //Copy column values down
                            for (int j = 3; j < RecurringGiftRowToCopyDown.Table.Columns.Count; j++)
                            {
                                //Update all columns except the pk fields that remain the same
                                if (!RecurringGiftRowToCopyDown.Table.Columns[j].ColumnName.EndsWith("_text"))
                                {
                                    RecurringGiftRowToReceive[j] = RecurringGiftRowToCopyDown[j];
                                }
                            }
                        }

                        if (currentRecurringGiftTransNo == FBatchRow.LastGiftNumber)
                        {
                            //Mark last record for deletion
                            RecurringGiftRowCurrent.ChargeStatus = MFinanceConstants.MARKED_FOR_DELETION;
                        }

                        //Will always be previous row
                        RecurringGiftRowToReceive = RecurringGiftRowCurrent;
                    }

                    FPreviouslySelectedDetailRow = null;
                    FGiftSelectedForDeletionFlag = true;
                    FBatchRow.LastGiftNumber--;
                }

                //Save and check for inactive values and ex-workers and anonymous gifts
                //  in other unsaved Batches
                FPetraUtilsObject.SetChangedFlag();

                if (!FMyForm.SaveChangesManual(Logic.TExtraGiftBatchChecks.GiftBatchAction.DELETINGTRANS, false, false))
                {
                    FMyForm.GetBatchControl().UpdateRecurringBatchDictionary();

                    MessageBox.Show(Catalog.GetString("The gift detail has been deleted but the changes are not saved!"),
                                    Catalog.GetString("Deletion Warning"),
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);

                    ACompletionMessage = string.Empty;

                    if (FGiftSelectedForDeletionFlag)
                    {
                        FGiftSelectedForDeletionFlag = false;
                        SetBatchLastGiftNumber();
                        UpdateControlsProtection();
                    }

                    UpdateTotals();

                    return(false);
                }

                //Clear current batch's gift data and reload from server
                RefreshRecurringBatchGiftData(FBatchNumber, true);

                DeletionSuccessful = true;
            }
            catch (Exception ex)
            {
                //Revert to previous state
                RevertDataSet(FMainDS, BackupMainDS, CurrentRowIndex);

                TLogging.LogException(ex, Utilities.GetMethodSignature());
                throw;
            }
            finally
            {
                FMyForm.NewDonorWarning         = true;
                FMainDS.EnforceConstraints      = true;
                FMyForm.FCurrentGiftBatchAction = Logic.TExtraGiftBatchChecks.GiftBatchAction.NONE;
                this.Cursor = Cursors.Default;
            }

            SetGiftDetailDefaultView();
            FFilterAndFindObject.ApplyFilter();
            UpdateRecordNumberDisplay();

            return(DeletionSuccessful);
        }
Esempio n. 7
0
        /// <summary>
        /// Check for inactive field values
        /// </summary>
        /// <param name="AAction"></param>
        /// <returns></returns>
        public bool AllowInactiveFieldValues(TExtraGiftBatchChecks.GiftBatchAction AAction)
        {
            TFrmRecurringGiftBatch MainForm = (TFrmRecurringGiftBatch)this.ParentForm;

            bool InSubmitting    = (AAction == TExtraGiftBatchChecks.GiftBatchAction.SUBMITTING);
            bool InDeleting      = (AAction == TExtraGiftBatchChecks.GiftBatchAction.DELETING);
            bool InDeletingTrans = (AAction == TExtraGiftBatchChecks.GiftBatchAction.DELETINGTRANS);

            int CurrentBatch = FPreviouslySelectedDetailRow.BatchNumber;

            //Variables for building warning message
            string        WarningMessage = string.Empty;
            string        WarningHeader  = string.Empty;
            StringBuilder WarningList    = new StringBuilder();

            //Find batches that have changed
            List <ARecurringGiftBatchRow> BatchesToCheck = MainForm.GetUnsavedBatchRowsList(CurrentBatch);
            List <int> BatchesWithInactiveValues         = new List <int>();

            if (BatchesToCheck.Count > 0)
            {
                int    currentBatchListNo;
                string batchNoList = string.Empty;

                int    numInactiveFieldsPresent = 0;
                string bankCostCentre;
                string bankAccount;

                foreach (ARecurringGiftBatchRow gBR in BatchesToCheck)
                {
                    currentBatchListNo = gBR.BatchNumber;

                    bool checkingCurrentBatch = (currentBatchListNo == CurrentBatch);

                    bool batchVerified     = false;
                    bool batchExistsInDict = FRecurringBatchesVerifiedOnSavingDict.TryGetValue(currentBatchListNo, out batchVerified);

                    if (batchExistsInDict)
                    {
                        if (batchVerified && !(InSubmitting && checkingCurrentBatch && FWarnOfInactiveValuesOnSubmitting))
                        {
                            continue;
                        }
                    }
                    else if (!(InDeleting && checkingCurrentBatch))
                    {
                        FRecurringBatchesVerifiedOnSavingDict.Add(currentBatchListNo, false);
                    }

                    //If processing batch about to be submitted, only warn according to user preferences
                    if ((InSubmitting && checkingCurrentBatch && !FWarnOfInactiveValuesOnSubmitting) ||
                        (InDeleting && checkingCurrentBatch))
                    {
                        continue;
                    }

                    //Check for inactive Bank Cost Centre & Account
                    bankCostCentre = gBR.BankCostCentre;
                    bankAccount    = gBR.BankAccountCode;

                    if (!FAccountAndCostCentreLogicObject.CostCentreIsActive(bankCostCentre))
                    {
                        WarningList.AppendFormat("   Cost Centre '{0}' in batch: {1}{2}",
                                                 gBR.BankAccountCode,
                                                 gBR.BatchNumber,
                                                 Environment.NewLine);

                        numInactiveFieldsPresent++;
                        BatchesWithInactiveValues.Add(currentBatchListNo);
                    }

                    if (!FAccountAndCostCentreLogicObject.AccountIsActive(bankAccount))
                    {
                        WarningList.AppendFormat(" Bank Account '{0}' in batch: {1}{2}",
                                                 gBR.BankAccountCode,
                                                 gBR.BatchNumber,
                                                 Environment.NewLine);

                        numInactiveFieldsPresent++;

                        if (!BatchesWithInactiveValues.Contains(currentBatchListNo))
                        {
                            BatchesWithInactiveValues.Add(currentBatchListNo);
                        }
                    }
                }

                if (numInactiveFieldsPresent > 0)
                {
                    string batchList           = string.Empty;
                    string otherChangedBatches = string.Empty;

                    BatchesWithInactiveValues.Sort();

                    //Update the dictionary
                    foreach (int batch in BatchesWithInactiveValues)
                    {
                        if (batch == CurrentBatch)
                        {
                            if ((!InSubmitting && (FRecurringBatchesVerifiedOnSavingDict[batch] == false)) ||
                                (InSubmitting && FWarnOfInactiveValuesOnSubmitting))
                            {
                                FRecurringBatchesVerifiedOnSavingDict[batch] = true;
                                batchList += (string.IsNullOrEmpty(batchList) ? "" : ", ") + batch.ToString();
                            }
                        }
                        else if (FRecurringBatchesVerifiedOnSavingDict[batch] == false)
                        {
                            FRecurringBatchesVerifiedOnSavingDict[batch] = true;
                            batchList += (string.IsNullOrEmpty(batchList) ? "" : ", ") + batch.ToString();
                            //Build a list of all batches except current batch
                            otherChangedBatches += (string.IsNullOrEmpty(otherChangedBatches) ? "" : ", ") + batch.ToString();
                        }
                    }

                    //Create header message
                    WarningHeader  = "{0} inactive value(s) found in recurring batch{1}{4}{4}Do you still want to continue with ";
                    WarningHeader += (!InDeletingTrans ? AAction.ToString().ToLower() : "deleting gift detail(s) and saving changes to") +
                                     " batch: {2}";
                    WarningHeader += (otherChangedBatches.Length > 0 ? " and with saving: {3}" : "") + " ?{4}";

                    if (!InSubmitting || (otherChangedBatches.Length > 0))
                    {
                        WarningHeader += "{4}(You will only be warned once about inactive values when saving any batch!){4}";
                    }

                    //Handle plural
                    batchList = (otherChangedBatches.Length > 0 ? "es: " : ": ") + batchList;

                    WarningMessage = String.Format(Catalog.GetString(WarningHeader + "{4}Inactive values:{4}{5}{4}{6}{5}"),
                                                   numInactiveFieldsPresent,
                                                   batchList,
                                                   CurrentBatch,
                                                   otherChangedBatches,
                                                   Environment.NewLine,
                                                   new String('-', 44),
                                                   WarningList);

                    TFrmExtendedMessageBox extendedMessageBox = new TFrmExtendedMessageBox((TFrmRecurringGiftBatch)ParentForm);

                    string header = string.Empty;

                    if (InSubmitting)
                    {
                        header = "Submit";
                    }
                    else if (InDeleting)
                    {
                        header = "Delete";
                    }
                    else if (InDeletingTrans)
                    {
                        header = "Delete Gift Detail From";
                    }
                    else
                    {
                        header = "Save";
                    }

                    return(extendedMessageBox.ShowDialog(WarningMessage,
                                                         Catalog.GetString(header + " Recurring Gift Batch"), string.Empty,
                                                         TFrmExtendedMessageBox.TButtons.embbYesNo,
                                                         TFrmExtendedMessageBox.TIcon.embiQuestion) == TFrmExtendedMessageBox.TResult.embrYes);
                }
            }

            return(true);
        }
Esempio n. 8
0
        private void SubmitBatch(System.Object sender, System.EventArgs e)
        {
            bool Success = false;

            if ((GetSelectedRowIndex() < 0) || (FPreviouslySelectedDetailRow == null))
            {
                MessageBox.Show(Catalog.GetString("Please select a Recurring Gift Batch before submitting!"));
                return;
            }

            TFrmRecurringGiftBatch MainForm  = (TFrmRecurringGiftBatch)ParentForm;
            TFrmStatusDialog       dlgStatus = new TFrmStatusDialog(FPetraUtilsObject.GetForm());
            bool LoadDialogVisible           = false;

            try
            {
                Cursor = Cursors.WaitCursor;
                MainForm.FCurrentGiftBatchAction = TExtraGiftBatchChecks.GiftBatchAction.SUBMITTING;

                dlgStatus.Show();
                LoadDialogVisible       = true;
                dlgStatus.Heading       = String.Format(Catalog.GetString("Recurring Gift Batch {0}"), FSelectedBatchNumber);
                dlgStatus.CurrentStatus = Catalog.GetString("Loading gifts ready for submitting...");

                if (!LoadAllBatchData(FSelectedBatchNumber))
                {
                    Cursor = Cursors.Default;
                    MessageBox.Show(Catalog.GetString("The Recurring Gift Batch is empty!"),
                                    Catalog.GetString("Submit Gift Batch"),
                                    MessageBoxButtons.OK, MessageBoxIcon.Stop);

                    dlgStatus.Close();
                    LoadDialogVisible = false;
                    return;
                }

                dlgStatus.Close();
                LoadDialogVisible = false;

                Success = FSubmitLogicObject.SubmitBatch(FPreviouslySelectedDetailRow,
                                                         FWarnOfInactiveValuesOnSubmitting,
                                                         FDonorZeroIsValid,
                                                         FRecipientZeroIsValid);
            }
            catch (Exception ex)
            {
                TLogging.LogException(ex, Utilities.GetMethodSignature());
                throw;
            }
            finally
            {
                if (LoadDialogVisible)
                {
                    dlgStatus.Close();
                    LoadDialogVisible = false;
                }

                MainForm.FCurrentGiftBatchAction = TExtraGiftBatchChecks.GiftBatchAction.NONE;
                Cursor = Cursors.Default;
            }
        }