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


C# GLBatchTDS.Merge方法代码示例

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


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

示例1: UpdateTotalsOfBatch

        public static void UpdateTotalsOfBatch(Int32 ALedgerNumber, Int32 ABatchNumber)
        {
            //TVerificationResultCollection AVerificationResult = new TVerificationResultCollection();
            GLBatchTDS glDS = new GLBatchTDS();

            decimal sumDebits = 0.0M;
            decimal sumCredits = 0.0M;

            //Load all Batch, Journal and Transaction records
            glDS.Merge(LoadABatchAJournalATransaction(ALedgerNumber, ABatchNumber));

            if ((glDS.ABatch == null) || (glDS.ABatch.Count == 0))
            {
                return;
            }

            try
            {
                ABatchRow currentBatch = (ABatchRow)glDS.ABatch.Rows[0];

                glDS.AJournal.DefaultView.RowFilter = string.Empty;

                foreach (DataRowView journalview in glDS.AJournal.DefaultView)
                {
                    GLBatchTDSAJournalRow journalrow = (GLBatchTDSAJournalRow)journalview.Row;

                    UpdateTotalsOfJournal(ref glDS, journalrow);

                    sumDebits += journalrow.JournalDebitTotal;
                    sumCredits += journalrow.JournalCreditTotal;
                }

                currentBatch.BatchDebitTotal = sumDebits;
                currentBatch.BatchCreditTotal = sumCredits;
                currentBatch.BatchRunningTotal = Math.Round(sumDebits - sumCredits, 2);

                glDS.AcceptChanges();
            }
            catch (Exception)
            {
                glDS.RejectChanges();
                throw;
            }
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:44,代码来源:GL.Transactions.cs

示例2: UpdateTotalsOfBatchesAndJournals

        private static void UpdateTotalsOfBatchesAndJournals(ref GLBatchTDS AInspectDS,
            Int32 ALedgerNumber,
            int[] ABatchNumbers,
            bool ABatchTableInDataSet,
            bool AJournalTableInDataSet)
        {
            Int32 currJournalNumber = -1;

            ABatchRow currentBatchRow = null;

            foreach (int currBatchNumber in ABatchNumbers)
            {
                if (!ABatchTableInDataSet && !AJournalTableInDataSet)
                {
                    if (AInspectDS.ATransaction.Count > 0)
                    {
                        AInspectDS.ATransaction.DefaultView.RowFilter = String.Format("{0} = {1}",
                            ATransactionTable.GetBatchNumberDBName(),
                            currBatchNumber);

                        List <int>journalNums = new List <int>();

                        foreach (DataRowView dr in AInspectDS.ATransaction.DefaultView)
                        {
                            ATransactionRow tr = (ATransactionRow)dr.Row;

                            currJournalNumber = tr.JournalNumber;

                            if (!journalNums.Contains(currJournalNumber))
                            {
                                journalNums.Add(currJournalNumber);
                            }
                        }

                        if (journalNums.Count == 1)
                        {
                            AInspectDS.Merge(LoadABatch(ALedgerNumber, currBatchNumber), true);
                            AInspectDS.Merge(LoadAJournalATransaction(ALedgerNumber, currBatchNumber, currJournalNumber), true);
                        }
                        else
                        {
                            //Multiple journals
                            AInspectDS.Merge(LoadABatchAJournalATransaction(ALedgerNumber, currBatchNumber), true);
                        }
                    }
                    else
                    {
                        AInspectDS.Merge(LoadABatchAJournalATransaction(ALedgerNumber, currBatchNumber), true);
                    }
                }
                else if (!ABatchTableInDataSet)
                {
                    AInspectDS.AJournal.DefaultView.RowFilter = String.Format("{0} = {1}",
                        AJournalTable.GetBatchNumberDBName(),
                        currBatchNumber);

                    if (AInspectDS.AJournal.DefaultView.Count == 1)
                    {
                        currJournalNumber = ((AJournalRow)AInspectDS.AJournal.DefaultView[0].Row).JournalNumber;
                        AInspectDS.Merge(LoadABatch(ALedgerNumber, currBatchNumber), true);
                        AInspectDS.Merge(LoadAJournalATransaction(ALedgerNumber, currBatchNumber, currJournalNumber), true);
                    }
                    else
                    {
                        AInspectDS.Merge(LoadABatchAJournalATransaction(ALedgerNumber, currBatchNumber), true);
                    }
                }
                else if (!AJournalTableInDataSet)
                {
                    if (AInspectDS.ATransaction.Count > 0)
                    {
                        AInspectDS.ATransaction.DefaultView.RowFilter = String.Format("{0} = {1}",
                            ATransactionTable.GetBatchNumberDBName(),
                            currBatchNumber);

                        List <int>journalNums = new List <int>();

                        foreach (DataRowView dr in AInspectDS.ATransaction.DefaultView)
                        {
                            ATransactionRow tr = (ATransactionRow)dr.Row;

                            currJournalNumber = tr.JournalNumber;

                            if (!journalNums.Contains(currJournalNumber))
                            {
                                journalNums.Add(currJournalNumber);
                            }
                        }

                        if (journalNums.Count == 1)
                        {
                            AInspectDS.Merge(LoadAJournalATransaction(ALedgerNumber, currBatchNumber, currJournalNumber), true);
                        }
                        else
                        {
                            //Multiple journals
                            AInspectDS.Merge(LoadAJournalATransaction(ALedgerNumber, currBatchNumber), true);
                        }
                    }
                    else
//.........这里部分代码省略.........
开发者ID:js1987,项目名称:openpetragit,代码行数:101,代码来源:GL.Transactions.cs

示例3: RecurringTransAnalAttrRequiredUpdating

        /// <summary>
        /// Need to ensure that the Analysis Attributes grid has all the entries
        /// that are required for the selected account.
        /// There may or may not already be attribute assignments for this transaction.
        /// </summary>
        /// <param name="AGLBatchDS"></param>
        /// <param name="AAccountCode"></param>
        /// <param name="ATransactionNumber"></param>
        /// <returns></returns>
        public bool RecurringTransAnalAttrRequiredUpdating(GLBatchTDS AGLBatchDS,
            string AAccountCode,
            int ATransactionNumber)
        {
            #region Validate Arguments

            if (AGLBatchDS == null)
            {
                throw new EFinanceSystemDataObjectNullOrEmptyException(String.Format(Catalog.GetString(
                            "Function:{0} - The Recurring GL Batch dataset is null!"),
                        Utilities.GetMethodName(true)));
            }
            else if ((AGLBatchDS.ARecurringBatch == null) || (AGLBatchDS.ARecurringBatch.Count == 0))
            {
                throw new EFinanceSystemDataObjectNullOrEmptyException(String.Format(Catalog.GetString(
                            "Function:{0} - The Recurring GL Batch table in the dataset is null or empty!"),
                        Utilities.GetMethodName(true)));
            }
            else if ((AGLBatchDS.ARecurringTransaction == null) || (AGLBatchDS.ARecurringTransaction.Count == 0))
            {
                throw new EFinanceSystemDataObjectNullOrEmptyException(String.Format(Catalog.GetString(
                            "Function:{0} - The Recurring GL Transaction table in the dataset is null or empty!"),
                        Utilities.GetMethodName(true)));
            }
            else if (AGLBatchDS.ARecurringTransAnalAttrib == null)
            {
                throw new EFinanceSystemDataObjectNullOrEmptyException(String.Format(Catalog.GetString(
                            "Function:{0} - The Recurring GL Transaction Analysis Attributes table in the dataset is null or empty!"),
                        Utilities.GetMethodName(true)));
            }
            else if (AAccountCode.Length == 0)
            {
                return false;
            }
            else if (ATransactionNumber <= 0)
            {
                throw new ArgumentException(String.Format(Catalog.GetString("Function:{0} - The Transaction number must be greater than 0!"),
                        Utilities.GetMethodName(true)));
            }

            #endregion Validate Arguments

            try
            {
                //See what analysis attribute codes are required for the specified account code in this ledger
                StringCollection requiredAnalAttrCodes = new StringCollection();
                StringCollection currentAnalAttrCodes = new StringCollection();
                StringCollection analAttrCodesToDelete = new StringCollection();
                StringCollection analAttrCodesToAdd = new StringCollection();

                //The server call is needed
                requiredAnalAttrCodes = TRemote.MFinance.Setup.WebConnectors.RequiredAnalysisAttributesForAccount(FLedgerNumber,
                    AAccountCode,
                    true);

                //Populate current codes and which ones to add or delete
                // (Check if loading required)
                SetRecurringTransAnalAttributeDefaultView(AGLBatchDS, ATransactionNumber);

                //First check if loading required
                if (AGLBatchDS.ARecurringTransAnalAttrib.DefaultView.Count == 0)
                {
                    AGLBatchDS.Merge(TRemote.MFinance.GL.WebConnectors.LoadARecurringTransAnalAttribForJournal(FLedgerNumber, FBatchNumber,
                            FJournalNumber));
                }

                foreach (DataRowView drv in AGLBatchDS.ARecurringTransAnalAttrib.DefaultView)
                {
                    ARecurringTransAnalAttribRow transAnalAttrRow = (ARecurringTransAnalAttribRow)drv.Row;

                    string analAttrCode = transAnalAttrRow.AnalysisTypeCode;

                    //Populate the current codes string collection
                    currentAnalAttrCodes.Add(analAttrCode);

                    if ((requiredAnalAttrCodes.Count == 0) || !requiredAnalAttrCodes.Contains(analAttrCode))
                    {
                        //Populate the invalid codes string collection
                        analAttrCodesToDelete.Add(analAttrCode);
                    }
                }

                foreach (string analAttrCode in requiredAnalAttrCodes)
                {
                    if (!currentAnalAttrCodes.Contains(analAttrCode))
                    {
                        //Populate the needed codes string collection
                        analAttrCodesToAdd.Add(analAttrCode);
                    }
                }

//.........这里部分代码省略.........
开发者ID:Davincier,项目名称:openpetra,代码行数:101,代码来源:AnalysisAttributes.cs

示例4: TransAnalAttrRequiredUpdating


//.........这里部分代码省略.........
                //See what analysis attribute codes are required for the specified account code in this ledger
                StringCollection requiredAnalAttrCodes = new StringCollection();
                StringCollection currentAnalAttrCodes = new StringCollection();
                StringCollection analAttrCodesToDelete = new StringCollection();
                StringCollection analAttrCodesToAdd = new StringCollection();

                if ((AGLSetupDS != null) && (AGLSetupDS.AAnalysisAttribute != null))
                {
                    // This makes use of the supplied GLSetupTDS
                    AGLSetupDS.AAnalysisAttribute.DefaultView.RowFilter = String.Format("{0}='{1}' And {2}=true",
                        AAnalysisAttributeTable.GetAccountCodeDBName(),
                        AAccountCode,
                        AAnalysisAttributeTable.GetActiveDBName());

                    foreach (DataRowView drv in AGLSetupDS.AAnalysisAttribute.DefaultView)
                    {
                        requiredAnalAttrCodes.Add(drv.Row[AAnalysisAttributeTable.ColumnAnalysisTypeCodeId].ToString());
                    }
                }
                else
                {
                    //The server call is needed
                    requiredAnalAttrCodes = TRemote.MFinance.Setup.WebConnectors.RequiredAnalysisAttributesForAccount(FLedgerNumber,
                        AAccountCode,
                        true);
                }

                //Populate current codes and which ones to add or delete
                // (Check if loading required)
                SetTransAnalAttributeDefaultView(AGLBatchDS, ATransactionNumber);

                if (AGLBatchDS.ATransAnalAttrib.DefaultView.Count == 0)
                {
                    AGLBatchDS.Merge(TRemote.MFinance.GL.WebConnectors.LoadATransAnalAttribForJournal(FLedgerNumber, FBatchNumber, FJournalNumber));
                }

                foreach (DataRowView drv in AGLBatchDS.ATransAnalAttrib.DefaultView)
                {
                    ATransAnalAttribRow transAnalAttrRow = (ATransAnalAttribRow)drv.Row;

                    //Populate the current codes string collection
                    string analAttrCode = transAnalAttrRow.AnalysisTypeCode;
                    currentAnalAttrCodes.Add(analAttrCode);

                    if ((requiredAnalAttrCodes.Count == 0) || !requiredAnalAttrCodes.Contains(analAttrCode))
                    {
                        //Populate the invalid codes string collection
                        analAttrCodesToDelete.Add(analAttrCode);
                    }
                }

                foreach (string analAttrCode in requiredAnalAttrCodes)
                {
                    if (!currentAnalAttrCodes.Contains(analAttrCode))
                    {
                        //Populate the needed codes string collection
                        analAttrCodesToAdd.Add(analAttrCode);
                    }
                }

                //count collection sizes
                int codesNumToAdd = analAttrCodesToAdd.Count;
                int codesNumToDelete = analAttrCodesToDelete.Count;

                //Nothing to add or take away
                if ((codesNumToAdd == 0) && (codesNumToDelete == 0))
开发者ID:Davincier,项目名称:openpetra,代码行数:67,代码来源:AnalysisAttributes.cs

示例5: UpdateRecurringBatchTotalsWithLoad

        public static bool UpdateRecurringBatchTotalsWithLoad(ref GLBatchTDS AMainDS,
            Int32 ALedgerNumber, Int32 ABatchNumber)
        {
            #region Validate Arguments

            if (AMainDS == null)
            {
                throw new EFinanceSystemDataObjectNullOrEmptyException(String.Format(Catalog.GetString(
                            "Function:{0} - The Recurring GL Batch dataset is null!"),
                        Utilities.GetMethodName(true)));
            }
            else if (ALedgerNumber <= 0)
            {
                throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString(
                            "Function:{0} - The Ledger number must be greater than 0!"),
                        Utilities.GetMethodName(true)), ALedgerNumber);
            }
            else if (ABatchNumber <= 0)
            {
                throw new EFinanceSystemInvalidBatchNumberException(String.Format(Catalog.GetString(
                            "Function:{0} - The Batch number must be greater than 0!"),
                        Utilities.GetMethodName(true)), ALedgerNumber, ABatchNumber);
            }

            #endregion Validate Arguments

            bool AmountsUpdated = false;

            //Take a copy of the dataset but with specified batch only
            GLBatchTDS SingleBatchDS = GLRoutines.SingleBatchOnlyDataSet(ref AMainDS, ALedgerNumber, ABatchNumber);

            #region Validate Data

            if (SingleBatchDS.ARecurringBatch.Count == 0)
            {
                throw new EFinanceSystemDataTableReturnedNoDataException(String.Format(Catalog.GetString(
                            "Function:{0} - GL Batch data for Batch {1} in Ledger {2} does not exist or could not be accessed!"),
                        Utilities.GetMethodName(true),
                        ABatchNumber,
                        ALedgerNumber));
            }

            #endregion Validate Data

            //Assign
            ARecurringBatchRow CurrentRecurringBatchRow = SingleBatchDS.ARecurringBatch[0];

            if (SingleBatchDS.ARecurringJournal.Count == 0)
            {
                //Try to load all data
                SingleBatchDS.Merge(LoadARecurringBatchARecurJournalARecurTransaction(ALedgerNumber, ABatchNumber));
            }
            else if (SingleBatchDS.ARecurringTransaction.Count == 0)
            {
                //Try to load all data
                SingleBatchDS.Merge(LoadARecurringTransaction(ALedgerNumber, ABatchNumber));
            }

            SingleBatchDS.AcceptChanges();

            AmountsUpdated = GLRoutines.UpdateRecurringBatchTotals(ref SingleBatchDS, ref CurrentRecurringBatchRow);

            if (AmountsUpdated)
            {
                SingleBatchDS.AcceptChanges();
                AMainDS.Merge(SingleBatchDS);
            }

            return AmountsUpdated;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:70,代码来源:GL.Transactions.cs

示例6: ReduceGLDataSet

        private static GLBatchTDS ReduceGLDataSet(ref GLBatchTDS AMainDS, Int32 ALedgerNumber, Int32 ABatchNumber, bool AKeepThisBatchOnly = true)
        {
            #region Validate Arguments

            if (AMainDS == null)
            {
                throw new EFinanceSystemDataObjectNullOrEmptyException(String.Format(Catalog.GetString("Function:{0} - The GL Batch dataset is null!"),
                        Utilities.GetMethodName(true)));
            }
            else if (ALedgerNumber <= 0)
            {
                throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString(
                            "Function:{0} - The Ledger number must be greater than 0!"),
                        Utilities.GetMethodName(true)), ALedgerNumber);
            }
            else if (ABatchNumber <= 0)
            {
                throw new EFinanceSystemInvalidBatchNumberException(String.Format(Catalog.GetString(
                            "Function:{0} - The Batch number must be greater than 0!"),
                        Utilities.GetMethodName(true)), ALedgerNumber, ABatchNumber);
            }

            #endregion Validate Arguments

            GLBatchTDS ReducedDS = new GLBatchTDS();
            ReducedDS.Merge(AMainDS);

            DataView BatchDV = new DataView(ReducedDS.ABatch);
            DataView JournalDV = new DataView(ReducedDS.AJournal);
            DataView TransactionDV = new DataView(ReducedDS.ATransaction);
            DataView AnalysisAttribDV = new DataView(ReducedDS.ATransAnalAttrib);
            //Recurring
            DataView RecurringBatchDV = new DataView(ReducedDS.ARecurringBatch);
            DataView RecurringJournalDV = new DataView(ReducedDS.ARecurringJournal);
            DataView RecurringTransactionDV = new DataView(ReducedDS.ARecurringTransaction);
            DataView RecurringAnalysisAttribDV = new DataView(ReducedDS.ARecurringTransAnalAttrib);

            string CommonRowFilter = StandardRowFilterByLedgerAndBatch(ALedgerNumber, ABatchNumber, !AKeepThisBatchOnly);

            AnalysisAttribDV.RowFilter = CommonRowFilter;

            foreach (DataRowView drv in AnalysisAttribDV)
            {
                drv.Delete();
            }

            TransactionDV.RowFilter = CommonRowFilter;

            foreach (DataRowView drv in TransactionDV)
            {
                drv.Delete();
            }

            JournalDV.RowFilter = CommonRowFilter;

            foreach (DataRowView drv in JournalDV)
            {
                drv.Delete();
            }

            BatchDV.RowFilter = CommonRowFilter;

            foreach (DataRowView drv in BatchDV)
            {
                drv.Delete();
            }

            //Recurring
            RecurringAnalysisAttribDV.RowFilter = CommonRowFilter;

            foreach (DataRowView drv in RecurringAnalysisAttribDV)
            {
                drv.Delete();
            }

            RecurringTransactionDV.RowFilter = CommonRowFilter;

            foreach (DataRowView drv in RecurringTransactionDV)
            {
                drv.Delete();
            }

            RecurringJournalDV.RowFilter = CommonRowFilter;

            foreach (DataRowView drv in RecurringJournalDV)
            {
                drv.Delete();
            }

            RecurringBatchDV.RowFilter = CommonRowFilter;

            foreach (DataRowView drv in RecurringBatchDV)
            {
                drv.Delete();
            }

            ReducedDS.AcceptChanges();

            return ReducedDS;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:100,代码来源:GLRoutines.cs


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