c# - How to get the FirstOrDefault added/updated/deleted data Row in a data Table? -
i'm developing external .dll epicor erp calls in bpm's pre/post processing. .dll written in c# , epicor passes .dll dataset.
i've seen code examples either changed rows or firstordefault not both.
this code null never gets called.
var ttquotedtl = ds.quotedtl.where(r => r.rowmod == icerow.rowstate_added || r.rowmod == icerow.rowstate_updated || r.rowmod == icerow.rowstate_deleted); var ttquotedtl_xrow = (from ttquotedtl_row in ttquotedtl select ttquotedtl_row).firstordefault(); if (ttquotedtl_xrow != null) { //do }
i can ttquotedtl not null , perform work if call this:
var ttquotedtl_xrow = ds.quotedtl.firstordefault();
but i'm concerned won't row has been added, updated or deleted.
you can combine two, linq statements composable.
var quotedtlrow = ds.quotedtl .where(r => r.rowmod == icerow.rowstate_added || r.rowmod == icerow.rowstate_updated || r.rowmod == icerow.rowstate_deleted ).firstordefault();
if null may need see more code.
incidentally, if ds dataset passed bpm method row ds.quotedetail
implements icerow interface. provides methods .added()
, .updated()
, .deleted()
, .unchanged()
meaning above can shortened
var quotedtlrow = ds.quotedtl .where( r => !r.unchanged() ).firstordefault();
Comments
Post a Comment