/// <summary>
        /// Switches to the corresponding TabPage.
        /// </summary>
        /// <remarks>If the TabPage is on a different TabGroup than the one that is currently
        /// shown, the TabGroup is first switched to (and it is initialised, if needed).</remarks>
        /// <param name="ATabPage">TapPage to switch to.</param>
        public void SelectTabPage(TPartnerEditTabPageEnum ATabPage)
        {
            TPartnerEditScreenLogic.TModuleTabGroupEnum ModuleTabGroup = TPartnerEditScreenLogic.DetermineTabGroup(ATabPage);

            ShowChildUserControl(ModuleTabGroup);

            switch (ModuleTabGroup)
            {
            case TPartnerEditScreenLogic.TModuleTabGroupEnum.mtgPartner:
                ucoPartnerTabSet.SelectTabPage(ATabPage);
                break;

            case TPartnerEditScreenLogic.TModuleTabGroupEnum.mtgPersonnel:
                ucoPersonnelTabSet.SelectTabPage(ATabPage);
                break;
            }
        }
        /// <summary>
        /// Shows the UserControl that has the Tabs for the currently selected Tab. If needed, initialisation
        /// of the UserContol is done.
        /// </summary>
        public void ShowChildUserControl(TPartnerEditScreenLogic.TModuleTabGroupEnum AModuleTabGroup)
        {
            InitChildUserControl(AModuleTabGroup);

            switch (AModuleTabGroup)
            {
            case TPartnerEditScreenLogic.TModuleTabGroupEnum.mtgPartner:

                ucoPartnerTabSet.Visible   = true;
                ucoPersonnelTabSet.Visible = false;
                ucoPartnerTabSet.SelectTabPage(ucoPartnerTabSet.CurrentlySelectedTabPage);     // make refresh happen

                break;

            case TPartnerEditScreenLogic.TModuleTabGroupEnum.mtgPersonnel:

                ucoPersonnelTabSet.Visible = true;
                ucoPartnerTabSet.Visible   = false;
                ucoPersonnelTabSet.SelectTabPage(ucoPersonnelTabSet.CurrentlySelectedTabPage);     // make refresh happen

                break;
            }
        }
        /// <summary>
        /// Initialises the UserControl that has the Tabs for the currently selected Tab.
        /// </summary>
        private void InitChildUserControl(TPartnerEditScreenLogic.TModuleTabGroupEnum AModuleTabGroup)
        {
            switch (AModuleTabGroup)
            {
                case TPartnerEditScreenLogic.TModuleTabGroupEnum.mtgPartner:

                    if (!FInitialisedChildUCs.Contains(ucoPartnerTabSet.GetType().Name))
                    {
                        FInitialisedChildUCs.Add(ucoPartnerTabSet.GetType().Name);

                        this.ParentForm.Cursor = Cursors.WaitCursor;

                        ucoPartnerTabSet.PetraUtilsObject = FPetraUtilsObject;
                        ucoPartnerTabSet.PartnerEditUIConnector = FPartnerEditUIConnector;

                        if (!FInitialisedChildUCs.Contains(ucoPersonnelTabSet.GetType().Name))
                        {
                            ucoPartnerTabSet.InitiallySelectedTabPage = FInitiallySelectedTabPage;
                        }
                        else
                        {
                            ucoPartnerTabSet.InitiallySelectedTabPage = TPartnerEditTabPageEnum.petpAddresses;
                        }

                        ucoPartnerTabSet.MainDS = FMainDS;
                        ucoPartnerTabSet.SpecialInitUserControl();
                        ucoPartnerTabSet.HookupDataChange += new THookupDataChangeEventHandler(ucoPartnerTabSet_HookupDataChange);
                        ucoPartnerTabSet.HookupPartnerEditDataChange += new THookupPartnerEditDataChangeEventHandler(
                            ucoPartnerTabSet_HookupPartnerEditDataChange);

                        this.ParentForm.Cursor = Cursors.Default;
                    }

                    break;

                case TPartnerEditScreenLogic.TModuleTabGroupEnum.mtgPersonnel:

                    if (!FInitialisedChildUCs.Contains(ucoPersonnelTabSet.GetType().Name))
                    {
                        FInitialisedChildUCs.Add(ucoPersonnelTabSet.GetType().Name);

                        this.ParentForm.Cursor = Cursors.WaitCursor;

                        ucoPersonnelTabSet.PetraUtilsObject = FPetraUtilsObject;
                        ucoPersonnelTabSet.PartnerEditUIConnector = FPartnerEditUIConnector;

                        if (!FInitialisedChildUCs.Contains(ucoPartnerTabSet.GetType().Name))
                        {
                            ucoPersonnelTabSet.InitiallySelectedTabPage = FInitiallySelectedTabPage;
                        }
                        else
                        {
                            ucoPersonnelTabSet.InitiallySelectedTabPage = TPartnerEditTabPageEnum.petpPersonnelIndividualData;
                        }

                        ucoPersonnelTabSet.MainDS = FMainDS;
                        ucoPersonnelTabSet.SpecialInitUserControl();

                        this.ParentForm.Cursor = Cursors.Default;
                    }

                    break;
            }

            FCurrentModuleTabGroup = AModuleTabGroup;
        }
        /// <summary>
        /// Initialises the UserControl that has the Tabs for the currently selected Tab.
        /// </summary>
        private void InitChildUserControl(TPartnerEditScreenLogic.TModuleTabGroupEnum AModuleTabGroup)
        {
            switch (AModuleTabGroup)
            {
            case TPartnerEditScreenLogic.TModuleTabGroupEnum.mtgPartner:

                if (!FInitialisedChildUCs.Contains(ucoPartnerTabSet.GetType().Name))
                {
                    FInitialisedChildUCs.Add(ucoPartnerTabSet.GetType().Name);

                    this.ParentForm.Cursor = Cursors.WaitCursor;

                    ucoPartnerTabSet.PetraUtilsObject       = FPetraUtilsObject;
                    ucoPartnerTabSet.PartnerEditUIConnector = FPartnerEditUIConnector;

                    if (!FInitialisedChildUCs.Contains(ucoPersonnelTabSet.GetType().Name))
                    {
                        ucoPartnerTabSet.InitiallySelectedTabPage = FInitiallySelectedTabPage;
                    }
                    else
                    {
                        ucoPartnerTabSet.InitiallySelectedTabPage = TPartnerEditTabPageEnum.petpAddresses;
                    }

                    ucoPartnerTabSet.MainDS = FMainDS;
                    ucoPartnerTabSet.SpecialInitUserControl();
                    ucoPartnerTabSet.HookupDataChange            += new THookupDataChangeEventHandler(ucoPartnerTabSet_HookupDataChange);
                    ucoPartnerTabSet.HookupPartnerEditDataChange += new THookupPartnerEditDataChangeEventHandler(
                        ucoPartnerTabSet_HookupPartnerEditDataChange);
                    ucoPartnerTabSet.AddressAddedPartnerNeedsToBecomeActive += UcoPartnerTabSet_AddressAddedPartnerNeedsToBecomeActive;
                    this.ParentForm.Cursor = Cursors.Default;
                }

                break;

            case TPartnerEditScreenLogic.TModuleTabGroupEnum.mtgPersonnel:

                if (!FInitialisedChildUCs.Contains(ucoPersonnelTabSet.GetType().Name))
                {
                    FInitialisedChildUCs.Add(ucoPersonnelTabSet.GetType().Name);

                    this.ParentForm.Cursor = Cursors.WaitCursor;

                    ucoPersonnelTabSet.PetraUtilsObject       = FPetraUtilsObject;
                    ucoPersonnelTabSet.PartnerEditUIConnector = FPartnerEditUIConnector;

                    if (!FInitialisedChildUCs.Contains(ucoPartnerTabSet.GetType().Name))
                    {
                        ucoPersonnelTabSet.InitiallySelectedTabPage = FInitiallySelectedTabPage;
                    }
                    else
                    {
                        ucoPersonnelTabSet.InitiallySelectedTabPage = TPartnerEditTabPageEnum.petpPersonnelIndividualData;
                    }

                    ucoPersonnelTabSet.MainDS = FMainDS;
                    ucoPersonnelTabSet.SpecialInitUserControl();

                    this.ParentForm.Cursor = Cursors.Default;
                }

                break;
            }

            FCurrentModuleTabGroup = AModuleTabGroup;
        }
        /// <summary>
        /// Determines which TabPage to show when the screen is loaded and which
        /// TabSet to initialise.
        /// </summary>
        /// <remarks>
        /// Verifies that TapPages are only opened for the Partners which use them.
        /// </remarks>
        private void DetermineInitiallySelectedTabPage()
        {
            switch (FShowTabPage)
            {
                case TPartnerEditTabPageEnum.petpDefault:

                    // TODO 2 oChristianK cPartner Edit / Tabs : Introduce a User Default that can specify which TabPage is the one the User wants to see as default.
                    FShowTabPage = TPartnerEditTabPageEnum.petpAddresses;
                    FInitiallySelectedTabPage = FShowTabPage;

                    break;

                case TPartnerEditTabPageEnum.petpFoundationDetails:

                    if (!FFoundationDetailsEnabled)
                    {
                        FShowTabPage = TPartnerEditTabPageEnum.petpAddresses;
                    }

                    FInitiallySelectedTabPage = FShowTabPage;

                    break;

                case TPartnerEditTabPageEnum.petpFamilyMembers:

                    if (!((FPartnerClass == "PERSON")
                          || (FPartnerClass == "FAMILY")))
                    {
                        FShowTabPage = TPartnerEditTabPageEnum.petpAddresses;
                    }

                    FInitiallySelectedTabPage = FShowTabPage;

                    break;

                case TPartnerEditTabPageEnum.petpOfficeSpecific:

                    if (!FMainDS.MiscellaneousData[0].OfficeSpecificDataLabelsAvailable)
                    {
                        FShowTabPage = TPartnerEditTabPageEnum.petpAddresses;
                    }

                    FInitiallySelectedTabPage = FShowTabPage;

                    break;

                case TPartnerEditTabPageEnum.petpAddresses:
                case TPartnerEditTabPageEnum.petpDetails:
                case TPartnerEditTabPageEnum.petpContactDetails:
                case TPartnerEditTabPageEnum.petpSubscriptions:
                case TPartnerEditTabPageEnum.petpPartnerTypes:
                case TPartnerEditTabPageEnum.petpPartnerRelationships:
                case TPartnerEditTabPageEnum.petpNotes:
                case TPartnerEditTabPageEnum.petpFinanceDetails:
                case TPartnerEditTabPageEnum.petpInterests:
                    FInitiallySelectedTabPage = FShowTabPage;

                    break;

#if  SHOWUNFINISHEDTABS
                case TPartnerEditTabPageEnum.petpReminders:
                    FInitiallySelectedTabPage = FShowTabPage;

                    break;

#else
                case TPartnerEditTabPageEnum.petpContacts:
                    FInitiallySelectedTabPage = FShowTabPage;

                    break;

                case TPartnerEditTabPageEnum.petpReminders:
                    FShowTabPage = TPartnerEditTabPageEnum.petpAddresses;
                    FInitiallySelectedTabPage = FShowTabPage;

                    break;
#endif

                case TPartnerEditTabPageEnum.petpPersonnelIndividualData:
                case TPartnerEditTabPageEnum.petpPersonnelApplications:
                    FInitiallySelectedTabPage = FShowTabPage;

                    break;

                default:
                    FInitiallySelectedTabPage = TPartnerEditTabPageEnum.petpAddresses;

                    break;
            }

            FCurrentModuleTabGroup = TPartnerEditScreenLogic.DetermineTabGroup(FInitiallySelectedTabPage);
        }