/// <summary> /// Load all the data of a partner into a TDS /// </summary> public static PartnerImportExportTDS ExportPartner(Int64 APartnerKey) { PartnerImportExportTDS MainDS = new PartnerImportExportTDS(); TDBTransaction Transaction = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.ReadCommitted); PPartnerAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); PChurchAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); PFamilyAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); PPersonAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); POrganisationAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); PUnitAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); PVenueAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); PLocationAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PPartnerLocationAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PPartnerCommentAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PPartnerTypeAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PPartnerInterestAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PPartnerGiftDestinationAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PInterestAccess.LoadAll(MainDS, Transaction); PmPersonalDataAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); PmPassportDetailsAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmDocumentAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PmDocumentTypeAccess.LoadAll(MainDS, Transaction); PmPersonQualificationAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmSpecialNeedAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmPastExperienceAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmPersonLanguageAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmPersonAbilityAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmStaffDataAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmJobAssignmentAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PmPersonEvaluationAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmGeneralApplicationAccess.LoadViaPPersonPartnerKey(MainDS, APartnerKey, Transaction); PtApplicationTypeAccess.LoadAll(MainDS, Transaction); PmShortTermApplicationAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmYearProgramApplicationAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); UmUnitStructureAccess.LoadViaPUnitChildUnitKey(MainDS, APartnerKey, Transaction); UmUnitAbilityAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); UmUnitLanguageAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); UmUnitCostAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); UmJobAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); UmJobRequirementAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); UmJobLanguageAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); UmJobQualificationAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); PcBuildingAccess.LoadViaPVenue(MainDS, APartnerKey, Transaction); PcRoomAccess.LoadViaPVenue(MainDS, APartnerKey, Transaction); DBAccess.GDBAccessObj.RollbackTransaction(); return(MainDS); }
/// <summary> /// Determines the number of DataRows for the Individual Data Items that work on multiple DataRows. /// </summary> /// <param name="AMiscellaneousDataDR">Instance of <see cref="IndividualDataTDSMiscellaneousDataRow" />.</param> /// <param name="AReadTransaction">Open Database transaction.</param> /// <returns>void</returns> private static void DetermineItemCounts(IndividualDataTDSMiscellaneousDataRow AMiscellaneousDataDR, TDBTransaction AReadTransaction) { Int64 PartnerKey = AMiscellaneousDataDR.PartnerKey; // Note: Commitment Records are counted already in BuildSummaryData and therefore don't need to be done here. AMiscellaneousDataDR.ItemsCountPassportDetails = PmPassportDetailsAccess.CountViaPPerson(PartnerKey, AReadTransaction); AMiscellaneousDataDR.ItemsCountPersonalDocuments = PmDocumentAccess.CountViaPPerson(PartnerKey, AReadTransaction); AMiscellaneousDataDR.ItemsCountProfessionalAreas = PmPersonQualificationAccess.CountViaPPerson(PartnerKey, AReadTransaction); AMiscellaneousDataDR.ItemsCountPersonalLanguages = PmPersonLanguageAccess.CountViaPPerson(PartnerKey, AReadTransaction); AMiscellaneousDataDR.ItemsCountPersonalAbilities = PmPersonAbilityAccess.CountViaPPerson(PartnerKey, AReadTransaction); AMiscellaneousDataDR.ItemsCountPreviousExperience = PmPastExperienceAccess.CountViaPPerson(PartnerKey, AReadTransaction); AMiscellaneousDataDR.ItemsCountCommitmentPeriods = PmStaffDataAccess.CountViaPPerson(PartnerKey, AReadTransaction); AMiscellaneousDataDR.ItemsCountJobAssignments = PmJobAssignmentAccess.CountViaPPartner(PartnerKey, AReadTransaction); AMiscellaneousDataDR.ItemsCountProgressReports = PmPersonEvaluationAccess.CountViaPPerson(PartnerKey, AReadTransaction); AMiscellaneousDataDR.ItemsCountPersonSkills = PmPersonSkillAccess.CountViaPPerson(PartnerKey, AReadTransaction); AMiscellaneousDataDR.ItemsCountApplications = PmGeneralApplicationAccess.CountViaPPersonPartnerKey(PartnerKey, AReadTransaction); }
/// <summary> /// Load all the data of a partner into a TDS /// </summary> public static PartnerImportExportTDS ExportPartner(Int64 APartnerKey, TPartnerClass?APartnerClass = null) { PartnerImportExportTDS MainDS = new PartnerImportExportTDS(); TDBTransaction Transaction = new TDBTransaction(); DBAccess.ReadTransaction( ref Transaction, delegate { PPartnerAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); // APartnerClass is optional but if it was not provided we need to assign to it now if (APartnerClass == null) { APartnerClass = SharedTypes.PartnerClassStringToEnum(MainDS.PPartner[0].PartnerClass); } if (APartnerClass == TPartnerClass.CHURCH) { PChurchAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); } else if (APartnerClass == TPartnerClass.FAMILY) { PFamilyAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); PPartnerGiftDestinationAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); } else if (APartnerClass == TPartnerClass.PERSON) { PPersonAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); PmPersonalDataAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); PmPassportDetailsAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmDocumentAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PmDocumentTypeAccess.LoadAll(MainDS, Transaction); PmPersonQualificationAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmSpecialNeedAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmPastExperienceAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmPersonLanguageAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmPersonAbilityAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmStaffDataAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmJobAssignmentAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PmPersonEvaluationAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmPersonSkillAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmGeneralApplicationAccess.LoadViaPPersonPartnerKey(MainDS, APartnerKey, Transaction); PtApplicationTypeAccess.LoadAll(MainDS, Transaction); PmShortTermApplicationAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); PmYearProgramApplicationAccess.LoadViaPPerson(MainDS, APartnerKey, Transaction); } else if (APartnerClass == TPartnerClass.ORGANISATION) { POrganisationAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); } else if (APartnerClass == TPartnerClass.UNIT) { PUnitAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); UmUnitStructureAccess.LoadViaPUnitChildUnitKey(MainDS, APartnerKey, Transaction); UmUnitAbilityAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); UmUnitLanguageAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); UmUnitCostAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); UmJobAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); UmJobRequirementAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); UmJobLanguageAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); UmJobQualificationAccess.LoadViaPUnit(MainDS, APartnerKey, Transaction); } else if (APartnerClass == TPartnerClass.VENUE) { PVenueAccess.LoadByPrimaryKey(MainDS, APartnerKey, Transaction); PcBuildingAccess.LoadViaPVenue(MainDS, APartnerKey, Transaction); PcRoomAccess.LoadViaPVenue(MainDS, APartnerKey, Transaction); } PPartnerAttributeAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PLocationAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PPartnerLocationAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PPartnerCommentAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PPartnerTypeAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PPartnerInterestAccess.LoadViaPPartner(MainDS, APartnerKey, Transaction); PInterestAccess.LoadAll(MainDS, Transaction); }); return(MainDS); }