Skip to content

Instantly share code, notes, and snippets.

@aconfee
Last active May 20, 2019 18:43
Show Gist options
  • Save aconfee/3316f0b508425a04f7f34baa8a7c79a1 to your computer and use it in GitHub Desktop.
Save aconfee/3316f0b508425a04f7f34baa8a7c79a1 to your computer and use it in GitHub Desktop.
private void AutoGenEntryDetailSequenceNumbers()
{
AchFile.Batches.ToList().ForEach(batch =>
{
var currentMaxSequenceNumber = batch.EntryDetails.Max(d => d.EntryDetailSequenceNumber);
batch.EntryDetails.OrderBy(d => d.EntryDetailSequenceNumber).ToList()
.ForEach(d => d.EntryDetailSequenceNumber = d.EntryDetailSequenceNumber ?? ++currentMaxSequenceNumber);
});
}
-----------------------
new:
private void AutoGenEntryDetailSequenceNumbers()
{
AchFile.Batches.ToList().ForEach(batch =>
{
var currentMaxSequenceNumber = 1;
batch.EntryDetails.ToList()
.ForEach(d =>
{
d.EntryDetailSequenceNumber = d.EntryDetailSequenceNumber ?? currentMaxSequenceNumber;
++currentMaxSequenceNumber;
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment