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


C# GLBatchTDS.AcceptChanges方法代码示例

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


在下文中一共展示了GLBatchTDS.AcceptChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: CreateARecurringBatch

        /// <summary>
        /// create a new recurring batch.
        /// it is already stored to the database, to avoid problems with LastBatchNumber
        /// </summary>
        public static GLBatchTDS CreateARecurringBatch(Int32 ALedgerNumber)
        {
            bool NewTransactionStarted = false;

            GLBatchTDS MainDS = null;
            GLBatchTDS Temp = null;

            //Error handling
            string ErrorContext = "Create a recurring Batch";
            string ErrorMessage = String.Empty;
            //Set default type as non-critical
            TResultSeverity ErrorType = TResultSeverity.Resv_Noncritical;
            TVerificationResultCollection VerificationResult = null;

            try
            {
                MainDS = new GLBatchTDS();
                Temp = new GLBatchTDS();

                TDBTransaction Transaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction
                                                 (IsolationLevel.Serializable, TEnforceIsolationLevel.eilMinimum, out NewTransactionStarted);

                ALedgerAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, Transaction);

                ARecurringBatchAccess.LoadViaALedger(Temp, ALedgerNumber, Transaction);

                DataView RecurringBatchDV = new DataView(Temp.ARecurringBatch);
                RecurringBatchDV.RowFilter = string.Empty;
                RecurringBatchDV.Sort = string.Format("{0} DESC",
                    ARecurringBatchTable.GetBatchNumberDBName());

                //Recurring batch numbers can be reused so check each time for current highest number
                if (RecurringBatchDV.Count > 0)
                {
                    MainDS.ALedger[0].LastRecurringBatchNumber = (int)(RecurringBatchDV[0][ARecurringBatchTable.GetBatchNumberDBName()]);
                }
                else
                {
                    MainDS.ALedger[0].LastRecurringBatchNumber = 0;
                }

                ARecurringBatchRow NewRow = MainDS.ARecurringBatch.NewRowTyped(true);
                NewRow.LedgerNumber = ALedgerNumber;
                NewRow.BatchNumber = ++MainDS.ALedger[0].LastRecurringBatchNumber;
                MainDS.ARecurringBatch.Rows.Add(NewRow);

                GLBatchTDSAccess.SubmitChanges(MainDS);

                MainDS.AcceptChanges();
                Temp.RejectChanges();
            }
            catch (Exception ex)
            {
                ErrorMessage =
                    String.Format(Catalog.GetString("Unknown error while creating a recurring batch for Ledger: {0}." +
                            Environment.NewLine + Environment.NewLine + ex.ToString()),
                        ALedgerNumber);
                ErrorType = TResultSeverity.Resv_Critical;
                VerificationResult = new TVerificationResultCollection();
                VerificationResult.Add(new TVerificationResult(ErrorContext, ErrorMessage, ErrorType));

                throw new EVerificationResultsException(ErrorMessage, VerificationResult, ex.InnerException);
            }
            finally
            {
                if (NewTransactionStarted)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                }
            }

            return MainDS;
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:77,代码来源:Common.Posting.cs

示例3: SubmitRecurringGLBatch


//.........这里部分代码省略.........
                                foreach (ARecurringTransactionRow recTransaction in RGLMainDS.ARecurringTransaction.Rows)
                                {
                                    if ((recTransaction.JournalNumber == recJournal.JournalNumber)
                                        && (recTransaction.BatchNumber == ABatchNumber)
                                        && (recTransaction.LedgerNumber == ALedgerNumber))
                                    {
                                        ATransactionRow TransactionRow = GLMainDS.ATransaction.NewRowTyped();
                                        TransactionRow.LedgerNumber = JournalRow.LedgerNumber;
                                        TransactionRow.BatchNumber = JournalRow.BatchNumber;
                                        TransactionRow.JournalNumber = JournalRow.JournalNumber;
                                        TransactionRow.TransactionNumber = recTransaction.TransactionNumber;

                                        if (TransactionRow.TransactionNumber > JournalRow.LastTransactionNumber)
                                        {
                                            JournalRow.LastTransactionNumber = TransactionRow.TransactionNumber;
                                        }

                                        TransactionRow.Narrative = recTransaction.Narrative;
                                        TransactionRow.AccountCode = recTransaction.AccountCode;
                                        TransactionRow.CostCentreCode = recTransaction.CostCentreCode;
                                        TransactionRow.TransactionAmount = recTransaction.TransactionAmount;
                                        TransactionRow.AmountInBaseCurrency = GLRoutines.Divide(recTransaction.TransactionAmount, AExchangeRateToBase);

                                        if (!TransactionInIntlCurrency)
                                        {
                                            TransactionRow.AmountInIntlCurrency = GLRoutines.Divide((decimal)TransactionRow.AmountInBaseCurrency,
                                                AExchangeRateIntlToBase);
                                        }
                                        else
                                        {
                                            TransactionRow.AmountInIntlCurrency = TransactionRow.TransactionAmount;
                                        }

                                        TransactionRow.TransactionDate = AEffectiveDate;
                                        TransactionRow.DebitCreditIndicator = recTransaction.DebitCreditIndicator;
                                        TransactionRow.HeaderNumber = recTransaction.HeaderNumber;
                                        TransactionRow.DetailNumber = recTransaction.DetailNumber;
                                        TransactionRow.SubType = recTransaction.SubType;
                                        TransactionRow.Reference = recTransaction.Reference;

                                        GLMainDS.ATransaction.Rows.Add(TransactionRow);

                                        foreach (ARecurringTransAnalAttribRow recAnalAttrib in RGLMainDS.ARecurringTransAnalAttrib.Rows)
                                        {
                                            if ((recAnalAttrib.TransactionNumber == recTransaction.TransactionNumber)
                                                && (recTransaction.JournalNumber == recJournal.JournalNumber)
                                                && (recTransaction.BatchNumber == ABatchNumber)
                                                && (recTransaction.LedgerNumber == ALedgerNumber))
                                            {
                                                ATransAnalAttribRow TransAnalAttribRow = GLMainDS.ATransAnalAttrib.NewRowTyped();

                                                TransAnalAttribRow.LedgerNumber = JournalRow.LedgerNumber;
                                                TransAnalAttribRow.BatchNumber = JournalRow.BatchNumber;
                                                TransAnalAttribRow.JournalNumber = JournalRow.JournalNumber;
                                                TransAnalAttribRow.TransactionNumber = recTransaction.TransactionNumber;
                                                TransAnalAttribRow.AnalysisTypeCode = recAnalAttrib.AnalysisTypeCode;

                                                TransAnalAttribRow.AccountCode = recAnalAttrib.AccountCode;
                                                TransAnalAttribRow.CostCentreCode = recAnalAttrib.CostCentreCode;
                                                TransAnalAttribRow.AnalysisAttributeValue = recAnalAttrib.AnalysisAttributeValue;

                                                GLMainDS.ATransAnalAttrib.Rows.Add(TransAnalAttribRow);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                ABatchAccess.SubmitChanges(GLMainDS.ABatch, Transaction);

                ALedgerAccess.SubmitChanges(LedgerTable, Transaction);

                AJournalAccess.SubmitChanges(GLMainDS.AJournal, Transaction);

                ATransactionAccess.SubmitChanges(GLMainDS.ATransaction, Transaction);

                ATransAnalAttribAccess.SubmitChanges(GLMainDS.ATransAnalAttrib, Transaction);

                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.CommitTransaction();
                }

                GLMainDS.AcceptChanges();
            }
            catch (Exception Exc)
            {
                TLogging.Log("An Exception occured during the submission of a Recurring GL Batch:" + Environment.NewLine + Exc.ToString());

                if (NewTransaction)
                {
                    DBAccess.GDBAccessObj.RollbackTransaction();
                }

                throw new EOPAppException("Error in SubmitRecurringGLBatch", Exc);
            }
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:101,代码来源:GL.Transactions.cs

示例4: LoadARecurringJournalAndContent

        public static GLBatchTDS LoadARecurringJournalAndContent(Int32 ALedgerNumber, Int32 ABatchNumber)
        {
            #region Validate Arguments

            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 MainDS = new GLBatchTDS();

            TDBTransaction Transaction = null;

            try
            {
                DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                    TEnforceIsolationLevel.eilMinimum,
                    ref Transaction,
                    delegate
                    {
                        ARecurringJournalAccess.LoadViaARecurringBatch(MainDS, ALedgerNumber, ABatchNumber, Transaction);

                        ARecurringTransactionTable TransactionTable = new ARecurringTransactionTable();
                        ARecurringTransactionRow TemplateTransactionRow = TransactionTable.NewRowTyped(false);
                        TemplateTransactionRow.LedgerNumber = ALedgerNumber;
                        TemplateTransactionRow.BatchNumber = ABatchNumber;
                        ARecurringTransactionAccess.LoadUsingTemplate(MainDS, TemplateTransactionRow, Transaction);

                        ARecurringTransAnalAttribTable TransAnalAttribTable = new ARecurringTransAnalAttribTable();
                        ARecurringTransAnalAttribRow TemplateTransAnalAttribRow = TransAnalAttribTable.NewRowTyped(false);
                        TemplateTransAnalAttribRow.LedgerNumber = ALedgerNumber;
                        TemplateTransAnalAttribRow.BatchNumber = ABatchNumber;
                        ARecurringTransAnalAttribAccess.LoadUsingTemplate(MainDS, TemplateTransAnalAttribRow, Transaction);

                        #region Validate Data

                        if ((MainDS.ARecurringJournal.Count == 0) && (MainDS.ARecurringTransaction.Count > 0))
                        {
                            throw new ApplicationException(String.Format(Catalog.GetString(
                                        "Function:{0} - Orphaned GL Transactions exist in Recurring GL Batch {1} in Ledger {2}!"),
                                    Utilities.GetMethodName(true),
                                    ABatchNumber,
                                    ALedgerNumber));
                        }
                        else if (((MainDS.ARecurringJournal.Count == 0)
                                  || (MainDS.ARecurringTransaction.Count == 0)) && (MainDS.ARecurringTransAnalAttrib.Count > 0))
                        {
                            throw new ApplicationException(String.Format(Catalog.GetString(
                                        "Function:{0} - Orphaned GL Transaction Analysis Attributes exist in Recurring GL Batch {1} in Ledger {2}!"),
                                    Utilities.GetMethodName(true),
                                    ABatchNumber,
                                    ALedgerNumber));
                        }

                        #endregion Validate Data
                    });

                MainDS.AcceptChanges();
            }
            catch (Exception ex)
            {
                TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}",
                        Utilities.GetMethodSignature(),
                        Environment.NewLine,
                        ex.Message));
                throw ex;
            }

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

示例5: CreateABatch

        /// <summary>
        /// create a new batch.
        /// it is already stored to the database, to avoid problems with LastBatchNumber
        /// </summary>
        /// <param name="ALedgerNumber"></param>
        /// <param name="ABatchDescription"></param>
        /// <param name="ABatchControlTotal"></param>
        /// <param name="ADateEffective"></param>
        /// <returns></returns>
        public static GLBatchTDS CreateABatch(
            Int32 ALedgerNumber,
            string ABatchDescription,
            decimal ABatchControlTotal,
            DateTime ADateEffective)
        {
            TDBTransaction Transaction = null;
            bool SubmissionOK = false;
            GLBatchTDS MainDS = null;

            //Error handling
            string ErrorContext = "Create a Batch";
            string ErrorMessage = String.Empty;
            //Set default type as non-critical
            TResultSeverity ErrorType = TResultSeverity.Resv_Noncritical;
            TVerificationResultCollection VerificationResult = null;

            MainDS = new GLBatchTDS();

            DBAccess.GDBAccessObj.GetNewOrExistingAutoTransaction(IsolationLevel.Serializable,
                TEnforceIsolationLevel.eilMinimum,
                ref Transaction,
                ref SubmissionOK,
                delegate
                {
                    try
                    {
                        ALedgerAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, Transaction);

                        ABatchRow NewRow = MainDS.ABatch.NewRowTyped(true);
                        NewRow.LedgerNumber = ALedgerNumber;
                        MainDS.ALedger[0].LastBatchNumber++;
                        NewRow.BatchNumber = MainDS.ALedger[0].LastBatchNumber;
                        NewRow.BatchPeriod = MainDS.ALedger[0].CurrentPeriod;
                        NewRow.BatchYear = MainDS.ALedger[0].CurrentFinancialYear;

                        int FinancialYear, FinancialPeriod;

                        if (ADateEffective != default(DateTime))
                        {
                            TFinancialYear.GetLedgerDatePostingPeriod(ALedgerNumber, ref ADateEffective, out FinancialYear, out FinancialPeriod,
                                Transaction, false);
                            NewRow.DateEffective = ADateEffective;
                            NewRow.BatchPeriod = FinancialPeriod;
                            NewRow.BatchYear = FinancialYear;
                        }

                        NewRow.BatchDescription = ABatchDescription;
                        NewRow.BatchControlTotal = ABatchControlTotal;
                        MainDS.ABatch.Rows.Add(NewRow);

                        GLBatchTDSAccess.SubmitChanges(MainDS);

                        MainDS.AcceptChanges();

                        SubmissionOK = true;
                    }
                    catch (Exception ex)
                    {
                        ErrorMessage =
                            String.Format(Catalog.GetString("Unknown error while creating a batch for Ledger: {0}." +
                                    Environment.NewLine + Environment.NewLine + ex.ToString()),
                                ALedgerNumber);
                        ErrorType = TResultSeverity.Resv_Critical;
                        VerificationResult = new TVerificationResultCollection();
                        VerificationResult.Add(new TVerificationResult(ErrorContext, ErrorMessage, ErrorType));

                        throw new EVerificationResultsException(ErrorMessage, VerificationResult, ex.InnerException);
                    }
                });

            return MainDS;
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:82,代码来源:Common.Posting.cs

示例6: ImportGLTransactions

        } // Import GL Batches

        /// <summary>
        /// Wrapper for importing GL Transactions. Called from client side
        /// </summary>
        /// <param name="ARequestParams"></param>
        /// <param name="AImportString"></param>
        /// <param name="ALedgerNumber"></param>
        /// <param name="ABatchNumber"></param>
        /// <param name="AJournalNumber"></param>
        /// <param name="AMessages"></param>
        /// <returns></returns>
        public bool ImportGLTransactions(
            Hashtable ARequestParams,
            String AImportString,
            Int32 ALedgerNumber,
            Int32 ABatchNumber,
            Int32 AJournalNumber,
            out TVerificationResultCollection AMessages)
        {
            string ImportMessage = Catalog.GetString("Initialising");

            TProgressTracker.InitProgressTracker(DomainManager.GClientID.ToString(),
                Catalog.GetString("Importing GL Batches"),
                100);

            TProgressTracker.SetCurrentState(DomainManager.GClientID.ToString(),
                Catalog.GetString("Initialising"),
                5);

            TVerificationResultCollection Messages = new TVerificationResultCollection();

            // fix for Mono issue with out parameter: https://bugzilla.xamarin.com/show_bug.cgi?id=28196
            AMessages = Messages;

            GLSetupTDS SetupDS = new GLSetupTDS();
            SetupDS.CaseSensitive = true;
            StringReader sr = new StringReader(AImportString);

            FDelimiter = (String)ARequestParams["Delimiter"];
            Int32 LedgerNumber = (Int32)ARequestParams["ALedgerNumber"];
            FDateFormatString = (String)ARequestParams["DateFormatString"];
            String NumberFormat = (String)ARequestParams["NumberFormat"];
            FNewLine = (String)ARequestParams["NewLine"];

            FCultureInfoNumberFormat = new CultureInfo(NumberFormat.Equals("American") ? "en-US" : "de-DE");
            FCultureInfoDate = new CultureInfo("en-GB");
            FCultureInfoDate.DateTimeFormat.ShortDatePattern = FDateFormatString;

            TDBTransaction Transaction = null;
            Int32 RowNumber = 0;
            Int32 InitialTextLength = AImportString.Length;
            Int32 TextProcessedLength = 0;
            Int32 PercentDone = 10;
            Int32 PreviousPercentDone = 0;
            bool submissionOK = false;
            Boolean CancelledByUser = false;

            // Create some validation dictionaries
            TValidationControlsDict ValidationControlsDictTransaction = new TValidationControlsDict();

            try
            {
                // This needs to be initialised because we will be calling the method
                TSharedFinanceValidationHelper.GetValidPostingDateRangeDelegate = @TFinanceServerLookups.GetCurrentPostingRangeDates;
                TSharedFinanceValidationHelper.GetValidPeriodDatesDelegate = @TAccountingPeriodsWebConnector.GetPeriodDates;

                DBAccess.GDBAccessObj.BeginAutoTransaction(IsolationLevel.Serializable, ref Transaction, ref submissionOK,
                    delegate
                    {
                        // Construct our DataSet - we use all the journals for the batch so we can update the batch totals.
                        GLBatchTDS MainDS = new GLBatchTDS();
                        ABatchTable BatchTable = ABatchAccess.LoadByPrimaryKey(ALedgerNumber, ABatchNumber, Transaction);
                        MainDS.ABatch.Merge(BatchTable);
                        AJournalTable JournalTable = AJournalAccess.LoadViaABatch(ALedgerNumber, ABatchNumber, Transaction);
                        MainDS.AJournal.Merge(JournalTable);
                        ATransactionTable TransactionTable = ATransactionAccess.LoadViaABatch(ALedgerNumber, ABatchNumber, Transaction);
                        MainDS.ATransaction.Merge(TransactionTable);
                        ATransAnalAttribTable TransAnalAttributeTable = ATransAnalAttribAccess.LoadViaAJournal(ALedgerNumber,
                            ABatchNumber,
                            AJournalNumber,
                            Transaction);
                        MainDS.ATransAnalAttrib.Merge(TransAnalAttributeTable);
                        MainDS.AcceptChanges();

                        ABatchRow NewBatchRow = (ABatchRow)MainDS.ABatch.Rows.Find(new object[] { ALedgerNumber, ABatchNumber });
                        AJournalRow NewJournalRow = (AJournalRow)MainDS.AJournal.Rows.Find(new object[] { ALedgerNumber, ABatchNumber, AJournalNumber });

                        // Load supplementary tables that we are going to need for validation
                        ALedgerTable LedgerTable = ALedgerAccess.LoadByPrimaryKey(ALedgerNumber, Transaction);
                        AAnalysisTypeAccess.LoadViaALedger(SetupDS, LedgerNumber, Transaction);
                        AFreeformAnalysisAccess.LoadViaALedger(SetupDS, LedgerNumber, Transaction);
                        AAnalysisAttributeAccess.LoadViaALedger(SetupDS, LedgerNumber, Transaction);
                        ACostCentreAccess.LoadViaALedger(SetupDS, LedgerNumber, Transaction);
                        AAccountAccess.LoadViaALedger(SetupDS, LedgerNumber, Transaction);
                        ALedgerInitFlagAccess.LoadViaALedger(SetupDS, LedgerNumber, Transaction);

                        DateTime firstDayOfMonth;
                        decimal intlRateFromBase = -1.0m;

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

示例7: LoadAJournal

        public static GLBatchTDS LoadAJournal(Int32 ALedgerNumber, Int32 ABatchNumber, Int32 AJournalNumber)
        {
            #region Validate Arguments

            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);
            }
            else if (AJournalNumber <= 0)
            {
                throw new ArgumentException(String.Format(Catalog.GetString("Function:{0} - The Journal number must be greater than 0!"),
                        Utilities.GetMethodName(true),
                        AJournalNumber));
            }

            #endregion Validate Arguments

            GLBatchTDS MainDS = new GLBatchTDS();

            TDBTransaction Transaction = null;

            try
            {
                DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                    TEnforceIsolationLevel.eilMinimum,
                    ref Transaction,
                    delegate
                    {
                        AJournalAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, ABatchNumber, AJournalNumber, Transaction);

                        #region Validate Data

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

                        #endregion Validate Data
                    });

                MainDS.AcceptChanges();
            }
            catch (Exception ex)
            {
                TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}",
                        Utilities.GetMethodSignature(),
                        Environment.NewLine,
                        ex.Message));
                throw ex;
            }

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

示例8: LoadARecurringTransactionARecurringTransAnalAttrib

        public static GLBatchTDS LoadARecurringTransactionARecurringTransAnalAttrib(Int32 ALedgerNumber, Int32 ABatchNumber, Int32 AJournalNumber)
        {
            #region Validate Arguments

            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);
            }
            else if (AJournalNumber <= 0)
            {
                throw new ArgumentException(String.Format(Catalog.GetString("Function:{0} - The Journal number must be greater than 0!"),
                        Utilities.GetMethodName(true),
                        AJournalNumber));
            }

            #endregion Validate Arguments

            string AnalysisAttrList = string.Empty;

            GLBatchTDS MainDS = new GLBatchTDS();
            TDBTransaction Transaction = null;

            try
            {
                DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                    TEnforceIsolationLevel.eilMinimum,
                    ref Transaction,
                    delegate
                    {
                        ARecurringTransactionAccess.LoadViaARecurringJournal(MainDS, ALedgerNumber, ABatchNumber, AJournalNumber, Transaction);
                        ARecurringTransAnalAttribAccess.LoadViaARecurringJournal(MainDS, ALedgerNumber, ABatchNumber, AJournalNumber, Transaction);
                    });

                #region Validate Data

                if ((MainDS.ARecurringTransaction.Count == 0) && (MainDS.ARecurringTransAnalAttrib.Count > 0))
                {
                    throw new ApplicationException(String.Format(Catalog.GetString(
                                "Function:{0} - Orphaned GL Transaction Analysis Attributes exist in Recurring GL Batch {1} in Ledger {2}!"),
                            Utilities.GetMethodName(true),
                            ABatchNumber,
                            ALedgerNumber));
                }

                #endregion Validate Data

                foreach (GLBatchTDSARecurringTransactionRow transRow in MainDS.ARecurringTransaction.Rows)
                {
                    MainDS.ARecurringTransAnalAttrib.DefaultView.RowFilter = String.Format("{0} = {1}",
                        ARecurringTransAnalAttribTable.GetTransactionNumberDBName(),
                        transRow.TransactionNumber);

                    foreach (DataRowView drv in MainDS.ARecurringTransAnalAttrib.DefaultView)
                    {
                        ARecurringTransAnalAttribRow recurrTransAnalAttrRow = (ARecurringTransAnalAttribRow)drv.Row;

                        if (AnalysisAttrList.Length > 0)
                        {
                            AnalysisAttrList += ", ";
                        }

                        AnalysisAttrList += (recurrTransAnalAttrRow.AnalysisTypeCode + "=" + recurrTransAnalAttrRow.AnalysisAttributeValue);
                    }

                    if (transRow.AnalysisAttributes != AnalysisAttrList)
                    {
                        transRow.AnalysisAttributes = AnalysisAttrList;
                    }

                    //clear the attributes string and table
                    AnalysisAttrList = string.Empty;
                }

                MainDS.ARecurringTransAnalAttrib.DefaultView.RowFilter = string.Empty;

                MainDS.AcceptChanges();
            }
            catch (Exception ex)
            {
                TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}",
                        Utilities.GetMethodSignature(),
                        Environment.NewLine,
                        ex.Message));
                throw ex;
            }

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

示例9: SubmitRecurringGLBatch


//.........这里部分代码省略.........
                                        //TODO (not here, but in the client or while posting) Check for expired key ministry (while Posting)

                                        foreach (ARecurringTransactionRow recTransaction in RGLMainDS.ARecurringTransaction.Rows)
                                        {
                                            if ((recTransaction.JournalNumber == recJournal.JournalNumber)
                                                && (recTransaction.BatchNumber == ABatchNumber)
                                                && (recTransaction.LedgerNumber == ALedgerNumber))
                                            {
                                                ATransactionRow TransactionRow = GLMainDS.ATransaction.NewRowTyped();
                                                TransactionRow.LedgerNumber = JournalRow.LedgerNumber;
                                                TransactionRow.BatchNumber = JournalRow.BatchNumber;
                                                TransactionRow.JournalNumber = JournalRow.JournalNumber;
                                                TransactionRow.TransactionNumber = recTransaction.TransactionNumber;

                                                if (TransactionRow.TransactionNumber > JournalRow.LastTransactionNumber)
                                                {
                                                    JournalRow.LastTransactionNumber = TransactionRow.TransactionNumber;
                                                }

                                                TransactionRow.Narrative = recTransaction.Narrative;
                                                TransactionRow.AccountCode = recTransaction.AccountCode;
                                                TransactionRow.CostCentreCode = recTransaction.CostCentreCode;
                                                TransactionRow.TransactionAmount = recTransaction.TransactionAmount;
                                                TransactionRow.AmountInBaseCurrency =
                                                    GLRoutines.Divide(recTransaction.TransactionAmount, journalCurrencyExchangeRateToBase);

                                                if (!TransactionInIntlCurrency)
                                                {
                                                    TransactionRow.AmountInIntlCurrency = ((AExchangeRateIntlToBase == 0) ? 0 :
                                                                                           GLRoutines.Divide((decimal)TransactionRow.
                                                                                               AmountInBaseCurrency,
                                                                                               AExchangeRateIntlToBase));
                                                }
                                                else
                                                {
                                                    TransactionRow.AmountInIntlCurrency = TransactionRow.TransactionAmount;
                                                }

                                                TransactionRow.TransactionDate = AEffectiveDate;
                                                TransactionRow.DebitCreditIndicator = recTransaction.DebitCreditIndicator;
                                                TransactionRow.HeaderNumber = recTransaction.HeaderNumber;
                                                TransactionRow.DetailNumber = recTransaction.DetailNumber;
                                                TransactionRow.SubType = recTransaction.SubType;
                                                TransactionRow.Reference = recTransaction.Reference;

                                                GLMainDS.ATransaction.Rows.Add(TransactionRow);

                                                foreach (ARecurringTransAnalAttribRow recAnalAttrib in RGLMainDS.ARecurringTransAnalAttrib.Rows)
                                                {
                                                    if ((recAnalAttrib.TransactionNumber == recTransaction.TransactionNumber)
                                                        && (recTransaction.JournalNumber == recJournal.JournalNumber)
                                                        && (recTransaction.BatchNumber == ABatchNumber)
                                                        && (recTransaction.LedgerNumber == ALedgerNumber))
                                                    {
                                                        ATransAnalAttribRow TransAnalAttribRow = GLMainDS.ATransAnalAttrib.NewRowTyped();

                                                        TransAnalAttribRow.LedgerNumber = JournalRow.LedgerNumber;
                                                        TransAnalAttribRow.BatchNumber = JournalRow.BatchNumber;
                                                        TransAnalAttribRow.JournalNumber = JournalRow.JournalNumber;
                                                        TransAnalAttribRow.TransactionNumber = recTransaction.TransactionNumber;
                                                        TransAnalAttribRow.AnalysisTypeCode = recAnalAttrib.AnalysisTypeCode;

                                                        TransAnalAttribRow.AccountCode = recAnalAttrib.AccountCode;
                                                        TransAnalAttribRow.CostCentreCode = recAnalAttrib.CostCentreCode;
                                                        TransAnalAttribRow.AnalysisAttributeValue = recAnalAttrib.AnalysisAttributeValue;

                                                        GLMainDS.ATransAnalAttrib.Rows.Add(TransAnalAttribRow);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        ALedgerAccess.SubmitChanges(LedgerTable, Transaction);
                        ABatchAccess.SubmitChanges(GLMainDS.ABatch, Transaction);
                        AJournalAccess.SubmitChanges(GLMainDS.AJournal, Transaction);
                        ATransactionAccess.SubmitChanges(GLMainDS.ATransaction, Transaction);
                        ATransAnalAttribAccess.SubmitChanges(GLMainDS.ATransAnalAttrib, Transaction);

                        SubmissionOK = true;
                    });

                GLMainDS.AcceptChanges();
            }
            catch (Exception ex)
            {
                TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}",
                        Utilities.GetMethodSignature(),
                        Environment.NewLine,
                        ex.Message));
                throw ex;
            }

            AVerifications = Verifications;

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

示例10: LoadALedgerTable

        public static GLBatchTDS LoadALedgerTable(Int32 ALedgerNumber)
        {
            #region Validate Arguments

            if (ALedgerNumber <= 0)
            {
                throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString(
                            "Function:{0} - The Ledger number must be greater than 0!"),
                        Utilities.GetMethodName(true)), ALedgerNumber);
            }

            #endregion Validate Arguments

            GLBatchTDS MainDS = new GLBatchTDS();

            TDBTransaction Transaction = null;

            try
            {
                DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                    TEnforceIsolationLevel.eilMinimum,
                    ref Transaction,
                    delegate
                    {
                        ALedgerAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, Transaction);

                        #region Validate Data

                        if ((MainDS.ALedger == null) || (MainDS.ALedger.Count == 0))
                        {
                            throw new EFinanceSystemDataTableReturnedNoDataException(String.Format(Catalog.GetString(
                                        "Function:{0} - Ledger data for Ledger number {1} does not exist or could not be accessed!"),
                                    Utilities.GetMethodName(true),
                                    ALedgerNumber));
                        }

                        #endregion Validate Data
                    });

                // Remove all Tables that were not filled with data before remoting them.
                MainDS.RemoveEmptyTables();

                MainDS.AcceptChanges();
            }
            catch (Exception ex)
            {
                TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}",
                        Utilities.GetMethodSignature(),
                        Environment.NewLine,
                        ex.Message));
                throw ex;
            }

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

示例11: LoadARecurringBatch

        public static GLBatchTDS LoadARecurringBatch(Int32 ALedgerNumber, TFinanceBatchFilterEnum AFilterBatchStatus)
        {
            #region Validate Arguments

            if (ALedgerNumber <= 0)
            {
                throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString(
                            "Function:{0} - The Ledger number must be greater than 0!"),
                        Utilities.GetMethodName(true)), ALedgerNumber);
            }

            #endregion Validate Arguments

            GLBatchTDS MainDS = new GLBatchTDS();

            TDBTransaction Transaction = null;

            try
            {
                DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                    TEnforceIsolationLevel.eilMinimum,
                    ref Transaction,
                    delegate
                    {
                        ALedgerAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, Transaction);

                        #region Validate Data

                        if ((MainDS.ALedger == null) || (MainDS.ALedger.Count == 0))
                        {
                            throw new EFinanceSystemDataTableReturnedNoDataException(String.Format(Catalog.GetString(
                                        "Function:{0} - Ledger data for Ledger number {1} does not exist or could not be accessed!"),
                                    Utilities.GetMethodName(true),
                                    ALedgerNumber));
                        }

                        #endregion Validate Data

                        string SelectClause =
                            String.Format("SELECT * FROM PUB_{0} WHERE {1}={2}",
                                ARecurringBatchTable.GetTableDBName(),
                                ARecurringBatchTable.GetLedgerNumberDBName(),
                                ALedgerNumber);

                        string FilterByBatchStatus = string.Empty;

                        if ((AFilterBatchStatus & TFinanceBatchFilterEnum.fbfEditing) != 0)
                        {
                            FilterByBatchStatus =
                                string.Format(" AND {0} = '{1}'",
                                    ARecurringBatchTable.GetBatchStatusDBName(),
                                    MFinanceConstants.BATCH_UNPOSTED);
                        }

                        //else if (AFilterBatchStatus == TFinanceBatchFilterEnum.fbfAll)
                        //{
                        //    // FilterByBatchStatus is empty
                        //}

                        DBAccess.GDBAccessObj.Select(MainDS, SelectClause + FilterByBatchStatus,
                            MainDS.ARecurringBatch.TableName, Transaction);
                    });

                MainDS.AcceptChanges();
            }
            catch (Exception ex)
            {
                TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}",
                        Utilities.GetMethodSignature(),
                        Environment.NewLine,
                        ex.Message));
                throw ex;
            }

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

示例12: LoadABatch

        public static GLBatchTDS LoadABatch(Int32 ALedgerNumber, int AYear, int APeriod)
        {
            #region Validate Arguments

            if (ALedgerNumber <= 0)
            {
                throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString(
                            "Function:{0} - The Ledger number must be greater than 0!"),
                        Utilities.GetMethodName(true)), ALedgerNumber);
            }

            #endregion Validate Arguments

            GLBatchTDS MainDS = new GLBatchTDS();

            TDBTransaction Transaction = null;

            try
            {
                DBAccess.GDBAccessObj.GetNewOrExistingAutoReadTransaction(IsolationLevel.ReadCommitted,
                    TEnforceIsolationLevel.eilMinimum,
                    ref Transaction,
                    delegate
                    {
                        ALedgerAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, Transaction);

                        #region Validate Data

                        if ((MainDS.ALedger == null) || (MainDS.ALedger.Count == 0))
                        {
                            throw new EFinanceSystemDataTableReturnedNoDataException(String.Format(
                                    Catalog.GetString("Function:{0} - Ledger data for Ledger number {1} does not exist or could not be accessed!"),
                                    Utilities.GetMethodName(true),
                                    ALedgerNumber));
                        }

                        #endregion Validate Data

                        string FilterByPeriod = string.Empty;

                        if (AYear > -1)
                        {
                            FilterByPeriod = String.Format(" AND PUB_{0}.{1} = {2}",
                                ABatchTable.GetTableDBName(),
                                ABatchTable.GetBatchYearDBName(),
                                AYear);

                            if ((APeriod == 0) && (AYear == MainDS.ALedger[0].CurrentFinancialYear))
                            {
                                //Return current and forwarding periods
                                FilterByPeriod += String.Format(" AND PUB_{0}.{1} >= {2}",
                                    ABatchTable.GetTableDBName(),
                                    ABatchTable.GetBatchPeriodDBName(),
                                    MainDS.ALedger[0].CurrentPeriod);
                            }
                            else if (APeriod > 0)
                            {
                                //Return only specified period
                                FilterByPeriod += String.Format(" AND PUB_{0}.{1} = {2}",
                                    ABatchTable.GetTableDBName(),
                                    ABatchTable.GetBatchPeriodDBName(),
                                    APeriod);
                            }

                            //else
                            //{
                            //    //Nothing to add, returns all periods
                            //}
                        }

                        string SelectClause =
                            String.Format("SELECT * FROM PUB_{0} WHERE {1} = {2}",
                                ABatchTable.GetTableDBName(),
                                ABatchTable.GetLedgerNumberDBName(),
                                ALedgerNumber);

                        DBAccess.GDBAccessObj.Select(MainDS, SelectClause + FilterByPeriod,
                            MainDS.ABatch.TableName, Transaction);
                    });

                MainDS.AcceptChanges();
            }
            catch (Exception ex)
            {
                TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}",
                        Utilities.GetMethodSignature(),
                        Environment.NewLine,
                        ex.Message));
                throw ex;
            }

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

示例13: CreateARecurringBatch

        /// <summary>
        /// create a new recurring batch.
        /// it is already stored to the database, to avoid problems with LastBatchNumber
        /// </summary>
        public static GLBatchTDS CreateARecurringBatch(Int32 ALedgerNumber)
        {
            #region Validate Arguments

            if (ALedgerNumber <= 0)
            {
                throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString(
                            "Function:{0} - The Ledger number must be greater than 0!"),
                        Utilities.GetMethodName(true)), ALedgerNumber);
            }

            #endregion Validate Arguments

            GLBatchTDS MainDS = new GLBatchTDS();
            GLBatchTDS TempDS = new GLBatchTDS();

            TDBTransaction Transaction = null;
            bool SubmissionOK = false;

            try
            {
                DBAccess.GDBAccessObj.GetNewOrExistingAutoTransaction(IsolationLevel.Serializable,
                    TEnforceIsolationLevel.eilMinimum,
                    ref Transaction,
                    ref SubmissionOK,
                    delegate
                    {
                        ALedgerAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, Transaction);

                        #region Validate Data

                        if ((MainDS.ALedger == null) || (MainDS.ALedger.Count == 0))
                        {
                            throw new EFinanceSystemDataTableReturnedNoDataException(String.Format(Catalog.GetString(
                                        "Function:{0} - Ledger data for Ledger number {1} does not exist or could not be accessed!"),
                                    Utilities.GetMethodName(true),
                                    ALedgerNumber));
                        }

                        #endregion Validate Data

                        ARecurringBatchAccess.LoadViaALedger(TempDS, ALedgerNumber, Transaction);

                        DataView RecurringBatchDV = new DataView(TempDS.ARecurringBatch);
                        RecurringBatchDV.RowFilter = string.Empty;
                        RecurringBatchDV.Sort = string.Format("{0} DESC",
                            ARecurringBatchTable.GetBatchNumberDBName());

                        //Recurring batch numbers can be reused so check each time for current highest number
                        if (RecurringBatchDV.Count > 0)
                        {
                            MainDS.ALedger[0].LastRecurringBatchNumber = (int)(RecurringBatchDV[0][ARecurringBatchTable.GetBatchNumberDBName()]);
                        }
                        else
                        {
                            MainDS.ALedger[0].LastRecurringBatchNumber = 0;
                        }

                        ARecurringBatchRow NewRow = MainDS.ARecurringBatch.NewRowTyped(true);
                        NewRow.LedgerNumber = ALedgerNumber;
                        NewRow.BatchNumber = ++MainDS.ALedger[0].LastRecurringBatchNumber;
                        MainDS.ARecurringBatch.Rows.Add(NewRow);

                        //Empty the TempDS
                        TempDS.RejectChanges();

                        //Submit changes to MainDS
                        GLBatchTDSAccess.SubmitChanges(MainDS);

                        SubmissionOK = true;
                    });

                MainDS.AcceptChanges();
            }
            catch (Exception ex)
            {
                TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}",
                        Utilities.GetMethodSignature(),
                        Environment.NewLine,
                        ex.Message));
                throw ex;
            }

            return MainDS;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:89,代码来源:Common.Posting.cs

示例14: CreateABatch

        /// <summary>
        /// create a new batch.
        /// it is already stored to the database, to avoid problems with LastBatchNumber
        /// </summary>
        /// <param name="ALedgerNumber"></param>
        /// <param name="ABatchDescription"></param>
        /// <param name="ABatchControlTotal"></param>
        /// <param name="ADateEffective"></param>
        /// <returns></returns>
        public static GLBatchTDS CreateABatch(
            Int32 ALedgerNumber,
            string ABatchDescription,
            decimal ABatchControlTotal,
            DateTime ADateEffective)
        {
            #region Validate Arguments

            if (ALedgerNumber <= 0)
            {
                throw new EFinanceSystemInvalidLedgerNumberException(String.Format(Catalog.GetString(
                            "Function:{0} - The Ledger number must be greater than 0!"),
                        Utilities.GetMethodName(true)), ALedgerNumber);
            }

            #endregion Validate Arguments

            GLBatchTDS MainDS = new GLBatchTDS();

            TDBTransaction Transaction = null;
            bool SubmissionOK = false;

            try
            {
                DBAccess.GDBAccessObj.GetNewOrExistingAutoTransaction(IsolationLevel.Serializable,
                    TEnforceIsolationLevel.eilMinimum,
                    ref Transaction,
                    ref SubmissionOK,
                    delegate
                    {
                        ALedgerAccess.LoadByPrimaryKey(MainDS, ALedgerNumber, Transaction);

                        #region Validate Data

                        if ((MainDS.ALedger == null) || (MainDS.ALedger.Count == 0))
                        {
                            throw new EFinanceSystemDataTableReturnedNoDataException(String.Format(Catalog.GetString(
                                        "Function:{0} - Ledger data for Ledger number {1} does not exist or could not be accessed!"),
                                    Utilities.GetMethodName(true),
                                    ALedgerNumber));
                        }

                        #endregion Validate Data

                        ABatchRow NewRow = MainDS.ABatch.NewRowTyped(true);
                        NewRow.LedgerNumber = ALedgerNumber;
                        MainDS.ALedger[0].LastBatchNumber++;
                        NewRow.BatchNumber = MainDS.ALedger[0].LastBatchNumber;
                        NewRow.BatchPeriod = MainDS.ALedger[0].CurrentPeriod;
                        NewRow.BatchYear = MainDS.ALedger[0].CurrentFinancialYear;

                        int FinancialYear, FinancialPeriod;

                        if (ADateEffective != default(DateTime))
                        {
                            TFinancialYear.GetLedgerDatePostingPeriod(ALedgerNumber, ref ADateEffective, out FinancialYear, out FinancialPeriod,
                                Transaction, false);
                            NewRow.DateEffective = ADateEffective;
                            NewRow.BatchPeriod = FinancialPeriod;
                            NewRow.BatchYear = FinancialYear;
                        }

                        NewRow.BatchDescription = ABatchDescription;
                        NewRow.BatchControlTotal = ABatchControlTotal;
                        MainDS.ABatch.Rows.Add(NewRow);

                        GLBatchTDSAccess.SubmitChanges(MainDS);

                        SubmissionOK = true;
                    });

                MainDS.AcceptChanges();
            }
            catch (Exception ex)
            {
                TLogging.Log(String.Format("Method:{0} - Unexpected error!{1}{1}{2}",
                        Utilities.GetMethodSignature(),
                        Environment.NewLine,
                        ex.Message));
                throw ex;
            }

            return MainDS;
        }
开发者ID:Davincier,项目名称:openpetra,代码行数:93,代码来源:Common.Posting.cs

示例15: LoadATransactionATransAnalAttrib

        public static GLBatchTDS LoadATransactionATransAnalAttrib(Int32 ALedgerNumber, Int32 ABatchNumber, Int32 AJournalNumber)
        {
            string strAnalAttr = string.Empty;
            bool newTransaction = false;

            TDBTransaction Transaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted,
                TEnforceIsolationLevel.eilMinimum,
                out newTransaction);

            GLBatchTDS MainDS = new GLBatchTDS();

            ATransactionAccess.LoadViaAJournal(MainDS, ALedgerNumber, ABatchNumber, AJournalNumber, Transaction);

            ATransAnalAttribAccess.LoadViaAJournal(MainDS, ALedgerNumber, ABatchNumber, AJournalNumber, Transaction);

            foreach (GLBatchTDSATransactionRow transRow in MainDS.ATransaction.Rows)
            {
                MainDS.ATransAnalAttrib.DefaultView.RowFilter = String.Format("{0} = {1}",
                    ATransAnalAttribTable.GetTransactionNumberDBName(),
                    transRow.TransactionNumber);

                foreach (DataRowView rv in MainDS.ATransAnalAttrib.DefaultView)
                {
                    ATransAnalAttribRow Row = (ATransAnalAttribRow)rv.Row;

                    if (strAnalAttr.Length > 0)
                    {
                        strAnalAttr += ", ";
                    }

                    strAnalAttr += (Row.AnalysisTypeCode + "=" + Row.AnalysisAttributeValue);
                }

                if (transRow.AnalysisAttributes != strAnalAttr)
                {
                    transRow.AnalysisAttributes = strAnalAttr;
                }

                //reset the attributes string
                strAnalAttr = string.Empty;
            }

            MainDS.ATransAnalAttrib.DefaultView.RowFilter = string.Empty;

            if (newTransaction)
            {
                DBAccess.GDBAccessObj.RollbackTransaction();
            }

            MainDS.AcceptChanges();

            return MainDS;
        }
开发者ID:js1987,项目名称:openpetragit,代码行数:53,代码来源:GL.Transactions.cs


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