/// <summary> /// this supports the batch export files from Petra 2.x. /// Each line starts with a type specifier, B for batch, J for journal, T for transaction /// </summary> private void BtnOK_Click(object sender, EventArgs e) { FExportFileName = txtFilename.Text; String fileContents = string.Empty; Int32 budgetCount = 0; if (FExportFileName == String.Empty) { MessageBox.Show(Catalog.GetString("Please choose a location for the Export File."), Catalog.GetString("Error"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (!FExportFileName.EndsWith(".csv", StringComparison.CurrentCultureIgnoreCase) && !FExportFileName.EndsWith(".txt", StringComparison.CurrentCultureIgnoreCase)) { FExportFileName += ".csv"; txtFilename.Text = FExportFileName; } if (!Directory.Exists(Path.GetDirectoryName(FExportFileName))) { MessageBox.Show(Catalog.GetString("Please select an existing directory for this file!"), Catalog.GetString("Error"), MessageBoxButtons.OK, MessageBoxIcon.Error); FExportFileName = string.Empty; return; } if (File.Exists(FExportFileName)) { if (MessageBox.Show(Catalog.GetString("The file already exists. Is it OK to overwrite it?"), Catalog.GetString("Export Budget"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No) { return; } try { File.Delete(FExportFileName); } catch (Exception ex) { MessageBox.Show(String.Format( Catalog.GetString( "Failed to delete the file. Maybe it is already open in another application? The system message was:{0}{1}"), Environment.NewLine, ex.Message), Catalog.GetString("Export Budget"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } //Hashtable requestParams = new Hashtable(); //requestParams.Add("ALedgerNumber", FLedgerNumber); //requestParams.Add("Delimiter", ConvertDelimiter(cmbDelimiter.GetSelectedString(), false)); //requestParams.Add("DateFormatString", cmbDateFormat.GetSelectedString()); //requestParams.Add("NumberFormat", ConvertNumberFormat(cmbNumberFormat)); TVerificationResultCollection AMessages; string[] delims = new string[1]; delims[0] = ConvertDelimiter(cmbDelimiter.GetSelectedString(), false); TFrmStatusDialog dlgStatus = null; try { this.Cursor = Cursors.WaitCursor; dlgStatus = new TFrmStatusDialog(FPetraUtilsObject.GetForm()); dlgStatus.Show(); dlgStatus.Heading = Catalog.GetString("Exporting Budgets"); dlgStatus.CurrentStatus = Catalog.GetString("Exporting budget data for this year and next..."); budgetCount = TRemote.MFinance.Budget.WebConnectors.ExportBudgets(FLedgerNumber, FExportFileName, delims, ref fileContents, ref FBudgetDS, out AMessages); dlgStatus.Close(); dlgStatus = null; this.Cursor = Cursors.Default; if ((AMessages != null) && (AMessages.Count > 0)) { if (!TVerificationHelper.IsNullOrOnlyNonCritical(AMessages)) { MessageBox.Show(AMessages.BuildVerificationResultString(), Catalog.GetString("Error"), MessageBoxButtons.OK, MessageBoxIcon.Error); FExportFileName = string.Empty; return; } else { MessageBox.Show(AMessages.BuildVerificationResultString(), Catalog.GetString("Warnings"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } SaveUserDefaults(); if (budgetCount == 0) { MessageBox.Show(Catalog.GetString("There are no Budgets matching your criteria"), Catalog.GetString("Error"), MessageBoxButtons.OK, MessageBoxIcon.Error); FExportFileName = string.Empty; return; } StreamWriter sw1 = new StreamWriter(FExportFileName); sw1.Write(fileContents); sw1.Close(); } catch (Exception ex) { TLogging.LogException(ex, Utilities.GetMethodSignature()); throw; } finally { this.Cursor = Cursors.Default; if (dlgStatus != null) { dlgStatus.Close(); dlgStatus = null; } } bool ShowExportedFileInExplorer = false; // Offer the client the chance to open the file in Excel or whatever if (MessageBox.Show(String.Format(Catalog.GetString( "{0} Budget rows were exported successfully! Would you like to open the file in your default application?"), budgetCount.ToString()), Catalog.GetString("Budget Export"), MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes) { try { ProcessStartInfo si = new ProcessStartInfo(FExportFileName); si.UseShellExecute = true; si.Verb = "open"; Process p = new Process(); p.StartInfo = si; p.Start(); } catch { MessageBox.Show(Catalog.GetString( "Unable to launch the default application to open: '") + FExportFileName + "'!", Catalog.GetString( "Budget Export"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); ShowExportedFileInExplorer = true; } } else { ShowExportedFileInExplorer = true; } if (ShowExportedFileInExplorer) { //If windows start Windows File Explorer TExecutingOSEnum osVersion = Utilities.DetermineExecutingOS(); if ((osVersion >= TExecutingOSEnum.eosWinXP) && (osVersion < TExecutingOSEnum.oesUnsupportedPlatform)) { try { Process.Start("explorer.exe", string.Format("/select,\"{0}\"", FExportFileName)); } catch { MessageBox.Show(Catalog.GetString( "Unable to launch Windows File Explorer to open: '") + FExportFileName + "'!", Catalog.GetString( "Budget Export"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } Close(); }
private void SubmitBatch(System.Object sender, System.EventArgs e) { bool Success = false; bool LoadDialogVisible = false; TFrmStatusDialog dlgStatus = new TFrmStatusDialog(FPetraUtilsObject.GetForm()); if ((GetSelectedRowIndex() < 0) || (FPreviouslySelectedDetailRow == null)) { MessageBox.Show(Catalog.GetString("Please select a Recurring Batch before submitting.")); return; } try { bool submittingAlreadyConfirmed = false; Cursor = Cursors.WaitCursor; 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("Posting failed"), MessageBoxButtons.OK, MessageBoxIcon.Stop); dlgStatus.Close(); LoadDialogVisible = false; return; } dlgStatus.CurrentStatus = Catalog.GetString("Checking for inactive values..."); if (!AllowInactiveFieldValues(ref submittingAlreadyConfirmed)) { dlgStatus.Close(); LoadDialogVisible = false; return; } dlgStatus.Close(); LoadDialogVisible = false; Success = FSubmitLogicObject.SubmitBatch(FPreviouslySelectedDetailRow, txtDetailHashTotal, ref submittingAlreadyConfirmed); } catch (Exception ex) { TLogging.LogException(ex, Utilities.GetMethodSignature()); throw; } finally { if (LoadDialogVisible) { dlgStatus.Close(); LoadDialogVisible = false; } Cursor = Cursors.Default; } }
private void SubmitBatch(System.Object sender, EventArgs e) { if ((GetSelectedRowIndex() < 0) || (FPreviouslySelectedDetailRow == null)) { MessageBox.Show(Catalog.GetString("Please select a Recurring Batch before submitting!")); return; } TFrmRecurringGLBatch MainForm = (TFrmRecurringGLBatch)ParentForm; TFrmStatusDialog dlgStatus = new TFrmStatusDialog(FPetraUtilsObject.GetForm()); TFrmRecurringGLBatchSubmit SubmitForm = null; bool LoadDialogVisible = false; try { Cursor = Cursors.WaitCursor; MainForm.FCurrentGLBatchAction = TGLBatchEnums.GLBatchAction.SUBMITTING; dlgStatus.Show(); LoadDialogVisible = true; dlgStatus.Heading = String.Format(Catalog.GetString("Recurring GL Batch {0}"), FSelectedBatchNumber); dlgStatus.CurrentStatus = Catalog.GetString("Loading journals and transactions ready for submitting..."); if (!LoadAllBatchData()) { Cursor = Cursors.Default; MessageBox.Show(Catalog.GetString("The Recurring GL Batch is empty!"), Catalog.GetString("Submit GL Batch"), MessageBoxButtons.OK, MessageBoxIcon.Stop); dlgStatus.Close(); LoadDialogVisible = false; return; } dlgStatus.Close(); LoadDialogVisible = false; //Make sure that all control data is in dataset MainForm.GetLatestControlData(); //Save and check for inactive values if (FPetraUtilsObject.HasChanges) { //Keep this conditional check separate from the one above so that it only gets called // when necessary and doesn't result in the executon of the same method if (!MainForm.SaveChangesManual(MainForm.FCurrentGLBatchAction)) { return; } } else { //This has to be called here because if there are no changes then the DataSavingValidating // method which calls the method below, will not run. if (!MainForm.GetTransactionsControl().AllowInactiveFieldValues(FLedgerNumber, FSelectedBatchNumber, MainForm.FCurrentGLBatchAction)) { return; } } if ((FPreviouslySelectedDetailRow.BatchControlTotal != 0) && (FPreviouslySelectedDetailRow.BatchDebitTotal != FPreviouslySelectedDetailRow.BatchControlTotal)) { MessageBox.Show(String.Format(Catalog.GetString( "The recurring gl batch total ({0}) for batch {1} does not equal the hash total ({2})."), FPreviouslySelectedDetailRow.BatchDebitTotal, FPreviouslySelectedDetailRow.BatchNumber, FPreviouslySelectedDetailRow.BatchControlTotal)); txtDetailBatchControlTotal.Focus(); txtDetailBatchControlTotal.SelectAll(); return; } SubmitForm = new TFrmRecurringGLBatchSubmit(FPetraUtilsObject.GetForm()); ParentForm.ShowInTaskbar = false; GLBatchTDS submitRecurringDS = (GLBatchTDS)FMainDS.Clone(); int currentBatch = FPreviouslySelectedDetailRow.BatchNumber; submitRecurringDS.Merge(TRemote.MFinance.GL.WebConnectors.LoadARecurringBatchAndRelatedTables(FLedgerNumber, FSelectedBatchNumber)); SubmitForm.SubmitMainDS = submitRecurringDS; SubmitForm.ShowDialog(); } catch (Exception ex) { TLogging.LogException(ex, Utilities.GetMethodSignature()); throw; } finally { if (LoadDialogVisible) { dlgStatus.Close(); LoadDialogVisible = false; } if (SubmitForm != null) { SubmitForm.Dispose(); ParentForm.ShowInTaskbar = true; } MainForm.FCurrentGLBatchAction = TGLBatchEnums.GLBatchAction.NONE; Cursor = Cursors.Default; } if (FPetraUtilsObject.HasChanges) { // save first, then submit if (!((TFrmRecurringGLBatch)ParentForm).SaveChanges()) { // saving failed, therefore do not try to post MessageBox.Show(Catalog.GetString( "The recurring batch was not submitted due to problems during saving; ") + Environment.NewLine + Catalog.GetString("Please fix the batch first and then submit it."), Catalog.GetString("Submit Failure"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } }
/// <summary> /// load the gifts into the grid /// </summary> /// <param name="ALedgerNumber"></param> /// <param name="ABatchNumber"></param> /// <param name="ABatchStatus"></param> /// <param name="AForceLoadFromServer">Set to true to get data from the server even though it is apparently the current batch number and status</param> /// <returns>True if gift transactions were loaded from server, false if transactions had been loaded already.</returns> public bool LoadGifts(Int32 ALedgerNumber, Int32 ABatchNumber, string ABatchStatus, bool AForceLoadFromServer = false) { //Set key flags bool FirstGiftTransLoad = (FLedgerNumber == -1); bool SameCurrentBatch = ((FLedgerNumber == ALedgerNumber) && (FBatchNumber == ABatchNumber) && (FBatchStatus == ABatchStatus) && !AForceLoadFromServer); FBatchRow = GetBatchRow(); if ((FBatchRow == null) && (GetAnyBatchRow(ABatchNumber) == null)) { MessageBox.Show(String.Format("Cannot load transactions for Gift Batch {0} as the batch is not currently loaded!", ABatchNumber)); return(false); } //Set key values from Batch FLedgerNumber = ALedgerNumber; FBatchNumber = ABatchNumber; FBatchCurrencyCode = FBatchRow.CurrencyCode; FBatchMethodOfPayment = FBatchRow.MethodOfPaymentCode; FBatchStatus = ABatchStatus; FBatchUnpostedFlag = (FBatchStatus == MFinanceConstants.BATCH_UNPOSTED); if (FirstGiftTransLoad) { InitialiseControls(); } UpdateCurrencySymbols(FBatchCurrencyCode); //Check if the same batch is selected, so no need to apply filter if (SameCurrentBatch) { //Same as previously selected and we have not been asked to force a full refresh if (FBatchUnpostedFlag && (GetSelectedRowIndex() > 0)) { if (FGLEffectivePeriodHasChangedFlag) { //Just in case for the currently selected row, the date field has not been updated FGLEffectivePeriodHasChangedFlag = false; GetSelectedDetailRow().DateEntered = FBatchRow.GlEffectiveDate; dtpDateEntered.Date = FBatchRow.GlEffectiveDate; } GetDetailsFromControls(GetSelectedDetailRow()); } UpdateControlsProtection(); if (FBatchUnpostedFlag && ((FBatchCurrencyCode != FBatchRow.CurrencyCode) || (FBatchExchangeRateToBase != FBatchRow.ExchangeRateToBase))) { UpdateBaseAmount(false); } return(false); } //New Batch FCurrentGiftInBatch = 0; //New set of transactions to be loaded TFrmStatusDialog dlgStatus = new TFrmStatusDialog(FPetraUtilsObject.GetForm()); if (FShowStatusDialogOnLoadFlag == true) { dlgStatus.Show(); FShowStatusDialogOnLoadFlag = false; dlgStatus.Heading = String.Format(Catalog.GetString("Batch {0}"), ABatchNumber); dlgStatus.CurrentStatus = Catalog.GetString("Loading transactions ..."); } FGiftTransactionsLoadedFlag = false; FSuppressListChangedFlag = false; //Apply new filter FPreviouslySelectedDetailRow = null; grdDetails.DataSource = null; // if this form is readonly, then we need all codes, because old (inactive) codes might have been used if (FirstGiftTransLoad || (FActiveOnlyFlag == (ViewMode || !FBatchUnpostedFlag))) { FActiveOnlyFlag = !(ViewMode || !FBatchUnpostedFlag); dlgStatus.CurrentStatus = Catalog.GetString("Initialising controls ..."); try { //Without this, the Save button enables even for Posted batches! FPetraUtilsObject.SuppressChangeDetection = true; TFinanceControls.InitialiseMotivationGroupList(ref cmbDetailMotivationGroupCode, FLedgerNumber, FActiveOnlyFlag); TFinanceControls.InitialiseMotivationDetailList(ref cmbMotivationDetailCode, FLedgerNumber, FActiveOnlyFlag); TFinanceControls.InitialiseMethodOfGivingCodeList(ref cmbDetailMethodOfGivingCode, FActiveOnlyFlag); TFinanceControls.InitialiseMethodOfPaymentCodeList(ref cmbDetailMethodOfPaymentCode, FActiveOnlyFlag); TFinanceControls.InitialisePMailingList(ref cmbDetailMailingCode, FActiveOnlyFlag); } finally { FPetraUtilsObject.SuppressChangeDetection = false; } } // This sets the incomplete filter but does check the panel enabled state ShowData(); // This sets the main part of the filter but excluding the additional items set by the user GUI // It gets the right sort order SetGiftDetailDefaultView(); // only load from server if there are no transactions loaded yet for this batch // otherwise we would overwrite transactions that have already been modified if (FMainDS.AGiftDetail.DefaultView.Count == 0) { dlgStatus.CurrentStatus = Catalog.GetString("Requesting transactions from server ..."); //Load all partners in Batch FMainDS.DonorPartners.Merge(TRemote.MFinance.Gift.WebConnectors.LoadAllPartnerDataForBatch(ALedgerNumber, ABatchNumber)); //LoadAllPartnerDataForBatch(); //Include Donor fields LoadGiftDataForBatch(ALedgerNumber, ABatchNumber); } //Check if need to update batch period in each gift if (FBatchUnpostedFlag) { dlgStatus.CurrentStatus = Catalog.GetString("Updating batch period ..."); ((TFrmGiftBatch)ParentForm).GetBatchControl().UpdateBatchPeriod(); } // Now we set the full filter FFilterAndFindObject.ApplyFilter(); UpdateRecordNumberDisplay(); FFilterAndFindObject.SetRecordNumberDisplayProperties(); SelectRowInGrid(1); UpdateControlsProtection(); dlgStatus.CurrentStatus = Catalog.GetString("Updating totals for the batch ..."); UpdateTotals(); if ((FPreviouslySelectedDetailRow != null) && (FBatchUnpostedFlag)) { bool disableSave = (FBatchRow.RowState == DataRowState.Unchanged && !FPetraUtilsObject.HasChanges); if (disableSave && FPetraUtilsObject.HasChanges && !DataUtilities.DataRowColumnsHaveChanged(FBatchRow)) { FPetraUtilsObject.DisableSaveButton(); } } FGiftTransactionsLoadedFlag = true; dlgStatus.Close(); return(true); }
/// <summary> /// Imports budgets from a file /// </summary> /// <param name="ACurrentBudgetYear"></param> /// <param name="AMainDS"></param> public void ImportBudget(int ACurrentBudgetYear, ref BudgetTDS AMainDS) { TVerificationResultCollection Messages = new TVerificationResultCollection(); int BudgetsImported = 0; int BudgetsAdded = 0; int BudgetsUpdated = 0; int BudgetsFailed = 0; if (FPetraUtilsObject.HasChanges) { // saving failed, therefore do not try to post MessageBox.Show(Catalog.GetString("Please save before trying to import!"), Catalog.GetString( "Failure"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } String DateFormatString = TUserDefaults.GetStringDefault("Imp Date", "MDY"); OpenFileDialog OFDialog = new OpenFileDialog(); string ExportPath = TClientSettings.GetExportPath(); string FullPath = TUserDefaults.GetStringDefault("Imp Filename", ExportPath + Path.DirectorySeparatorChar + "import.csv"); TImportExportDialogs.SetOpenFileDialogFilePathAndName(OFDialog, FullPath, ExportPath); OFDialog.Title = Catalog.GetString("Import budget(s) from CSV file"); OFDialog.Filter = Catalog.GetString("Text Files(*.txt) | *.txt | Delimited Files(*.csv) | *.csv"); String ImportOptions = TUserDefaults.GetStringDefault("Imp Options", ";" + TDlgSelectCSVSeparator.NUMBERFORMAT_AMERICAN); // This call fixes Windows7 Open File Dialogs. It must be the line before ShowDialog() TWin7FileOpenSaveDialog.PrepareDialog(Path.GetFileName(FullPath)); if (OFDialog.ShowDialog() == DialogResult.OK) { TFrmStatusDialog dlgStatus = new TFrmStatusDialog(FPetraUtilsObject.GetForm()); FdlgSeparator = new TDlgSelectCSVSeparator(false); try { string fileTitle = OFDialog.SafeFileName; Boolean fileCanOpen = FdlgSeparator.OpenCsvFile(OFDialog.FileName); if (!fileCanOpen) { MessageBox.Show(Catalog.GetString("Unable to open file."), Catalog.GetString("Budget Import"), MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } FdlgSeparator.DateFormat = DateFormatString; if (ImportOptions.Length > 1) { FdlgSeparator.NumberFormat = ImportOptions.Substring(1); } FdlgSeparator.SelectedSeparator = ImportOptions.Substring(0, 1); if (FdlgSeparator.ShowDialog() == DialogResult.OK) { string[] FdlgSeparatorVal = new string[] { FdlgSeparator.SelectedSeparator, FdlgSeparator.DateFormat, FdlgSeparator.NumberFormat }; Application.UseWaitCursor = true; //New set of budgets to be loaded dlgStatus.Show(); dlgStatus.Heading = Catalog.GetString("Budget Import"); dlgStatus.CurrentStatus = Catalog.GetString("Importing budgets from '" + fileTitle + "' ..."); // read contents of file string ImportString = File.ReadAllText(OFDialog.FileName); //TODO return the budget from the year, and -99 for fail BudgetsImported = TRemote.MFinance.Budget.WebConnectors.ImportBudgets(FLedgerNumber, ImportString, OFDialog.FileName, FdlgSeparatorVal, ref AMainDS, out BudgetsAdded, out BudgetsUpdated, out BudgetsFailed, out Messages); dlgStatus.Visible = false; Application.UseWaitCursor = false; ShowMessages(Messages, BudgetsImported, BudgetsAdded, BudgetsUpdated, BudgetsFailed); } // We save the defaults even if ok is false - because the client will probably want to try and import // the same file again after correcting any errors SaveUserDefaults(OFDialog, ImportOptions); } catch (Exception ex) { TLogging.LogException(ex, Utilities.GetMethodSignature()); throw; } finally { Application.UseWaitCursor = false; } // update grid if ((BudgetsAdded + BudgetsUpdated) > 0) { try { dlgStatus.CurrentStatus = Catalog.GetString("Updating budget period data..."); dlgStatus.Visible = true; Application.UseWaitCursor = true; UpdateABudgetPeriodAmounts(AMainDS, ACurrentBudgetYear); FUserControl.SetBudgetDefaultView(AMainDS); } finally { Application.UseWaitCursor = false; dlgStatus.Close(); } FPetraUtilsObject.SetChangedFlag(); } else { dlgStatus.Close(); } } }
/// <summary> /// Call the code to consolidate all budgets /// </summary> /// <param name="AParentWindow"></param> /// <param name="ALedgerNumber"></param> public static void ConsolidateBudgets(Form AParentWindow, Int32 ALedgerNumber) //, TVerificationResultCollection AVerificationResult = null) /// <param name="AVerificationResult"></param> { string Msg = string.Empty; Msg = "You can either consolidate all of your budgets"; Msg += " or just those that have changed since the last consolidation." + "\n\r\n\r"; Msg += "Do you want to consolidate all of your budgets?"; DialogResult DlgRes; DlgRes = MessageBox.Show(Msg, "Consolidate Budgets", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly, false); if (DlgRes == DialogResult.Cancel) { return; } bool ConsolidateAll = (DlgRes == DialogResult.Yes); TFrmStatusDialog DlgStatus = null; try { Cursor.Current = Cursors.WaitCursor; DlgStatus = new TFrmStatusDialog(AParentWindow); DlgStatus.Show(); DlgStatus.Heading = Catalog.GetString("Consolidating Budgets"); DlgStatus.CurrentStatus = Catalog.GetString("Loading budget data..."); TRemote.MFinance.Budget.WebConnectors.LoadBudgetForConsolidate(ALedgerNumber); DlgStatus.CurrentStatus = Catalog.GetString("Consolidating" + (ConsolidateAll ? " all " : " changed ") + "budget data..."); TRemote.MFinance.Budget.WebConnectors.ConsolidateBudgets(ALedgerNumber, ConsolidateAll); DlgStatus.Close(); DlgStatus = null; MessageBox.Show("Budget Consolidation Complete.", "Consolidate Budgets"); } catch (Exception ex) { TLogging.LogException(ex, Utilities.GetMethodSignature()); throw; } finally { Cursor.Current = Cursors.Default; if (DlgStatus != null) { DlgStatus.Close(); DlgStatus = null; } } }
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; } }