/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="AFilterFindPanelObject">The FilterFindPanel Object on the main form</param>
        /// <param name="ASuspenseAccountsAllowed">Used to determine if the suspense accounts control be shown.</param>
        public TUC_AccountsListFilterFind(TFilterAndFindPanel AFilterFindPanelObject, bool ASuspenseAccountsAllowed)
        {
            FSuspenseAccountsAllowed = ASuspenseAccountsAllowed;

            FFilterTxtAccountCode = (TextBox)AFilterFindPanelObject.FilterPanelControls.FindControlByName("txtAccountCode");
            FFilterCmbAccountType = (TCmbAutoComplete)AFilterFindPanelObject.FilterPanelControls.FindControlByName("cmbAccountType");
            FFilterTxtDescrEnglish = (TextBox)AFilterFindPanelObject.FilterPanelControls.FindControlByName("txtDescrEnglish");
            FFilterTxtDescrLocal = (TextBox)AFilterFindPanelObject.FilterPanelControls.FindControlByName("txtDescrLocal");
            FFilterChkBankAccount = (CheckBox)AFilterFindPanelObject.FilterPanelControls.FindControlByName("chkBankAccount");

            if (ASuspenseAccountsAllowed)
            {
                FFilterChkSuspenseAccount = (CheckBox)AFilterFindPanelObject.FilterPanelControls.FindControlByName("chkSuspenseAccount");
            }

            FFilterChkActive = (CheckBox)AFilterFindPanelObject.FilterPanelControls.FindControlByName("chkActive");
            FFilterChkSummary = (CheckBox)AFilterFindPanelObject.FilterPanelControls.FindControlByName("chkSummary");
            FFilterChkForeign = (CheckBox)AFilterFindPanelObject.FilterPanelControls.FindControlByName("chkForeign");

            FFindTxtAccountCode = (TextBox)AFilterFindPanelObject.FindPanelControls.FindControlByName("txtAccountCode");
            FFindCmbAccountType = (TCmbAutoComplete)AFilterFindPanelObject.FindPanelControls.FindControlByName("cmbAccountType");
            FFindTxtDescrEnglish = (TextBox)AFilterFindPanelObject.FindPanelControls.FindControlByName("txtDescrEnglish");
            FFindTxtDescrLocal = (TextBox)AFilterFindPanelObject.FindPanelControls.FindControlByName("txtDescrLocal");
            FFindChkBankAccount = (CheckBox)AFilterFindPanelObject.FindPanelControls.FindControlByName("chkBankAccount");

            if (ASuspenseAccountsAllowed)
            {
                FFindChkSuspenseAccount = (CheckBox)AFilterFindPanelObject.FindPanelControls.FindControlByName("chkSuspenseAccount");
            }

            FFindChkActive = (CheckBox)AFilterFindPanelObject.FindPanelControls.FindControlByName("chkActive");
            FFindChkSummary = (CheckBox)AFilterFindPanelObject.FindPanelControls.FindControlByName("chkSummary");
            FFindChkForeign = (CheckBox)AFilterFindPanelObject.FindPanelControls.FindControlByName("chkForeign");
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="AFilterFindPanelObject">The FilterFindPanel Object on the main form</param>
        public TUC_CostCentreListFilterFind(TFilterAndFindPanel AFilterFindPanelObject)
        {
            FFilterTxtCostCentreCode = (TextBox)AFilterFindPanelObject.FilterPanelControls.FindControlByName("txtCostCentreCode");
            FFilterCmbCostCentreType = (TCmbAutoComplete)AFilterFindPanelObject.FilterPanelControls.FindControlByName("cmbCostCentreType");
            FFilterTxtCostCentreName = (TextBox)AFilterFindPanelObject.FilterPanelControls.FindControlByName("txtCostCentreName");
            FFilterChkActive = (CheckBox)AFilterFindPanelObject.FilterPanelControls.FindControlByName("chkActive");

            FFindTxtCostCentreCode = (TextBox)AFilterFindPanelObject.FindPanelControls.FindControlByName("txtCostCentreCode");
            FFindCmbCostCentreType = (TCmbAutoComplete)AFilterFindPanelObject.FindPanelControls.FindControlByName("cmbCostCentreType");
            FFindTxtCostCentreName = (TextBox)AFilterFindPanelObject.FindPanelControls.FindControlByName("txtCostCentreName");
            FFindChkActive = (CheckBox)AFilterFindPanelObject.FindPanelControls.FindControlByName("chkActive");
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="ALedgerNumber">Ledger number</param>
        /// <param name="AMainDS">The main data set</param>
        /// <param name="AFilterFindPanelObject">The filter panel control object</param>
        public TUC_GiftBatches_LoadAndFilter(int ALedgerNumber, GiftBatchTDS AMainDS, TFilterAndFindPanel AFilterFindPanelObject)
        {
            FLedgerNumber = ALedgerNumber;
            FMainDS = AMainDS;
            FFilterFindPanelObject = AFilterFindPanelObject;

            FrbtEditing = (RadioButton)AFilterFindPanelObject.FilterPanelControls.FindControlByName("rbtEditing");
            FrbtPosting = (RadioButton)AFilterFindPanelObject.FilterPanelControls.FindControlByName("rbtPosting");
            FrbtAll = (RadioButton)AFilterFindPanelObject.FilterPanelControls.FindControlByName("rbtAll");
            FcmbYearEnding = (TCmbAutoComplete)AFilterFindPanelObject.FilterPanelControls.FindControlByName("cmbYearEnding");
            FcmbPeriod = (TCmbAutoComplete)AFilterFindPanelObject.FilterPanelControls.FindControlByName("cmbPeriod");

            FMainDS.AGiftBatch.DefaultView.Sort = String.Format("{0}, {1} DESC",
                AGiftBatchTable.GetLedgerNumberDBName(),
                AGiftBatchTable.GetBatchNumberDBName()
                );

            // Populate the Year ComboBox with available years for the specified ledger
            TFinanceControls.InitialiseAvailableGiftYearsList(ref FcmbYearEnding, FLedgerNumber);
            //TLogging.Log("Gift Years completed");

            // Ensure that we start with the status set to 'editing'.
            FrbtEditing.Checked = true;
            //TLogging.Log("Editing checkbox selected");
        }
        private void GetDataAccordingToContactComboType(TOverallContactComboType AContactComboType,
            out TCmbAutoComplete AComboBoxForContactComboType, out DataColumn ADataColumn)
        {
            string PhoneComboTypeStr;  // Ignored, but needed as this is an out Argument of GetDataAccordingToContactComboType...

            GetDataAccordingToContactComboType(AContactComboType, out AComboBoxForContactComboType, out PhoneComboTypeStr);

            switch (AContactComboType)
            {
                case TOverallContactComboType.occtPrimaryPhone:
                    ADataColumn = new PPartnerAttributeTable().Columns[PPartnerAttributeTable.ColumnPrimaryId];

                    break;

                case TOverallContactComboType.occtPhoneWithinOrganisation:
                    ADataColumn = new PPartnerAttributeTable().Columns[PPartnerAttributeTable.ColumnWithinOrganisationId];

                    break;

                case TOverallContactComboType.occtPrimaryEmail:
                    ADataColumn = new PPartnerAttributeTable().Columns[PPartnerAttributeTable.ColumnPrimaryId];

                    break;

                case TOverallContactComboType.occtEmailWithinOrganisation:
                    ADataColumn = new PPartnerAttributeTable().Columns[PPartnerAttributeTable.ColumnWithinOrganisationId];

                    break;

                default:
                    ADataColumn = null;

                    break;
            }
        }
        private void GetDataAccordingToContactComboType(TOverallContactComboType AContactComboType,
            out TCmbAutoComplete AComboBoxForContactComboType, out string APhoneComboTypeStr)
        {
            switch (AContactComboType)
            {
                case TOverallContactComboType.occtPrimaryPhone:
                    AComboBoxForContactComboType = cmbPrimaryPhoneForContacting;
                    APhoneComboTypeStr = StrPrimaryPhone;

                    break;

                case TOverallContactComboType.occtPhoneWithinOrganisation:
                    AComboBoxForContactComboType = cmbPhoneWithinTheOrganisation;
                    APhoneComboTypeStr = StrPhoneWithinOrgansiation;

                    break;

                case TOverallContactComboType.occtPrimaryEmail:
                    AComboBoxForContactComboType = cmbPrimaryEMail;
                    APhoneComboTypeStr = StrPrimaryEmail;

                    break;

                case TOverallContactComboType.occtSecondaryEmail:
                    AComboBoxForContactComboType = cmbSecondaryEMail;
                    APhoneComboTypeStr = StrSecondaryEmail;

                    break;

                case TOverallContactComboType.occtEmailWithinOrganisation:
                    AComboBoxForContactComboType = cmbEMailWithinTheOrganisation;
                    APhoneComboTypeStr = StrEmailWithinOrgansiation;

                    break;

                default:
                    AComboBoxForContactComboType = null;
                    APhoneComboTypeStr = String.Empty;

                    break;
            }
        }
        /// <summary>
        /// Adds available E-Mail Addresses to a ComboBox. If <paramref name="ANewEmailAddressValue"/> is specified
        /// then this value gets selected in the ComboBox.
        /// </summary>
        /// <remarks>Method is similar to Method <see cref="UpdatePhoneComboItems"/>.</remarks>
        /// <param name="AComboBox">The ComboBox Control whose Items should get updated.</param>
        /// <param name="ASuppressMessages">If set to false: Messages will be shown to the user in certain circumstances.
        /// However, this will only be done in case <paramref name="AComboBox"/> is cmbPrimaryEMail!</param>
        /// <param name="ANewEmailAddressValue">Pass a new E-Mail Address to get it selected in the ComboBox. (Default=null)</param>
        /// <param name="APreviousValue">The Previous Value. Only needed for cmbSecondaryEMail!</param>
        private void UpdateEmailComboItems(TCmbAutoComplete AComboBox, bool ASuppressMessages,
            string ANewEmailAddressValue = null, string APreviousValue = null)
        {
            object[] EligibleEmailAddresses;
            string ThePrimaryEmailAddress = String.Empty;
            string TheSecondaryEmailAddress = String.Empty;
            string TheWithinOrganisationEmailAddress = String.Empty;
            string PrimaryContactMethod;  // Ignored, but needed as this is an out Argument of GetSystemCategoryOvrlContSettgsValues...
            DataView EligibleEmailAddrsDV;
            DataView AllEmailAddrsDV;
            string CurrentlySelectedEmailAddr = AComboBox.GetSelectedString(-1);

            // Determine all Partner Attributes that have a Partner Attribute Type that constitutes an E-Mail
            // and that are Current.
            EligibleEmailAddrsDV = GetDataViewForContactCombo(TOverallContactComboType.occtPrimaryEmail, true);

            EligibleEmailAddresses = new object[EligibleEmailAddrsDV.Count + 1];
            EligibleEmailAddresses[0] = String.Empty;

            if (AComboBox == cmbSecondaryEMail)
            {
                GetSystemCategoryOvrlContSettgsValues(out PrimaryContactMethod, out TheSecondaryEmailAddress);
            }

            for (int Counter = 0; Counter < EligibleEmailAddrsDV.Count; Counter++)
            {
                var TheEmailRow = ((PPartnerAttributeRow)EligibleEmailAddrsDV[Counter].Row);

                EligibleEmailAddresses[Counter + 1] = TheEmailRow.Value;

                if (AComboBox != cmbSecondaryEMail)
                {
                    if (TheEmailRow.Primary)
                    {
                        ThePrimaryEmailAddress = TheEmailRow.Value;
                    }

                    if (TheEmailRow.WithinOrganisation)
                    {
                        TheWithinOrganisationEmailAddress = TheEmailRow.Value;
                    }
                }
            }

            if (!AreComboBoxItemsIdenticalToArgument(AComboBox, EligibleEmailAddresses))
            {
                // Add the available E-Mail Addresses to the ComboBox
                AComboBox.Items.Clear();
                AComboBox.Items.AddRange(EligibleEmailAddresses);
            }

            if ((AComboBox == cmbPrimaryEMail)
                && (ThePrimaryEmailAddress != String.Empty))
            {
                if (AComboBox.GetSelectedString() != ThePrimaryEmailAddress)
                {
                    // Select the Primary E-mail Address in the ComboBox
                    FEmailSelectedValueChangedEvent = true;

                    AComboBox.SetSelectedString(ThePrimaryEmailAddress);

                    FEmailSelectedValueChangedEvent = false;
                }
            }
            else if ((AComboBox == cmbEMailWithinTheOrganisation)
                     && (TheWithinOrganisationEmailAddress != String.Empty))
            {
                if (AComboBox.GetSelectedString() != TheWithinOrganisationEmailAddress)
                {
                    // Select the Within Organisation E-mail Address in the ComboBox
                    FEmailSelectedValueChangedEvent = true;

                    AComboBox.SetSelectedString(TheWithinOrganisationEmailAddress);

                    FEmailSelectedValueChangedEvent = false;
                }
            }
            else if ((AComboBox == cmbSecondaryEMail)
                     && (ANewEmailAddressValue != null)
                     && (ANewEmailAddressValue != String.Empty))
            {
                if (APreviousValue == TheSecondaryEmailAddress)
                {
                    if ((APreviousValue != ANewEmailAddressValue)
                        && (CurrentlySelectedEmailAddr == APreviousValue)
                        && (AComboBox.GetSelectedString() != ANewEmailAddressValue))
                    {
                        // Select the Secondary E-mail Address in the ComboBox
                        FEmailSelectedValueChangedEvent = true;

                        AComboBox.SetSelectedString(ANewEmailAddressValue);

                        FEmailSelectedValueChangedEvent = false;
                    }
                }
                else
                {
                    // Select the Secondary E-mail Address in the ComboBox
                    FEmailSelectedValueChangedEvent = true;

                    AComboBox.SetSelectedString(TheSecondaryEmailAddress);

                    FEmailSelectedValueChangedEvent = false;
                }
            }
            else
            {
                CurrentlySelectedEmailAddr = ANewEmailAddressValue ?? CurrentlySelectedEmailAddr;

                AComboBox.SetSelectedString(CurrentlySelectedEmailAddr);

                if ((AComboBox == cmbPrimaryEMail)
                    && (!ASuppressMessages))
                {
                    if (EligibleEmailAddrsDV.Count > 0)
                    {
                        FTimerDrivenMessageBoxKind = TTimerDrivenMessageBoxKind.tdmbkNoPrimaryEmailAsNoCurrentAvailable;
                        ShowMessageBoxTimer.Start();
                    }
                    else
                    {
                        AllEmailAddrsDV = GetDataViewForContactCombo(TOverallContactComboType.occtPrimaryEmail, false);

                        if (AllEmailAddrsDV.Count > 0)
                        {
                            FTimerDrivenMessageBoxKind = TTimerDrivenMessageBoxKind.tdmbkNoPrimaryEmailButNonCurrentAvailable;
                            ShowMessageBoxTimer.Start();
                        }
                    }
                }
            }
        }
        private bool ValidateOvrlContSettgsCombos(TOverallContactComboType AContactComboType, TCmbAutoComplete AComboBoxForContactComboType,
            string AComboBoxSelectedString, DataView AEligibleValuesDV)
        {
            bool ReturnValue = true;
            DataView CurrentValuesDV;
            PPartnerAttributeRow ThePartnerAttributeRow;
            bool ChoiceFoundAmongEligibleValues = false;

            CurrentValuesDV = GetDataViewForContactCombo(AContactComboType, true);

            if (CurrentValuesDV.Count != 0)
            {
                if ((AContactComboType == TOverallContactComboType.occtPrimaryEmail)
                    && (AComboBoxSelectedString == String.Empty))
                {
                    // Generate a Validation *Warning*, not an error. The user can ignore this if (s)he chooses to do so!
                    ValidationPrimaryEmailAddrNotSet();
                }
                else if ((AContactComboType == TOverallContactComboType.occtSecondaryEmail)
                         && (AComboBoxSelectedString != String.Empty)
                         && (AComboBoxSelectedString == cmbPrimaryEMail.GetSelectedString()))
                {
                    // Generate a Validation *Warning*, not an error. The user can ignore this if (s)he chooses to do so!
                    ValidationSecondaryEmailAddrEqualsPrimaryEmailAddr();
                }
                else
                {
                    if (AComboBoxSelectedString != String.Empty)
                    {
                        for (int Counter3 = 0; Counter3 < AEligibleValuesDV.Count; Counter3++)
                        {
                            ThePartnerAttributeRow = ((PPartnerAttributeRow)AEligibleValuesDV[Counter3].Row);

                            if (ThePartnerAttributeRow.Value == AComboBoxSelectedString)
                            {
                                ChoiceFoundAmongEligibleValues = true;

                                if (!ThePartnerAttributeRow.Current)
                                {
                                    // This condition should not occur, unless the program code that runs when the 'Valid'
                                    // CheckBox is disabled and which should clear all the Items from the ComboBox is somehow
                                    // not working correctly, or not run at all. This condition is therefore a 'back-stop'
                                    // that will prevent invalid data going to the DB!

                                    // Generate a Validation *Error*. The user cannot ignore this.
                                    if ((AContactComboType == TOverallContactComboType.occtPrimaryPhone)
                                        || (AContactComboType == TOverallContactComboType.occtPhoneWithinOrganisation))
                                    {
                                        ValidationPhoneNrSetButItIsntCurrent(AContactComboType);
                                    }
                                    else
                                    {
                                        ValidationEmailAddrSetButItIsntCurrent(AContactComboType);
                                    }

                                    UpdateItemsOfOvrlContSettgsCombo(AComboBoxForContactComboType, false);

                                    ReturnValue = false;
                                }
                            }
                        }

                        if (!ChoiceFoundAmongEligibleValues)
                        {
                            // This condition should not occur, unless various bits of program code are somehow
                            // not working correctly, or not run at all. This condition is therefore a 'back-stop'
                            // that will prevent invalid data going to the DB!

                            // Generate a Validation *Error*. The user cannot ignore this.
                            if ((AContactComboType == TOverallContactComboType.occtPrimaryPhone)
                                || (AContactComboType == TOverallContactComboType.occtPhoneWithinOrganisation))
                            {
                                ValidationPhoneNrSetButNotAmongPhoneNrs(AContactComboType);
                            }
                            else
                            {
                                ValidationEmailAddrSetButNotAmongEmailAddrs(AContactComboType);
                            }

                            UpdateItemsOfOvrlContSettgsCombo(AComboBoxForContactComboType, true);

                            ReturnValue = false;
                        }
                    }
                }
            }
            else
            {
                if (AComboBoxSelectedString != String.Empty)
                {
                    // This condition should not occur, unless various bits of program code are somehow
                    // not working correctly, or not run at all. This condition is therefore a 'back-stop'
                    // that will prevent invalid data going to the DB!

                    // Generate a Validation *Error*. The user cannot ignore this.
                    if ((AContactComboType == TOverallContactComboType.occtPrimaryPhone)
                        || (AContactComboType == TOverallContactComboType.occtPhoneWithinOrganisation))
                    {
                        ValidationPhoneNrSetButNoPhoneNrAvailable(AContactComboType);
                    }
                    else
                    {
                        ValidationEmailAddrSetButNoEmailAddrAvailable(AContactComboType);
                    }

                    UpdateItemsOfOvrlContSettgsCombo(AComboBoxForContactComboType, true);

                    ReturnValue = false;
                }
            }

            return ReturnValue;
        }
        /// <summary>
        /// Adds available Phone Numbers to a ComboBox. If <paramref name="ANewPhoneNumberValue"/> is specified
        /// then this value gets selected in the ComboBox.
        /// </summary>
        /// <remarks>Method is similar to Method <see cref="UpdateEmailComboItems"/>.</remarks>
        /// <param name="AComboBox">The ComboBox Control whose Items should get updated.</param>
        /// <param name="ANewPhoneNumberValue">Pass a new Phone Number to get it selected in the ComboBox. (Default=null)</param>
        private void UpdatePhoneComboItems(TCmbAutoComplete AComboBox, string ANewPhoneNumberValue = null)
        {
            object[] EligiblePhoneNumbers;
            string ThePrimaryPhoneNumber = String.Empty;
            string TheWithinOrganisationPhoneNumber = String.Empty;
            DataView EligiblePhoneNrsDV;
            string CurrentlySelectedPhoneNr = AComboBox.GetSelectedString(-1);

            // Determine all Partner Attributes that have a Partner Attribute Type that constitutes a Phone Number
            // and that are Current (Fax Numbers are excluded from this!).
            EligiblePhoneNrsDV = Calculations.DeterminePartnerPhoneNumbers(FMainDS.PPartnerAttribute, true, false);

            EligiblePhoneNumbers = new object[EligiblePhoneNrsDV.Count + 1];
            EligiblePhoneNumbers[0] = String.Empty;

            for (int Counter = 0; Counter < EligiblePhoneNrsDV.Count; Counter++)
            {
                var ThePhoneRow = ((PPartnerAttributeRow)EligiblePhoneNrsDV[Counter].Row);

                EligiblePhoneNumbers[Counter + 1] = ThePhoneRow.Value;

                if (ThePhoneRow.Primary)
                {
                    ThePrimaryPhoneNumber = ThePhoneRow.Value;
                }

                if (ThePhoneRow.WithinOrganisation)
                {
                    TheWithinOrganisationPhoneNumber = ThePhoneRow.Value;
                }
            }

            if (!AreComboBoxItemsIdenticalToArgument(AComboBox, EligiblePhoneNumbers))
            {
                // Add the available Phone Numbers to the ComboBox
                AComboBox.Items.Clear();
                AComboBox.Items.AddRange(EligiblePhoneNumbers);
            }

            if ((AComboBox == cmbPrimaryPhoneForContacting)
                && (ThePrimaryPhoneNumber != String.Empty))
            {
                if (AComboBox.GetSelectedString() != ThePrimaryPhoneNumber)
                {
                    // Select the Primary Phone Number in the ComboBox
                    FPhoneSelectedValueChangedEvent = true;

                    AComboBox.SetSelectedString(ThePrimaryPhoneNumber);

                    FPhoneSelectedValueChangedEvent = false;
                }
            }
            else if ((AComboBox == cmbPhoneWithinTheOrganisation)
                     && (TheWithinOrganisationPhoneNumber != String.Empty))
            {
                if (AComboBox.GetSelectedString() != TheWithinOrganisationPhoneNumber)
                {
                    // Select the Within Organisation Phone Number in the ComboBox
                    FPhoneSelectedValueChangedEvent = true;

                    AComboBox.SetSelectedString(TheWithinOrganisationPhoneNumber);

                    FPhoneSelectedValueChangedEvent = false;
                }
            }
            else
            {
                CurrentlySelectedPhoneNr = ANewPhoneNumberValue ?? CurrentlySelectedPhoneNr;

                AComboBox.SetSelectedString(CurrentlySelectedPhoneNr);
            }
        }
 /// <summary>
 /// Helper method that we can call to initialise each of the filter/find comboBoxes
 /// </summary>
 private void InitFilterFindComboBox(TCmbAutoComplete AFFInstance, TCacheableFinanceTablesEnum AListTable)
 {
     AFFInstance.DataSource = TDataCache.TMFinance.GetCacheableFinanceTable(AListTable, FLedgerNumber).DefaultView;
     AFFInstance.DrawMode = DrawMode.OwnerDrawFixed;
     AFFInstance.DrawItem += new DrawItemEventHandler(DrawComboBoxItem);
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="APetraUtilsObject">Reference to the PetraUtilsObject for the form</param>
        /// <param name="ALedgerNumber">Ledger number</param>
        /// <param name="AMainDS">The main data set</param>
        /// <param name="AFilterFindPanelObject">The filter panel control object</param>
        public TUC_GLBatches_LoadAndFilter(TFrmPetraEditUtils APetraUtilsObject,
            int ALedgerNumber,
            GLBatchTDS AMainDS,
            TFilterAndFindPanel AFilterFindPanelObject)
        {
            FPetraUtilsObject = APetraUtilsObject;
            FFilterFindPanelObject = AFilterFindPanelObject;
            FMainDS = AMainDS;
            FLedgerNumber = ALedgerNumber;

            FcmbYearEnding = (TCmbAutoComplete)AFilterFindPanelObject.FilterPanelControls.FindControlByName("cmbYearEnding");
            FcmbPeriod = (TCmbAutoComplete)AFilterFindPanelObject.FilterPanelControls.FindControlByName("cmbPeriod");
            FrbtEditing = (RadioButton)AFilterFindPanelObject.FilterPanelControls.FindControlByName("rbtEditing");
            FrbtPosting = (RadioButton)AFilterFindPanelObject.FilterPanelControls.FindControlByName("rbtPosting");
            FrbtAll = (RadioButton)AFilterFindPanelObject.FilterPanelControls.FindControlByName("rbtAll");

            TFinanceControls.InitialiseAvailableFinancialYearsList(ref FcmbYearEnding, FLedgerNumber, false, true);
            //TLogging.Log("GL Financial Years completed");
            FrbtEditing.Checked = true;
            //TLogging.Log("Editing checkbox selected");
        }
示例#11
0
        /// <summary>
        /// This function fills the available financial periods of a given ledger and financial year into a TCmbAutoComplete combobox
        /// </summary>
        public static void InitialiseAvailableFinancialPeriodsList(
            ref TCmbAutoComplete AControl,
            System.Int32 ALedgerNr,
            System.Int32 AYear,
            System.Int32 AInitialSelectedIndex,
            Boolean AShowCurrentAndForwarding)
        {
            DataTable periods = InitialiseAvailableFinancialPeriodsList(ALedgerNr, AYear, AShowCurrentAndForwarding);

            AControl.DisplayMember = "display";
            AControl.ValueMember = "value";
            AControl.SelectedIndexOnDataSourceChange = AInitialSelectedIndex;
            AControl.DataSource = periods.DefaultView;
        }
示例#12
0
        /// <summary>
        /// This function fills the available financial years of a given ledger into a TCmbAutoComplete combobox
        /// </summary>
        public static void InitialiseAvailableFinancialYearsList(ref TCmbAutoComplete AControl,
            System.Int32 ALedgerNr,
            bool AIncludeNextYear = false,
            bool AShowYearEndings = false)
        {
            string DisplayMember;
            string ValueMember;
            DataTable Table;

            if (AShowYearEndings)
            {
                Table = TRemote.MFinance.GL.WebConnectors.GetAvailableGLYearEnds(ALedgerNr,
                    0,
                    AIncludeNextYear,
                    out DisplayMember,
                    out ValueMember);
            }
            else
            {
                Table = TRemote.MFinance.GL.WebConnectors.GetAvailableGLYears(ALedgerNr,
                    0,
                    AIncludeNextYear,
                    out DisplayMember,
                    out ValueMember);
            }

            Table.DefaultView.Sort = ValueMember + " DESC";

            AControl.DisplayMember = DisplayMember;
            AControl.ValueMember = ValueMember;
            AControl.DataSource = Table.DefaultView;

            if (Table.DefaultView.Count > 0)
            {
                AControl.SelectedIndex = 0;
            }
        }
示例#13
0
        /// <summary>
        /// This function fills the available financial years of a given ledger into a TCmbAutoComplete combobox
        /// </summary>
        /// <param name="AControl"></param>
        /// <param name="ALedgerNr"></param>
        public static void InitialiseAvailableGiftYearsList(ref TCmbAutoComplete AControl, System.Int32 ALedgerNr)
        {
            string DisplayMember;
            string ValueMember;

            DataTable Table = TRemote.MFinance.Gift.WebConnectors.GetAvailableGiftYears(ALedgerNr, out DisplayMember, out ValueMember);

            Table.DefaultView.Sort = ValueMember + " DESC";

            AControl.DisplayMember = DisplayMember;
            AControl.ValueMember = ValueMember;
            AControl.DataSource = Table.DefaultView;

            if (Table.DefaultView.Count > 0)
            {
                AControl.SelectedIndex = 0;
            }
        }
        /// <summary>
        /// Helper method that we can call to initialise each of the filter/find comboBoxes
        /// </summary>
        private void InitFilterFindComboBox(TCmbAutoPopulated AClonedFromComboBox,
            TCmbAutoComplete AFFInstance)
        {
            AFFInstance.DisplayMember = AClonedFromComboBox.DisplayMember;
            AFFInstance.ValueMember = AClonedFromComboBox.ValueMember;

            if (AClonedFromComboBox.Name.Contains("Account"))
            {
                // This is quicker than getting the cached table again
                AFFInstance.DataSource = FAccountTable.Copy().DefaultView;
                //AFFInstance.DataSource = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.AccountList, FLedgerNumber).DefaultView;
            }
            else if (AClonedFromComboBox.Name.Contains("CostCentre"))
            {
                // This is quicker than getting the cached table again
                AFFInstance.DataSource = FCostCentreTable.Copy().DefaultView;
                //AFFInstance.DataSource = TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.CostCentreList, FLedgerNumber).DefaultView;
            }
            else
            {
                throw new Exception("Unexpected ComboBox name");
            }

            AFFInstance.DrawMode = DrawMode.OwnerDrawFixed;
            AFFInstance.DrawItem += new DrawItemEventHandler(DrawComboBoxItem);
        }
 /// <summary>
 /// Updates the Items of a ComboBox from the 'Overall Contact Settings Group'.
 /// </summary>
 /// <param name="AComboBox">The ComboBox from the 'Overall Contact Settings Group' whose Items should be updated.</param>
 /// <param name="ASuppressMessages">If set to false: Messages will be shown to the user in certain circumstances.
 /// However, this will only be done in case <paramref name="AComboBox"/> is cmbPrimaryEMail, in all other cases
 /// this Argument gets ignored!</param>
 private void UpdateItemsOfOvrlContSettgsCombo(TCmbAutoComplete AComboBox, bool ASuppressMessages = true)
 {
     if ((AComboBox == cmbPrimaryEMail)
         || (AComboBox == cmbEMailWithinTheOrganisation))
     {
         UpdateEmailComboItems(AComboBox, ASuppressMessages);
     }
     else if ((AComboBox == cmbPrimaryPhoneForContacting)
              || (AComboBox == cmbPhoneWithinTheOrganisation))
     {
         UpdatePhoneComboItems(AComboBox);
     }
 }
示例#16
0
        /// <summary>
        /// Performs actions that need to happen once the user changes the value of the 'Charge Option' ComboBox.
        /// </summary>
        /// <param name="AAChargeOptionComboBox">'Charge Option' ComboBox Control</param>
        /// <param name="ADetailChargeAmountLabel">'Charge Amount' Label Control</param>
        /// <param name="ADetailChargeAmountTextBox">'Charge Amount' TextBox Control</param>
        /// <param name="ADetailChargePercentageTextBox">'Charge Percentage' TextBox Control</param>
        public static void ChargeOptionComboChanged(TCmbAutoComplete AAChargeOptionComboBox, Label ADetailChargeAmountLabel,
            TTxtNumericTextBox ADetailChargeAmountTextBox, TTxtNumericTextBox ADetailChargePercentageTextBox)
        {
            ADetailChargeAmountLabel.Text = AAChargeOptionComboBox.GetSelectedString() + Catalog.GetString(" Amount:");
            ADetailChargeAmountTextBox.Enabled = true;
            ADetailChargePercentageTextBox.Enabled = true;

            switch (AAChargeOptionComboBox.SelectedIndex)
            {
                case 2:
                    ADetailChargePercentageTextBox.Enabled = false;
                    ADetailChargePercentageTextBox.NumberValueDecimal = (decimal)0.0;

                    break;

                case 3:
                    ADetailChargeAmountLabel.Text = Catalog.GetString("Amount:");      // overwrite what was assigned earlier on
                    ADetailChargeAmountTextBox.Enabled = false;                         // overwrite what was assigned earlier on
                    ADetailChargeAmountTextBox.NumberValueDecimal = (decimal)0.0;

                    break;
            }
        }
示例#17
0
 /// <summary>
 /// load the history of a combobox for auto completion from the user defaults
 /// </summary>
 /// <param name="AComboBox"></param>
 public void LoadComboBoxHistory(TCmbAutoComplete AComboBox)
 {
     AComboBox.SetDataSourceStringList(TUserDefaults.GetStringDefault("CmbHistory" + AComboBox.Name, ""));
 }