/// <summary> /// Shows a message that the user will need to have different Module permissions for the editing of data /// in *this* screen. Call this Method if the screen is read-only and the user has admin rights for the /// Module in which the screen is listed in the Main Menu. /// The user can choose to not get that message shown again (handled inside this called Method) - this /// choice is stored in a UserDefault. /// </summary> /// <param name="AParentForm">Reference to the calling Form.</param> /// <param name="AShownOnMenuForConvenience">The Module in which the screen is listed in the /// Main Menu.</param> /// <param name="AModuleThatDataIsAssociatedWith">Module that the data that this Form allows to edit /// is associated with.</param> /// <param name="AAdminModulePermission">The Module Permission required for editing data in the screen /// that differs from the Module Permission that is required for editing data of Setup screens in the /// respective Module.</param> /// <param name="AUserDefaultNameForNotShowingTheMessageBoxAgain">Name of the UserDefault. /// Gets prefixed with <see cref="TUserDefaults.NamedDefaults.SUPPRESS_MESSAGE_PREFIX"/>!</param> public static void MsgUserWillNeedToHaveDifferentAdminModulePermissionForEditing(Form AParentForm, string AShownOnMenuForConvenience, string AModuleThatDataIsAssociatedWith, string AAdminModulePermission, string AUserDefaultNameForNotShowingTheMessageBoxAgain) { TFrmExtendedMessageBox ExtendedMessageBox = new TFrmExtendedMessageBox(AParentForm); bool DoNotShowMessageBoxAgain; string FinalUserDefaultName = TUserDefaults.NamedDefaults.SUPPRESS_MESSAGE_PREFIX + AUserDefaultNameForNotShowingTheMessageBoxAgain; if (!TUserDefaults.GetBooleanDefault(FinalUserDefaultName, false)) { ExtendedMessageBox.ShowDialog( String.Format(MCommonResourcestrings.StrDiffentPermissionRequiredForEditingData, AAdminModulePermission) + Environment.NewLine + String.Format( MCommonResourcestrings.StrDiffentPermissionRequiredForEditingDataMenuHint, AShownOnMenuForConvenience, AModuleThatDataIsAssociatedWith), MCommonResourcestrings.StrReadOnlyInformationTitle, MCommonResourcestrings.StrDontShowThisMessageAgain, TFrmExtendedMessageBox.TButtons.embbOK, TFrmExtendedMessageBox.TIcon.embiInformation); // We don't care about the return value because there is only an 'OK' Button shown... ExtendedMessageBox.GetResult(out DoNotShowMessageBoxAgain); if (DoNotShowMessageBoxAgain) { TUserDefaults.SetDefault(FinalUserDefaultName, DoNotShowMessageBoxAgain); } } }
/// <summary> /// Opens an extended message box screen. /// </summary> /// <param name="AParentForm">The owner of the screen</param> /// <param name="AMessage">The message</param> /// <param name="ACaption">The box Title</param> /// <param name="AChkOptionText">Text to display with the checkbox. If empty no box is displayed.</param> /// <param name="AButtons">Integer value for the buttons to display corresponding to the TButtons enumeration. /// 0=embbYesYesToAllNoCancel, 1=embbYesYesToAllNoNoToAllCancel, 2=embbYesYesToAllNoNoToAll, 3=embbYesNo, 4=embbYesNoCancel, /// 5=embbOK, 6=embbOKCancel</param> /// <param name="ADefaultButton">Integer value for the default button corresponding to the TDefaultBtton enumeration. /// 0 indicates no default, 1 is button 1 and so on.</param> /// <param name="AIcon">Integer value for the icon corresponding to the TIcon enumeration.</param> /// <param name="AOptionEntrySelected">Set to true if the checkbox is to be initially selected.</param> /// <param name="AOptionExitSelected">Returns true if the option was selected on exit. False otherwise.</param> /// <returns>0=Yes, 1=YesToAll, 2=No, 3=NoToAll, 4=OK, 5=Cancel, 6=Undefined</returns> public static int Create(Form AParentForm, String AMessage, String ACaption, String AChkOptionText, int AButtons, int ADefaultButton, int AIcon, bool AOptionEntrySelected, out bool AOptionExitSelected) { TFrmExtendedMessageBox dlg = new TFrmExtendedMessageBox(AParentForm); dlg.ShowDialog(AMessage, ACaption, AChkOptionText, (TFrmExtendedMessageBox.TButtons)AButtons, (TFrmExtendedMessageBox.TDefaultButton)ADefaultButton, (TFrmExtendedMessageBox.TIcon)AIcon, AOptionEntrySelected); return((int)dlg.GetResult(out AOptionExitSelected)); }
/// <summary> /// Verify and if necessary update partner data in an extract /// </summary> public static void VerifyAndUpdateExtract(System.Windows.Forms.Form AForm, ref ExtractTDSMExtractTable AExtractTable, out bool AChangesMade) { bool AddressExists; bool AddressNeitherCurrentNorMailing; bool ReplaceAddress; bool ReplaceAddressYesToAll = false; bool ReplaceAddressNoToAll = false; string CountryName; string EmailAddress; PLocationTable LocationTable; PLocationRow LocationRow; PPartnerLocationTable PartnerLocationTable; TFrmExtendedMessageBox MsgBox = new TFrmExtendedMessageBox(AForm); TFrmExtendedMessageBox.TResult MsgBoxResult; bool DontShowPartnerRemovePartnerKeyNonExistent = false; bool DontShowReplaceAddress = false; bool DontShowPartnerRemoveNoAddress = false; // initialize output parameter AChangesMade = false; // build a collection of objects to be deleted before actually deleting them (as otherwise // indexes may not be valid any longer) List <ExtractTDSMExtractRow>RowsToDelete = new List <ExtractTDSMExtractRow>(); // prepare mouse cursor so user knows something is happening AForm.Cursor = Cursors.WaitCursor; // look at every single extract row foreach (ExtractTDSMExtractRow Row in AExtractTable.Rows) { // initialize for this row ReplaceAddress = false; // check if the partner record still exists, otherwise remove from extract if (!TRemote.MPartner.Partner.ServerLookups.WebConnectors.VerifyPartner(Row.PartnerKey)) { if (!DontShowPartnerRemovePartnerKeyNonExistent) { MsgBox.ShowDialog(String.Format(Catalog.GetString("The following partner record does not exist any longer and " + "will therefore be removed from this extract: \n\r\n\r" + "{0} ({1})"), Row.PartnerShortName, Row.PartnerKey), Catalog.GetString("Verify and Update Extract"), Catalog.GetString("Don't show this message again"), TFrmExtendedMessageBox.TButtons.embbOK, TFrmExtendedMessageBox.TIcon.embiInformation); MsgBoxResult = MsgBox.GetResult(out DontShowPartnerRemovePartnerKeyNonExistent); } RowsToDelete.Add(Row); } else { AddressExists = TRemote.MPartner.Partner.ServerLookups.WebConnectors.VerifyPartnerAtLocation (Row.PartnerKey, new TLocationPK(Row.SiteKey, Row.LocationKey), out AddressNeitherCurrentNorMailing); if (!AddressExists) { if (!DontShowReplaceAddress) { MsgBox.ShowDialog(String.Format(Catalog.GetString("Address for {0} ({1}) in this extract no longer exists and " + "will therefore be replaced with a current address"), Row.PartnerShortName, Row.PartnerKey), Catalog.GetString("Verify and Update Extract"), Catalog.GetString("Don't show this message again"), TFrmExtendedMessageBox.TButtons.embbOK, TFrmExtendedMessageBox.TIcon.embiInformation); MsgBoxResult = MsgBox.GetResult(out DontShowReplaceAddress); } ReplaceAddress = true; } else if (AddressNeitherCurrentNorMailing) { if (!ReplaceAddressYesToAll && !ReplaceAddressNoToAll) { MsgBoxResult = MsgBox.ShowDialog(String.Format(Catalog.GetString("Address for {0} ({1}) in this extract is not current. " + "Do you want to update it with a current address if there is one?"), Row.PartnerShortName, Row.PartnerKey), Catalog.GetString("Verify and Update Extract"), "", TFrmExtendedMessageBox.TButtons.embbYesYesToAllNoNoToAll, TFrmExtendedMessageBox.TIcon.embiQuestion); if (MsgBoxResult == TFrmExtendedMessageBox.TResult.embrYesToAll) { ReplaceAddressYesToAll = true; } else if (MsgBoxResult == TFrmExtendedMessageBox.TResult.embrYes) { ReplaceAddress = true; } else if (MsgBoxResult == TFrmExtendedMessageBox.TResult.embrNoToAll) { ReplaceAddressNoToAll = true; } } // need to set the flag each time we come through here. if (ReplaceAddressYesToAll) { ReplaceAddress = true; } } if (ReplaceAddress) { if (!TRemote.MPartner.Mailing.WebConnectors.GetBestAddress(Row.PartnerKey, out LocationTable, out PartnerLocationTable, out CountryName, out EmailAddress)) { // in this case there is no address at all for this partner (should not really happen) if (!DontShowPartnerRemoveNoAddress) { MsgBox.ShowDialog(String.Format(Catalog.GetString("No address could be found for {0} ({1}). " + "Therefore the partner record will be removed from this extract"), Row.PartnerShortName, Row.PartnerKey), Catalog.GetString("Verify and Update Extract"), Catalog.GetString("Don't show this message again"), TFrmExtendedMessageBox.TButtons.embbOK, TFrmExtendedMessageBox.TIcon.embiInformation); MsgBoxResult = MsgBox.GetResult(out DontShowPartnerRemoveNoAddress); } RowsToDelete.Add(Row); } else { if (LocationTable.Rows.Count > 0) { LocationRow = (PLocationRow)LocationTable.Rows[0]; /* it could be that GetBestAddress still returns a non-current address if * there is no better one */ if ((Row.SiteKey != LocationRow.SiteKey) || (Row.LocationKey != LocationRow.LocationKey)) { AChangesMade = true; Row.SiteKey = LocationRow.SiteKey; Row.LocationKey = LocationRow.LocationKey; } } } } } } // now delete the actual rows foreach (ExtractTDSMExtractRow Row in RowsToDelete) { AChangesMade = true; Row.Delete(); } // prepare mouse cursor so user knows something is happening AForm.Cursor = Cursors.Default; }
/// <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> public void ImportBatches(TGiftImportDataSourceEnum AImportSource) { bool ok = false; String importString; String impOptions; OpenFileDialog dialog = null; if (FPetraUtilsObject.HasChanges) { // saving failed, therefore do not try to post MessageBox.Show(Catalog.GetString("Please save before calling this function!"), Catalog.GetString( "Failure"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FdlgSeparator = new TDlgSelectCSVSeparator(false); if (AImportSource == TGiftImportDataSourceEnum.FromClipboard) { importString = Clipboard.GetText(TextDataFormat.UnicodeText); if ((importString == null) || (importString.Length == 0)) { MessageBox.Show(Catalog.GetString("Please first copy data from your spreadsheet application!"), Catalog.GetString("Failure"), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } impOptions = TUserDefaults.GetStringDefault("Imp Options", ";American"); String dateFormatString = TUserDefaults.GetStringDefault("Imp Date", "MDY"); FdlgSeparator = new TDlgSelectCSVSeparator(false); FdlgSeparator.SelectedSeparator = "\t"; FdlgSeparator.CSVData = importString; FdlgSeparator.DateFormat = dateFormatString; if (impOptions.Length > 1) { FdlgSeparator.NumberFormat = impOptions.Substring(1); } } else if (AImportSource == TGiftImportDataSourceEnum.FromFile) { dialog = new OpenFileDialog(); dialog.FileName = TUserDefaults.GetStringDefault("Imp Filename", TClientSettings.GetExportPath() + Path.DirectorySeparatorChar + "import.csv"); dialog.Title = Catalog.GetString("Import Batches from CSV File"); dialog.Filter = Catalog.GetString("Gift Batches files (*.csv)|*.csv"); impOptions = TUserDefaults.GetStringDefault("Imp Options", ";" + TDlgSelectCSVSeparator.NUMBERFORMAT_AMERICAN); if (dialog.ShowDialog() == DialogResult.OK) { Boolean fileCanOpen = FdlgSeparator.OpenCsvFile(dialog.FileName); if (!fileCanOpen) { MessageBox.Show(Catalog.GetString("Unable to open file."), Catalog.GetString("Gift Import"), MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } importString = File.ReadAllText(dialog.FileName); String dateFormatString = TUserDefaults.GetStringDefault("Imp Date", "MDY"); FdlgSeparator.DateFormat = dateFormatString; if (impOptions.Length > 1) { FdlgSeparator.NumberFormat = impOptions.Substring(1); } FdlgSeparator.SelectedSeparator = impOptions.Substring(0, 1); } else { return; } } else { // unknown source!! The following need a value... impOptions = String.Empty; importString = String.Empty; } if (FdlgSeparator.ShowDialog() == DialogResult.OK) { Hashtable requestParams = new Hashtable(); requestParams.Add("ALedgerNumber", FLedgerNumber); requestParams.Add("Delimiter", FdlgSeparator.SelectedSeparator); requestParams.Add("DateFormatString", FdlgSeparator.DateFormat); requestParams.Add("NumberFormat", FdlgSeparator.NumberFormat); requestParams.Add("NewLine", Environment.NewLine); bool Repeat = true; while (Repeat) { Repeat = false; TVerificationResultCollection AMessages = new TVerificationResultCollection(); GiftBatchTDSAGiftDetailTable NeedRecipientLedgerNumber = new GiftBatchTDSAGiftDetailTable(); Thread ImportThread = new Thread(() => ImportGiftBatches( requestParams, importString, out AMessages, out ok, out NeedRecipientLedgerNumber)); using (TProgressDialog ImportDialog = new TProgressDialog(ImportThread)) { ImportDialog.ShowDialog(); } // If NeedRecipientLedgerNumber contains data then AMessages will only ever contain // one message alerting the user that no data has been imported. // We do not want to show this as we will be displaying another more detailed message. if (NeedRecipientLedgerNumber.Rows.Count == 0) { ShowMessages(AMessages); } // if the import contains gifts with Motivation Group 'GIFT' and that have a Family recipient with no Gift Destination // then the import will have failed and we need to alert the user if (NeedRecipientLedgerNumber.Rows.Count > 0) { bool OfferToRunImportAgain = true; bool DoNotShowMessageBoxEverytime = false; TFrmExtendedMessageBox.TResult Result = TFrmExtendedMessageBox.TResult.embrUndefined; int count = 1; // for each gift in which the recipient needs a Git Destination foreach (GiftBatchTDSAGiftDetailRow Row in NeedRecipientLedgerNumber.Rows) { if (!DoNotShowMessageBoxEverytime) { string CheckboxText = string.Empty; // only show checkbox if there is at least one more occurance of this error if (NeedRecipientLedgerNumber.Rows.Count - count > 0) { CheckboxText = string.Format( Catalog.GetString("Do this for all further occurances ({0})?"), NeedRecipientLedgerNumber.Rows.Count - count); } TFrmExtendedMessageBox extendedMessageBox = new TFrmExtendedMessageBox(FPetraUtilsObject.GetForm()); extendedMessageBox.ShowDialog(string.Format( Catalog.GetString( "Gift Import has been cancelled as the recipient '{0}' ({1}) has no Gift Destination assigned."), Row.RecipientDescription, Row.RecipientKey) + "\n\r\n\r\n\r" + Catalog.GetString("Do you want to assign a Gift Destination to this partner now?"), Catalog.GetString("Import Errors"), CheckboxText, TFrmExtendedMessageBox.TButtons.embbYesNo, TFrmExtendedMessageBox.TIcon.embiWarning); Result = extendedMessageBox.GetResult(out DoNotShowMessageBoxEverytime); } if (Result == TFrmExtendedMessageBox.TResult.embrYes) { // allow the user to assign a Gift Destingation TFrmGiftDestination GiftDestinationForm = new TFrmGiftDestination(FPetraUtilsObject.GetForm(), Row.RecipientKey); GiftDestinationForm.ShowDialog(); } else { OfferToRunImportAgain = false; if (DoNotShowMessageBoxEverytime) { break; } } count++; } // if the user has clicked yes to assigning Gift Destinations then offer to restart the import if (OfferToRunImportAgain && (MessageBox.Show(Catalog.GetString("Would you like to import this Gift Batch again?"), Catalog.GetString("Gift Import"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)) { Repeat = true; } } } } if (ok) { MessageBox.Show(Catalog.GetString("Your data was imported successfully!"), Catalog.GetString("Gift Import"), MessageBoxButtons.OK, MessageBoxIcon.Information); SaveUserDefaults(dialog, impOptions); FMyUserControl.LoadBatchesForCurrentYear(); FPetraUtilsObject.DisableSaveButton(); } }
private void UpdateTaxDeductiblePct() { decimal OriginalPct = 100; decimal NewPct = 100; DateTime OriginalValidFrom = DateTime.MinValue; DateTime NewValidFrom = DateTime.MinValue; // if a datarow already exists if (FMainDS.PPartnerTaxDeductiblePct.Rows[0].HasVersion(DataRowVersion.Original)) { OriginalPct = Convert.ToDecimal( FMainDS.PPartnerTaxDeductiblePct.Rows[0][PPartnerTaxDeductiblePctTable.GetPercentageTaxDeductibleDBName(), DataRowVersion.Original]); OriginalValidFrom = Convert.ToDateTime( FMainDS.PPartnerTaxDeductiblePct.Rows[0][PPartnerTaxDeductiblePctTable.GetDateValidFromDBName(), DataRowVersion.Original]); } int i = 0; // there will be either 0 or 1 rows that are not marked as deleted while (FMainDS.PPartnerTaxDeductiblePct.Rows[i].RowState == DataRowState.Deleted && i < (FMainDS.PPartnerTaxDeductiblePct.Rows.Count - 1)) { i++; } // if Tax Deductible Pct has not just been removed if (FMainDS.PPartnerTaxDeductiblePct.Rows[i].HasVersion(DataRowVersion.Current)) { NewPct = Convert.ToDecimal( FMainDS.PPartnerTaxDeductiblePct.Rows[i][PPartnerTaxDeductiblePctTable.GetPercentageTaxDeductibleDBName(), DataRowVersion.Current]); NewValidFrom = Convert.ToDateTime( FMainDS.PPartnerTaxDeductiblePct.Rows[i][PPartnerTaxDeductiblePctTable.GetDateValidFromDBName(), DataRowVersion.Current]); } // if either pct or date has changed if ((NewPct != OriginalPct) || (OriginalValidFrom != NewValidFrom)) { DataTable GiftTotals; // find gifts that could be affected by this change if (TRemote.MFinance.Gift.WebConnectors.IsPartnerARecipient(FPartnerKey, out GiftTotals, NewPct, NewValidFrom)) { string StartMsg = string.Empty; string PermissionGifts = string.Empty; string NoPermissionGifts = string.Empty; bool UnpostedGifts = false; bool UnpostedGiftInLedgerWithNoPermission = false; bool PostedGifts = false; bool PostedGiftInLedgerWithNoPermission = false; // check what gifts we have - posted/unposted - ledger permission/no ledger permission foreach (DataRow Row in GiftTotals.Rows) { if (Convert.ToInt32(Row["Unposted"]) > 0) { if (UserInfo.GUserInfo.IsInLedger(Convert.ToInt32(Row["LedgerNumber"]))) { UnpostedGifts = true; } else { UnpostedGiftInLedgerWithNoPermission = true; } } if (Convert.ToInt32(Row["Posted"]) > 0) { if (UserInfo.GUserInfo.IsInLedger(Convert.ToInt32(Row["LedgerNumber"]))) { PostedGifts = true; } else { PostedGiftInLedgerWithNoPermission = true; } } } // if pct (and date) has changed if (NewPct != OriginalPct) { StartMsg = string.Format(Catalog.GetString("This partner's Tax Deductible Percentage has been changed from {0}% to {1}%."), OriginalPct.ToString("0.##"), NewPct.ToString("0.##")); } // if only date has changed else { StartMsg = string.Format(Catalog.GetString( "This partner's Tax Deductible Percentage has been changed to {0}% for all gifts from {1}."), NewPct.ToString("0.##"), NewValidFrom.Date.ToString("dd-MMM-yyyy")); } /* Unposted gifts */ if (UnpostedGifts || UnpostedGiftInLedgerWithNoPermission) { if (UnpostedGifts) { PermissionGifts = "\n\n" + Catalog.GetString("Do you want to update all unposted gifts with this new percentage?") + "\n"; } if (UnpostedGiftInLedgerWithNoPermission) { NoPermissionGifts = "\n\n" + Catalog.GetString( "Some unposted gifts cannot be auto updated with this new percentage as you do not have permission to access the ledger which they belong to." ) + "\n"; } // add info on how many gifts belonging to which ledger foreach (DataRow Row in GiftTotals.Rows) { if ((Convert.ToInt32(Row["Unposted"]) > 0) && UserInfo.GUserInfo.IsInLedger(Convert.ToInt32(Row["LedgerNumber"]))) { if (Convert.ToInt32(Row["Unposted"]) == 1) { PermissionGifts += "\n" + "- " + string.Format(Catalog.GetString("1 unposted gift from Ledger {0}"), Convert.ToInt32(Row["LedgerNumber"])); } else { PermissionGifts += "\n" + "- " + string.Format(Catalog.GetString("{0} unposted gifts from Ledger {1}"), Convert.ToInt32(Row["Unposted"]), Convert.ToInt32(Row["LedgerNumber"])); } } else if (Convert.ToInt32(Row["Unposted"]) > 0) { if (Convert.ToInt32(Row["Unposted"]) == 1) { NoPermissionGifts += "\n" + "- " + string.Format(Catalog.GetString("1 unposted gift from Ledger {0}"), Convert.ToInt32(Row["LedgerNumber"])); } else { NoPermissionGifts += "\n" + "- " + string.Format(Catalog.GetString("{0} unposted gifts from Ledger {1}"), Convert.ToInt32(Row["Unposted"]), Convert.ToInt32(Row["LedgerNumber"])); } } } // display a message box if (UnpostedGifts) { if (!string.IsNullOrEmpty(NoPermissionGifts)) { NoPermissionGifts = "(" + NoPermissionGifts + ")"; } if (MessageBox.Show(StartMsg + PermissionGifts + NoPermissionGifts, Catalog.GetString("Tax Deductible Percentage Changed"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { // update unposted gifts TRemote.MFinance.Gift.WebConnectors.UpdateUnpostedGiftsTaxDeductiblePct(FPartnerKey, NewPct, NewValidFrom); } } else { MessageBox.Show(StartMsg + NoPermissionGifts, Catalog.GetString("Tax Deductible Percentage Changed"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } } /* Posted gifts */ if (PostedGifts || PostedGiftInLedgerWithNoPermission) { if (PostedGifts) { PermissionGifts = Environment.NewLine + Environment.NewLine + string.Format(Catalog.GetString( "Do you want to update all posted gifts from {0} with this new percentage?"), NewValidFrom.Date.ToString("dd-MMM-yyyy")) + Environment.NewLine; } if (PostedGiftInLedgerWithNoPermission) { NoPermissionGifts = Environment.NewLine + Environment.NewLine + Catalog.GetString( "Some posted gifts cannot be auto updated with this new percentage as you do not have permission to access the ledger which they belong to." ) + Environment.NewLine; } // add info on how many gifts belonging to which ledger foreach (DataRow Row in GiftTotals.Rows) { if ((Convert.ToInt32(Row["Posted"]) > 0) && UserInfo.GUserInfo.IsInLedger(Convert.ToInt32(Row["LedgerNumber"]))) { if (Convert.ToInt32(Row["Posted"]) == 1) { PermissionGifts += Environment.NewLine + "- " + string.Format(Catalog.GetString("1 posted gift from Ledger {0}"), Convert.ToInt32(Row["LedgerNumber"])); } else { PermissionGifts += Environment.NewLine + "- " + string.Format(Catalog.GetString("{0} posted gifts from Ledger {1}"), Convert.ToInt32(Row["Posted"]), Convert.ToInt32(Row["LedgerNumber"])); } } else if (Convert.ToInt32(Row["Posted"]) > 0) { if (Convert.ToInt32(Row["Posted"]) == 1) { NoPermissionGifts += Environment.NewLine + "- " + string.Format(Catalog.GetString("1 posted gift from Ledger {0}"), Convert.ToInt32(Row["LedgerNumber"])); } else { NoPermissionGifts += Environment.NewLine + "- " + string.Format(Catalog.GetString("{0} posted gifts from Ledger {1}"), Convert.ToInt32(Row["Posted"]), Convert.ToInt32(Row["LedgerNumber"])); } } } // display a message box if (PostedGifts) { if (!string.IsNullOrEmpty(NoPermissionGifts)) { NoPermissionGifts = "(" + NoPermissionGifts + ")"; } TFrmExtendedMessageBox ExtendedMessageBox = new TFrmExtendedMessageBox(FPetraUtilsObject.GetForm()); if (ExtendedMessageBox.ShowDialog(StartMsg + PermissionGifts + NoPermissionGifts, Catalog.GetString("Tax Deductible Percentage Changed"), Catalog.GetString("Do not print the adjusting gift transactions on periodic receipts"), TFrmExtendedMessageBox.TButtons.embbYesNo, TFrmExtendedMessageBox.TIcon.embiQuestion) == TFrmExtendedMessageBox.TResult.embrYes) { bool NoLabel; ExtendedMessageBox.GetResult(out NoLabel); // update posted gifts TCommonScreensForwarding.TaxDeductiblePctAdjust.Invoke(FPartnerKey, NewPct, NewValidFrom, NoLabel, FPetraUtilsObject.GetForm()); } } else { MessageBox.Show(StartMsg + NoPermissionGifts, Catalog.GetString("Tax Deductible Percentage Changed"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } }
/// <summary> /// Opens an extended message box screen. /// </summary> /// <param name="AParentForm">The owner of the screen</param> /// <param name="AMessage">The message</param> /// <param name="ACaption">The box Title</param> /// <param name="AChkOptionText">Text to display with the checkbox. If empty no box is displayed.</param> /// <param name="AButtons">Integer value for the buttons to display corresponding to the TButtons enumeration. /// 0=embbYesYesToAllNoCancel, 1=embbYesYesToAllNoNoToAllCancel, 2=embbYesYesToAllNoNoToAll, 3=embbYesNo, 4=embbYesNoCancel, /// 5=embbOK, 6=embbOKCancel</param> /// <param name="ADefaultButton">Integer value for the default button corresponding to the TDefaultBtton enumeration. /// 0 indicates no default, 1 is button 1 and so on.</param> /// <param name="AIcon">Integer value for the icon corresponding to the TIcon enumeration.</param> /// <param name="AOptionEntrySelected">Set to true if the checkbox is to be initially selected.</param> /// <param name="AOptionExitSelected">Returns true if the option was selected on exit. False otherwise.</param> /// <returns>0=Yes, 1=YesToAll, 2=No, 3=NoToAll, 4=OK, 5=Cancel, 6=Undefined</returns> public static int Create(Form AParentForm, String AMessage, String ACaption, String AChkOptionText, int AButtons, int ADefaultButton, int AIcon, bool AOptionEntrySelected, out bool AOptionExitSelected) { TFrmExtendedMessageBox dlg = new TFrmExtendedMessageBox(AParentForm); dlg.ShowDialog(AMessage, ACaption, AChkOptionText, (TFrmExtendedMessageBox.TButtons)AButtons, (TFrmExtendedMessageBox.TDefaultButton)ADefaultButton, (TFrmExtendedMessageBox.TIcon)AIcon, AOptionEntrySelected); return (int)dlg.GetResult(out AOptionExitSelected); }