温馨提示:本文翻译自stackoverflow.com,查看原文请点击:crud - Determine if a record has been updated/inserted/deleted
acumatica crud

crud - 确定记录是否已被更新/插入/删除

发布于 2020-03-27 10:23:05

我有一个称为APTran的DAC。我想确保我在此DAC中的所有记录均已插入。

这是针对相应的POReceiptLine开票数量审核我的APTran记录

foreach(APTran apTran in Base.Transactions.Select())
{
   // determine the state of apTran (inserted, Deleted)
}

查看更多

查看更多

提问者
Adam St.Hilaire
被浏览
49
Hugues Beauséjour 2019-07-03 22:01
bool isInserted = cache.GetStatus(apTran) == PXEntryStatus.Inserted;
bool isDeleted = cache.GetStatus(apTran) == PXEntryStatus.Deleted;
bool isInsertedDeleted = cache.GetStatus(apTran) == PXEntryStatus.InsertedDeleted;

InsertedDeleted是一种特殊情况,其中记录已插入高速缓存中,但在记录持久化到数据库之前被删除。

我不知道检查记录是否实际插入数据库的正式方法。我通常要做的是检查数据库生成的字段值之一。在插入数据库之前,它们将为null。

bool hasBeenPersisted = apTran.Tstamp != null;