Created
July 14, 2019 20:55
-
-
Save mitchgollub/19df2b01115bc13273f249e1d4927e40 to your computer and use it in GitHub Desktop.
c-sharp-and-csvs
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
foreach (var salesRep in salesReps) | |
{ | |
var summary = new SalesSummary { SalesRep = salesRep }; | |
var repTransactions = transactions.Where(x => x.SalesRep == salesRep); | |
summary.Y2DSold = repTransactions.Where(x => x.Date >= new DateTime(dateTimeNow.Year, 1, 1)) | |
.Select(x => CalculateTransaction(x)) | |
.Sum(); | |
summary.M2DSold = repTransactions.Where(x => x.Date >= new DateTime(dateTimeNow.Year, dateTimeNow.Month, 1)) | |
.Select(x => CalculateTransaction(x)) | |
.Sum(); | |
summary.Q2DSold = repTransactions.Where(x => GetQuarter(x.Date) == GetQuarter(dateTimeNow)) | |
.Select(x => CalculateTransaction(x)) | |
.Sum(); | |
summary.I2DSold = repTransactions | |
.Select(x => CalculateTransaction(x)) | |
.Sum(); | |
salesSummaries.Add(summary); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment