Example #1
0
        private void ValidateDataDetailsManual(PCountryRow ARow)
        {
            TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;

            TSharedValidation_CacheableDataTables.ValidateCountrySetupManual(this, ARow, ref VerificationResultCollection,
                                                                             FPetraUtilsObject.ValidationControlsDict);
        }
Example #2
0
        /// <summary>
        /// Gets the AddressOrder (p_address_order_i DB field) of a certain Country.
        /// </summary>
        /// <param name="ACountryCode">CountryCode (ISO Code) of a Country</param>
        /// <returns>AddressOrder for that Country (0 if Country cannot be found).</returns>
        public static Int32 GetAddressOrder(String ACountryCode)
        {
            PCountryTable DataCacheCountryDT = (PCountryTable)TDataCache.TMCommon.GetCacheableCommonTable(TCacheableCommonTablesEnum.CountryList);
            PCountryRow   CountryDR          = (PCountryRow)DataCacheCountryDT.Rows.Find(ACountryCode);

            return((CountryDR != null) ? CountryDR.AddressOrder : 0);
        }
        private void ValidateDataDetailsManual(PCountryRow ARow)
        {
            TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection;

            TSharedValidation_CacheableDataTables.ValidateCountrySetupManual(this, ARow, ref VerificationResultCollection,
                FPetraUtilsObject.ValidationControlsDict);
        }
        /// <summary>
        /// Adds a row to the combo box repesenting the "not set" state
        /// </summary>
        /// <param name="NotSetValue">The Value when NotSet state is true</param>
        /// <param name="NotSetDisplay">The DisplayedText when NotSet state is true</param>
        public void AddNotSetRow(String NotSetValue,
                                 String NotSetDisplay)
        {
            //store the special instructions
            this.FAddNotSetValue = true;
            this.FNotSetValue    = NotSetValue;
            this.FNotSetDisplay  = NotSetDisplay;
            PCountryRow Dr = (PCountryRow)FDataCache_CountryListTable.NewRow();

            Dr.CountryName = FNotSetDisplay;
            Dr.CountryCode = FNotSetValue;
            FDataCache_CountryListTable.Rows.InsertAt(Dr, 0);
            cmbCountry.cmbCombobox.SelectedValue = FNotSetValue;
        }
Example #5
0
        private void NewRowManual(ref PCountryRow ARow)
        {
            string newName        = Catalog.GetString("NEWCODE");
            Int32  countNewDetail = 0;

            if (FMainDS.PCountry.Rows.Find(new object[] { newName }) != null)
            {
                while (FMainDS.PCountry.Rows.Find(new object[] { newName + countNewDetail.ToString() }) != null)
                {
                    countNewDetail++;
                }

                newName += countNewDetail.ToString();
            }

            ARow.CountryCode = newName;
        }
        private void NewRowManual(ref PCountryRow ARow)
        {
            string newName = Catalog.GetString("NEWCODE");
            Int32 countNewDetail = 0;

            if (FMainDS.PCountry.Rows.Find(new object[] { newName }) != null)
            {
                while (FMainDS.PCountry.Rows.Find(new object[] { newName + countNewDetail.ToString() }) != null)
                {
                    countNewDetail++;
                }

                newName += countNewDetail.ToString();
            }

            ARow.CountryCode = newName;
        }
Example #7
0
        /// <summary>
        /// Adds a row to the combo box repesenting the "not set" state
        /// </summary>
        /// <param name="NotSetValue">The Value when NotSet state is true</param>
        /// <param name="NotSetDisplay">The DisplayedText when NotSet state is true</param>
        public void AddNotSetRow(String NotSetValue,
                                 String NotSetDisplay)
        {
            //store the special instructions
            this.FAddNotSetValue        = true;
            this.FNotSetValue           = NotSetValue;
            this.FNotSetDisplay         = NotSetDisplay;
            FDataCache_CountryListTable = TDataCache.TMCommon.GetCacheableCommonTable(TCacheableCommonTablesEnum.CountryList);
            PCountryRow Dr = (PCountryRow)FDataCache_CountryListTable.NewRow();

            Dr.CountryName = FNotSetDisplay;
            Dr.CountryCode = FNotSetValue;
            FDataCache_CountryListTable.Rows.InsertAt(Dr, 0);
            FDataCache_CountryListTable.DefaultView.Sort = "p_country_code_c";
            cmbCountry.cmbCombobox.BeginUpdate();
            cmbCountry.cmbCombobox.DisplayMember = "p_country_code_c";
            cmbCountry.cmbCombobox.ValueMember   = "p_country_code_c";
            cmbCountry.cmbCombobox.DataSource    = FDataCache_CountryListTable.DefaultView;
            cmbCountry.cmbCombobox.EndUpdate();
            cmbCountry.cmbCombobox.SelectedValue = FNotSetValue;
        }
        private String GetLedgerInfo(Int32 ALedgerNumber)
        {
            ALedgerRow ledger =
                ((ALedgerTable)TDataCache.TMFinance.GetCacheableFinanceTable(
                     TCacheableFinanceTablesEnum.LedgerDetails, ALedgerNumber))[0];
            String strBaseCurrency = ledger.BaseCurrency;
            String strCountryCode  = ledger.CountryCode;

            PCountryTable DataCacheCountryDT =
                (PCountryTable)TDataCache.TMCommon.GetCacheableCommonTable(
                    TCacheableCommonTablesEnum.CountryList);
            PCountryRow CountryDR =
                (PCountryRow)DataCacheCountryDT.Rows.Find(strCountryCode);

            String strLedgerName = FLedgerNumber.ToString();

            if (CountryDR != null)
            {
                strLedgerName += (" - " + CountryDR.CountryName);
            }

            strLedgerName += (" [" + strBaseCurrency + "]");
            return(strLedgerName);
        }
Example #9
0
        public static void FillFormDataFromPersonnel(Int64 APartnerKey,
                                                     TFormDataPerson AFormDataPerson,
                                                     TFormLetterInfo AFormLetterInfo,
                                                     TDBTransaction AReadTransaction,
                                                     Int64 ASiteKey     = 0,
                                                     Int32 ALocationKey = 0)
        {
            TPartnerClass         PartnerClass;
            String                ShortName;
            TStdPartnerStatusCode PartnerStatusCode;

            if (AFormDataPerson == null)
            {
                return;
            }

            if (MCommonMain.RetrievePartnerShortName(APartnerKey, out ShortName, out PartnerClass, out PartnerStatusCode, AReadTransaction))
            {
                // first retrieve all partner information
// we cannot reference MPartner connect because of SimplePartnerEdit, cyclic dependencies
#if DISABLED_TP_20180623
                TFormLettersWebConnector.FillFormDataFromPerson(APartnerKey,
                                                                AFormDataPerson,
                                                                AFormLetterInfo,
                                                                AReadTransaction,
                                                                ASiteKey,
                                                                ALocationKey);
#endif

                // retrieve Special Needs information
                if (AFormLetterInfo.IsRetrievalRequested(TFormDataRetrievalSection.eSpecialNeeds))
                {
                    PmSpecialNeedTable SpecialNeedTable;
                    PmSpecialNeedRow   SpecialNeedRow;
                    SpecialNeedTable = PmSpecialNeedAccess.LoadViaPPerson(APartnerKey, AReadTransaction);

                    if (SpecialNeedTable.Count > 0)
                    {
                        SpecialNeedRow = (PmSpecialNeedRow)SpecialNeedTable.Rows[0];
                        AFormDataPerson.DietaryNeeds = SpecialNeedRow.DietaryComment;
                        AFormDataPerson.MedicalNeeds = SpecialNeedRow.MedicalComment;
                        AFormDataPerson.OtherNeeds   = SpecialNeedRow.OtherSpecialNeed;
                        AFormDataPerson.Vegetarian   = SpecialNeedRow.VegetarianFlag;
                    }
                }

                // retrieve Personal Data information
                if (AFormLetterInfo.IsRetrievalRequested(TFormDataRetrievalSection.ePersonalData))
                {
                    PmPersonalDataTable PersonalDataTable;
                    PmPersonalDataRow   PersonalDataRow;
                    PersonalDataTable = PmPersonalDataAccess.LoadViaPPerson(APartnerKey, AReadTransaction);

                    if (PersonalDataTable.Count > 0)
                    {
                        PersonalDataRow = (PmPersonalDataRow)PersonalDataTable.Rows[0];

                        if (!PersonalDataRow.IsBelieverSinceYearNull() &&
                            (PersonalDataRow.BelieverSinceYear != 0))
                        {
                            AFormDataPerson.YearsBeliever = (DateTime.Today.Year - PersonalDataRow.BelieverSinceYear).ToString();
                        }

                        AFormDataPerson.CommentBeliever = PersonalDataRow.BelieverSinceComment;
                    }
                }

                // retrieve Passport information
                if (AFormLetterInfo.IsRetrievalRequested(TFormDataRetrievalSection.ePassport))
                {
                    PmPassportDetailsTable PassportTable;
                    TFormDataPassport      PassportRecord;
                    PassportTable = PmPassportDetailsAccess.LoadViaPPerson(APartnerKey, AReadTransaction);
                    Boolean MainPassportFound = false;

                    foreach (PmPassportDetailsRow PassportRow in PassportTable.Rows)
                    {
                        // only list "full" passports that have not expired yet
                        if ((PassportRow.IsDateOfExpirationNull() ||
                             (PassportRow.DateOfExpiration >= DateTime.Today)) &&
                            (PassportRow.PassportDetailsType == "P"))
                        {
                            PassportRecord = new TFormDataPassport();

                            PassportRecord.IsMainPassport  = PassportRow.MainPassport;
                            PassportRecord.Number          = PassportRow.PassportNumber;
                            PassportRecord.PassportName    = PassportRow.FullPassportName;
                            PassportRecord.NationalityCode = PassportRow.PassportNationalityCode;

                            // retrieve country name from country table
                            TCacheable    CachePopulator = new TCacheable();
                            PCountryTable CountryTable   =
                                (PCountryTable)CachePopulator.GetCacheableTable(TCacheableCommonTablesEnum.CountryList);
                            PCountryRow CountryRow =
                                (PCountryRow)CountryTable.Rows.Find(new object[] { PassportRow.PassportNationalityCode });

                            if (CountryRow != null)
                            {
                                PassportRecord.NationalityName = CountryRow.CountryName;
                            }

                            PassportRecord.TypeCode = PassportRow.PassportDetailsType;
                            // retrieve passport type name from type table
                            TPersonnelCacheable PersonnelCachePopulator = new TPersonnelCacheable();
                            PtPassportTypeTable TypeTable =
                                (PtPassportTypeTable)PersonnelCachePopulator.GetCacheableTable(TCacheablePersonTablesEnum.
                                                                                               PassportTypeList);
                            PtPassportTypeRow TypeRow =
                                (PtPassportTypeRow)TypeTable.Rows.Find(new object[] { PassportRow.PassportDetailsType });

                            if (TypeRow != null)
                            {
                                PassportRecord.TypeDescription = TypeRow.Description;
                            }

                            PassportRecord.DateOfIssue  = PassportRow.DateOfIssue;
                            PassportRecord.PlaceOfIssue = PassportRow.PlaceOfIssue;
                            PassportRecord.DateOfExpiry = PassportRow.DateOfExpiration;
                            PassportRecord.PlaceOfBirth = PassportRow.PlaceOfBirth;

                            // set number and nationality in main record (only for main passport or if there is just one)
                            if (PassportRow.MainPassport || (PassportTable.Count == 1))
                            {
                                AFormDataPerson.PassportNumber          = PassportRecord.Number;
                                AFormDataPerson.PassportNationality     = PassportRecord.NationalityName;
                                AFormDataPerson.PassportNationalityCode = PassportRecord.NationalityCode;
                                AFormDataPerson.PassportName            = PassportRecord.PassportName;
                                AFormDataPerson.PassportDateOfIssue     = PassportRecord.DateOfIssue;
                                AFormDataPerson.PassportPlaceOfIssue    = PassportRecord.PlaceOfIssue;
                                AFormDataPerson.PassportDateOfExpiry    = PassportRecord.DateOfExpiry;
                                AFormDataPerson.PassportPlaceOfBirth    = PassportRecord.PlaceOfBirth;

                                MainPassportFound = true;
                            }

                            // If the PassportName has not been set yet then make sure it is set on Person level from at least one passport
                            // (this will not be necessary any longer once the tick box for "Main Passport" is implemented)
                            if (!MainPassportFound)
                            {
                                AFormDataPerson.PassportName = PassportRecord.PassportName;
                            }

                            AFormDataPerson.AddPassport(PassportRecord);
                        }
                    }
                }

                // retrieve Language information
                if (AFormLetterInfo.IsRetrievalRequested(TFormDataRetrievalSection.eLanguage))
                {
                    PmPersonLanguageTable PersonLanguageTable;
                    TFormDataLanguage     PersonLanguageRecord;
                    PersonLanguageTable = PmPersonLanguageAccess.LoadViaPPerson(APartnerKey, AReadTransaction);

                    foreach (PmPersonLanguageRow PersonLanguageRow in PersonLanguageTable.Rows)
                    {
                        PersonLanguageRecord = new TFormDataLanguage();

                        PersonLanguageRecord.Code = PersonLanguageRow.LanguageCode;

                        // retrieve language name from language table
                        TCacheable     CachePopulator = new TCacheable();
                        PLanguageTable LanguageTable  =
                            (PLanguageTable)CachePopulator.GetCacheableTable(TCacheableCommonTablesEnum.LanguageCodeList);
                        PLanguageRow LanguageRow = (PLanguageRow)LanguageTable.Rows.Find(new object[] { PersonLanguageRow.LanguageCode });

                        if (LanguageRow != null)
                        {
                            PersonLanguageRecord.Name = LanguageRow.LanguageDescription;
                        }

                        PersonLanguageRecord.Level = PersonLanguageRow.LanguageLevel.ToString();

                        // retrieve language level name from language level table
                        TPersonnelCacheable  CachePopulatorPersonnel = new TPersonnelCacheable();
                        PtLanguageLevelTable LanguageLevelTable      =
                            (PtLanguageLevelTable)CachePopulatorPersonnel.GetCacheableTable(TCacheablePersonTablesEnum.LanguageLevelList);
                        PtLanguageLevelRow LanguageLevelRow =
                            (PtLanguageLevelRow)LanguageLevelTable.Rows.Find(new object[] { PersonLanguageRow.LanguageLevel });

                        if (LanguageLevelRow != null)
                        {
                            PersonLanguageRecord.LevelDesc = LanguageLevelRow.LanguageLevelDescr;
                        }

                        PersonLanguageRecord.Comment = PersonLanguageRow.Comment;

                        AFormDataPerson.AddLanguage(PersonLanguageRecord);
                    }
                }

                // retrieve Skill information
                if (AFormLetterInfo.IsRetrievalRequested(TFormDataRetrievalSection.eSkill))
                {
                    PmPersonSkillTable PersonSkillTable;
                    TFormDataSkill     PersonSkillRecord;
                    TFormDataDegree    PersonDegreeRecord;
                    PersonSkillTable = PmPersonSkillAccess.LoadViaPPerson(APartnerKey, AReadTransaction);

                    foreach (PmPersonSkillRow PersonSkillRow in PersonSkillTable.Rows)
                    {
                        PersonSkillRecord = new TFormDataSkill();

                        PersonSkillRecord.Category    = PersonSkillRow.SkillCategoryCode;
                        PersonSkillRecord.Description = PersonSkillRow.DescriptionEnglish;

                        // if no description in local language then use english
                        PersonSkillRecord.DescriptionLocalOrDefault = PersonSkillRow.DescriptionLocal;

                        if (PersonSkillRow.DescriptionLocal != "")
                        {
                            PersonSkillRecord.DescriptionLocalOrDefault = PersonSkillRow.DescriptionEnglish;
                        }

                        PersonSkillRecord.Level = PersonSkillRow.SkillLevel;

                        // retrieve skill level name from skill level table
                        TPersonnelCacheable CachePopulatorPersonnel = new TPersonnelCacheable();
                        PtSkillLevelTable   SkillLevelTable         =
                            (PtSkillLevelTable)CachePopulatorPersonnel.GetCacheableTable(TCacheablePersonTablesEnum.SkillLevelList);
                        PtSkillLevelRow SkillLevelRow =
                            (PtSkillLevelRow)SkillLevelTable.Rows.Find(new object[] { PersonSkillRow.SkillLevel });

                        if (SkillLevelRow != null)
                        {
                            PersonSkillRecord.LevelDesc = SkillLevelRow.Description;
                        }

                        PersonSkillRecord.YearsExp     = PersonSkillRow.YearsOfExperience;
                        PersonSkillRecord.Professional = PersonSkillRow.ProfessionalSkill;
                        PersonSkillRecord.Degree       = PersonSkillRow.Degree;
                        PersonSkillRecord.Comment      = PersonSkillRow.Comment;

                        AFormDataPerson.AddSkill(PersonSkillRecord);

                        // now add a degree record if a degree is mentioned
                        if (!PersonSkillRow.IsDegreeNull() &&
                            (PersonSkillRow.Degree.Length > 0))
                        {
                            PersonDegreeRecord      = new TFormDataDegree();
                            PersonDegreeRecord.Name = PersonSkillRow.Degree;
                            PersonDegreeRecord.Year = PersonSkillRow.YearOfDegree.ToString();

                            AFormDataPerson.AddDegree(PersonDegreeRecord);
                        }
                    }
                }

                // retrieve past work experience information
                if (AFormLetterInfo.IsRetrievalRequested(TFormDataRetrievalSection.eWorkExperience))
                {
                    TFormDataWorkExperience PersonExpRecord;

                    /*
                     * currently we don't include application records in the work experience data
                     *
                     * String UnitShortName;
                     * TPartnerClass UnitClass;
                     *
                     * // retrieve applications for short term events
                     * String SqlStmt = TDataBase.ReadSqlFile("Personnel.FormLetters.GetAppTravelDates.sql");
                     *
                     * OdbcParameter[] parameters = new OdbcParameter[1];
                     * parameters[0] = new OdbcParameter("PartnerKey", OdbcType.BigInt);
                     * parameters[0].Value = APartnerKey;
                     *
                     * DataTable travelData = DBAccess.GDBAccessObj.SelectDT(SqlStmt, "TravelDates", ReadTransaction, parameters);
                     *
                     * for (int i = 0; i < travelData.Rows.Count; i++)
                     * {
                     *  PersonExpRecord = new TFormDataWorkExperience();
                     *
                     *  if ((travelData.Rows[i][0]).GetType() == typeof(DateTime))
                     *  {
                     *      PersonExpRecord.StartDate = (DateTime?)travelData.Rows[i][0];
                     *  }
                     *
                     *  if ((travelData.Rows[i][1]).GetType() == typeof(DateTime))
                     *  {
                     *      PersonExpRecord.EndDate = (DateTime?)travelData.Rows[i][1];
                     *  }
                     *
                     *  PersonExpRecord.Organisation = "";
                     *  PersonExpRecord.Role = "";
                     *  PersonExpRecord.Category = "";
                     *  PersonExpRecord.SameOrg = true;
                     *  PersonExpRecord.SimilarOrg = true;
                     *  PersonExpRecord.Comment = "";
                     *
                     *  // check if unit exists and use unit name as location
                     *  if (TPartnerServerLookups.GetPartnerShortName((Int64)travelData.Rows[i][2], out UnitShortName, out UnitClass))
                     *  {
                     *      PersonExpRecord.Location = UnitShortName;
                     *  }
                     *  else
                     *  {
                     *      PersonExpRecord.Location = travelData.Rows[i][3].ToString();
                     *  }
                     *
                     *  AFormDataPerson.AddWorkExperience(PersonExpRecord);
                     * }
                     */

                    // retrieve actual past experience records
                    PmPastExperienceTable PersonExpTable;
                    PersonExpTable = PmPastExperienceAccess.LoadViaPPerson(APartnerKey, AReadTransaction);
                    PUnitTable UnitTable;
                    PUnitRow   UnitRow;

                    foreach (PmPastExperienceRow PersonExpRow in PersonExpTable.Rows)
                    {
                        PersonExpRecord = new TFormDataWorkExperience();

                        PersonExpRecord.StartDate    = PersonExpRow.StartDate;
                        PersonExpRecord.EndDate      = PersonExpRow.EndDate;
                        PersonExpRecord.Location     = PersonExpRow.PrevLocation;
                        PersonExpRecord.Organisation = PersonExpRow.OtherOrganisation;
                        PersonExpRecord.Role         = PersonExpRow.PrevRole;
                        PersonExpRecord.Category     = PersonExpRow.Category;
                        PersonExpRecord.SameOrg      = PersonExpRow.PrevWorkHere;
                        PersonExpRecord.SimilarOrg   = PersonExpRow.PrevWork;
                        PersonExpRecord.Comment      = PersonExpRow.PastExpComments;

                        // check if previous experience came from an event with location set to event code
                        // -> in this case don't set event code as location but rather the event name
                        PUnitRow template = new PUnitTable().NewRowTyped(false);

                        template.OutreachCode = PersonExpRow.PrevLocation;

                        UnitTable = PUnitAccess.LoadUsingTemplate(template, AReadTransaction);

                        if (UnitTable.Rows.Count > 0)
                        {
                            UnitRow = (PUnitRow)UnitTable.Rows[0];
                            PersonExpRecord.Location = UnitRow.UnitName;
                        }

                        AFormDataPerson.AddWorkExperience(PersonExpRecord);
                    }
                }

                // retrieve Commitment information
                if (AFormLetterInfo.IsRetrievalRequested(TFormDataRetrievalSection.eCommitment) ||
                    AFormLetterInfo.IsRetrievalRequested(TFormDataRetrievalSection.eFutureCommitment))
                {
                    String              FieldName;
                    TPartnerClass       FieldPartnerClass;
                    PmStaffDataTable    PersonCommitmentTable;
                    PmStaffDataRow      PersonCommitmentRow;
                    TFormDataCommitment PersonCommitmentRecord;
                    PersonCommitmentTable = PmStaffDataAccess.LoadViaPPerson(APartnerKey, AReadTransaction);
                    PersonCommitmentTable.DefaultView.Sort = PmStaffDataTable.GetStartOfCommitmentDBName() + " DESC";

                    if (AFormLetterInfo.IsRetrievalRequested(TFormDataRetrievalSection.eCommitment))
                    {
                        foreach (DataRowView rv in PersonCommitmentTable.DefaultView)
                        {
                            PersonCommitmentRow    = (PmStaffDataRow)rv.Row;
                            PersonCommitmentRecord = new TFormDataCommitment();

                            PersonCommitmentRecord.StartDate = PersonCommitmentRow.StartOfCommitment;
                            PersonCommitmentRecord.EndDate   = PersonCommitmentRow.EndOfCommitment;
                            PersonCommitmentRecord.Status    = PersonCommitmentRow.StatusCode;

                            PersonCommitmentRecord.ReceivingFieldKey = PersonCommitmentRow.ReceivingField.ToString("0000000000");
                            TPartnerServerLookups.GetPartnerShortName(PersonCommitmentRow.ReceivingField, out FieldName,
                                                                      out FieldPartnerClass);
                            PersonCommitmentRecord.ReceivingFieldName = FieldName;

                            PersonCommitmentRecord.SendingFieldKey = PersonCommitmentRow.HomeOffice.ToString("0000000000");
                            TPartnerServerLookups.GetPartnerShortName(PersonCommitmentRow.HomeOffice, out FieldName,
                                                                      out FieldPartnerClass);
                            PersonCommitmentRecord.SendingFieldName = FieldName;

                            PersonCommitmentRecord.RecruitingFieldKey = PersonCommitmentRow.OfficeRecruitedBy.ToString("0000000000");
                            TPartnerServerLookups.GetPartnerShortName(PersonCommitmentRow.OfficeRecruitedBy, out FieldName,
                                                                      out FieldPartnerClass);
                            PersonCommitmentRecord.RecruitingFieldName = FieldName;

                            PersonCommitmentRecord.Comment = PersonCommitmentRow.StaffDataComments;

                            AFormDataPerson.AddCommitment(PersonCommitmentRecord);
                        }
                    }

                    if (AFormLetterInfo.IsRetrievalRequested(TFormDataRetrievalSection.eFutureCommitment))
                    {
                        foreach (DataRowView rv in PersonCommitmentTable.DefaultView)
                        {
                            PersonCommitmentRow = (PmStaffDataRow)rv.Row;

                            if (PersonCommitmentRow.StartOfCommitment >= DateTime.Today)
                            {
                                TPartnerServerLookups.GetPartnerShortName(PersonCommitmentRow.ReceivingField, out FieldName,
                                                                          out FieldPartnerClass);
                                AFormDataPerson.FutureFieldName       = FieldName;
                                AFormDataPerson.FutureCommitStartDate = PersonCommitmentRow.StartOfCommitment;
                                AFormDataPerson.FutureCommitEndDate   = PersonCommitmentRow.EndOfCommitment;

                                // only use the first commitment (list is sorted by start date)
                                break;
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Validates the Setup Countries screen data.
        /// </summary>
        /// <param name="AContext">Context that describes where the data validation failed.</param>
        /// <param name="ARow">The <see cref="DataRow" /> which holds the the data against which the validation is run.</param>
        /// <param name="AVerificationResultCollection">Will be filled with any <see cref="TVerificationResult" /> items if
        /// data validation errors occur.</param>
        /// <param name="AValidationControlsDict">A <see cref="TValidationControlsDict" /> containing the Controls that
        /// display data that is about to be validated.</param>
        public static void ValidateCountrySetupManual(object AContext, PCountryRow ARow,
            ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict)
        {
            DataColumn ValidationColumn;
            TValidationControlsData ValidationControlsData;
            TVerificationResult VerificationResult;

            // Don't validate deleted DataRows
            if (ARow.RowState == DataRowState.Deleted)
            {
                return;
            }

            // 'International Access Code' must have a value
            ValidationColumn = ARow.Table.Columns[PCountryTable.ColumnInternatAccessCodeId];

            if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
            {
                VerificationResult = TStringChecks.StringMustNotBeEmpty(ARow.InternatAccessCode,
                    ValidationControlsData.ValidationControlLabel,
                    AContext, ValidationColumn, ValidationControlsData.ValidationControl);

                // Handle addition to/removal from TVerificationResultCollection
                AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
            }

            if (!ARow.IsInternatTelephoneCodeNull())
            {
                // 'International Telephone Code' must be positive
                ValidationColumn = ARow.Table.Columns[PCountryTable.ColumnInternatTelephoneCodeId];

                if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
                {
                    VerificationResult = TNumericalChecks.IsPositiveOrZeroInteger(ARow.InternatTelephoneCode,
                        ValidationControlsData.ValidationControlLabel,
                        AContext, ValidationColumn, ValidationControlsData.ValidationControl);

                    // Handle addition/removal to/from TVerificationResultCollection
                    AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
                }
            }

            if (!ARow.IsTimeZoneMinimumNull()
                && !ARow.IsTimeZoneMaximumNull())
            {
                // 'Time Zone From' must be <= 'Time Zone To'
                ValidationColumn = ARow.Table.Columns[PCountryTable.ColumnTimeZoneMinimumId];

                if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
                {
                    VerificationResult = TNumericalChecks.FirstLesserOrEqualThanSecondDecimal(
                        ARow.TimeZoneMinimum, ARow.TimeZoneMaximum,
                        ValidationControlsData.ValidationControlLabel, ValidationControlsData.SecondValidationControlLabel,
                        AContext, ValidationColumn, ValidationControlsData.ValidationControl);

                    // Handle addition to/removal from TVerificationResultCollection
                    AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
                }
            }

            // 'International Postal Type' must be in 'p_international_postal_type' DB Table (this DB Table is not a Cacheable DataTable)
            ValidationColumn = ARow.Table.Columns[PCountryTable.ColumnInternatPostalTypeCodeId];

            if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData))
            {
                VerificationResult = TSharedCommonValidation.IsValidInternationalPostalCode(ARow.InternatPostalTypeCode,
                    ValidationControlsData.ValidationControlLabel,
                    AContext, ValidationColumn, ValidationControlsData.ValidationControl);

                // Handle addition to/removal from TVerificationResultCollection
                AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn);
            }
        }