Skip to content

Instantly share code, notes, and snippets.

@thePunderWoman
Created November 1, 2012 18:55
Show Gist options
  • Save thePunderWoman/3995712 to your computer and use it in GitHub Desktop.
Save thePunderWoman/3995712 to your computer and use it in GitHub Desktop.
PIES REport stuff
List<Part> parts = new List<Part>();
int partcount = db.CustomerReportParts.Where(x => x.customerID.Equals(customerID)).Select(x => x.partID).Count();
if (start == null) {
if (partcount == 0) {
parts = db.Parts.OrderBy(x => x.partID).ToList<Part>();
} else {
parts = (from p in db.Parts
join crp in db.CustomerReportParts on p.partID equals crp.partID
orderby p.partID
select p).ToList<Part>();
}
} else {
if (partcount == 0) {
parts = db.Parts.Where(x => x.dateModified >= start).OrderBy(x => x.partID).ToList<Part>();
} else {
parts = (from p in db.Parts
join crp in db.CustomerReportParts on p.partID equals crp.partID
where p.dateModified >= start
orderby p.partID
select p).ToList<Part>();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment