We have this BPM to inactivate our RunOut parts:
var qPart = (from qP in Db.Part
where qP.InActive == false && qP.RunOut == true
orderby qP.Company, qP.PartNum
select new {Part = qP}).ToList();
if (qPart != null)
{
if (qPart.FirstOrDefault() != null)
{
foreach(var p in qPart)
{
p.Part.InActive = true;
}
}
}
However, we noticed that we ended up inactivating parts that had open job records as this way of updating seems to not trigger the expected validation (PartBeforeUpdate) experienced when we do the update manually in Part Entry screen or when we rewrite the code to use Erp.Contracts.BO.Part library (Update() method).
I was under the impression that updating LINQ-fed variables to do DB-writes were acceptable (not like forcing SQL Updates) as I thought it was still going through all needed validations implicitely in the back, but I guess I was wrong. Am I missing something here?
TIA