コード例 #1
0
        // delete highlighted row/s
        private void DeleteRecord(Object Sender, EventArgs e)
        {
            ATransactionRow RowToDelete = FMainDS.ATransaction.NewRowTyped();

            RowToDelete.ItemArray = (object[])FPreviouslySelectedDetailRow.ItemArray.Clone();

            this.DeleteATransaction();

            if (grdDetails.Rows.Count <= 2)
            {
                btnOK.Enabled = false;
            }

            ATransAnalAttribTable TempTable = new ATransAnalAttribTable();

            TempTable.Merge(FMainDS.ATransAnalAttrib);

            foreach (ATransAnalAttribRow Row in TempTable.Rows)
            {
                if ((Row.RowState != DataRowState.Deleted) &&
                    (Row.LedgerNumber == RowToDelete.LedgerNumber) &&
                    (Row.BatchNumber == RowToDelete.BatchNumber) &&
                    (Row.JournalNumber == RowToDelete.JournalNumber))
                {
                    if (Row.TransactionNumber == RowToDelete.TransactionNumber)
                    {
                        // delete row as no longer used
                        FMainDS.ATransAnalAttrib.Rows.Find(
                            new object[] { Row.LedgerNumber, Row.BatchNumber, Row.JournalNumber, Row.TransactionNumber,
                                           Row.AnalysisTypeCode }).Delete();
                    }
                    else if (Row.TransactionNumber > RowToDelete.TransactionNumber)
                    {
                        // transaction number needs updated
                        ((ATransAnalAttribRow)FMainDS.ATransAnalAttrib.Rows.Find(
                             new object[] { Row.LedgerNumber, Row.BatchNumber, Row.JournalNumber, Row.TransactionNumber,
                                            Row.AnalysisTypeCode })).TransactionNumber -= 1;
                    }
                }
            }

            foreach (ATransactionRow Row in FMainDS.ATransaction.Rows)
            {
                if ((Row.RowState != DataRowState.Deleted) &&
                    (Row.LedgerNumber == RowToDelete.LedgerNumber) &&
                    (Row.BatchNumber == RowToDelete.BatchNumber) &&
                    (Row.JournalNumber == RowToDelete.JournalNumber) &&
                    (Row.TransactionNumber > RowToDelete.TransactionNumber))
                {
                    // transaction number needs updated
                    Row.TransactionNumber -= 1;
                }
            }

            FPetraUtilsObject.DisableSaveButton();
        }
コード例 #2
0
        // delete highlighted row/s
        private void DeleteRecord(Object Sender, EventArgs e)
        {
            ATransactionRow RowToDelete = FMainDS.ATransaction.NewRowTyped();

            RowToDelete.ItemArray = (object[])FPreviouslySelectedDetailRow.ItemArray.Clone();

            this.DeleteATransaction();

            if (grdDetails.Rows.Count <= 2)
            {
                btnOK.Enabled = false;
            }

            ATransAnalAttribTable TempTable = new ATransAnalAttribTable();
            TempTable.Merge(FMainDS.ATransAnalAttrib);

            foreach (ATransAnalAttribRow Row in TempTable.Rows)
            {
                if ((Row.RowState != DataRowState.Deleted)
                    && (Row.LedgerNumber == RowToDelete.LedgerNumber)
                    && (Row.BatchNumber == RowToDelete.BatchNumber)
                    && (Row.JournalNumber == RowToDelete.JournalNumber))
                {
                    if (Row.TransactionNumber == RowToDelete.TransactionNumber)
                    {
                        // delete row as no longer used
                        FMainDS.ATransAnalAttrib.Rows.Find(
                            new object[] { Row.LedgerNumber, Row.BatchNumber, Row.JournalNumber, Row.TransactionNumber,
                                           Row.AnalysisTypeCode }).Delete();
                    }
                    else if (Row.TransactionNumber > RowToDelete.TransactionNumber)
                    {
                        // transaction number needs updated
                        ((ATransAnalAttribRow)FMainDS.ATransAnalAttrib.Rows.Find(
                             new object[] { Row.LedgerNumber, Row.BatchNumber, Row.JournalNumber, Row.TransactionNumber,
                                            Row.AnalysisTypeCode })).TransactionNumber -= 1;
                    }
                }
            }

            foreach (ATransactionRow Row in FMainDS.ATransaction.Rows)
            {
                if ((Row.RowState != DataRowState.Deleted)
                    && (Row.LedgerNumber == RowToDelete.LedgerNumber)
                    && (Row.BatchNumber == RowToDelete.BatchNumber)
                    && (Row.JournalNumber == RowToDelete.JournalNumber)
                    && (Row.TransactionNumber > RowToDelete.TransactionNumber))
                {
                    // transaction number needs updated
                    Row.TransactionNumber -= 1;
                }
            }

            FPetraUtilsObject.DisableSaveButton();
        }