Last active
December 15, 2015 11:49
-
-
Save phatty/5255849 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var Records = context.Customers.Join(context.TransactionExchangeMoneys | |
, x => x.Cust_ID | |
, y => y.PayBy | |
, (x, y) => new { x, y }) | |
.Join(context.Products | |
, t=> t.y.ProductID | |
, p => p.ProductID | |
, (t,p) => new {t,p}) | |
.GroupBy(r => new { r.t.x.Cust_ID,r.t.x.UserNames ,r.t.x.EmailAddress_First,r.t.x.ShopName}) | |
.Select(g => new UserAndMoneyPaid | |
{ | |
Username = g.Key.UserNames, | |
Email = g.Key.EmailAddress_First, | |
ShopName = g.Key.ShopName, | |
TotalMoneyCollect = g.Sum(a=>a.p.MoneyReturnShop), | |
TotalMoneyPaid = g.Where(a=>a.t.y.ReturnMoney != null).Sum(a=>a.t.y.ReturnMoney) | |
}) | |
.OrderBy(o=>o.Username); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment