///<summary></summary> private void gridSubs_RightClickHelper(object sender, EventArgs e) { int index = gridSubs.GetSelectedIndex(); if (index == -1) //Should not happen, menu item is only enabled when exactly 1 row is selected. { return; } List <BugSubmission> listSubs; switch (((MenuItem)sender).Index) { case 0: //Open Submission listSubs = (List <BugSubmission>)gridSubs.ListGridRows[index].Tag; FormBugSubmission formBugSub = new FormBugSubmission(listSubs[0], _jobCur); formBugSub.Show(); break; case 1: //Open Bug listSubs = (List <BugSubmission>)gridSubs.ListGridRows[index].Tag; OpenBug(listSubs[0]); break; case 2: //Hide or Unhide submission listSubs = gridSubs.SelectedTags <List <BugSubmission> >().SelectMany(x => x.ToList()).ToList(); bool isHidden = (!listSubs.First().IsHidden); //Flip all grouped submissions based on what the user selected/sees in the grid. listSubs.ForEach(x => x.IsHidden = isHidden); BugSubmissions.UpdateMany(listSubs, "IsHidden"); FillSubGrid(true); break; case 3: //Link or Unlink bug listSubs = gridSubs.SelectedTags <List <BugSubmission> >().SelectMany(x => x.ToList()).ToList(); if (listSubs.First().BugId == 0) //Not linked to existing bug, so link { FormBugSearch formBS = new FormBugSearch(new Job()); if (formBS.ShowDialog() != DialogResult.OK) { return; } listSubs.ForEach(x => x.BugId = formBS.BugCur.BugId); BugSubmissionHashes.UpdateBugIds(listSubs, formBS.BugCur.BugId); } else //Unlink { listSubs.ForEach(x => x.BugId = 0); BugSubmissionHashes.UpdateBugIds(listSubs, 0); } BugSubmissions.UpdateMany(listSubs, "BugId"); FillSubGrid(true); break; } }
public static bool HideMatchedBugSubmissions() { List <BugSubmission> listAllSubs = BugSubmissions.GetAll(); List <BugSubmission> listToBeHiddenSubs = listAllSubs.Where(x => !x.IsHidden && listAllSubs.Any(y => y != x && y.ExceptionStackTrace == x.ExceptionStackTrace && y.IsHidden) ).ToList(); if (listToBeHiddenSubs.Count == 0) { return(false); } listToBeHiddenSubs.ForEach(x => x.IsHidden = true); BugSubmissions.UpdateMany(listToBeHiddenSubs, "IsHidden"); return(true); }