当前位置: 首页>>代码示例>>C#>>正文


C# TPartnerEditUIConnector.SubmitChanges方法代码示例

本文整理汇总了C#中Ict.Petra.Server.MPartner.Partner.UIConnectors.TPartnerEditUIConnector.SubmitChanges方法的典型用法代码示例。如果您正苦于以下问题:C# TPartnerEditUIConnector.SubmitChanges方法的具体用法?C# TPartnerEditUIConnector.SubmitChanges怎么用?C# TPartnerEditUIConnector.SubmitChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ict.Petra.Server.MPartner.Partner.UIConnectors.TPartnerEditUIConnector的用法示例。


在下文中一共展示了TPartnerEditUIConnector.SubmitChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestFamilyPropagateNewLocation

        public void TestFamilyPropagateNewLocation()
        {
            TPartnerEditUIConnector connector = new TPartnerEditUIConnector();

            PartnerEditTDS MainDS = new PartnerEditTDS();

            TCreateTestPartnerData.CreateFamilyWithTwoPersonRecords(MainDS);

            DataSet ResponseDS = new PartnerEditTDS();
            TVerificationResultCollection VerificationResult;

            TSubmitChangesResult result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(VerificationResult,
                "There was a critical error when saving:");

            // now change on partner location. should ask about everyone else
            // it seems, the change must be to PLocation. In Petra 2.3, changes to the PartnerLocation are not propagated
            // MainDS.PPartnerLocation[0].DateGoodUntil = new DateTime(2011, 01, 01);

            Assert.AreEqual(1, MainDS.PLocation.Rows.Count, "there should be only one address for the whole family");

            MainDS.PLocation[0].County = "different";

            ResponseDS = new PartnerEditTDS();

            result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(VerificationResult,
                "There was a critical error when saving:");

            Assert.AreEqual(TSubmitChangesResult.scrInfoNeeded,
                result,
                "should ask if the partner locations of the other members of the family should be changed as well");

            // TODO: simulate the dialog where the user selects which people to propagate the address change for.

            // TODO: what about replacing the whole address?
            // TODO: adding a new location for all members of the family?
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:40,代码来源:TestPartnerEdit.cs

示例2: TestNewPartnerWithLocation0

        public void TestNewPartnerWithLocation0()
        {
            TPartnerEditUIConnector connector = new TPartnerEditUIConnector();

            PartnerEditTDS MainDS = new PartnerEditTDS();

            PPartnerRow PartnerRow = TCreateTestPartnerData.CreateNewFamilyPartner(MainDS);

            PPartnerLocationRow PartnerLocationRow = MainDS.PPartnerLocation.NewRowTyped();

            PartnerLocationRow.SiteKey = DomainManager.GSiteKey;
            PartnerLocationRow.PartnerKey = PartnerRow.PartnerKey;
            PartnerLocationRow.LocationKey = 0;
            PartnerLocationRow.TelephoneNumber = PartnerRow.PartnerKey.ToString();
            MainDS.PPartnerLocation.Rows.Add(PartnerLocationRow);

            DataSet ResponseDS = new PartnerEditTDS();
            TVerificationResultCollection VerificationResult;

            TSubmitChangesResult result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(VerificationResult,
                "There was a critical error when saving:");

            Assert.AreEqual(TSubmitChangesResult.scrOK, result, "Create a partner with location 0");

            TCreateTestPartnerData.CreateNewLocation(PartnerRow.PartnerKey, MainDS);

            // remove location 0, same is done in csharp\ICT\Petra\Client\MCommon\logic\UC_PartnerAddresses.cs TUCPartnerAddressesLogic::AddRecord
            // Check if record with PartnerLocation.LocationKey = 0 is around > delete it
            DataRow PartnerLocationRecordZero =
                MainDS.PPartnerLocation.Rows.Find(new object[] { PartnerRow.PartnerKey, DomainManager.GSiteKey, 0 });

            if (PartnerLocationRecordZero != null)
            {
                DataRow LocationRecordZero = MainDS.PLocation.Rows.Find(new object[] { DomainManager.GSiteKey, 0 });

                if (LocationRecordZero != null)
                {
                    LocationRecordZero.Delete();
                }

                PartnerLocationRecordZero.Delete();
            }

            ResponseDS = new PartnerEditTDS();
            result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(VerificationResult,
                "There was a critical error when saving:");

            Assert.AreEqual(TSubmitChangesResult.scrOK, result, "Replace location 0 of partner");

            Assert.AreEqual(1, MainDS.PPartnerLocation.Rows.Count, "the partner should only have one location in the dataset");

            // get all addresses of the partner
            TDBTransaction ReadTransaction = null;
            DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum,
                ref ReadTransaction,
                delegate
                {
                    PPartnerLocationTable testPartnerLocations = PPartnerLocationAccess.LoadViaPPartner(PartnerRow.PartnerKey, ReadTransaction);
                    Assert.AreEqual(1, testPartnerLocations.Rows.Count, "the partner should only have one location");
                    Assert.Greater(testPartnerLocations[0].LocationKey, 0, "TPartnerEditUIConnector SubmitChanges returns valid location key");
                });
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:66,代码来源:TestPartnerEdit.cs

示例3: TestSaveNewPartnerWithExistingLocation

        public void TestSaveNewPartnerWithExistingLocation()
        {
            TPartnerEditUIConnector connector = new TPartnerEditUIConnector();

            PartnerEditTDS MainDS = new PartnerEditTDS();

            PPartnerRow PartnerRow = TCreateTestPartnerData.CreateNewFamilyPartner(MainDS);

            TCreateTestPartnerData.CreateNewLocation(PartnerRow.PartnerKey, MainDS);

            DataSet ResponseDS = new PartnerEditTDS();
            TVerificationResultCollection VerificationResult;

            TSubmitChangesResult result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(VerificationResult,
                "There was a critical error when saving:");

            Assert.AreEqual(TSubmitChangesResult.scrOK, result, "saving the first partner with a location");

            Int32 LocationKey = MainDS.PLocation[0].LocationKey;

            MainDS = new PartnerEditTDS();

            PartnerRow = TCreateTestPartnerData.CreateNewFamilyPartner(MainDS);

            PPartnerLocationRow PartnerLocationRow = MainDS.PPartnerLocation.NewRowTyped();
            PartnerLocationRow.SiteKey = DomainManager.GSiteKey;
            PartnerLocationRow.PartnerKey = PartnerRow.PartnerKey;
            PartnerLocationRow.LocationKey = LocationKey;
            PartnerLocationRow.TelephoneNumber = PartnerRow.PartnerKey.ToString();
            MainDS.PPartnerLocation.Rows.Add(PartnerLocationRow);

            ResponseDS = new PartnerEditTDS();

            result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            CommonNUnitFunctions.EnsureNullOrOnlyNonCriticalVerificationResults(VerificationResult,
                "There was a critical error when saving:");

            TDBTransaction ReadTransaction = null;
            DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum,
                ref ReadTransaction,
                delegate
                {
                    PPartnerTable PartnerAtAddress = PPartnerAccess.LoadViaPLocation(
                        DomainManager.GSiteKey, LocationKey, ReadTransaction);
                    Assert.AreEqual(2, PartnerAtAddress.Rows.Count, "there should be two partners at this location");
                });
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:50,代码来源:TestPartnerEdit.cs

示例4: TestDeleteVenue

        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));
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:59,代码来源:TestPartnerEdit.cs

示例5: TestMergeTwoFamilies_Arrange

        /// <summary>
        /// Creates two Family Partners and a Family Partner.
        /// </summary>
        /// <param name="AFromPartnerKey">Partner Key of the Family Partner that is the 'From' Partner in the Partner Merge Test.</param>
        /// <param name="AToPartnerKey">Partner Key of the Family Partner that is the 'To' Partner in the Partner Merge Test.</param>
        /// <param name="AConnector">Instantiated Partner Edit UIConnector.</param>
        private void TestMergeTwoFamilies_Arrange(out long AFromPartnerKey, out long AToPartnerKey, TPartnerEditUIConnector AConnector)
        {
            TVerificationResultCollection VerificationResult;
            TSubmitChangesResult Result;
            DataSet ResponseDS;
            PartnerEditTDS MainDS = new PartnerEditTDS();

            // Create two new Family Partners
            PPartnerRow FromPartnerRow = TCreateTestPartnerData.CreateNewFamilyPartner(MainDS);
            PPartnerRow ToPartnerRow = TCreateTestPartnerData.CreateNewFamilyPartner(MainDS);

            // Guard Assertions
            Assert.That(FromPartnerRow, Is.Not.Null);
            Assert.That(ToPartnerRow, Is.Not.Null);

            AFromPartnerKey = FromPartnerRow.PartnerKey;
            AToPartnerKey = ToPartnerRow.PartnerKey;

            PFamilyRow FromFamilyRow = (PFamilyRow)MainDS.PFamily.Rows.Find(new object[] { AFromPartnerKey });
            PFamilyRow ToFamilyRow = (PFamilyRow)MainDS.PFamily.Rows.Find(new object[] { AToPartnerKey });

            // Guard Assertions
            Assert.That(FromFamilyRow, Is.Not.Null);
            Assert.That(ToFamilyRow, Is.Not.Null);

            // Modify records so that they contain different data
            ToPartnerRow.PartnerShortName = "";
            FromFamilyRow.FirstName = "Chang";
            ToFamilyRow.FirstName = "Eng";
            ToFamilyRow.FamilyName = "";

            // Submit the two new Family Partner records to the database
            ResponseDS = new PartnerEditTDS();
            Result = AConnector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            // Guard Assertion
            Assert.That(Result, Is.EqualTo(
                    TSubmitChangesResult.scrOK), "SubmitChanges for two Families failed: " + VerificationResult.BuildVerificationResultString());
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:45,代码来源:TestPartnerMerge.cs

示例6: TestDeleteUnit

        public void TestDeleteUnit()
        {
            DataSet ResponseDS = new PartnerEditTDS();
            TVerificationResultCollection VerificationResult;
            String TextMessage;
            Boolean CanDeletePartner;
            PPartnerRow UnitPartnerRow;
            PUnitRow UnitRow;
            TSubmitChangesResult result;
            Int64 PartnerKey;

            TPartnerEditUIConnector connector = new TPartnerEditUIConnector();

            PartnerEditTDS MainDS = new PartnerEditTDS();

            UnitPartnerRow = TCreateTestPartnerData.CreateNewUnitPartner(MainDS);
            result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

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

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

            Assert.IsTrue(CanDeletePartner);

            // set unit type to Key Ministry which means it is not allowed to be deleted any longer
            UnitRow = (PUnitRow)MainDS.PUnit.Rows[0];
            UnitRow.UnitTypeCode = MPartnerConstants.UNIT_TYPE_KEYMIN;
            result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);
            Assert.AreEqual(TSubmitChangesResult.scrOK, result, "set unit type to " + MPartnerConstants.UNIT_TYPE_KEYMIN);

            CanDeletePartner = TPartnerWebConnector.CanPartnerBeDeleted(UnitPartnerRow.PartnerKey, out TextMessage);

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

            Assert.IsTrue(!CanDeletePartner);

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

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

            // check that Unit record is really deleted
            Assert.IsTrue(!TPartnerServerLookups.VerifyPartner(PartnerKey));
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:55,代码来源:TestPartnerEdit.cs

示例7: TestDeleteOrganisation

        public void TestDeleteOrganisation()
        {
            DataSet ResponseDS = new PartnerEditTDS();
            TVerificationResultCollection VerificationResult;
            String TextMessage;
            Boolean CanDeletePartner;
            PPartnerRow OrganisationPartnerRow;
            TSubmitChangesResult result;
            Int64 PartnerKey;

            TPartnerEditUIConnector connector = new TPartnerEditUIConnector();

            PartnerEditTDS MainDS = new PartnerEditTDS();

            OrganisationPartnerRow = TCreateTestPartnerData.CreateNewOrganisationPartner(MainDS);
            result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);
            Assert.AreEqual(TSubmitChangesResult.scrOK, result, "create organisation record");

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

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

            Assert.IsTrue(CanDeletePartner);

            // now test actual deletion of Organisation partner
            PartnerKey = OrganisationPartnerRow.PartnerKey;
            Assert.IsTrue(TPartnerWebConnector.DeletePartner(PartnerKey, out VerificationResult));

            // check that Organisation record is really deleted
            Assert.IsTrue(!TPartnerServerLookups.VerifyPartner(PartnerKey));
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:35,代码来源:TestPartnerEdit.cs

示例8: TestMergeAPInfo_Arrange

        /// <summary>
        /// Creates two Person Partners, a Family Partner and AP Info for the From Partner.
        /// </summary>
        /// <param name="AFromPartnerKey">Partner Key of the Person Partner that is the 'From' Partner in the Partner Merge Test.</param>
        /// <param name="AToPartnerKey">Partner Key of the Person Partner that is the 'To' Partner in the Partner Merge Test.</param>
        /// <param name="AFamilyPartnerKey">Partner Key of the Family Partner that is in the Partner Merge Test.</param>
        /// <param name="AAPDocumentID">Document ID for APDocument that is created for testing.</param>
        /// <param name="ALedgerNumber">Ledger Number for the GiftBatch that is created for testing.</param>
        /// <param name="AConnector">Instantiated Partner Edit UIConnector.</param>
        private void TestMergeAPInfo_Arrange(out long AFromPartnerKey, out long AToPartnerKey, out long AFamilyPartnerKey, out int AAPDocumentID,
            out int ALedgerNumber, TPartnerEditUIConnector AConnector)
        {
            TVerificationResultCollection VerificationResult;
            TSubmitChangesResult Result;
            DataSet ResponseDS;
            PartnerEditTDS MainDS = new PartnerEditTDS();
            AccountsPayableTDS APDS = new AccountsPayableTDS();

            // create two new Person Partners, one family and APInfo for From Partner
            TCreateTestPartnerData.CreateFamilyWithTwoPersonRecords(MainDS);
            PPartnerRow FamilyPartnerRow = (PPartnerRow)MainDS.PPartner.Rows[0];
            PPartnerRow FromPartnerRow = (PPartnerRow)MainDS.PPartner.Rows[1];
            PPartnerRow ToPartnerRow = (PPartnerRow)MainDS.PPartner.Rows[2];
            AApDocumentRow APDocumentRow = TCreateTestPartnerData.CreateNewAPInfo(FromPartnerRow.PartnerKey, ref APDS);

            // Guard Assertions
            Assert.That(FamilyPartnerRow, Is.Not.Null);
            Assert.That(FromPartnerRow, Is.Not.Null);
            Assert.That(ToPartnerRow, Is.Not.Null);
            Assert.That(APDocumentRow, Is.Not.Null);
            Assert.AreEqual(1, APDS.AApSupplier.Rows.Count);

            AFamilyPartnerKey = FamilyPartnerRow.PartnerKey;
            AFromPartnerKey = FromPartnerRow.PartnerKey;
            AToPartnerKey = ToPartnerRow.PartnerKey;
            AAPDocumentID = APDocumentRow.ApDocumentId;
            ALedgerNumber = APDocumentRow.LedgerNumber;

            // Submit the new records to the database
            ResponseDS = new PartnerEditTDS();
            Result = AConnector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            // Guard Assertion
            Assert.That(Result, Is.EqualTo(
                    TSubmitChangesResult.scrOK), "SubmitChanges for two Persons failed: " + VerificationResult.BuildVerificationResultString());

            // Submit the new Supplier record to the database
            TSupplierEditUIConnector Connector = new TSupplierEditUIConnector();
            Result = Connector.SubmitChanges(ref APDS);

            // Guard Assertion
            Assert.That(Result, Is.EqualTo(
                    TSubmitChangesResult.scrOK), "SubmitChanges for AP Info failed");

            // Submit the new Document record to the database
            Result = TAPTransactionWebConnector.SaveAApDocument(ref APDS, out VerificationResult);

            // Guard Assertion
            Assert.That(Result, Is.EqualTo(
                    TSubmitChangesResult.scrOK), "SubmitChanges for AP Info failed: " + VerificationResult.BuildVerificationResultString());
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:61,代码来源:TestPartnerMerge.cs

示例9: TestMergePMData_Arrange

        /// <summary>
        /// Creates two Person Partners, a Family Partner and AP Info for the From Partner.
        /// </summary>
        /// <param name="AFromPartnerKey">Partner Key of the Person Partner that is the 'From' Partner in the Partner Merge Test.</param>
        /// <param name="AToPartnerKey">Partner Key of the Person Partner that is the 'To' Partner in the Partner Merge Test.</param>
        /// <param name="AFamilyPartnerKey">Partner Key of the Family Partner that is in the Partner Merge Test.</param>
        /// <param name="ADataLabelKey">Key for PDataLabel that is created for testing.</param>
        /// <param name="AConnector">Instantiated Partner Edit UIConnector.</param>
        private void TestMergePMData_Arrange(out long AFromPartnerKey, out long AToPartnerKey, out long AFamilyPartnerKey,
            out int ADataLabelKey, TPartnerEditUIConnector AConnector)
        {
            TVerificationResultCollection VerificationResult;
            TSubmitChangesResult Result;
            DataSet ResponseDS;
            PartnerEditTDS MainDS = new PartnerEditTDS();
            IndividualDataTDS IndividualDS = new IndividualDataTDS();

            // create two new Person Partners, one family and PM Data for both Partners
            TCreateTestPartnerData.CreateFamilyWithTwoPersonRecords(MainDS);
            PPartnerRow FamilyPartnerRow = (PPartnerRow)MainDS.PPartner.Rows[0];
            PPartnerRow FromPartnerRow = (PPartnerRow)MainDS.PPartner.Rows[1];
            PPartnerRow ToPartnerRow = (PPartnerRow)MainDS.PPartner.Rows[2];
            PDataLabelTable DataLabel = TCreateTestPartnerData.CreateNewPMData(FromPartnerRow.PartnerKey, ToPartnerRow.PartnerKey, IndividualDS);

            PmPassportDetailsRow row = (PmPassportDetailsRow)IndividualDS.PmPassportDetails.Rows[0];

            // Guard Assertions
            Assert.That(FamilyPartnerRow, Is.Not.Null);
            Assert.That(FromPartnerRow, Is.Not.Null);
            Assert.That(ToPartnerRow, Is.Not.Null);
            Assert.That(DataLabel, Is.Not.Null);
            Assert.AreEqual(1, IndividualDS.PDataLabelValuePartner.Rows.Count);
            Assert.AreEqual(1, IndividualDS.PmPassportDetails.Rows.Count);
            Assert.AreEqual(2, IndividualDS.PmPersonalData.Rows.Count);

            AFamilyPartnerKey = FamilyPartnerRow.PartnerKey;
            AFromPartnerKey = FromPartnerRow.PartnerKey;
            AToPartnerKey = ToPartnerRow.PartnerKey;
            ADataLabelKey = ((PDataLabelRow)DataLabel.Rows[0]).Key;

            // Submit the new records to the database
            ResponseDS = new PartnerEditTDS();
            Result = AConnector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            // Guard Assertion
            Assert.That(Result, Is.EqualTo(
                    TSubmitChangesResult.scrOK), "SubmitChanges for two Persons failed: " + VerificationResult.BuildVerificationResultString());

            // Submit the new DataLabel record to the database
            PDataLabelAccess.SubmitChanges(DataLabel, DBAccess.GDBAccessObj.Transaction);

            // Submit the new Document record to the database
            MainDS.Merge(IndividualDS);
            Result = TIndividualDataWebConnector.SubmitChangesServerSide(ref IndividualDS,
                ref MainDS,
                DBAccess.GDBAccessObj.Transaction,
                out VerificationResult);

            // Guard Assertion
            Assert.That(Result, Is.EqualTo(
                    TSubmitChangesResult.scrOK), "SubmitChanges for PM Data failed: " + VerificationResult.BuildVerificationResultString());
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:62,代码来源:TestPartnerMerge.cs

示例10: TestMergeBankToPerson_Arrange

        /// <summary>
        /// Creates a Bank Partner a Person Partner and a Family Partner.
        /// </summary>
        /// <param name="AFromPartnerKey">Partner Key of the Bank Partner that is the 'From' Partner in the Partner Merge Test.</param>
        /// <param name="AToPartnerKey">Partner Key of the Person Partner that is the 'To' Partner in the Partner Merge Test.</param>
        /// <param name="AToFamilyKey">Partner Key of the Family Partner of the Person Partner.</param>
        /// <param name="AConnector">Instantiated Partner Edit UIConnector.</param>
        private void TestMergeBankToPerson_Arrange(out long AFromPartnerKey,
            out long AToPartnerKey,
            out long AToFamilyKey,
            TPartnerEditUIConnector AConnector)
        {
            TVerificationResultCollection VerificationResult;
            TSubmitChangesResult Result;
            DataSet ResponseDS;
            PartnerEditTDS MainDS = new PartnerEditTDS();

            // Create one new Bank Partner and one new Person Partner
            PPartnerRow FromPartnerRow = TCreateTestPartnerData.CreateNewBankPartner(MainDS);

            TCreateTestPartnerData.CreateFamilyWithOnePersonRecord(MainDS);

            PPersonRow ToPartnerRow = (PPersonRow)MainDS.PPerson.Rows[0];
            PFamilyRow ToFamilyRow = (PFamilyRow)MainDS.PFamily.Rows[0];

            // Guard Assertions
            Assert.That(FromPartnerRow, Is.Not.Null);
            Assert.That(ToPartnerRow, Is.Not.Null);
            Assert.That(ToFamilyRow, Is.Not.Null);

            AFromPartnerKey = FromPartnerRow.PartnerKey;
            AToPartnerKey = ToPartnerRow.PartnerKey;
            AToFamilyKey = ToFamilyRow.PartnerKey;

            // Submit the new Partner records to the database
            ResponseDS = new PartnerEditTDS();
            Result = AConnector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            // Guard Assertion
            Assert.That(Result, Is.EqualTo(
                    TSubmitChangesResult.scrOK), "SubmitChanges for bank and person failed: " + VerificationResult.BuildVerificationResultString());
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:42,代码来源:TestPartnerMerge.cs

示例11: TestMergeRecurringGiftInfo_Arrange

        /// <summary>
        /// Creates two Person Partners, a Family Partner and Gift Info for the From Partner.
        /// </summary>
        /// <param name="AFromPartnerKey">Partner Key of the Person Partner that is the 'From' Partner in the Partner Merge Test.</param>
        /// <param name="AToPartnerKey">Partner Key of the Person Partner that is the 'To' Partner in the Partner Merge Test.</param>
        /// <param name="AFamilyPartnerKey">Partner Key of the Family Partner that is in the Partner Merge Test.</param>
        /// <param name="ALedgerNumber">Ledger Number for the GiftBatch that is created for testing.</param>
        /// <param name="ABatchNumber">Batch Number for the GiftBatch that is created for testing.</param>
        /// <param name="AConnector">Instantiated Partner Edit UIConnector.</param>
        private void TestMergeRecurringGiftInfo_Arrange(out long AFromPartnerKey,
            out long AToPartnerKey,
            out long AFamilyPartnerKey,
            out int ALedgerNumber,
            out int ABatchNumber,
            TPartnerEditUIConnector AConnector)
        {
            TVerificationResultCollection VerificationResult;
            TSubmitChangesResult Result;
            DataSet ResponseDS;
            PartnerEditTDS MainDS = new PartnerEditTDS();
            GiftBatchTDS GiftDS = new GiftBatchTDS();

            // create two new Person Partners, one family and GiftInfo for From Partner
            TCreateTestPartnerData.CreateFamilyWithTwoPersonRecords(MainDS);
            PPartnerRow FamilyPartnerRow = (PPartnerRow)MainDS.PPartner.Rows[0];
            PPartnerRow FromPartnerRow = (PPartnerRow)MainDS.PPartner.Rows[1];
            PPartnerRow ToPartnerRow = (PPartnerRow)MainDS.PPartner.Rows[2];
            ARecurringGiftBatchRow GiftBatchRow = TCreateTestPartnerData.CreateNewRecurringGiftInfo(FromPartnerRow.PartnerKey, ref GiftDS);

            // Guard Assertions
            Assert.That(FamilyPartnerRow, Is.Not.Null);
            Assert.That(FromPartnerRow, Is.Not.Null);
            Assert.That(ToPartnerRow, Is.Not.Null);
            Assert.That(GiftBatchRow, Is.Not.Null);
            Assert.AreEqual(1, GiftDS.ARecurringGift.Rows.Count);
            Assert.AreEqual(1, GiftDS.ARecurringGiftDetail.Rows.Count);

            AFamilyPartnerKey = FamilyPartnerRow.PartnerKey;
            AFromPartnerKey = FromPartnerRow.PartnerKey;
            AToPartnerKey = ToPartnerRow.PartnerKey;
            ALedgerNumber = GiftBatchRow.LedgerNumber;
            ABatchNumber = GiftBatchRow.BatchNumber;

            // Submit the new records to the database
            ResponseDS = new PartnerEditTDS();
            Result = AConnector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            // Guard Assertion
            Assert.That(Result, Is.EqualTo(
                    TSubmitChangesResult.scrOK), "SubmitChanges for two Persons failed: " + VerificationResult.BuildVerificationResultString());

            // Submit the new Gift Info records to the database
            Result = TGiftTransactionWebConnector.SaveGiftBatchTDS(ref GiftDS, out VerificationResult);

            // Guard Assertion
            Assert.That(Result, Is.EqualTo(
                    TSubmitChangesResult.scrOK), "SubmitChanges for Recurring Gift Info failed: " + VerificationResult.BuildVerificationResultString());
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:58,代码来源:TestPartnerMerge.cs

示例12: TestMergeTwoBanks_Arrange

        /// <summary>
        /// Creates two Bank Partners and a Bank Partner.
        /// </summary>
        /// <param name="AFromPartnerKey">Partner Key of the Bank Partner that is the 'From' Partner in the Partner Merge Test.</param>
        /// <param name="AToPartnerKey">Partner Key of the Bank Partner that is the 'To' Partner in the Partner Merge Test.</param>
        /// <param name="ABankingDetailsKey">BankingDetailsKey for the BankingDetails record being tested</param>
        /// <param name="AConnector">Instantiated Partner Edit UIConnector.</param>
        private void TestMergeTwoBanks_Arrange(out long AFromPartnerKey,
            out long AToPartnerKey,
            out int ABankingDetailsKey,
            TPartnerEditUIConnector AConnector)
        {
            TVerificationResultCollection VerificationResult;
            TSubmitChangesResult Result;
            DataSet ResponseDS;
            PartnerEditTDS MainDS = new PartnerEditTDS();

            // Create two new Bank Partners and a new BankingDetails record
            PPartnerRow FromPartnerRow = TCreateTestPartnerData.CreateNewBankPartner(MainDS);
            PPartnerRow ToPartnerRow = TCreateTestPartnerData.CreateNewBankPartner(MainDS);
            PartnerEditTDSPBankingDetailsRow BankingDetailsRow = TCreateTestPartnerData.CreateNewBankingRecords(FromPartnerRow.PartnerKey, MainDS);

            // Guard Assertions
            Assert.That(FromPartnerRow, Is.Not.Null);
            Assert.That(ToPartnerRow, Is.Not.Null);
            Assert.That(BankingDetailsRow, Is.Not.Null);

            AFromPartnerKey = FromPartnerRow.PartnerKey;
            AToPartnerKey = ToPartnerRow.PartnerKey;
            ABankingDetailsKey = BankingDetailsRow.BankingDetailsKey;

            PBankRow FromBankRow = (PBankRow)MainDS.PBank.Rows.Find(new object[] { AFromPartnerKey });
            PBankRow ToBankRow = (PBankRow)MainDS.PBank.Rows.Find(new object[] { AToPartnerKey });

            // Guard Assertions
            Assert.That(FromBankRow, Is.Not.Null);
            Assert.That(ToBankRow, Is.Not.Null);

            // Modify records so that they contain different data
            ToPartnerRow.PartnerShortName = "";
            ToBankRow.BranchName = "";
            BankingDetailsRow.BankKey = AFromPartnerKey;

            // Submit the two new Bank Partner records to the database
            ResponseDS = new PartnerEditTDS();
            Result = AConnector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            // Guard Assertion
            Assert.That(Result, Is.EqualTo(
                    TSubmitChangesResult.scrOK), "SubmitChanges for two Banks failed: " + VerificationResult.BuildVerificationResultString());
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:51,代码来源:TestPartnerMerge.cs

示例13: TestMergeTwoPersonsFromDifferentFamilies_Arrange

        /// <summary>
        /// Creates two Person Partners and two Family Partner.
        /// </summary>
        /// <param name="AFromPartnerKey">Partner Key of the Person Partner that is the 'From' Partner in the Partner Merge Test.</param>
        /// <param name="AToPartnerKey">Partner Key of the Person Partner that is the 'From' Partner in the Partner Merge Test.</param>
        /// <param name="AFromFamilyPartnerKey">Partner Key of the From Family Partner that is in the Partner Merge Test.</param>
        /// <param name="AToFamilyPartnerKey">Partner Key of the To Family Partner that is in the Partner Merge Test.</param>
        /// <param name="ASiteKey">Site Key of the Location that is in the Partner Merge Test.</param>
        /// <param name="ALocationKey">Location Key of the Location that is in the Partner Merge Test.</param>
        /// <param name="AConnector">Instantiated Partner Edit UIConnector.</param>
        private void TestMergeTwoPersonsFromDifferentFamilies_Arrange(out long AFromPartnerKey,
            out long AToPartnerKey,
            out long AFromFamilyPartnerKey,
            out long AToFamilyPartnerKey,
            out long[] ASiteKey,
            out int[] ALocationKey,
            TPartnerEditUIConnector AConnector)
        {
            TVerificationResultCollection VerificationResult;
            TSubmitChangesResult Result;
            DataSet ResponseDS;
            PartnerEditTDS MainDS = new PartnerEditTDS();

            // create one new Person Partner, one family and one location
            TCreateTestPartnerData.CreateFamilyWithOnePersonRecord(MainDS);
            PPartnerRow FromFamilyPartnerRow = (PPartnerRow)MainDS.PPartner.Rows[0];
            PPartnerRow FromPartnerRow = (PPartnerRow)MainDS.PPartner.Rows[1];
            PLocationRow LocationRow = (PLocationRow)MainDS.PLocation.Rows[0];

            // Submit the two new Person Partner records to the database (need to this now or will get error when second location is created)
            ResponseDS = new PartnerEditTDS();
            Result = AConnector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            // create one new Person Partner, one family and one location
            TCreateTestPartnerData.CreateFamilyWithOnePersonRecord(MainDS);
            PPartnerRow ToFamilyPartnerRow = (PPartnerRow)MainDS.PPartner.Rows[2];
            PPartnerRow ToPartnerRow = (PPartnerRow)MainDS.PPartner.Rows[3];

            // Guard Assertions
            Assert.That(FromFamilyPartnerRow, Is.Not.Null);
            Assert.That(FromPartnerRow, Is.Not.Null);
            Assert.That(ToFamilyPartnerRow, Is.Not.Null);
            Assert.That(ToPartnerRow, Is.Not.Null);
            Assert.That(LocationRow, Is.Not.Null);

            AFromFamilyPartnerKey = FromFamilyPartnerRow.PartnerKey;
            AToFamilyPartnerKey = ToFamilyPartnerRow.PartnerKey;
            AFromPartnerKey = FromPartnerRow.PartnerKey;
            AToPartnerKey = ToPartnerRow.PartnerKey;

            PFamilyRow FromFamilyRow = (PFamilyRow)MainDS.PFamily.Rows.Find(new object[] { AFromFamilyPartnerKey });
            PFamilyRow ToFamilyRow = (PFamilyRow)MainDS.PFamily.Rows.Find(new object[] { AToFamilyPartnerKey });
            PPersonRow FromPersonRow = (PPersonRow)MainDS.PPerson.Rows.Find(new object[] { AFromPartnerKey });
            PPersonRow ToPersonRow = (PPersonRow)MainDS.PPerson.Rows.Find(new object[] { AToPartnerKey });

            // location data is needed for the merge
            ASiteKey = new long[1];
            ALocationKey = new int[1];
            ASiteKey[0] = LocationRow.SiteKey;
            ALocationKey[0] = LocationRow.LocationKey;

            // Guard Assertions
            Assert.That(FromFamilyRow, Is.Not.Null);
            Assert.That(ToFamilyRow, Is.Not.Null);
            Assert.That(FromPersonRow, Is.Not.Null);
            Assert.That(ToPersonRow, Is.Not.Null);

            // Modify records so that they contain different data
            ToPartnerRow.PartnerShortName = "";
            ToPersonRow.FirstName = "";
            FromPersonRow.Gender = "MALE";
            ToPersonRow.Gender = "UNKNOWN";

            // Submit the two new Person Partner records to the database
            ResponseDS = new PartnerEditTDS();
            Result = AConnector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            // Guard Assertion
            Assert.That(Result, Is.EqualTo(
                    TSubmitChangesResult.scrOK), "SubmitChanges for two Persons from different Families failed: " +
                VerificationResult.BuildVerificationResultString());
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:82,代码来源:TestPartnerMerge.cs

示例14: TestMergeTwoUnits_Arrange

        /// <summary>
        /// Creates two Unit Partners.
        /// </summary>
        /// <param name="AFromPartnerKey">Partner Key of the Unit Partner that is the 'From' Partner in the Partner Merge Test.</param>
        /// <param name="AToPartnerKey">Partner Key of the Unit Partner that is the 'To' Partner in the Partner Merge Test.</param>
        /// <param name="ATestPartnerKey">Partner Key of the auxilary Family Partner.</param>
        /// <param name="AConnector">Instantiated Partner Edit UIConnector.</param>
        private void TestMergeTwoUnits_Arrange(out long AFromPartnerKey,
            out long AToPartnerKey,
            out long ATestPartnerKey,
            TPartnerEditUIConnector AConnector)
        {
            TVerificationResultCollection VerificationResult;
            TSubmitChangesResult Result;
            DataSet ResponseDS;
            PartnerEditTDS MainDS = new PartnerEditTDS();

            // Create two new Unit Partners
            PPartnerRow FromPartnerRow = TCreateTestPartnerData.CreateNewUnitPartner(MainDS);
            PPartnerRow ToPartnerRow = TCreateTestPartnerData.CreateNewUnitPartner(MainDS);

            // Guard Assertions
            Assert.That(FromPartnerRow, Is.Not.Null);
            Assert.That(ToPartnerRow, Is.Not.Null);

            AFromPartnerKey = FromPartnerRow.PartnerKey;
            AToPartnerKey = ToPartnerRow.PartnerKey;

            PUnitRow FromUnitRow = (PUnitRow)MainDS.PUnit.Rows.Find(new object[] { AFromPartnerKey });
            PUnitRow ToUnitRow = (PUnitRow)MainDS.PUnit.Rows.Find(new object[] { AToPartnerKey });

            // Guard Assertions
            Assert.That(FromUnitRow, Is.Not.Null);
            Assert.That(ToUnitRow, Is.Not.Null);

            // Modify records so that they contain different data
            ToPartnerRow.PartnerShortName = "";
            FromUnitRow.Maximum = 3;
            ToUnitRow.Maximum = 6;

            // Submit the two new Unit Partner records to the database
            ResponseDS = new PartnerEditTDS();
            Result = AConnector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            // Guard Assertion
            Assert.That(Result, Is.EqualTo(
                    TSubmitChangesResult.scrOK), "SubmitChanges for two Units failed: " + VerificationResult.BuildVerificationResultString());

            // Create a Family record to be able to test later that the FieldKey (which is referencing p_unit) is changed
            PPartnerRow TestPartnerRow = TCreateTestPartnerData.CreateNewFamilyPartner(MainDS);
            Assert.That(TestPartnerRow, Is.Not.Null);

            ATestPartnerKey = TestPartnerRow.PartnerKey;
            PFamilyRow TestFamilyPartnerRow = (PFamilyRow)MainDS.PFamily.Rows.Find(new object[] { ATestPartnerKey });
            Assert.That(TestFamilyPartnerRow, Is.Not.Null);

            // Submit the new records to database
            ResponseDS = new PartnerEditTDS();
            Result = AConnector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);

            // Guard Assertion
            Assert.That(Result, Is.EqualTo(
                    TSubmitChangesResult.scrOK), "SubmitChanges for Family failed: " + VerificationResult.BuildVerificationResultString());
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:64,代码来源:TestPartnerMerge.cs

示例15: TestDeleteFamily

        public void TestDeleteFamily()
        {
            DataSet ResponseDS = new PartnerEditTDS();
            TVerificationResultCollection VerificationResult;
            String TextMessage;
            Boolean CanDeletePartner;
            PPartnerRow FamilyPartnerRow;
            PFamilyRow FamilyRow;
            PPersonRow PersonRow;
            TSubmitChangesResult result;
            Int64 PartnerKey;

            TPartnerEditUIConnector connector = new TPartnerEditUIConnector();

            PartnerEditTDS MainDS = new PartnerEditTDS();

            FamilyPartnerRow = TCreateTestPartnerData.CreateNewFamilyPartner(MainDS);
            result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);
            Assert.AreEqual(TSubmitChangesResult.scrOK, result, "Create family record");

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

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

            Assert.IsTrue(CanDeletePartner);

            // add a person to the family which means the family is not allowed to be deleted any longer
            FamilyRow = (PFamilyRow)MainDS.PFamily.Rows[0];
            FamilyRow.FamilyMembers = true;
            TCreateTestPartnerData.CreateNewLocation(FamilyPartnerRow.PartnerKey, MainDS);
            result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult);
            Assert.AreEqual(TSubmitChangesResult.scrOK, result, "create new location");

            PartnerEditTDS PersonDS = new PartnerEditTDS();
            PersonRow = TCreateTestPartnerData.CreateNewPerson(PersonDS, FamilyPartnerRow.PartnerKey,
                MainDS.PLocation[0].LocationKey, "Adam", "Mr", 0);
            PersonRow.FamilyKey = FamilyPartnerRow.PartnerKey;
            result = connector.SubmitChanges(ref PersonDS, ref ResponseDS, out VerificationResult);
            Assert.AreEqual(TSubmitChangesResult.scrOK, result, "create person record");

            CanDeletePartner = TPartnerWebConnector.CanPartnerBeDeleted(FamilyPartnerRow.PartnerKey, out TextMessage);

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

            Assert.IsTrue(!CanDeletePartner);


            // create new family and create subscription given as gift from this family: not allowed to be deleted
            FamilyPartnerRow = TCreateTestPartnerData.CreateNewFamilyPartner(MainDS);
            PPublicationTable PublicationTable = PPublicationAccess.LoadByPrimaryKey("TESTPUBLICATION", DBAccess.GDBAccessObj.Transaction);

            if (PublicationTable.Count == 0)
            {
                // first check if frequency "Annual" exists and if not then create it
                if (!AFrequencyAccess.Exists("Annual", DBAccess.GDBAccessObj.Transaction))
                {
                    // set up details (e.g. bank account) for this Bank so deletion is not allowed
                    AFrequencyTable FrequencyTable = new AFrequencyTable();
                    AFrequencyRow FrequencyRow = FrequencyTable.NewRowTyped();
                    FrequencyRow.FrequencyCode = "Annual";
                    FrequencyRow.FrequencyDescription = "Annual Frequency";
                    FrequencyTable.Rows.Add(FrequencyRow);

                    AFrequencyAccess.SubmitChanges(FrequencyTable, DBAccess.GDBAccessObj.Transaction);
                }

                // now add the publication "TESTPUBLICATION"
                PPublicationRow PublicationRow = PublicationTable.NewRowTyped();
                PublicationRow.PublicationCode = "TESTPUBLICATION";
                PublicationRow.FrequencyCode = "Annual";
                PublicationTable.Rows.Add(PublicationRow);

                PPublicationAccess.SubmitChanges(PublicationTable, DBAccess.GDBAccessObj.Transaction);
            }

            // make sure that "reason subscription given" exists
            if (!PReasonSubscriptionGivenAccess.Exists("FREE", DBAccess.GDBAccessObj.Transaction))
            {
                // set up details (e.g. bank account) for this Bank so deletion is not allowed
                PReasonSubscriptionGivenTable ReasonTable = new PReasonSubscriptionGivenTable();
                PReasonSubscriptionGivenRow ReasonRow = ReasonTable.NewRowTyped();
                ReasonRow.Code = "FREE";
                ReasonRow.Description = "Free Subscription";
                ReasonTable.Rows.Add(ReasonRow);

                PReasonSubscriptionGivenAccess.SubmitChanges(ReasonTable, DBAccess.GDBAccessObj.Transaction);
            }

            // now add the publication "TESTPUBLICATION" to the first family record and indicate it was a gift from newly created family record
            PSubscriptionRow SubscriptionRow = MainDS.PSubscription.NewRowTyped();
            SubscriptionRow.PublicationCode = "TESTPUBLICATION";
            SubscriptionRow.PartnerKey = FamilyRow.PartnerKey; // link subscription with original family
            SubscriptionRow.GiftFromKey = FamilyPartnerRow.PartnerKey; // indicate that subscription is a gift from newly created family
//.........这里部分代码省略.........
开发者ID:js1987,项目名称:openpetragit,代码行数:101,代码来源:TestPartnerEdit.cs


注:本文中的Ict.Petra.Server.MPartner.Partner.UIConnectors.TPartnerEditUIConnector.SubmitChanges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。