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


C# PartnerEditTDS.Merge方法代码示例

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


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

示例1: InitializeManualCode

        private void InitializeManualCode()
        {
            // show this dialog in center of screen
            this.StartPosition = FormStartPosition.CenterScreen;

            FMainDS = new PartnerEditTDS();

            // now add the one subscription row to the DS that we are working with
            PContactLogTable ContactLogTable = new PContactLogTable();
            FMainDS.Merge(ContactLogTable);
            PContactLogRow ContactLogRow = FMainDS.PContactLog.NewRowTyped(true);
            ContactLogRow.ContactCode = "";
            FMainDS.PContactLog.Rows.Add(ContactLogRow);

            ucoContactLog.MainDS = FMainDS;
            ucoContactLog.SpecialInitUserControl();
            FPetraUtilsObject.HasChanges = false;
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:18,代码来源:UpdateExtractAddContactLogDialog.ManualCode.cs

示例2: InitializeManualCode

        private void InitializeManualCode()
        {
            // show this dialog in center of screen
            this.StartPosition = FormStartPosition.CenterScreen;

            FMainDS = new PartnerEditTDS();

            // now add the one subscription row to the DS that we are working with
            PSubscriptionTable SubscriptionTable = new PSubscriptionTable();
            FMainDS.Merge(SubscriptionTable);
            PSubscriptionRow SubscriptionRow = FMainDS.PSubscription.NewRowTyped(true);
            SubscriptionRow.PublicationCode = ""; // avoid NOT NULL error message
            FMainDS.PSubscription.Rows.Add(SubscriptionRow);

            ucoSubscription.MainDS = FMainDS;
            ucoSubscription.SpecialInitUserControl();
            FPetraUtilsObject.HasChanges = false;
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:18,代码来源:UpdateExtractAddSubscriptionDialog.ManualCode.cs

示例3: LoadData

        private void LoadData(Boolean ADelayedDataLoading, TPartnerEditTabPageEnum ATabPage)
        {
            PartnerEditTDSMiscellaneousDataTable MiscellaneousDataDT;
            PartnerEditTDSMiscellaneousDataRow MiscellaneousDataDR;
            TDBTransaction ReadTransaction;
            DateTime LastGiftDate;
            DateTime LastContactDate;
            String LastGiftInfo;
            TLocationPK LocationPK;
            Boolean OfficeSpecificDataLabelsAvailable = false;
            Int32 ItemsCountAddresses = 0;
            Int32 ItemsCountAddressesActive = 0;
            Int32 ItemsCountContactDetails = -1;
            Int32 ItemsCountContactDetailsActive = -1;
            Int32 ItemsCountSubscriptions = 0;
            Int32 ItemsCountSubscriptionsActive = 0;
            Int32 ItemsCountPartnerTypes = 0;
            Int32 ItemsCountPartnerRelationships = 0;
            Int32 ItemsCountFamilyMembers = 0;
            Int32 ItemsCountPartnerInterests = 0;
            Int32 ItemsCountInterests = 0;
            Int32 ItemsCountPartnerBankingDetails = 0;
            Int32 ItemsCountContacts = 0;
            Int64 FoundationOwner1Key = 0;
            Int64 FoundationOwner2Key = 0;
            bool HasEXWORKERPartnerType = false;

//          TLogging.LogAtLevel(7, "TPartnerEditUIConnector.LoadData called. ADelayedDataLoading: " + ADelayedDataLoading.ToString() + "; ATabPage: " +
//               Enum.GetName(typeof(TPartnerEditTabPageEnum), ATabPage));

            // create the FPartnerEditScreenDS DataSet that will later be passed to the Client
            FPartnerEditScreenDS = new PartnerEditTDS(DATASETNAME);

            try
            {
                ReadTransaction = DBAccess.GDBAccessObj.BeginTransaction(IsolationLevel.RepeatableRead, 5);
                try
                {
                    #region Load data using the DataStore

                    // Partner
                    PPartnerAccess.LoadByPrimaryKey(FPartnerEditScreenDS, FPartnerKey, ReadTransaction);

                    if (FPartnerEditScreenDS.PPartner.Rows.Count != 0)
                    {
                        FPartnerClass = SharedTypes.PartnerClassStringToEnum(FPartnerEditScreenDS.PPartner[0].PartnerClass);
                    }
                    else
                    {
                        throw new EPartnerNotExistantException();
                    }

                    /*
                     * For Partners that aren't ORGANISATIONs we can check access to the Partner here.
                     * For Partners that *are* ORGANISATIONS we need to do a more elaborate check
                     * further down the code of this Method!
                     */
                    if (FPartnerClass != TPartnerClass.ORGANISATION)
                    {
                        /*
                         * Check if access to Partner is granted; if not, an
                         * ESecurityPartnerAccessDeniedException will be thrown by the called Method!
                         */
                        Ict.Petra.Shared.MPartner.TSecurity.CanAccessPartnerExc(FPartnerEditScreenDS.PPartner[0], false, null);
                    }

                    // Partner Types
                    FPartnerEditScreenDS.Merge(GetPartnerTypesInternal(out ItemsCountPartnerTypes, false));

                    if ((ADelayedDataLoading) && (ATabPage != TPartnerEditTabPageEnum.petpPartnerTypes))
                    {
                        // Empty Tables again, we don't want to transfer the data contained in them
                        FPartnerEditScreenDS.PPartnerType.Rows.Clear();
                    }

                    // Subscriptions
                    FPartnerEditScreenDS.Merge(GetSubscriptionsInternal(out ItemsCountSubscriptions, false));

                    if ((ADelayedDataLoading) && (ATabPage != TPartnerEditTabPageEnum.petpSubscriptions))
                    {
                        // Only count Subscriptions
                        Calculations.CalculateTabCountsSubscriptions(FPartnerEditScreenDS.PSubscription,
                            out ItemsCountSubscriptions,
                            out ItemsCountSubscriptionsActive);

                        // Empty Tables again, we don't want to transfer the data contained in them
                        FPartnerEditScreenDS.PSubscription.Rows.Clear();
                    }

                    // Partner Attributes - those always need to get loaded!
                    FPartnerEditScreenDS.Merge(PPartnerAttributeAccess.LoadViaPPartner(FPartnerKey, ReadTransaction));

                    // Contact Details
                    GetPartnerContactDetailsInternal(out ItemsCountContactDetails);

                    if ((ADelayedDataLoading) && (ATabPage != TPartnerEditTabPageEnum.petpContactDetails))
                    {
                        // Count Contact Details
                        Calculations.CalculateTabCountsPartnerContactDetails(FPartnerEditScreenDS.PPartnerAttribute,
                            out ItemsCountContactDetails, out ItemsCountContactDetailsActive);
//.........这里部分代码省略.........
开发者ID:js1987,项目名称:openpetragit,代码行数:101,代码来源:Partner.PartnerEdit.cs

示例4: SubmitChangesAddresses

        private TSubmitChangesResult SubmitChangesAddresses(ref PartnerEditTDS AInspectDS,
            TDBTransaction ASubmitChangesTransaction,
            ref PartnerAddressAggregateTDS AResponseDS,
            out TVerificationResultCollection AVerificationResult)
        {
            TSubmitChangesResult SubmissionResult;

            AVerificationResult = null;
//          TLogging.LogAtLevel(7, "TPartnerEditUIConnector.SubmitChangesAddresses: Instance hash is " + this.GetHashCode().ToString());

            if (AInspectDS != null)
            {
                SubmissionResult =
                    TPPartnerAddressAggregate.PrepareChanges(
                        AInspectDS,
                        FPartnerKey,
                        SharedTypes.PartnerClassEnumToString(FPartnerClass),
                        ASubmitChangesTransaction,
                        ref AResponseDS,
                        out AVerificationResult);

                /*
                 * Business Rule: Ensure that the DateModified of the Partner record is
                 * changed to today's date if a new PPartnerLocation is added.
                 */
                if (SubmissionResult == TSubmitChangesResult.scrOK)
                {
                    if (AInspectDS.PPartnerLocation != null)
                    {
                        DataView AddedPartnerLocationsDV = new DataView(AInspectDS.PPartnerLocation, "", "", DataViewRowState.Added);

                        if (AddedPartnerLocationsDV.Count > 0)
                        {
                            // New PPartnerLocation exists
                            TLogging.LogAtLevel(7,
                                "TPartnerEditUIConnector.SubmitChangesAddresses: New PPartnerLocation or changed PPartnerLocation exists.");

                            if (AInspectDS.PPartner != null)
                            {
                                if (AInspectDS.PPartner.Rows.Count > 0)
                                {
                                    // AInspectDS contains a PPartner DataRow > simply update the
                                    // DateModified there (strictly speaking this should not be necessary
                                    // because the DataStore should do that anyway when the PPartner
                                    // record is saved, but just to be sure it happens...)
                                    AInspectDS.PPartner[0].DateModified = DateTime.Today;
//                                  TLogging.LogAtLevel(7,  "TPartnerEditUIConnector.SubmitChangesAddresses: updated PPartner's DateModified to today (PPartner record was present).");
                                }
                            }
                            else
                            {
                                // AInspectDS doesn't contain a PPartner DataRow: load that PPartner
                                // record, change DateModified and save the PPartner record.
                                // must use AddedPartnerLocationsDV because AInspectDS.PPartnerLocation[0] could be a deleted row; see bug 759
                                PPartnerTable PartnerDT = PPartnerAccess.LoadByPrimaryKey(
                                    ((PPartnerLocationRow)(AddedPartnerLocationsDV[0].Row)).PartnerKey,
                                    ASubmitChangesTransaction);
                                PartnerDT[0].DateModified = DateTime.Today;
                                AInspectDS.Merge(PartnerDT);
//                              TLogging.LogAtLevel(7, "TPartnerEditUIConnector.SubmitChangesAddresses: updated PPartner's DateModified to today (PPartner record wasn't present).");
                            }
                        }
                    }
                }

                if (SubmissionResult == TSubmitChangesResult.scrError)
                {
//                  TLogging.LogAtLevel(9, Messages.BuildMessageFromVerificationResult("TPartnerEditUIConnector.SubmitChangesAddresses AVerificationResult: ", AVerificationResult));
                }
            }
            else
            {
                TLogging.LogAtLevel(8, "TPartnerEditUIConnector.SubmitChangesAddresses:AInspectDS = nil!");
                SubmissionResult = TSubmitChangesResult.scrNothingToBeSaved;
            }

            return SubmissionResult;
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:78,代码来源:Partner.PartnerEdit.cs

示例5: PrepareBankingDetailsForSaving

        private void PrepareBankingDetailsForSaving(ref PartnerEditTDS AInspectDS, ref TVerificationResultCollection AVerificationResult,
            TDBTransaction ATransaction)
        {
            if ((AInspectDS.PBankingDetails != null) && (AInspectDS.PBankingDetails.Rows.Count > 0))
            {
                AInspectDS.Merge(new PBankingDetailsUsageTable());
                AInspectDS.InitVars();
                PBankingDetailsUsageAccess.LoadViaPPartner(AInspectDS, FPartnerKey, ATransaction);
                AInspectDS.PBankingDetailsUsage.AcceptChanges();

                // make sure there is at least one main account, or no account at all
                // make sure there are no multiple main accounts

                PartnerEditTDS LocalDS = new PartnerEditTDS();
                PBankingDetailsAccess.LoadViaPPartner(LocalDS, FPartnerKey, ATransaction);

                // there are problems with Mono on merging deleted rows into the LocalDS, they become modified rows
                // see https://tracker.openpetra.org/view.php?id=1871
                LocalDS.Merge(AInspectDS.PBankingDetails);

                // workaround for bug 1871
                List <Int32>DeletedBankingDetails = new List <Int32>();

                if (AInspectDS.PPartnerBankingDetails != null)
                {
                    foreach (DataRow bdrow in AInspectDS.PPartnerBankingDetails.Rows)
                    {
                        if (bdrow.RowState == DataRowState.Deleted)
                        {
                            DeletedBankingDetails.Add(Convert.ToInt32(bdrow[AInspectDS.PPartnerBankingDetails.ColumnBankingDetailsKey,
                                                                            DataRowVersion.Original]));
                        }
                    }
                }

                bool ThereIsAtLeastOneAccount = false;

                // get the main account
                Int32 MainAccountBankingDetails = Int32.MinValue;

                foreach (PartnerEditTDSPBankingDetailsRow detailRow in LocalDS.PBankingDetails.Rows)
                {
                    if ((detailRow.RowState != DataRowState.Deleted) && !DeletedBankingDetails.Contains(detailRow.BankingDetailsKey))
                    {
                        ThereIsAtLeastOneAccount = true;

                        if (!detailRow.IsMainAccountNull() && detailRow.MainAccount)
                        {
                            if ((MainAccountBankingDetails != Int32.MinValue) && (detailRow.BankingDetailsKey != MainAccountBankingDetails))
                            {
                                AVerificationResult.Add(new TVerificationResult(
                                        String.Format("Banking Details"),
                                        string.Format("there are multiple main accounts"),
                                        TResultSeverity.Resv_Critical));
                                return;
                            }
                            else
                            {
                                // if the main account has been changed
                                MainAccountBankingDetails = detailRow.BankingDetailsKey;
                            }
                        }
                    }
                }

                bool alreadyExists = false;

                foreach (PBankingDetailsUsageRow usageRow in AInspectDS.PBankingDetailsUsage.Rows)
                {
                    if (usageRow.Type == MPartnerConstants.BANKINGUSAGETYPE_MAIN)
                    {
                        DataRow bdrow = LocalDS.PBankingDetails.Rows.Find(usageRow.BankingDetailsKey);

                        if ((bdrow == null) || (bdrow.RowState == DataRowState.Deleted)
                            || DeletedBankingDetails.Contains(usageRow.BankingDetailsKey))
                        {
                            // deleting the account
                            usageRow.Delete();
                        }
                        else if (MainAccountBankingDetails == Int32.MinValue)
                        {
                            MainAccountBankingDetails = usageRow.BankingDetailsKey;
                            alreadyExists = true;
                        }
                        else if ((MainAccountBankingDetails != Int32.MinValue) && (usageRow.BankingDetailsKey != MainAccountBankingDetails))
                        {
                            usageRow.Delete();
                        }
                        else
                        {
                            alreadyExists = true;
                        }
                    }
                }

                if (!alreadyExists && ThereIsAtLeastOneAccount)
                {
                    if (MainAccountBankingDetails == Int32.MinValue)
                    {
                        AVerificationResult.Add(new TVerificationResult(
//.........这里部分代码省略.........
开发者ID:js1987,项目名称:openpetragit,代码行数:101,代码来源:Partner.PartnerEdit.cs

示例6: InitializeManualCode

        private void InitializeManualCode()
        {
            // show this dialog in center of screen
            this.StartPosition = FormStartPosition.CenterScreen;

            // remove validation handler for controls as we only want validation when clicking the ok button
            cmbPSubscriptionPublicationCode.Validated -= new System.EventHandler(this.ControlValidatedHandler);
            cmbPSubscriptionSubscriptionStatus.Validated -= new System.EventHandler(this.ControlValidatedHandler);
            chkPSubscriptionGratisSubscription.Validated -= new System.EventHandler(this.ControlValidatedHandler);

            txtPSubscriptionNumberComplimentary.Validated -= new System.EventHandler(this.ControlValidatedHandler);
            txtPSubscriptionPublicationCopies.Validated -= new System.EventHandler(this.ControlValidatedHandler);
            cmbPSubscriptionReasonSubsGivenCode.Validated -= new System.EventHandler(this.ControlValidatedHandler);
            cmbPSubscriptionReasonSubsCancelledCode.Validated -= new System.EventHandler(this.ControlValidatedHandler);
            txtPSubscriptionGiftFromKey.Validated -= new System.EventHandler(this.ControlValidatedHandler);

            dtpPSubscriptionStartDate.Validated -= new System.EventHandler(this.ControlValidatedHandler);
            dtpPSubscriptionExpiryDate.Validated -= new System.EventHandler(this.ControlValidatedHandler);
            dtpPSubscriptionDateCancelled.Validated -= new System.EventHandler(this.ControlValidatedHandler);
            dtpPSubscriptionDateNoticeSent.Validated -= new System.EventHandler(this.ControlValidatedHandler);
            dtpPSubscriptionSubscriptionRenewalDate.Validated -= new System.EventHandler(this.ControlValidatedHandler);
            dtpPSubscriptionFirstIssue.Validated -= new System.EventHandler(this.ControlValidatedHandler);
            dtpPSubscriptionLastIssue.Validated -= new System.EventHandler(this.ControlValidatedHandler);

            txtPSubscriptionNumberIssuesReceived.Validated -= new System.EventHandler(this.ControlValidatedHandler);


            FMainDS = new PartnerEditTDS();

            // now add the one subscription row to the DS that we are working with
            PSubscriptionTable SubscriptionTable = new PSubscriptionTable();
            FMainDS.Merge(SubscriptionTable);
            PSubscriptionRow SubscriptionRow = FMainDS.PSubscription.NewRowTyped(true);
            SubscriptionRow.PublicationCode = ""; // avoid NOT NULL error message
            FMainDS.PSubscription.Rows.Add(SubscriptionRow);

            FPetraUtilsObject.HasChanges = false;

            // initialize all check box sections so fields are disabled
            OnTickChangeItem(chkChangeSubscriptionStatus, null);
            OnTickChangeItem(chkChangeGratisSubscription, null);

            OnTickChangeItem(chkChangeNumberComplimentary, null);
            OnTickChangeItem(chkChangePublicationCopies, null);
            OnTickChangeItem(chkChangeReasonSubsGivenCode, null);
            OnTickChangeItem(chkChangeReasonSubsCancelledCode, null);
            OnTickChangeItem(chkChangeGiftFromKey, null);

            OnTickChangeItem(chkChangeStartDate, null);
            OnTickChangeItem(chkChangeExpiryDate, null);
            OnTickChangeItem(chkChangeRenewalDate, null);
            OnTickChangeItem(chkChangeDateNoticeSent, null);
            OnTickChangeItem(chkChangeDateCancelled, null);

            OnTickChangeItem(chkChangeNumberIssuesReceived, null);
            OnTickChangeItem(chkChangeFirstIssue, null);
            OnTickChangeItem(chkChangeLastIssue, null);

            // Hook up this event manually here after all initalisation has happened as otherwise
            // Bug #2481 would occur if the first Publication in the 'Publication Code' ComboBox is not Valid
            cmbPSubscriptionPublicationCode.SelectedValueChanged += new System.EventHandler(this.PublicationCodeChanged);
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:62,代码来源:UpdateExtractChangeSubscriptionDialog.ManualCode.cs

示例7: 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

示例8: SaveChanges


//.........这里部分代码省略.........
                    }

                    switch (SubmissionResult)
                    {
                        case TSubmitChangesResult.scrOK:

                            SavedPartnerIsNewPartner = IsNewPartner(AInspectDS);

                            // MessageBox.Show('DUMMY: ' + (SubmitDS.Tables['Locations'].Rows[0]['DUMMY']).ToString() );
                            if ((SharedTypes.PartnerClassStringToEnum(AInspectDS.PPartner[0].PartnerClass) == TPartnerClass.UNIT)
                                && SavedPartnerIsNewPartner)
                            {
                                /*
                                 * A new Partner of PartnerClass UNIT has been created
                                 * -- give option to assign 'Parent' in Unit Hierarchy
                                 */
                                UnitParentAssignment = MessageBox.Show(StrQueryUnitParent,
                                    StrQueryUnitParentTitle,
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button1);

                                if (UnitParentAssignment == System.Windows.Forms.DialogResult.Yes)
                                {
                                    TFrmUnitHierarchy HierarchyForm = new TFrmUnitHierarchy(this.ParentForm);

                                    HierarchyForm.Show();
                                    HierarchyForm.ShowThisUnit(AInspectDS.PPartner[0].PartnerKey);
                                }
                            }

#if DATASETDEBUGGING
                            TLogging.Log("After submtting returned Server DataSet: " + SubmitDS.GetXml());
                            MessageBox.Show("Before CleanupAddressesBeforeMerge");
#endif
                            // Get rid of any new Addresses; they are returned back with different LocationKeys (based on a Sequence)
                            ucoLowerPart.CleanupAddressesBeforeMerge();
#if DATASETDEBUGGING
                            MessageBox.Show("After CleanupAddressesBeforeMerge");

                            if ((SubmitDS.PLocation != null)
                                && (SubmitDS.PLocation.Rows.Count > 0))
                            {
                                MessageBox.Show(
                                    "Location[0] LocationKey: " + SubmitDS.PLocation[0].LocationKey.ToString() +
                                    "; PartnerLocation[0] LocationKey: " +
                                    SubmitDS.PPartnerLocation[0].LocationKey.ToString());
                            }
#endif

                            // Delete all added Rows in the original dataset. They will automatically
                            // be put back in with the Merge. If added Rows are deleted they will
                            // be removed from the Row collection on the server. In that case the
                            // client will not be aware of that. For modified Rows: if they are
                            // deleted on the server they will not be taken out of the collection
                            // but come back to the client as being marked as 'Deleted'. Therefore
                            // with deleting the added Rows beforehand we are making sure that
                            // the dataset on the client is synchronized with the one on the server.
                            foreach (DataTable t in AInspectDS.Tables)
                            {
                                if ((t == AInspectDS.PBankingDetails)
                                    || (t == AInspectDS.PPartnerBankingDetails)
                                    || (t == AInspectDS.PDataLabelValuePartner))
                                {
                                    NumRows = t.Rows.Count;
开发者ID:Davincier,项目名称:openpetra,代码行数:66,代码来源:PartnerEdit.ManualCode.cs

示例9: LoadDataFromDB

        /// <summary>
        /// Load data from db.
        /// Data is held in variable MainDS.PPartner and then MainDS.PLocation, PFamilyAccess etc...
        /// The latter is to get the additional information not present in PPartner but in dependent tables.
        /// </summary>
        /// <param name="AMainDS">
        /// The Datastructure which is filled with the data from the DB.
        /// It should be empty initially.
        /// </param>
        private static void LoadDataFromDB(ref PartnerEditTDS AMainDS)
        {
            TDBTransaction Transaction = null;
            bool SubmissionOK = false;
            PartnerEditTDS MainDS = new PartnerEditTDS();

            DBAccess.GDBAccessObj.BeginAutoTransaction(IsolationLevel.Serializable,
                ref Transaction,
                ref SubmissionOK,
                delegate
                {
                    PPartnerAccess.LoadAll(MainDS, Transaction);
                    TLogging.LogAtLevel(TLogging.DEBUGLEVEL_TRACE, "Read Partners from Database : " + MainDS.PPartner.Rows.Count.ToString());
                    TLogging.LogAtLevel(TLogging.DEBUGLEVEL_TRACE, "Now reading additional data for each Partner:");

                    foreach (PPartnerRow partnerRow in MainDS.PPartner.Rows)
                    {
                        long partnerKey = partnerRow.PartnerKey;
                        PLocationAccess.LoadViaPPartner(MainDS, partnerKey, Transaction);
                        PPartnerLocationAccess.LoadViaPPartner(MainDS, partnerKey, Transaction);
                        PPartnerAttributeAccess.LoadViaPPartner(MainDS, partnerKey, Transaction);
                        PPartnerTypeAccess.LoadViaPPartner(MainDS, partnerKey, Transaction);
                        PPersonAccess.LoadViaPPartner(MainDS, partnerKey, Transaction);
                        PFamilyAccess.LoadViaPPartner(MainDS, partnerKey, Transaction);
                        POrganisationAccess.LoadViaPPartnerPartnerKey(MainDS, partnerKey, Transaction);
                        PUnitAccess.LoadViaPPartnerPartnerKey(MainDS, partnerKey, Transaction);
                        UmUnitStructureAccess.LoadViaPUnitChildUnitKey(MainDS, partnerKey, Transaction);
                        PBankAccess.LoadViaPPartnerPartnerKey(MainDS, partnerKey, Transaction);
                    }

                    if (TLogging.DebugLevel >= TLogging.DEBUGLEVEL_TRACE)
                    {
                        TLogging.Log("All in all:");
                        SortedList <string, int>sortedtables = new SortedList <string, int>();
                        sortedtables.Add("PLocation", MainDS.PLocation.Count);
                        sortedtables.Add("PPartnerLocation", MainDS.PPartnerLocation.Count);
                        sortedtables.Add("PPartnerAttribute", MainDS.PPartnerAttribute.Count);
                        sortedtables.Add("PPartnerType", MainDS.PPartnerType.Count);
                        sortedtables.Add("PPerson", MainDS.PPerson.Count);
                        sortedtables.Add("PFamily", MainDS.PFamily.Count);
                        sortedtables.Add("POrganisation", MainDS.POrganisation.Count);

                        foreach (KeyValuePair <string, int /*TTypedDataTable*/>pair in sortedtables)
                        {
                            TLogging.Log(pair.Key + " : " + pair.Value.ToString());
                        }
                    }

                    SubmissionOK = true;
                });

            AMainDS.Merge(MainDS);

            DBAccess.GDBAccessObj.RollbackTransaction();
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:64,代码来源:ImportExportYml.cs

示例10: TestBankingDetails

        public void TestBankingDetails()
        {
            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, "TPartnerEditUIConnector SubmitChanges return value");

            connector = new TPartnerEditUIConnector(PartnerRow.PartnerKey);

            // add a banking detail
            PartnerEditTDSPBankingDetailsRow bankingDetailsRow = MainDS.PBankingDetails.NewRowTyped(true);
            bankingDetailsRow.AccountName = "account of " + PartnerRow.PartnerShortName;
            bankingDetailsRow.BankAccountNumber = new Random().Next().ToString();
            bankingDetailsRow.BankingDetailsKey = (MainDS.PBankingDetails.Count + 1) * -1;
            bankingDetailsRow.BankKey = 43005004;
            bankingDetailsRow.MainAccount = true;
            bankingDetailsRow.BankingType = MPartnerConstants.BANKINGTYPE_BANKACCOUNT;
            MainDS.PBankingDetails.Rows.Add(bankingDetailsRow);

            PPartnerBankingDetailsRow partnerBankingDetails = MainDS.PPartnerBankingDetails.NewRowTyped(true);
            partnerBankingDetails.PartnerKey = PartnerRow.PartnerKey;
            partnerBankingDetails.BankingDetailsKey = bankingDetailsRow.BankingDetailsKey;
            MainDS.PPartnerBankingDetails.Rows.Add(partnerBankingDetails);

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

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

            foreach (DataTable t in MainDS.Tables)
            {
                if ((t == MainDS.PBankingDetails)
                    || (t == MainDS.PPartnerBankingDetails)
                    || (t == MainDS.PDataLabelValuePartner))
                {
                    int NumRows = t.Rows.Count;

                    for (int RowIndex = NumRows - 1; RowIndex >= 0; RowIndex -= 1)
                    {
                        DataRow InspectDR = t.Rows[RowIndex];

                        // delete all added Rows.
                        if (InspectDR.RowState == DataRowState.Added)
                        {
                            InspectDR.Delete();
                        }
                    }
                }
            }

            MainDS.AcceptChanges();

            Assert.AreEqual(1, PBankingDetailsUsageAccess.CountViaPPartner(PartnerRow.PartnerKey, null), "count of main accounts for partner");

            // add another account
            bankingDetailsRow = MainDS.PBankingDetails.NewRowTyped(true);
            bankingDetailsRow.AccountName = "2nd account of " + PartnerRow.PartnerShortName;
            bankingDetailsRow.BankAccountNumber = new Random().Next().ToString();
            bankingDetailsRow.BankingDetailsKey = (MainDS.PBankingDetails.Count + 1) * -1;
            bankingDetailsRow.BankKey = 43005004;
            bankingDetailsRow.MainAccount = false;
            bankingDetailsRow.BankingType = MPartnerConstants.BANKINGTYPE_BANKACCOUNT;
            MainDS.PBankingDetails.Rows.Add(bankingDetailsRow);

            partnerBankingDetails = MainDS.PPartnerBankingDetails.NewRowTyped(true);
            partnerBankingDetails.PartnerKey = PartnerRow.PartnerKey;
            partnerBankingDetails.BankingDetailsKey = bankingDetailsRow.BankingDetailsKey;
            MainDS.PPartnerBankingDetails.Rows.Add(partnerBankingDetails);

            PartnerEditTDS ChangedDS = MainDS.GetChangesTyped(true);
            result = connector.SubmitChanges(ref ChangedDS, ref ResponseDS, out VerificationResult);
            MainDS.Merge(ChangedDS);

            foreach (DataTable t in MainDS.Tables)
            {
                if ((t == MainDS.PBankingDetails)
                    || (t == MainDS.PPartnerBankingDetails)
                    || (t == MainDS.PDataLabelValuePartner))
                {
                    int NumRows = t.Rows.Count;

                    for (int RowIndex = NumRows - 1; RowIndex >= 0; RowIndex -= 1)
                    {
                        DataRow InspectDR = t.Rows[RowIndex];

                        // delete all added Rows.
                        if (InspectDR.RowState == DataRowState.Added)
//.........这里部分代码省略.........
开发者ID:Davincier,项目名称:openpetra,代码行数:101,代码来源:TestPartnerEditBankingDetails.cs

示例11: GetPartnerContactLogData

        public static PartnerEditTDS GetPartnerContactLogData(long APartnerKey)
        {
            PartnerEditTDS ReturnDS = new PartnerEditTDS();

            TDBTransaction Transaction = null;

            DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                TEnforceIsolationLevel.eilMinimum, ref Transaction,
                delegate
                {
                    ReturnDS.Merge(PContactLogAccess.LoadViaPPartnerPPartnerContact(APartnerKey, Transaction));
                    ReturnDS.Merge(PPartnerContactAccess.LoadViaPPartner(APartnerKey, Transaction));

                    if ((ReturnDS.PContactLog != null) && (ReturnDS.PContactLog.Count > 0))
                    {
                        foreach (PContactLogRow Row in ReturnDS.PContactLog.Rows)
                        {
                            ReturnDS.Merge(PPartnerContactAttributeAccess.LoadViaPContactLog(Row.ContactLogId, Transaction));
                        }
                    }
                });

            return ReturnDS;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:24,代码来源:Contacts.cs


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