// carry out the field adjustment
        private void FieldChangeAdjustment(System.Object sender, EventArgs e)
        {
            if (!ValidateControls())
            {
                return;
            }

            GiftBatchTDS GiftBatchDS = new GiftBatchTDS();

            // get all the data needed for this Field Adjustment
            if (!GetAllDataNeeded(ref GiftBatchDS))
            {
                return;
            }

            // show the list of gifts to be adjusted and ask the user for confirmation
            TFrmGiftFieldAdjustmentConfirmation ConfirmationForm = new TFrmGiftFieldAdjustmentConfirmation(this);

            ConfirmationForm.MainDS = GiftBatchDS;

            if (ConfirmationForm.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            // Carry out the gift adjustment
            GiftAdjustment(GiftBatchDS, null, chkNoReceipt.Checked, this);

            // refresh batches
            this.Cursor = Cursors.WaitCursor;
            ((TFrmGiftBatch)FPetraUtilsObject.GetCallerForm()).RefreshAll();
            this.Cursor = Cursors.Default;
            this.Close();
        }
Пример #2
0
        private void BtnOK_Click(Object Sender, EventArgs e)
        {
            // The general tab may present a dialog that allows the user to cancel - so we need to call this first
            if (ucoGeneral.SaveGeneralTab() == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            if (ucoAppearance.SaveAppearanceTab() |
                ((tpgFinance.Enabled && tabPageFinanceWasSelected && ucoFinance.SaveFinanceTab()) ||
                 (tpgGift.Enabled && tabPageGiftWasSelected && ucoGift.SaveGiftTab())))
            {
                Form       MainWindow = FPetraUtilsObject.GetCallerForm();
                MethodInfo method     = MainWindow.GetType().GetMethod("LoadNavigationUI");

                if (method != null)
                {
                    method.Invoke(MainWindow, new object[] { true });
                }

                method = MainWindow.GetType().GetMethod("SelectSettingsFolder");

                if (method != null)
                {
                    method.Invoke(MainWindow, null);
                }
            }

            ucoPartner.SavePartnerTab();
            ucoEmail.GetDataFromControls();
            Close();
        }
        private void SelectEvent_Click(System.Object sender, EventArgs e)
        {
            Form MainWindow = FPetraUtilsObject.GetCallerForm();

            // If the delegate is defined, the host form will launch a Modal Partner Find screen for us
            if (TCommonScreensForwarding.OpenEventFindScreen != null)
            {
                // delegate IS defined
                try
                {
                    TCommonScreensForwarding.OpenEventFindScreen.Invoke
                        ("",
                        out FEventPartnerKey,
                        out FEventPartnerShortName,
                        out FOutreachCode,
                        MainWindow);

                    if (FEventPartnerKey != -1)
                    {
                        txtEventName.Text            = FEventPartnerShortName;
                        chkShowAllOutreaches.Enabled = true;

                        InitGridManually();
                    }
                }
                catch (Exception exp)
                {
                    throw new ApplicationException("Exception occured while calling OpenEventFindScreen Delegate!", exp);
                }
            }
        }
        // open a dialog to select which bank account should be set to MAIN (if necessary)
        private bool GetMainBankAccount()
        {
            Form MainWindow = FPetraUtilsObject.GetCallerForm();

            // run a check to determine if a new 'Main' account needs selected. If not then just return.
            if (TRemote.MPartner.Partner.WebConnectors.NeedMainBankAccount(FFromPartnerKey, FToPartnerKey) == false)
            {
                return(true);
            }

            // If the delegate is defined, the host form will launch a Modal screen for us
            if (TCommonScreensForwarding.OpenGetMergeDataDialog != null)
            {
                // delegate IS defined
                try
                {
                    return(TCommonScreensForwarding.OpenGetMergeDataDialog.Invoke(FFromPartnerKey,
                                                                                  FToPartnerKey,
                                                                                  TMergeActionEnum.BANKACCOUNT,
                                                                                  MainWindow));
                }
                catch (Exception exp)
                {
                    throw new EOPAppException("Exception occured while calling OpenGetMergeDataDialog Delegate!", exp);
                }
            }

            return(false);
        }
Пример #5
0
        private void ShowEmergencyContacts(object sender, EventArgs e)
        {
            string contactFor          = string.Empty;
            string primaryContact      = Catalog.GetString("PRIMARY EMERGENCY CONTACT") + Environment.NewLine + Environment.NewLine;
            string secondaryContact    = Catalog.GetString("SECONDARY EMERGENCY CONTACT") + Environment.NewLine + Environment.NewLine;
            Int64  primaryContactKey   = 0;
            Int64  secondaryContactKey = 0;

            if ((FMainDS.PPerson != null) && (FMainDS.PPerson.Rows.Count > 0))
            {
                PPersonRow row = (PPersonRow)FMainDS.PPerson.Rows[0];
                contactFor = String.Format(Catalog.GetString("Emergency Contact Information For: {0} {1} {2} [{3:0000000000}]"),
                                           row.Title, row.FirstName, row.FamilyName, row.PartnerKey);

                FPetraUtilsObject.GetForm().Cursor          = Cursors.WaitCursor;
                PPartnerRelationshipTable relationshipTable = TRemote.MPartner.Partner.WebConnectors.GetPartnerRelationships(row.PartnerKey);
                FPetraUtilsObject.GetForm().Cursor          = Cursors.Default;

                for (int i = 0; i < relationshipTable.Rows.Count; i++)
                {
                    PPartnerRelationshipRow relationshipRow = (PPartnerRelationshipRow)relationshipTable.Rows[i];

                    if (string.Compare(relationshipRow.RelationName, "EMER-1", true) == 0)
                    {
                        ParseEmergencyContactData(ref primaryContact, relationshipRow);
                        primaryContactKey = relationshipRow.PartnerKey;
                    }
                    else if (string.Compare(relationshipRow.RelationName, "EMER-2", true) == 0)
                    {
                        ParseEmergencyContactData(ref secondaryContact, relationshipRow);
                        secondaryContactKey = relationshipRow.PartnerKey;
                    }
                }
            }

            if (primaryContactKey == 0)
            {
                primaryContact += Catalog.GetString("No primary contact");
            }

            if (secondaryContactKey == 0)
            {
                secondaryContact += Catalog.GetString("No secondary contact");
            }

            if ((primaryContactKey != 0) || (secondaryContactKey != 0))
            {
                // Show the emergency contacts dialog and pass it the inofrmation we have found
                TFrmEmergencyContactsDialog dlg = new TFrmEmergencyContactsDialog(FPetraUtilsObject.GetCallerForm());
                dlg.SetParameters(contactFor, primaryContact, secondaryContact, primaryContactKey, secondaryContactKey);
                dlg.Show();
            }
            else
            {
                MessageBox.Show(Catalog.GetString("There is no emergency contact information for this person."),
                                Catalog.GetString("Emergency Contacts"),
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
 private void RunOnceOnActivationManual()
 {
     // if fast reports, then ignore columns tab
     if ((FPetraUtilsObject.GetCallerForm() != null) && FPetraUtilsObject.FFastReportsPlugin.LoadedOK)
     {
         tabReportSettings.Controls.Remove(tpgColumns);
     }
 }
Пример #7
0
        private void RunOnceOnActivationManual()
        {
            FPetraUtilsObject.FFastReportsPlugin.SetDataGetter(LoadReportData);

            // if FastReport, then ignore columns tab
            if ((FPetraUtilsObject.GetCallerForm() != null) && FPetraUtilsObject.FFastReportsPlugin.LoadedOK)
            {
            }
        }
Пример #8
0
        // Deletes the conference
        private void RemoveRecord(System.Object sender, EventArgs e)
        {
            FSelectedConferenceKey  = (Int64)((DataRowView)grdConferences.SelectedDataRows[0]).Row[PcConferenceTable.GetConferenceKeyDBName()];
            FSelectedConferenceName = (String)((DataRowView)grdConferences.SelectedDataRows[0]).Row[PPartnerTable.GetPartnerShortNameDBName()];

            TDeleteConference.DeleteConference(FPetraUtilsObject.GetCallerForm(), FSelectedConferenceKey, FSelectedConferenceName);

            LoadDataGrid(false);
        }
 private void RunOnceOnActivationManual()
 {
     // if fast reports isn't working then close the screen
     if ((FPetraUtilsObject.GetCallerForm() != null) && !FPetraUtilsObject.FFastReportsPlugin.LoadedOK)
     {
         MessageBox.Show("No alternative reporting engine is available for this report. This screen will now be closed.", "Reporting engine");
         this.Close();
     }
 }
Пример #10
0
        /// <remarks>
        /// For NUnit tests that just try to open the Conference Find screen but which don't instantiate a Main Form
        /// we need to work around the fact that there is no Main Window!
        /// </remarks>
        private void InitGridManually()
        {
            MethodInfo Method = null;

            LoadDataGrid(true);

            grdConferences.DoubleClickCell += new TDoubleClickCellEventHandler(grdConferences_DoubleClickCell);

            // Attempt to obtain conference key from parent form or parent's parent form and use this to focus the currently selected
            // conference in the grid. If no conference key is found then the first conference in the grid will be focused.
            Form MainWindow = FPetraUtilsObject.GetCallerForm();

            // Main Window will not be available if run from within NUnit Test without Main Form instance...
            if (MainWindow != null)
            {
                Method = MainWindow.GetType().GetMethod("GetSelectedConferenceKey");
            }

            if (Method == null)
            {
                // Main Window will not be available if run from within NUnit Test without Main Form instance...
                if (MainWindow != null)
                {
                    Method = MainWindow.GetType().GetMethod("GetPetraUtilsObject");
                }

                if (Method != null)
                {
                    TFrmPetraUtils ParentPetraUtilsObject = (TFrmPetraUtils)Method.Invoke(MainWindow, null);
                    MainWindow = ParentPetraUtilsObject.GetCallerForm();
                    Method     = MainWindow.GetType().GetMethod("GetSelectedConferenceKey");
                }
            }

            if (Method != null)
            {
                FSelectedConferenceKey = Convert.ToInt64(Method.Invoke(MainWindow, null));
                int RowPos = 1;

                foreach (DataRowView rowView in FMainDS.PcConference.DefaultView)
                {
                    PcConferenceRow Row = (PcConferenceRow)rowView.Row;

                    if (Row.ConferenceKey == FSelectedConferenceKey)
                    {
                        break;
                    }

                    RowPos++;
                }

                // automatically select the current conference
                grdConferences.SelectRowInGrid(RowPos, true);
            }
        }
Пример #11
0
        private void RunOnceOnActivationManual()
        {
            FPetraUtilsObject.FFastReportsPlugin.SetDataGetter(LoadReportData);

            // if FastReport, then ignore columns tab
            if ((FPetraUtilsObject.GetCallerForm() != null) && FPetraUtilsObject.FFastReportsPlugin.LoadedOK)
            {
                tabReportSettings.Controls.Remove(tpgColumns);
                tabReportSettings.Controls.Remove(tpgAdditionalSettings);
            }
        }
        /// <summary>
        /// Saves any changed preferences to s_user_defaults
        /// </summary>
        /// <returns>void</returns>
        public bool SaveFinanceTab()
        {
            int NewLedger = cmbDefaultLedger.GetSelectedInt32();

            if (FInitiallySelectedLedger != NewLedger)
            {
                TUserDefaults.SetDefault(TUserDefaults.FINANCE_DEFAULT_LEDGERNUMBER, NewLedger);

                // change the current ledger in the main window
                Form         MainWindow            = FPetraUtilsObject.GetCallerForm();
                PropertyInfo CurrentLedgerProperty = MainWindow.GetType().GetProperty("CurrentLedger");
                CurrentLedgerProperty.SetValue(MainWindow, NewLedger, null);

                return(true);
            }

            if (FInactiveValuesWarningOnGLPosting != chkInactiveValuesWarningOnGLPosting.Checked)
            {
                FInactiveValuesWarningOnGLPosting = chkInactiveValuesWarningOnGLPosting.Checked;
                TUserDefaults.SetDefault(TUserDefaults.FINANCE_GL_WARN_OF_INACTIVE_VALUES_ON_POSTING, FInactiveValuesWarningOnGLPosting);
            }

            if (FShowMoneyAsCurrency != chkMoneyFormat.Checked)
            {
                FShowMoneyAsCurrency = chkMoneyFormat.Checked;
                TUserDefaults.SetDefault(StringHelper.FINANCE_CURRENCY_FORMAT_AS_CURRENCY, FShowMoneyAsCurrency);
            }

            if (FShowDecimalsAsCurrency != chkDecimalFormat.Checked)
            {
                FShowDecimalsAsCurrency = chkDecimalFormat.Checked;
                TUserDefaults.SetDefault(StringHelper.FINANCE_DECIMAL_FORMAT_AS_CURRENCY, FShowDecimalsAsCurrency);
            }

            if (FShowThousands != chkShowThousands.Checked)
            {
                FShowThousands = chkShowThousands.Checked;
                TUserDefaults.SetDefault(StringHelper.FINANCE_CURRENCY_SHOW_THOUSANDS, FShowThousands);
            }

            if (FDatesMayLookLikeIntegers != chkDatesMayBeIntegers.Checked)
            {
                FDatesMayLookLikeIntegers = chkDatesMayBeIntegers.Checked;
                TUserDefaults.SetDefault(MCommonConstants.USERDEFAULT_IMPORTEDDATESMAYBEINTEGERS, FDatesMayLookLikeIntegers);
            }

            return(false);
        }
Пример #13
0
        /// <summary>
        /// Saves any changed preferences to s_user_defaults
        /// </summary>
        /// <returns>void</returns>
        public bool SaveFinanceTab()
        {
            int NewLedger = cmbDefaultLedger.GetSelectedInt32();

            if (FCurrentLedger != NewLedger)
            {
                TUserDefaults.SetDefault(TUserDefaults.FINANCE_DEFAULT_LEDGERNUMBER, NewLedger);

                // change the current ledger in the main window
                Form         MainWindow            = FPetraUtilsObject.GetCallerForm();
                PropertyInfo CurrentLedgerProperty = MainWindow.GetType().GetProperty("CurrentLedger");
                CurrentLedgerProperty.SetValue(MainWindow, NewLedger, null);

                return(true);
            }

            if (FNewDonorWarning != chkNewDonorWarning.Checked)
            {
                FNewDonorWarning = chkNewDonorWarning.Checked;
                TUserDefaults.SetDefault(TUserDefaults.FINANCE_NEW_DONOR_WARNING, FNewDonorWarning);
            }

            if (FAutoSave != chkAutoSave.Checked)
            {
                FAutoSave = chkAutoSave.Checked;
                TUserDefaults.SetDefault(TUserDefaults.FINANCE_AUTO_SAVE_GIFT_SCREEN, FAutoSave);
            }

            if (FShowMoneyAsCurrency != chkMoneyFormat.Checked)
            {
                FShowMoneyAsCurrency = chkMoneyFormat.Checked;
                TUserDefaults.SetDefault(StringHelper.FINANCE_CURRENCY_FORMAT_AS_CURRENCY, FShowMoneyAsCurrency);
            }

            if (FShowDecimalsAsCurrency != chkDecimalFormat.Checked)
            {
                FShowDecimalsAsCurrency = chkDecimalFormat.Checked;
                TUserDefaults.SetDefault(StringHelper.FINANCE_DECIMAL_FORMAT_AS_CURRENCY, FShowDecimalsAsCurrency);
            }

            if (FShowThousands != chkShowThousands.Checked)
            {
                FShowThousands = chkShowThousands.Checked;
                TUserDefaults.SetDefault(StringHelper.FINANCE_CURRENCY_SHOW_THOUSANDS, FShowThousands);
            }

            return(false);
        }
Пример #14
0
        private void InitializeManualCode()
        {
            // Set the form properties
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
            this.ShowInTaskbar   = false;
            this.ControlBox      = false;

            // Position the window relative to the caller form
            Form caller = FPetraUtilsObject.GetCallerForm();

            this.Left = caller.Left + 200;
            this.Top  = caller.Top + 200;

            // Set a bold font for the heading
            lblHeading.Font = new System.Drawing.Font(lblHeading.Font, System.Drawing.FontStyle.Bold);
        }
Пример #15
0
        /// <summary>
        /// Create a new conference
        /// </summary>
        public void NewConference(System.Object sender, EventArgs e)
        {
            Form MainWindow = FPetraUtilsObject.GetCallerForm();

            System.Int64 PartnerKey = 0;
            string       PartnerShortName;
            String       OutreachCode;

            // If the delegate is defined, the host form will launch a Modal Partner Find screen for us
            if (TCommonScreensForwarding.OpenEventFindScreen != null)
            {
                // delegate IS defined
                try
                {
                    TCommonScreensForwarding.OpenEventFindScreen.Invoke
                        ("",
                        out PartnerKey,
                        out PartnerShortName,
                        out OutreachCode,
                        MainWindow);

                    // check if a conference already exists for chosen event
                    Boolean ConferenceExists = TRemote.MConference.Conference.WebConnectors.ConferenceExists(PartnerKey);

                    if ((PartnerKey != -1) && !ConferenceExists)
                    {
                        TRemote.MConference.Conference.WebConnectors.CreateNewConference(PartnerKey);

                        FSelectedConferenceKey  = PartnerKey;
                        FSelectedConferenceName = PartnerShortName;

                        ReloadNavigation();
                    }
                    else if ((PartnerKey != -1) && ConferenceExists)
                    {
                        MessageBox.Show(Catalog.GetString("This conference already exists"), Catalog.GetString(
                                            "New Conference"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        NewConference(sender, e);
                    }
                }
                catch (Exception exp)
                {
                    throw new EOPAppException("Exception occured while calling OpenEventFindScreen Delegate!", exp);
                }
            }
        }
Пример #16
0
        // open a dialog to select which To Partner's addresses should be merged
        private bool GetSelectedAddresses()
        {
            Form MainWindow = FPetraUtilsObject.GetCallerForm();

            // If the delegate is defined, the host form will launch a Modal screen for us
            if (TCommonScreensForwarding.OpenGetMergeDataDialog != null)
            {
                // delegate IS defined
                try
                {
                    string DataType = "ADDRESS";
                    return(TCommonScreensForwarding.OpenGetMergeDataDialog.Invoke(FFromPartnerKey, FToPartnerKey, DataType, MainWindow));
                }
                catch (Exception exp)
                {
                    throw new EOPAppException("Exception occured while calling OpenGetMergeDataDialog Delegate!", exp);
                }
            }

            return(false);
        }
Пример #17
0
        // reload navigation
        private void ReloadNavigation()
        {
            // update user defaults table
            TUserDefaults.SetDefault(TUserDefaults.CONFERENCE_LASTCONFERENCEWORKEDWITH, FSelectedConferenceKey);

            Form       MainWindow = FPetraUtilsObject.GetCallerForm();
            MethodInfo method     = MainWindow.GetType().GetMethod("LoadNavigationUI");

            if (method != null)
            {
                method.Invoke(MainWindow, new object[] { true });
            }

            method = MainWindow.GetType().GetMethod("SelectConferenceFolder");

            if (method != null)
            {
                method.Invoke(MainWindow, null);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        // open a dialog to select which From Partner's contact details should be merged
        private bool GetSelectedContactDetails()
        {
            Form MainWindow = FPetraUtilsObject.GetCallerForm();

            // If the delegate is defined, the host form will launch a Modal screen for us
            if (TCommonScreensForwarding.OpenGetMergeDataDialog != null)
            {
                // delegate IS defined
                try
                {
                    return(TCommonScreensForwarding.OpenGetMergeDataDialog.Invoke(FFromPartnerKey,
                                                                                  FToPartnerKey,
                                                                                  TMergeActionEnum.CONTACTDETAIL,
                                                                                  MainWindow));
                }
                catch (Exception exp)
                {
                    throw new EOPAppException("Exception occured while calling OpenGetMergeDataDialog Delegate!", exp);
                }
            }

            return(false);
        }
Пример #19
0
        private void BtnOK_Click(object sender, EventArgs e)
        {
            string msgTitle = Catalog.GetString("Import Options");

            if (chkWriteOutputFile.Checked)
            {
                if (txtOutputFileName.Text.Length == 0)
                {
                    MessageBox.Show(Catalog.GetString(
                                        "Please choose a name for the CSV output file"), msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }

            if (chkCreateExtract.Checked)
            {
                // Validation...
                if (txtExtractName.Text.Length == 0)
                {
                    MessageBox.Show(Catalog.GetString(
                                        "Please enter a name for the Extract"), msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                // Check the name
                if (((TFrmPartnerImport)FPetraUtilsObject.GetCallerForm()).ValidateExtractName(txtExtractName.Text) == false)
                {
                    MessageBox.Show(Catalog.GetString("The extract name has already been used.  Please choose a different name"),
                                    msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }

            this.DialogResult = DialogResult.OK;
            Close();
        }
Пример #20
0
        /// <summary>
        /// Saves any changed preferences to s_user_defaults
        /// </summary>
        /// <returns>void</returns>
        public bool SaveFinanceTab()
        {
            int NewLedger = cmbDefaultLedger.GetSelectedInt32();

            if (FCurrentLedger != NewLedger)
            {
                TUserDefaults.SetDefault(TUserDefaults.FINANCE_DEFAULT_LEDGERNUMBER, NewLedger);

                // change the current ledger in the main window
                Form         MainWindow            = FPetraUtilsObject.GetCallerForm();
                PropertyInfo CurrentLedgerProperty = MainWindow.GetType().GetProperty("CurrentLedger");
                CurrentLedgerProperty.SetValue(MainWindow, NewLedger, null);

                return(true);
            }

            if (FNewDonorWarning != chkNewDonorWarning.Checked)
            {
                FNewDonorWarning = chkNewDonorWarning.Checked;
                TUserDefaults.SetDefault(TUserDefaults.FINANCE_NEW_DONOR_WARNING, FNewDonorWarning);
            }

            return(false);
        }
Пример #21
0
        private void print(object sender, EventArgs ea)
        {
            Form MainWindow = FPetraUtilsObject.GetCallerForm();

            TCommonScreensForwarding.OpenPrintUnitHierarchy.Invoke(TRemote.MPartner.Partner.WebConnectors.GetUnitHierarchyRootUnitKey(), MainWindow);
        }
        private TSubmitChangesResult StoreManualCode(ref CorporateExchangeSetupTDS ASubmitChanges,
                                                     out TVerificationResultCollection AVerificationResult)
        {
            AVerificationResult = null;
            int TransactionsChanged;

            TSubmitChangesResult Result = TRemote.MFinance.Setup.WebConnectors.SaveCorporateExchangeSetupTDS(
                ref ASubmitChanges, out TransactionsChanged, out AVerificationResult);

            if ((Result == TSubmitChangesResult.scrOK) && (TransactionsChanged > 0) && (FPetraUtilsObject.GetCallerForm() != null))
            {
                MessageBox.Show(string.Format(Catalog.GetPluralString(
                                                  "{0} GL Transaction was automatically updated with the new corporate exchange rate.",
                                                  "{0} GL Transactions were automatically updated with the new corporate exchange rate.",
                                                  TransactionsChanged, true), TransactionsChanged),
                                Catalog.GetString("Save Corporate Exchange Rates"), MessageBoxButtons.OK);
            }

            return(Result);
        }
Пример #23
0
        private void BtnOK_Click(System.Object sender, EventArgs e)
        {
            MethodInfo method;

            TVerificationResultCollection VerificationResult;

            if (!dtpCalendarStartDate.Date.HasValue)
            {
                MessageBox.Show(Catalog.GetString("Please supply valid Start date."),
                                Catalog.GetString("Problem: No Ledger has been created"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            if (nudCurrentPeriod.Value > nudNumberOfPeriods.Value)
            {
                MessageBox.Show(Catalog.GetString("Current Period cannot be greater than Number of Periods!"),
                                Catalog.GetString("Problem: No Ledger has been created"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            if (chkActivateGiftProcessing.Checked &&
                ((txtStartingReceiptNumber.NumberValueInt == null) ||
                 (txtStartingReceiptNumber.NumberValueInt <= 0)))
            {
                MessageBox.Show(Catalog.GetString("Starting Receipt Number must be 1 or higher!"),
                                Catalog.GetString("Problem: No Ledger has been created"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            // check if a unit already exists that uses this ledger key; make sure name is identical
            String        UnitName;
            TPartnerClass PartnerClass;
            Int64         PartnerKey = Convert.ToInt64(nudLedgerNumber.Value) * 1000000L;

            if (TRemote.MPartner.Partner.ServerLookups.WebConnectors.GetPartnerShortName(PartnerKey,
                                                                                         out UnitName, out PartnerClass, true))
            {
                if (txtLedgerName.Text.Length == 0)
                {
                    txtLedgerName.Text = UnitName;
                }
                else
                {
                    if (UnitName != txtLedgerName.Text)
                    {
                        if (MessageBox.Show(String.Format(Catalog.GetString(
                                                              "A Unit Partner record already exists for Ledger Number {0}!\r\n(Partner Key: {1} - Name: '{2}')\r\nYour suggested name '{3}' will automatically be changed to '{2}'.\r\n\r\nDo you still want to continue?"),
                                                          nudLedgerNumber.Value.ToString(), PartnerKey.ToString(), UnitName, txtLedgerName.Text),
                                            Catalog.GetString("Problem: Ledger Name Mismatch"),
                                            MessageBoxButtons.YesNo,
                                            MessageBoxIcon.Error) == DialogResult.Yes)
                        {
                            txtLedgerName.Text = UnitName;
                        }
                        else
                        {
                            return;
                        }
                    }
                }
            }
            else
            {
                if (txtLedgerName.Text.Length == 0)
                {
                    MessageBox.Show(
                        Catalog.GetString("Please enter a name for your ledger!"),
                        Catalog.GetString("Problem: No Ledger has been created"),
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    return;
                }
            }

            Int32 StartingReceiptNumber = 1;

            if (txtStartingReceiptNumber.NumberValueInt != null)
            {
                StartingReceiptNumber = Convert.ToInt32(txtStartingReceiptNumber.NumberValueInt) - 1;
            }

            /* hourglass cursor */
            System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

            if (!TRemote.MFinance.Setup.WebConnectors.CreateNewLedger(
                    Convert.ToInt32(nudLedgerNumber.Value),
                    txtLedgerName.Text,
                    cmbCountryCode.GetSelectedString(),
                    cmbBaseCurrency.GetSelectedString(),
                    cmbIntlCurrency.GetSelectedString(),
                    dtpCalendarStartDate.Date.Value,
                    Convert.ToInt32(nudNumberOfPeriods.Value),
                    Convert.ToInt32(nudCurrentPeriod.Value),
                    Convert.ToInt32(nudNumberOfFwdPostingPeriods.Value),
                    rbtIchIsAsset.Checked,
                    chkActivateGiftProcessing.Checked,
                    StartingReceiptNumber,
                    chkActivateAccountsPayable.Checked,
                    out VerificationResult))
            {
                /* normal mouse cursor */
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;

                if (VerificationResult != null)
                {
                    MessageBox.Show(
                        VerificationResult.BuildVerificationResultString(),
                        Catalog.GetString("Problem: No Ledger has been created"));
                }
                else
                {
                    MessageBox.Show(Catalog.GetString("Problem: No Ledger has been created"),
                                    Catalog.GetString("Error"));
                }
            }
            else
            {
                /* normal mouse cursor */
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;

                MessageBox.Show(String.Format(Catalog.GetString(
                                                  "Ledger {0} ({1}) has been created successfully and is now the current Ledger.\r\n\r\nPermissions for users to be able to access this Ledger can be assigned in the System Manager Module."),
                                              txtLedgerName.Text,
                                              nudLedgerNumber.Value),
                                Catalog.GetString("Success"),
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                // reload permissions for user
                UserInfo.GUserInfo = TRemote.MSysMan.Security.UserManager.WebConnectors.ReloadCachedUserInfo();

                // reload list of Ledger names
                TDataCache.TMFinance.RefreshCacheableFinanceTable(TCacheableFinanceTablesEnum.LedgerNameList);

                // reload navigation
                Form MainWindow = FPetraUtilsObject.GetCallerForm();

                PropertyInfo CurrentLedgerProperty = MainWindow.GetType().GetProperty("CurrentLedger");
                CurrentLedgerProperty.SetValue(MainWindow, Convert.ToInt32(nudLedgerNumber.Value), null);

                method = MainWindow.GetType().GetMethod("LoadNavigationUI");

                if (method != null)
                {
                    method.Invoke(MainWindow, new object[] { true });
                }

                method = MainWindow.GetType().GetMethod("ShowCurrentLedgerInfoInStatusBar");

                if (method != null)
                {
                    method.Invoke(MainWindow, new object[] { });
                }

                method = MainWindow.GetType().GetMethod("SelectFinanceFolder");

                if (method != null)
                {
                    method.Invoke(MainWindow, new object[] { });
                }

                Close();
            }
        }
        private void AddRangeRecord(Object sender, EventArgs e)
        {
            Form MainWindow = FPetraUtilsObject.GetCallerForm();

            String RegionName = ((PPostcodeRegionRow)GetSelectedDetailRow()).Region;

            String[] RangeName;
            String[] RangeFrom;
            String[] RangeTo;

            // If the delegate is defined, the host form will launch a Modal Partner Find screen for us
            if (TCommonScreensForwarding.OpenRangeFindScreen != null)
            {
                // delegate IS defined
                try
                {
                    TCommonScreensForwarding.OpenRangeFindScreen.Invoke
                        (RegionName,
                        out RangeName,
                        out RangeFrom,
                        out RangeTo,
                        MainWindow);

                    if (RangeName == null)
                    {
                        return;
                    }

                    ShowDetailsManual(FPreviouslySelectedDetailRow);

                    for (int i = 0; i < RangeName.Length; i++)
                    {
                        if (RangeName[i] != null)
                        {
                            // check if this range already exists for region
                            Boolean RangeExists = false;

                            if (FMainDS.PPostcodeRegionRange.Rows.Find(new object[] { RegionName, RangeName[i] }) != null)
                            {
                                RangeExists = true;
                            }

                            if (!RangeExists && (RangeName[i].Length > 0))
                            {
                                PostcodeRegionsTDSPPostcodeRegionRangeRow NewRow = FMainDS.PPostcodeRegionRange.NewRowTyped(true);
                                NewRow.Region = RegionName;
                                NewRow.Range  = RangeName[i];
                                NewRow.From   = RangeFrom[i];
                                NewRow.To     = RangeTo[i];
                                FMainDS.PPostcodeRegionRange.Rows.Add(NewRow);
                                FPetraUtilsObject.SetChangedFlag();
                            }
                            else if (RangeName[i].Length > 0)
                            {
                                string Message = string.Format(Catalog.GetString("The {0} range already exists for this region"), RangeName[i]);
                                MessageBox.Show(Message, Catalog.GetString(
                                                    "Add Range"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                    }
                }
                catch (Exception exp)
                {
                    throw new EOPAppException("Exception occured while calling OpenRangeFindScreen Delegate!", exp);
                }
            }
        }