Esempio n. 1
0
        public void TestDeleteVenue()
        {
            DataSet ResponseDS = new PartnerEditTDS();
            TVerificationResultCollection VerificationResult;
            String               TextMessage;
            Boolean              CanDeletePartner;
            PPartnerRow          VenuePartnerRow;
            TSubmitChangesResult result;
            Int64 PartnerKey;

            TPartnerEditUIConnector connector = new TPartnerEditUIConnector();

            PartnerEditTDS MainDS = new PartnerEditTDS();

            VenuePartnerRow = TCreateTestPartnerData.CreateNewVenuePartner(MainDS);
            result          = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);
            Assert.AreEqual(TSubmitChangesResult.scrOK, result, "create venue record");

            // check if Venue partner can be deleted (still needs to be possible at this point)
            CanDeletePartner = TPartnerWebConnector.CanPartnerBeDeleted(VenuePartnerRow.PartnerKey, out TextMessage);

            if (TextMessage.Length > 0)
            {
                TLogging.Log(TextMessage);
            }

            Assert.IsTrue(CanDeletePartner);

            // set up buildings for this venue so deletion is not allowed
            PcBuildingTable BuildingTable = new PcBuildingTable();
            PcBuildingRow   BuildingRow   = BuildingTable.NewRowTyped();

            BuildingRow.VenueKey     = VenuePartnerRow.PartnerKey;
            BuildingRow.BuildingCode = "Test";
            BuildingTable.Rows.Add(BuildingRow);

            PcBuildingAccess.SubmitChanges(BuildingTable, DBAccess.GDBAccessObj.Transaction);

            // now deletion must not be possible since a building is linked to the venue
            CanDeletePartner = TPartnerWebConnector.CanPartnerBeDeleted(VenuePartnerRow.PartnerKey, out TextMessage);

            if (TextMessage.Length > 0)
            {
                TLogging.Log(TextMessage);
            }

            Assert.IsTrue(!CanDeletePartner);

            // now test actual deletion of venue partner
            VenuePartnerRow = TCreateTestPartnerData.CreateNewVenuePartner(MainDS);
            PartnerKey      = VenuePartnerRow.PartnerKey;
            result          = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);
            Assert.AreEqual(TSubmitChangesResult.scrOK, result, "create venue record for deletion");

            // check if Venue record is being deleted
            Assert.IsTrue(TPartnerWebConnector.DeletePartner(PartnerKey, out VerificationResult));

            // check that Venue record is really deleted
            Assert.IsTrue(!TPartnerServerLookups.VerifyPartner(PartnerKey));
        }
Esempio n. 2
0
        /// <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);
        }
Esempio n. 3
0
        /// <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);
        }