Beispiel #1
0
        public static IndividualDataTDS GetData(Int64 APartnerKey, TIndividualDataItemEnum AIndivDataItem)
        {
            IndividualDataTDS ReturnValue = new IndividualDataTDS();
            TDBTransaction    Transaction = null;

            DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.RepeatableRead, TEnforceIsolationLevel.eilMinimum,
                                                                      ref Transaction,
                                                                      delegate
            {
                ReturnValue = GetData(APartnerKey, AIndivDataItem, Transaction);
            });

            return(ReturnValue);
        }
Beispiel #2
0
        public static IndividualDataTDS GetData(Int64 APartnerKey, TIndividualDataItemEnum AIndivDataItem)
        {
            IndividualDataTDS ReturnValue = new IndividualDataTDS();
            TDBTransaction    Transaction = new TDBTransaction();

            DBAccess.ReadTransaction(
                ref Transaction,
                delegate
            {
                ReturnValue = GetData(APartnerKey, AIndivDataItem, Transaction);
            });

            return(ReturnValue);
        }
Beispiel #3
0
        public static IndividualDataTDS GetData(Int64 APartnerKey, TIndividualDataItemEnum AIndivDataItem)
        {
            IndividualDataTDS ReturnValue = new IndividualDataTDS();
            TDBTransaction Transaction = null;

            DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.RepeatableRead, TEnforceIsolationLevel.eilMinimum,
                ref Transaction,
                delegate
                {
                    ReturnValue = GetData(APartnerKey, AIndivDataItem, Transaction);
                });

            return ReturnValue;
        }
Beispiel #4
0
        public static IndividualDataTDS GetData(Int64 APartnerKey, TIndividualDataItemEnum AIndivDataItem)
        {
            IndividualDataTDS ReturnValue;
            TDBTransaction ReadTransaction;
            Boolean NewTransaction;

            ReadTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.RepeatableRead,
                TEnforceIsolationLevel.eilMinimum,
                out NewTransaction);
            ReturnValue = GetData(APartnerKey, AIndivDataItem, ReadTransaction);

            if (NewTransaction)
            {
                DBAccess.GDBAccessObj.CommitTransaction();
                TLogging.LogAtLevel(7, "TIndividualDataWebConnector.GetData: committed own transaction.");
            }

            return ReturnValue;
        }
        public static IndividualDataTDS GetData(Int64 APartnerKey, TIndividualDataItemEnum AIndivDataItem)
        {
            IndividualDataTDS ReturnValue;
            TDBTransaction    ReadTransaction;
            Boolean           NewTransaction;

            ReadTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.RepeatableRead,
                                                                                TEnforceIsolationLevel.eilMinimum,
                                                                                out NewTransaction);
            ReturnValue = GetData(APartnerKey, AIndivDataItem, ReadTransaction);

            if (NewTransaction)
            {
                DBAccess.GDBAccessObj.CommitTransaction();
                TLogging.LogAtLevel(7, "TIndividualDataWebConnector.GetData: committed own transaction.");
            }

            return(ReturnValue);
        }
Beispiel #6
0
        /// <summary>
        /// Passes data as a Typed DataSet to the caller, containing a DataTable that corresponds with <paramref name="AIndivDataItem"></paramref>.
        /// </summary>
        /// <param name="APartnerKey">PartnerKey of the Person to load data for.</param>
        /// <param name="AIndivDataItem">The Individual Data Item for which data should be returned.</param>
        /// <param name="AReadTransaction">Open Database transaction.</param>
        /// <returns>A Typed DataSet containing a DataTable that corresponds with <paramref name="AIndivDataItem"></paramref>.</returns>
        private static IndividualDataTDS GetData(Int64 APartnerKey, TIndividualDataItemEnum AIndivDataItem, TDBTransaction AReadTransaction)
        {
            IndividualDataTDS IndividualDataDS = new IndividualDataTDS("IndividualData");   // create the IndividualDataTDS DataSet that will later be passed to the Client
            IndividualDataTDSMiscellaneousDataTable MiscellaneousDataDT;
            IndividualDataTDSMiscellaneousDataRow MiscellaneousDataDR;

            #region Create 'Miscellaneous' DataRow

            MiscellaneousDataDT = IndividualDataDS.MiscellaneousData;
            MiscellaneousDataDR = MiscellaneousDataDT.NewRowTyped(false);
            MiscellaneousDataDR.PartnerKey = APartnerKey;

            MiscellaneousDataDT.Rows.Add(MiscellaneousDataDR);

            #endregion

            switch (AIndivDataItem)
            {
                case TIndividualDataItemEnum.idiSummary:
                    BuildSummaryData(APartnerKey, ref IndividualDataDS, AReadTransaction);

                    DetermineItemCounts(MiscellaneousDataDR, AReadTransaction);
                    break;

                case TIndividualDataItemEnum.idiPersonalLanguages:
                    PmPersonLanguageAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);

                    PLanguageTable LanguageTable = (PLanguageTable)TSharedDataCache.TMCommon.GetCacheableCommonTable(
                    TCacheableCommonTablesEnum.LanguageCodeList);
                    PLanguageRow LanguageRow;

                    foreach (IndividualDataTDSPmPersonLanguageRow PersonLanguageRow in IndividualDataDS.PmPersonLanguage.Rows)
                    {
                        LanguageRow = (PLanguageRow)LanguageTable.Rows.Find(new object[] { PersonLanguageRow.LanguageCode });

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

                    break;

                case TIndividualDataItemEnum.idiSpecialNeeds:
                    PmSpecialNeedAccess.LoadByPrimaryKey(IndividualDataDS, APartnerKey, AReadTransaction);
                    break;

                case TIndividualDataItemEnum.idiPreviousExperiences:
                    PmPastExperienceAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);
                    break;

                case TIndividualDataItemEnum.idiPersonalDocuments:
                    PmDocumentAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);
                    break;

                case TIndividualDataItemEnum.idiJobAssignments:
                    PmJobAssignmentAccess.LoadViaPPartner(IndividualDataDS, APartnerKey, AReadTransaction);
                    break;

                case TIndividualDataItemEnum.idiLocalPersonnelData:
                    // TODO: Fix this so LocalPersonnelData can actually load some data
                    bool labelsAvailable;
                    TOfficeSpecificDataLabelsUIConnector OfficeSpecificDataLabelsUIConnector;
                    OfficeSpecificDataLabelsUIConnector = new TOfficeSpecificDataLabelsUIConnector(APartnerKey,
                    TOfficeSpecificDataLabelUseEnum.Personnel);
                    IndividualDataDS.Merge(OfficeSpecificDataLabelsUIConnector.GetDataLocalPartnerDataValues(APartnerKey, out labelsAvailable, false,
                        AReadTransaction));
                    break;

                case TIndividualDataItemEnum.idiProgressReports:
                    PmPersonEvaluationAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);
                    break;

                case TIndividualDataItemEnum.idiCommitmentPeriods:
                    PmStaffDataAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);
                    break;

                case TIndividualDataItemEnum.idiPersonSkills:
                    PmPersonSkillAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);
                    break;

                case TIndividualDataItemEnum.idiPersonalAbilities:
                    PmPersonAbilityAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);
                    break;

                case TIndividualDataItemEnum.idiPassportDetails:
                    PmPassportDetailsAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);

                    PCountryTable CountryTable = (PCountryTable)TSharedDataCache.TMCommon.GetCacheableCommonTable(
                    TCacheableCommonTablesEnum.CountryList);
                    PCountryRow CountryRow;

                    foreach (IndividualDataTDSPmPassportDetailsRow PassportRow in IndividualDataDS.PmPassportDetails.Rows)
                    {
                        CountryRow = (PCountryRow)CountryTable.Rows.Find(new object[] { PassportRow.PassportNationalityCode });

                        if (CountryRow != null)
                        {
                            PassportRow.PassportNationalityName = CountryRow.CountryName;
                        }
                    }

                    break;

                case TIndividualDataItemEnum.idiPersonalData:
                    PmPersonalDataAccess.LoadByPrimaryKey(IndividualDataDS, APartnerKey, AReadTransaction);
                    break;

                case TIndividualDataItemEnum.idiEmergencyData:
                    PmPersonalDataAccess.LoadByPrimaryKey(IndividualDataDS, APartnerKey, AReadTransaction);
                    break;

                case TIndividualDataItemEnum.idiApplications:
                    PmGeneralApplicationAccess.LoadViaPPersonPartnerKey(IndividualDataDS, APartnerKey, AReadTransaction);
                    PmShortTermApplicationAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);
                    PmYearProgramApplicationAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);

                    IndividualDataTDSPmGeneralApplicationRow GenAppRow;
                    TPartnerClass PartnerClass;
                    TStdPartnerStatusCode PartnerStatus;
                    String EventOrFieldName;

                    //TODO: now go through all short and long term apps and set the
                    // two fields in general app for EventOrFieldName and ApplicationForEventOrField
                    foreach (PmShortTermApplicationRow ShortTermRow in IndividualDataDS.PmShortTermApplication.Rows)
                    {
                        GenAppRow = (IndividualDataTDSPmGeneralApplicationRow)IndividualDataDS.PmGeneralApplication.Rows.Find
                                        (new object[] { ShortTermRow.PartnerKey,
                                                        ShortTermRow.ApplicationKey, ShortTermRow.RegistrationOffice });
                        GenAppRow.ApplicationForEventOrField = Catalog.GetString("Event");

                        if (!ShortTermRow.IsStConfirmedOptionNull())
                        {
                            Ict.Petra.Server.MCommon.MCommonMain.RetrievePartnerShortName
                                (ShortTermRow.StConfirmedOption, out EventOrFieldName, out PartnerClass, out PartnerStatus);
                            GenAppRow.EventOrFieldName = EventOrFieldName;
                        }
                    }

                    foreach (PmYearProgramApplicationRow LongTermRow in IndividualDataDS.PmYearProgramApplication.Rows)
                    {
                        GenAppRow = (IndividualDataTDSPmGeneralApplicationRow)IndividualDataDS.PmGeneralApplication.Rows.Find
                                        (new object[] { LongTermRow.PartnerKey,
                                                        LongTermRow.ApplicationKey, LongTermRow.RegistrationOffice });
                        GenAppRow.ApplicationForEventOrField = Catalog.GetString("Field");

                        if (!GenAppRow.IsGenAppPossSrvUnitKeyNull())
                        {
                            Ict.Petra.Server.MCommon.MCommonMain.RetrievePartnerShortName
                                (GenAppRow.GenAppPossSrvUnitKey, out EventOrFieldName, out PartnerClass, out PartnerStatus);
                            GenAppRow.EventOrFieldName = EventOrFieldName;
                        }
                    }

                    break;

                    // TODO: work on all cases/load data for all Individual Data items
            }

            return IndividualDataDS;
        }
Beispiel #7
0
        /// <summary>
        /// Passes data as a Typed DataSet to the caller, containing a DataTable that corresponds with <paramref name="AIndivDataItem"></paramref>.
        /// </summary>
        /// <param name="APartnerKey">PartnerKey of the Person to load data for.</param>
        /// <param name="AIndivDataItem">The Individual Data Item for which data should be returned.</param>
        /// <param name="AReadTransaction">Open Database transaction.</param>
        /// <returns>A Typed DataSet containing a DataTable that corresponds with <paramref name="AIndivDataItem"></paramref>.</returns>
        private static IndividualDataTDS GetData(Int64 APartnerKey, TIndividualDataItemEnum AIndivDataItem, TDBTransaction AReadTransaction)
        {
            IndividualDataTDS IndividualDataDS = new IndividualDataTDS("IndividualData");   // create the IndividualDataTDS DataSet that will later be passed to the Client
            IndividualDataTDSMiscellaneousDataTable MiscellaneousDataDT;
            IndividualDataTDSMiscellaneousDataRow   MiscellaneousDataDR;

            #region Create 'Miscellaneous' DataRow

            MiscellaneousDataDT            = IndividualDataDS.MiscellaneousData;
            MiscellaneousDataDR            = MiscellaneousDataDT.NewRowTyped(false);
            MiscellaneousDataDR.PartnerKey = APartnerKey;

            MiscellaneousDataDT.Rows.Add(MiscellaneousDataDR);

            #endregion

            switch (AIndivDataItem)
            {
            case TIndividualDataItemEnum.idiSummary:
                BuildSummaryData(APartnerKey, ref IndividualDataDS, AReadTransaction);

                DetermineItemCounts(MiscellaneousDataDR, AReadTransaction);
                break;

            case TIndividualDataItemEnum.idiPersonalLanguages:
                PmPersonLanguageAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);

                PLanguageTable LanguageTable = (PLanguageTable)TSharedDataCache.TMCommon.GetCacheableCommonTable(
                    TCacheableCommonTablesEnum.LanguageCodeList);
                PLanguageRow LanguageRow;

                foreach (IndividualDataTDSPmPersonLanguageRow PersonLanguageRow in IndividualDataDS.PmPersonLanguage.Rows)
                {
                    LanguageRow = (PLanguageRow)LanguageTable.Rows.Find(new object[] { PersonLanguageRow.LanguageCode });

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

                break;

            case TIndividualDataItemEnum.idiSpecialNeeds:
                PmSpecialNeedAccess.LoadByPrimaryKey(IndividualDataDS, APartnerKey, AReadTransaction);
                break;

            case TIndividualDataItemEnum.idiPreviousExperiences:
                PmPastExperienceAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);

                PUnitTable UnitTable;
                PUnitRow   UnitRow;

                // For outreaches the event code is currently stored in the location field. Try to retrieve the correct
                // outreach event and return it's actual name (as the event does not mean much to anybody).
                foreach (IndividualDataTDSPmPastExperienceRow PastExpRow in IndividualDataDS.PmPastExperience.Rows)
                {
                    PUnitRow template = new PUnitTable().NewRowTyped(false);

                    template.OutreachCode = PastExpRow.PrevLocation;

                    UnitTable = PUnitAccess.LoadUsingTemplate(template, AReadTransaction);

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

                break;

            case TIndividualDataItemEnum.idiPersonalDocuments:
                PmDocumentAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);
                break;

            case TIndividualDataItemEnum.idiJobAssignments:
                PmJobAssignmentAccess.LoadViaPPartner(IndividualDataDS, APartnerKey, AReadTransaction);
                break;

            case TIndividualDataItemEnum.idiLocalPersonnelData:
                // TODO: Fix this so LocalPersonnelData can actually load some data
                bool labelsAvailable;
                TOfficeSpecificDataLabelsUIConnector OfficeSpecificDataLabelsUIConnector;
                OfficeSpecificDataLabelsUIConnector = new TOfficeSpecificDataLabelsUIConnector(APartnerKey,
                                                                                               TOfficeSpecificDataLabelUseEnum.Personnel);
                IndividualDataDS.Merge(OfficeSpecificDataLabelsUIConnector.GetDataLocalPartnerDataValues(APartnerKey, out labelsAvailable, false,
                                                                                                         AReadTransaction));
                break;

            case TIndividualDataItemEnum.idiProgressReports:
                PmPersonEvaluationAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);
                break;

            case TIndividualDataItemEnum.idiCommitmentPeriods:
                PmStaffDataAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);
                break;

            case TIndividualDataItemEnum.idiPersonSkills:
                PmPersonSkillAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);
                break;

            case TIndividualDataItemEnum.idiPersonalAbilities:
                PmPersonAbilityAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);
                break;

            case TIndividualDataItemEnum.idiPassportDetails:
                PmPassportDetailsAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);

                PCountryTable CountryTable = (PCountryTable)TSharedDataCache.TMCommon.GetCacheableCommonTable(
                    TCacheableCommonTablesEnum.CountryList);
                PCountryRow CountryRow;

                foreach (IndividualDataTDSPmPassportDetailsRow PassportRow in IndividualDataDS.PmPassportDetails.Rows)
                {
                    CountryRow = (PCountryRow)CountryTable.Rows.Find(new object[] { PassportRow.PassportNationalityCode });

                    if (CountryRow != null)
                    {
                        PassportRow.PassportNationalityName = CountryRow.CountryName;
                    }
                }

                break;

            case TIndividualDataItemEnum.idiPersonalData:
                PmPersonalDataAccess.LoadByPrimaryKey(IndividualDataDS, APartnerKey, AReadTransaction);
                break;

            case TIndividualDataItemEnum.idiEmergencyData:
                PmPersonalDataAccess.LoadByPrimaryKey(IndividualDataDS, APartnerKey, AReadTransaction);
                break;

            case TIndividualDataItemEnum.idiApplications:
                PmGeneralApplicationAccess.LoadViaPPersonPartnerKey(IndividualDataDS, APartnerKey, AReadTransaction);
                PmShortTermApplicationAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);
                PmYearProgramApplicationAccess.LoadViaPPerson(IndividualDataDS, APartnerKey, AReadTransaction);

                IndividualDataTDSPmGeneralApplicationRow GenAppRow;
                TPartnerClass         PartnerClass;
                TStdPartnerStatusCode PartnerStatus;
                String EventOrFieldName;

                //TODO: now go through all short and long term apps and set the
                // two fields in general app for EventOrFieldName and ApplicationForEventOrField
                foreach (PmShortTermApplicationRow ShortTermRow in IndividualDataDS.PmShortTermApplication.Rows)
                {
                    GenAppRow = (IndividualDataTDSPmGeneralApplicationRow)IndividualDataDS.PmGeneralApplication.Rows.Find
                                    (new object[] { ShortTermRow.PartnerKey,
                                                    ShortTermRow.ApplicationKey, ShortTermRow.RegistrationOffice });
                    GenAppRow.ApplicationForEventOrField = Catalog.GetString("Event");

                    if (!ShortTermRow.IsStConfirmedOptionNull())
                    {
                        Ict.Petra.Server.MCommon.MCommonMain.RetrievePartnerShortName
                            (ShortTermRow.StConfirmedOption, out EventOrFieldName, out PartnerClass, out PartnerStatus);
                        GenAppRow.EventOrFieldName = EventOrFieldName;
                    }
                }

                foreach (PmYearProgramApplicationRow LongTermRow in IndividualDataDS.PmYearProgramApplication.Rows)
                {
                    GenAppRow = (IndividualDataTDSPmGeneralApplicationRow)IndividualDataDS.PmGeneralApplication.Rows.Find
                                    (new object[] { LongTermRow.PartnerKey,
                                                    LongTermRow.ApplicationKey, LongTermRow.RegistrationOffice });
                    GenAppRow.ApplicationForEventOrField = Catalog.GetString("Field");

                    if (!GenAppRow.IsGenAppPossSrvUnitKeyNull())
                    {
                        Ict.Petra.Server.MCommon.MCommonMain.RetrievePartnerShortName
                            (GenAppRow.GenAppPossSrvUnitKey, out EventOrFieldName, out PartnerClass, out PartnerStatus);
                        GenAppRow.EventOrFieldName = EventOrFieldName;
                    }
                }

                break;

                // TODO: work on all cases/load data for all Individual Data items
            }

            return(IndividualDataDS);
        }
 private IndividualDataTDS GetDataPersonnelIndividualDataInternal(TIndividualDataItemEnum AIndividualDataItem)
 {
     return TIndividualDataWebConnector.GetData(FPartnerKey, AIndividualDataItem);
 }
 /// <summary>
 /// todoComment
 /// </summary>
 /// <returns></returns>
 public IndividualDataTDS GetDataPersonnelIndividualData(TIndividualDataItemEnum AIndividualDataItem)
 {
     return GetDataPersonnelIndividualDataInternal(AIndividualDataItem);
 }