Created
March 31, 2021 19:17
-
-
Save patrick711/bea38c39e1324c20cae5c56cddba6e9f to your computer and use it in GitHub Desktop.
IEnumerables: Scenario I
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
public void Test() | |
{ | |
//Method I | |
var soLineSplitsLinkedWithCurrentPO = | |
SelectFrom<SOLineSplit> | |
.Where<SOLineSplit.pOType.IsEqual<@P.AsString.ASCII>.And<SOLineSplit.pONbr.IsEqual<@P.AsString>>> | |
.AggregateTo<GroupBy<SOLineSplit.orderType>, GroupBy<SOLineSplit.orderNbr>> | |
.View.Select(this, row.OrderType, row.OrderNbr); | |
foreach (var item in soLineSplitsLinkedWithCurrentPO) | |
{ } | |
//Method II | |
var lines = SelectFrom<SOLineSplit> | |
.Where<SOLineSplit.pOType.IsEqual<@P.AsString.ASCII>.And<SOLineSplit.pONbr.IsEqual<@P.AsString>>> | |
.View.Select(this, row.OrderType, row.OrderNbr).RowCast<SOLine>().ToList(); | |
var groupedby = lines.GroupBy(x => new {x.OrderType, x.OrderNbr}); | |
var warehouse_count = lines.Select(l => l.SiteID).Distinct().Count(); | |
foreach (var item in groupedby) | |
{ | |
var subgroup = lines.Where(x => x.OrderType == item.Key.OrderType && x.OrderNbr == item.Key.OrderNbr); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment