public DataGridView MemberAssignmentBox(DataGridView data, Member selectedMember) { List <Assignment> assignments = manager.AssignmentsByCongregationId(selectedMember.CongregationId); List <MemberAssignment> ma = manager.MemberAssignmentsByMemberId(selectedMember.Id); data.Rows.Clear(); data.Refresh(); foreach (Assignment a in assignments) { bool isAssigned; if (ma.Any(z => z.AssignmentId == a.Id)) { isAssigned = true; } else { isAssigned = false; } data.Rows.Add(a.Id.ToString(), a.PositionOnSchedule, isAssigned, a.Label, a.Description, a.AmountPerMeeting); } data.Sort(data.Columns["SchedulePosition"], System.ComponentModel.ListSortDirection.Ascending); return(data); }