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


C# GLBatchTDS.GetChangesTyped方法代码示例

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


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

示例1: SaveGLBatchTDS

        public static TSubmitChangesResult SaveGLBatchTDS(ref GLBatchTDS AInspectDS,
            out TVerificationResultCollection AVerificationResult)
        {
            AVerificationResult = new TVerificationResultCollection();
            TVerificationResultCollection VerificationResult = AVerificationResult;

            // make sure that empty tables are removed
            AInspectDS = AInspectDS.GetChangesTyped(true);

            bool batchTableInDataSet = (AInspectDS.ABatch != null);
            bool journalTableInDataSet = (AInspectDS.AJournal != null);
            bool transTableInDataSet = (AInspectDS.ATransaction != null);
            bool attrTableInDataSet = (AInspectDS.ATransAnalAttrib != null);
            bool recurrBatchTableInDataSet = (AInspectDS.ARecurringBatch != null);
            bool recurrJournalTableInDataSet = (AInspectDS.ARecurringJournal != null);
            bool recurrTransTableInDataSet = (AInspectDS.ARecurringTransaction != null);

            //bool newTransaction = false;
            TDBTransaction Transaction = null;

            GLBatchTDS InspectDS = AInspectDS;

            // calculate debit and credit sums for journal and batch? but careful: we only have the changed parts!
            // no, we calculate the debit and credit sums before the posting, with GLRoutines.UpdateTotalsOfBatch

            // check added and modified and deleted rows: are they related to a posted or cancelled batch? we must not save adjusted posted batches!
            List <Int32>BatchNumbersInvolved = new List <int>();
            Int32 LedgerNumber = -1;

            //Check if saving recurring tables
            if (recurrBatchTableInDataSet
                || recurrJournalTableInDataSet
                || recurrTransTableInDataSet)
            {
                if (batchTableInDataSet || journalTableInDataSet || transTableInDataSet || attrTableInDataSet)
                {
                    throw new Exception(
                        "SaveGLBatchTDS: need to call GetChangesTyped before saving, otherwise confusion about recurring or normal gl batch");
                }

                return SaveRecurringGLBatchTDS(ref AInspectDS);
            }

            DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.Serializable,
                ref Transaction,
                delegate
                {
                    if (batchTableInDataSet)
                    {
                        LedgerNumber = ((ABatchRow)InspectDS.ABatch.Rows[0]).LedgerNumber;

                        foreach (ABatchRow batch in InspectDS.ABatch.Rows)
                        {
                            if (batch.RowState != DataRowState.Added)
                            {
                                Int32 BatchNumber;

                                try
                                {
                                    BatchNumber = batch.BatchNumber;
                                }
                                catch (Exception)
                                {
                                    // for deleted batches
                                    BatchNumber = (Int32)batch[ABatchTable.ColumnBatchNumberId, DataRowVersion.Original];
                                }

                                if (!BatchNumbersInvolved.Contains(BatchNumber))
                                {
                                    BatchNumbersInvolved.Add(BatchNumber);
                                }
                            }

                            int PeriodNumber, YearNr;

                            if (TFinancialYear.IsValidPostingPeriod(LedgerNumber,
                                    batch.DateEffective,
                                    out PeriodNumber,
                                    out YearNr,
                                    Transaction))
                            {
                                batch.BatchYear = YearNr;
                                batch.BatchPeriod = PeriodNumber;
                            }
                        }
                    }

                    if (journalTableInDataSet)
                    {
                        if (LedgerNumber == -1)
                        {
                            LedgerNumber = ((AJournalRow)InspectDS.AJournal.Rows[0]).LedgerNumber;
                        }

                        foreach (GLBatchTDSAJournalRow journal in InspectDS.AJournal.Rows)
                        {
                            Int32 BatchNumber;

                            try
                            {
//.........这里部分代码省略.........
开发者ID:js1987,项目名称:openpetragit,代码行数:101,代码来源:GL.Transactions.cs

示例2: SaveGLBatchTDS

        public static TSubmitChangesResult SaveGLBatchTDS(ref GLBatchTDS AInspectDS,
            out TVerificationResultCollection AVerificationResult)
        {
            AVerificationResult = new TVerificationResultCollection();
            TVerificationResultCollection VerificationResult = AVerificationResult;

            // make sure that empty tables are removed. This can return NULL!!
            AInspectDS = AInspectDS.GetChangesTyped(true);

            if (AInspectDS == null)
            {
                AVerificationResult.Add(new TVerificationResult(
                        Catalog.GetString("Save GL Batch"),
                        Catalog.GetString("No changes - nothing to do"),
                        TResultSeverity.Resv_Info));
                return TSubmitChangesResult.scrNothingToBeSaved;
            }

            bool AllValidationsOK = true;

            bool GLBatchTableInDataSet = (AInspectDS.ABatch != null && AInspectDS.ABatch.Count > 0);
            bool GLJournalTableInDataSet = (AInspectDS.AJournal != null && AInspectDS.AJournal.Count > 0);
            bool GLTransTableInDataSet = (AInspectDS.ATransaction != null && AInspectDS.ATransaction.Count > 0);
            bool GLTransAttrTableInDataSet = (AInspectDS.ATransAnalAttrib != null && AInspectDS.ATransAnalAttrib.Count > 0);

            bool RecurrGLBatchTableInDataSet = (AInspectDS.ARecurringBatch != null && AInspectDS.ARecurringBatch.Count > 0);
            bool RecurrGLJournalTableInDataSet = (AInspectDS.ARecurringJournal != null && AInspectDS.ARecurringJournal.Count > 0);
            bool RecurrGLTransTableInDataSet = (AInspectDS.ARecurringTransaction != null && AInspectDS.ARecurringTransaction.Count > 0);
            bool RecurrGLAttrTableInDataSet = (AInspectDS.ARecurringTransAnalAttrib != null && AInspectDS.ARecurringTransAnalAttrib.Count > 0);

            //Check if saving recurring tables
            if (RecurrGLBatchTableInDataSet || RecurrGLJournalTableInDataSet || RecurrGLTransTableInDataSet || RecurrGLAttrTableInDataSet)
            {
                if (GLBatchTableInDataSet || GLJournalTableInDataSet || GLTransTableInDataSet || GLTransAttrTableInDataSet)
                {
                    throw new Exception(String.Format("Function:{0} - Recurring and normal GL data found in same changes batch!",
                            Utilities.GetMethodName(true)));
                }

                return SaveRecurringGLBatchTDS(ref AInspectDS,
                    ref AVerificationResult,
                    RecurrGLBatchTableInDataSet,
                    RecurrGLJournalTableInDataSet,
                    RecurrGLTransTableInDataSet,
                    RecurrGLAttrTableInDataSet);
            }
            else
            {
                if (!(GLBatchTableInDataSet || GLJournalTableInDataSet || GLTransTableInDataSet || GLTransAttrTableInDataSet))
                {
                    throw new Exception(String.Format("Function:{0} - No GL data changes to save!", Utilities.GetMethodName(true)));
                }
            }

            GLBatchTDS InspectDS = AInspectDS;

            List <Int32>ListAllGLBatchesToProcess = new List <int>();
            Int32 LedgerNumber = -1;

            TDBTransaction Transaction = null;

            try
            {
                DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.Serializable,
                    ref Transaction,
                    delegate
                    {
                        if (GLBatchTableInDataSet)
                        {
                            DataView AllBatchesToProcess = new DataView(InspectDS.ABatch);
                            AllBatchesToProcess.RowStateFilter = DataViewRowState.OriginalRows | DataViewRowState.Added;

                            foreach (DataRowView drv in AllBatchesToProcess)
                            {
                                ABatchRow glbr = (ABatchRow)drv.Row;
                                int batchNumber;

                                if (glbr.RowState != DataRowState.Deleted)
                                {
                                    LedgerNumber = glbr.LedgerNumber;
                                    batchNumber = glbr.BatchNumber;
                                }
                                else
                                {
                                    LedgerNumber = (Int32)glbr[ABatchTable.ColumnLedgerNumberId, DataRowVersion.Original];
                                    batchNumber = (Int32)glbr[ABatchTable.ColumnBatchNumberId, DataRowVersion.Original];
                                }

                                if (!ListAllGLBatchesToProcess.Contains(batchNumber))
                                {
                                    ListAllGLBatchesToProcess.Add(batchNumber);
                                }

                                int periodNumber, yearNumber;

                                if (TFinancialYear.IsValidPostingPeriod(LedgerNumber,
                                        glbr.DateEffective,
                                        out periodNumber,
                                        out yearNumber,
                                        Transaction))
//.........这里部分代码省略.........
开发者ID:Davincier,项目名称:openpetra,代码行数:101,代码来源:GL.Transactions.cs


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