/// <summary>
        /// Re-show the specified row
        /// </summary>
        /// <param name="AModifiedJournalRow"></param>
        /// <param name="ARedisplay"></param>
        public void UndoModifiedJournalRow(GLBatchTDSAJournalRow AModifiedJournalRow, bool ARedisplay)
        {
            //Check if new row or not
            if (AModifiedJournalRow.RowState == DataRowState.Added)
            {
                return;
            }

            AModifiedJournalRow.RejectChanges();

            if (ARedisplay)
            {
                ShowDetails(AModifiedJournalRow);
            }
        }
示例#2
0
        /// <summary>
        /// Re-show the specified row
        /// </summary>
        /// <param name="ACurrentBatch"></param>
        /// <param name="AJournalToCancel"></param>
        /// <param name="ARedisplay"></param>
        public void PrepareJournalDataForCancelling(Int32 ACurrentBatch, Int32 AJournalToCancel, Boolean ARedisplay)
        {
            //This code will only be called when the Journal tab is active.

            DataView JournalDV   = new DataView(FMainDS.AJournal);
            DataView TransDV     = new DataView(FMainDS.ATransaction);
            DataView TransAnalDV = new DataView(FMainDS.ATransAnalAttrib);

            JournalDV.RowFilter = String.Format("{0}={1} And {2}={3}",
                                                AJournalTable.GetBatchNumberDBName(),
                                                ACurrentBatch,
                                                AJournalTable.GetJournalNumberDBName(),
                                                AJournalToCancel);

            TransDV.RowFilter = String.Format("{0}={1} And {2}={3}",
                                              ATransactionTable.GetBatchNumberDBName(),
                                              ACurrentBatch,
                                              ATransactionTable.GetJournalNumberDBName(),
                                              AJournalToCancel);

            TransAnalDV.RowFilter = String.Format("{0}={1} And {2}={3}",
                                                  ATransAnalAttribTable.GetBatchNumberDBName(),
                                                  ACurrentBatch,
                                                  ATransAnalAttribTable.GetJournalNumberDBName(),
                                                  AJournalToCancel);

            //Work from lowest level up
            if (TransAnalDV.Count > 0)
            {
                TransAnalDV.Sort = String.Format("{0}, {1}",
                                                 ATransAnalAttribTable.GetTransactionNumberDBName(),
                                                 ATransAnalAttribTable.GetAnalysisTypeCodeDBName());

                foreach (DataRowView drv in TransAnalDV)
                {
                    ATransAnalAttribRow transAnalRow = (ATransAnalAttribRow)drv.Row;

                    if (transAnalRow.RowState == DataRowState.Added)
                    {
                        //Do nothing
                    }
                    else if (transAnalRow.RowState != DataRowState.Unchanged)
                    {
                        transAnalRow.RejectChanges();
                    }
                }
            }

            if (TransDV.Count > 0)
            {
                TransDV.Sort = String.Format("{0}", ATransactionTable.GetTransactionNumberDBName());

                foreach (DataRowView drv in TransDV)
                {
                    ATransactionRow transRow = (ATransactionRow)drv.Row;

                    if (transRow.RowState == DataRowState.Added)
                    {
                        //Do nothing
                    }
                    else if (transRow.RowState != DataRowState.Unchanged)
                    {
                        transRow.RejectChanges();
                    }
                }
            }

            if (JournalDV.Count > 0)
            {
                GLBatchTDSAJournalRow journalRow = (GLBatchTDSAJournalRow)JournalDV[0].Row;

                //No need to check for Added state as new journals are always saved
                // on creation
                if (journalRow.RowState != DataRowState.Unchanged)
                {
                    journalRow.RejectChanges();
                }

                if (ARedisplay)
                {
                    ShowDetails(journalRow);
                }
            }

            if (TransDV.Count == 0)
            {
                //Load all related data for journal ready to delete/cancel
                FMainDS.Merge(TRemote.MFinance.GL.WebConnectors.LoadATransactionAndRelatedTablesForJournal(FLedgerNumber, ACurrentBatch,
                                                                                                           AJournalToCancel));
            }
        }
        /// <summary>
        /// Re-show the specified row
        /// </summary>
        /// <param name="AModifiedJournalRow"></param>
        /// <param name="ARedisplay"></param>
        public void UndoModifiedJournalRow(GLBatchTDSAJournalRow AModifiedJournalRow, bool ARedisplay)
        {
            //Check if new row or not
            if (AModifiedJournalRow.RowState == DataRowState.Added)
            {
                return;
            }

            AModifiedJournalRow.RejectChanges();

            if (ARedisplay)
            {
                ShowDetails(AModifiedJournalRow);
            }
        }