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


C# PartnerEditTDS.AcceptChanges方法代码示例

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


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

示例1: LoadData


//.........这里部分代码省略.........
                    TMailroom.GetLastContactDate(FPartnerKey, out LastContactDate);
                    GetContactsInternal(out ItemsCountContacts, out LastContactDate);

                    // Create 'miscellaneous' DataRow
                    MiscellaneousDataDT = FPartnerEditScreenDS.MiscellaneousData;
                    MiscellaneousDataDR = MiscellaneousDataDT.NewRowTyped(false);
                    MiscellaneousDataDR.PartnerKey = FPartnerKey;

                    if (FKeyForSelectingPartnerLocation.LocationKey == 0)
                    {
                        MiscellaneousDataDR.SelectedSiteKey = LocationPK.SiteKey;
                        MiscellaneousDataDR.SelectedLocationKey = LocationPK.LocationKey;
                    }
                    else
                    {
//                      TLogging.LogAtLevel(6, "Passed in FKeyForSelectingPartnerLocation.SiteKey and FKeyForSelectingPartnerLocation.LocationKey: " +
//                          FKeyForSelectingPartnerLocation.SiteKey.ToString() + "/" + FKeyForSelectingPartnerLocation.LocationKey.ToString());

                        MiscellaneousDataDR.SelectedSiteKey = FKeyForSelectingPartnerLocation.SiteKey;
                        MiscellaneousDataDR.SelectedLocationKey = FKeyForSelectingPartnerLocation.LocationKey;
                    }

                    if (LastGiftDate != DateTime.MinValue)
                    {
                        MiscellaneousDataDR.LastGiftDate = LastGiftDate;
                    }
                    else
                    {
                        MiscellaneousDataDR.SetLastGiftDateNull();
                    }

                    if (LastContactDate != DateTime.MinValue)
                    {
                        MiscellaneousDataDR.LastContactDate = LastContactDate;
                    }
                    else
                    {
                        MiscellaneousDataDR.SetLastContactDateNull();
                    }

                    MiscellaneousDataDR.LastGiftInfo = LastGiftInfo;
                    MiscellaneousDataDR.ItemsCountAddresses = ItemsCountAddresses;
                    MiscellaneousDataDR.ItemsCountAddressesActive = ItemsCountAddressesActive;
                    MiscellaneousDataDR.ItemsCountContactDetails = ItemsCountContactDetails;
                    MiscellaneousDataDR.ItemsCountContactDetailsActive = ItemsCountContactDetailsActive;
                    MiscellaneousDataDR.ItemsCountSubscriptions = ItemsCountSubscriptions;
                    MiscellaneousDataDR.ItemsCountSubscriptionsActive = ItemsCountSubscriptionsActive;
                    MiscellaneousDataDR.ItemsCountContacts = ItemsCountContacts;
                    MiscellaneousDataDR.ItemsCountPartnerTypes = ItemsCountPartnerTypes;
                    MiscellaneousDataDR.ItemsCountPartnerRelationships = ItemsCountPartnerRelationships;
                    MiscellaneousDataDR.ItemsCountFamilyMembers = ItemsCountFamilyMembers;
                    MiscellaneousDataDR.ItemsCountInterests = ItemsCountPartnerInterests;
                    MiscellaneousDataDR.ItemsCountPartnerBankingDetails = ItemsCountPartnerBankingDetails;
                    MiscellaneousDataDR.OfficeSpecificDataLabelsAvailable = OfficeSpecificDataLabelsAvailable;
                    MiscellaneousDataDR.FoundationOwner1Key = FoundationOwner1Key;
                    MiscellaneousDataDR.FoundationOwner2Key = FoundationOwner2Key;
                    MiscellaneousDataDR.HasEXWORKERPartnerType = HasEXWORKERPartnerType;
                    MiscellaneousDataDT.Rows.Add(MiscellaneousDataDR);
                    #endregion

                    // Add this partner key to the list of recently used partners.
                    TRecentPartnersHandling.AddRecentlyUsedPartner(FPartnerKey, FPartnerClass, false, TLastPartnerUse.lpuMailroomPartner);
                }
                catch (EPartnerLocationNotExistantException)
                {
                    // don't log this exception  this is thrown on purpose here and the Client deals with it.
                    DBAccess.GDBAccessObj.RollbackTransaction();
                    throw;
                }
                catch (ESecurityPartnerAccessDeniedException)
                {
                    // don't log this exception  this is thrown on purpose here and the Client deals with it.
                    DBAccess.GDBAccessObj.RollbackTransaction();
                    throw;
                }
                catch (Exception Exp)
                {
                    DBAccess.GDBAccessObj.RollbackTransaction();
                    TLogging.Log("TPartnerEditUIConnector.LoadData exception: " + Exp.ToString(), TLoggingType.ToLogfile);
                    TLogging.Log(Exp.StackTrace, TLoggingType.ToLogfile);
                    throw;
                }
            }
            finally
            {
                if (DBAccess.GDBAccessObj.Transaction != null)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                }
            }

            // Accept row changes here so that the Client gets 'unmodified' rows
            FPartnerEditScreenDS.AcceptChanges();

            // Remove all Tables that were not filled with data before remoting them.
            // Examples for such DataTables are the ones that exist for a certain Partner
            // Class, eg. Person  only one of those Tables will be filled, the other ones
            // are not needed at the Client side.
            FPartnerEditScreenDS.RemoveEmptyTables();
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:101,代码来源:Partner.PartnerEdit.cs

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

示例3: SaveChanges

        /// <summary>
        /// Determines the changes in the screen's dataset and submits them to the
        /// Server.
        /// </summary>
        /// <param name="AInspectDS">The screen's dataset
        /// </param>
        /// <returns>True if saving of data succeeded, otherwise false.</returns>
        private Boolean SaveChanges(ref PartnerEditTDS AInspectDS)
        {
            Boolean ReturnValue = false;
            PartnerEditTDS SubmitDS = null;
            TSubmitChangesResult SubmissionResult;

            TVerificationResultCollection VerificationResult;
            TVerificationResult VerificationResultItem;

            System.Windows.Forms.DialogResult UnitParentAssignment;
            int RowIndex;
            int NumRows;
            Int32 MaxColumn;
            Boolean SavedPartnerIsNewPartner = false;
            bool PartnerAttributesOrRelationsChanged = false;
            System.Int32 ChangedColumns;
#if SHOWCHANGES
            String DebugMessage;
#endif
#if DATASETDEBUGGING
            Int16 TmpRowCounter;
            string TmpDebugString = String.Empty;
#endif
            // Be sure to fire the OnLeave event on the active control of any user control
            FPetraUtilsObject.ForceOnLeaveForActiveControl();

            FPetraUtilsObject.OnDataSavingStart(this, new System.EventArgs());

            // Don't allow saving if user is still editing a Detail of a List
            if (FPetraUtilsObject.InDetailEditMode())
            {
                ReturnValue = false;
                return ReturnValue;
            }

            // Make sure that DataBinding writes the value of the active Control to the underlying DataSource!
            TDataBinding.EnsureDataChangesAreStored(this);

            GetDataFromControls();

            // Clear any validation errors so that the following call to ValidateAllData starts with a 'clean slate'.
            FPetraUtilsObject.VerificationResultCollection.Clear();

            if (ValidateAllData())
            {
                // Ask the user about non-critical warnings, if they are the only 'errors' in the collection
                if (FPetraUtilsObject.VerificationResultCollection.HasOnlyNonCriticalErrors
                    && (TDataValidation.ProcessAnyDataValidationWarnings(FPetraUtilsObject.VerificationResultCollection,
                            MCommonResourcestrings.StrFormSaveDataAnywayQuestion, this.GetType()) == false))
                {
                    return false;
                }

                // Fire the DataSavingValidated event, which is the last chance to cancel the save
                System.ComponentModel.CancelEventArgs eCancel = new System.ComponentModel.CancelEventArgs(false);
                FPetraUtilsObject.OnDataSavingValidated(this, eCancel);

                if (eCancel.Cancel == true)
                {
                    return false;
                }

                foreach (DataTable InspectDT in AInspectDS.Tables)
                {
                    foreach (DataRow InspectDR in InspectDT.Rows)
                    {
                        InspectDR.EndEdit();
                    }
                }

                if (FPetraUtilsObject.HasChanges)
                {
                    FPetraUtilsObject.WriteToStatusBar(MCommonResourcestrings.StrSavingDataInProgress);
                    this.Cursor = Cursors.WaitCursor;

                    /* $IFDEF SHOWCHANGES MessageBox.Show('SaveChanges: AInspectDS.PLocation.Rows[0].HasVersion(DataRowVersion.Original): ' + AInspectDS.PLocation.Rows[0].HasVersion(DataRowVersion.Original).ToString + '; LocationKey: ' +
                     *AInspectDS.PLocation.Row[0].LocationKey.ToString); $ENDIF */

                    /* $IFDEF SHOWCHANGES MessageBox.Show('SaveChanges: AInspectDS.PLocation.Rows[1].HasVersion(DataRowVersion.Original): ' + AInspectDS.PLocation.Rows[1].HasVersion(DataRowVersion.Original).ToString + '; LocationKey: ' +
                     *AInspectDS.PLocation.Row[1].LocationKey.ToString); $ENDIF */
                    if (!FPetraUtilsObject.SubmitChangesContinue)
                    {
                        foreach (DataTable InspectDT in AInspectDS.Tables)
                        {
                            // MessageBox.Show('inspectDataTable: ' + InspectDT.ToString);
                            if ((InspectDT.TableName != PLocationTable.GetTableName()) && (InspectDT.TableName != PPartnerLocationTable.GetTableName()))
                            {
                                MaxColumn = InspectDT.Columns.Count;
                                ChangedColumns = DataUtilities.AcceptChangesForUnmodifiedRows(InspectDT, MaxColumn);

                                if (ChangedColumns != 0)
                                {
#if SHOWCHANGES
//.........这里部分代码省略.........
开发者ID:Davincier,项目名称:openpetra,代码行数:101,代码来源:PartnerEdit.ManualCode.cs

示例4: GetBankingDetails

        /// <summary>
        /// get the banking details of the current partner
        /// </summary>
        public PartnerEditTDS GetBankingDetails()
        {
            Boolean NewTransaction;

            PartnerEditTDS localDS = new PartnerEditTDS();

            TDBTransaction ReadTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted,
                TEnforceIsolationLevel.eilMinimum,
                out NewTransaction);

            // Get hold of the two tables needed for the banking information:
            // p_partner_banking_details
            // p_banking_details
            try
            {
                FTaxDeductiblePercentageEnabled = TSystemDefaultsCache.GSystemDefaultsCache.GetBooleanDefault(
                    SharedConstants.SYSDEFAULT_TAXDEDUCTIBLEPERCENTAGE, false);
                PBankingDetailsAccess.LoadViaPPartner(localDS, FPartnerKey, ReadTransaction);
                PPartnerBankingDetailsAccess.LoadViaPPartner(localDS, FPartnerKey, ReadTransaction);
                PBankingDetailsUsageAccess.LoadViaPPartner(localDS, FPartnerKey, ReadTransaction);

                if (FTaxDeductiblePercentageEnabled)
                {
                    PPartnerTaxDeductiblePctAccess.LoadViaPPartner(localDS, FPartnerKey, ReadTransaction);
                }
            }
            catch (Exception)
            {
                TLogging.Log("An exception happened while retrieving data.", TLoggingType.ToLogfile);
                throw;
            }
            finally
            {
                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                    TLogging.LogAtLevel(7, "TPartnerEditUIConnector.GetBankingDetails: committed own transaction.");
                }
            }

            foreach (PartnerEditTDSPBankingDetailsRow bd in localDS.PBankingDetails.Rows)
            {
                bd.MainAccount =
                    (localDS.PBankingDetailsUsage.Rows.Find(
                         new object[] { FPartnerKey, bd.BankingDetailsKey, MPartnerConstants.BANKINGUSAGETYPE_MAIN }) != null);
            }

            localDS.RemoveEmptyTables();
            localDS.AcceptChanges();

            return localDS;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:55,代码来源:Partner.PartnerEdit.cs


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