Last active
May 20, 2019 18:43
-
-
Save aconfee/3316f0b508425a04f7f34baa8a7c79a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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