/// <summary> /// Pathfinder Class constructor, saves the passed G grid in Grid and a new instance of SortByF in Sort. /// </summary> public wszpathfinder(List <wszpathfindernode> G) { Grid = G; // Initialize the Grid. Sort = new SortByF(); // Initialize the IComparer. }
/// <summary> /// Pathfinder Class constructor, saves the passed G grid in Grid and a new instance of SortByF in Sort. /// </summary> public Pathfinder(List <PathfinderNode> G) { Grid = G; // Initialize the Grid. Sort = new SortByF(); // Initialize the IComparer. }
public async Task <ActionResult> DisplayReportF(SortByF Sort) { List <AppUser> users = await GetAllEmployees(); List <AppUser> employeeswReviews = new List <AppUser>(); AppUser aa = new AppUser(); _db.Add(aa); _db.SaveChanges(); foreach (AppUser ui in users) { AppUser a = _db.Users.Include(u => u.ReviewsApproved).FirstOrDefault(u => u.UserName == ui.UserName); if (a.ReviewsApproved.Count() != 0) { employeeswReviews.Add(a); } } var query = from u in employeeswReviews select u; List <AppUser> users1 = query.ToList(); foreach (AppUser use in users1) { int ReviewsApproved = 0; int ReviewsRejected = 0; List <Review> revs = _db.Reviews.Where(u => u.Approver.UserName == use.UserName).ToList(); foreach (Review rev in revs) { if (rev.Rejected == true) { ReviewsRejected++; } ReviewsApproved++; } use.NumReviewsApproved = ReviewsApproved; use.NumReviewsRejected = ReviewsRejected; } switch (Sort) { case SortByF.EmpID: return(View("ReportFResults", users1.OrderBy(o => o.UserName))); case SortByF.AppAsc: return(View("ReportFResults", users1.OrderBy(o => o.NumReviewsApproved))); case SortByF.AppDesc: return(View("ReportFResults", users1.OrderByDescending(o => o.NumReviewsApproved))); case SortByF.RejAsc: return(View("ReportFResults", users1.OrderBy(o => o.NumReviewsRejected))); case SortByF.RejDesc: return(View("ReportFResults", users1.OrderByDescending(o => o.NumReviewsRejected))); } return(View("ReportFResults", users1)); //if (PMOrder == Orderofresults.Ascending) //{ // query = query.OrderBy(o => o.ProfitMargin); //} //else //{ // query = query.OrderByDescending(o => o.ProfitMargin); //} //if (PriceOrder == Orderofresults.Ascending) //{ // query = query.OrderBy(o => o.TotalRev); //} //else //{ // query = query.OrderByDescending(o => o.TotalRev); //} //List<AppUser> users1 = query.ToList(); //foreach (AppUser use in users1) //{ // int ReviewsApproved = 0; // int ReviewsRejected = 0; // List<Review> revs = _db.Reviews.Where(u => u.Approver.UserName == use.UserName).ToList(); // foreach (Review rev in revs) // { // if (rev.Rejected == true) // { // ReviewsRejected++; // } // ReviewsApproved++; // } // use.NumReviewsApproved = ReviewsApproved; // use.NumReviewsRejected = ReviewsRejected; //} //return View("ReportFResults", users1); }