public void SetSurnameStats(SurnameStats stat) { this.Text = "Individuals & Families whose surame is " + stat.Surname; SortableBindingList <IDisplayIndividual> dsInd = new SortableBindingList <IDisplayIndividual>(); Predicate <Individual> indSurnames = x => x.Surname.Equals(stat.Surname); foreach (Individual i in ft.AllIndividuals.Filter(indSurnames)) { dsInd.Add(i); } dgIndividuals.DataSource = dsInd; SortIndividuals(); dgIndividuals.Dock = DockStyle.Fill; Predicate <Family> famSurnames = x => x.ContainsSurname(stat.Surname); SortableBindingList <IDisplayFamily> dsFam = new SortableBindingList <IDisplayFamily>(); foreach (Family f in ft.AllFamilies.Filter(famSurnames)) { dsFam.Add(f); } dgFamilies.DataSource = dsFam; SortFamilies(); splitContainer.Panel2Collapsed = false; UpdateStatusCount(); }
public void SetSurnameStats(SurnameStats stat, bool ignoreCase) { Text = $"Individuals & Families whose surame is {stat.Surname}"; SortableBindingList <IDisplayIndividual> dsInd = new SortableBindingList <IDisplayIndividual>(); bool indSurnames(Individual x) => x.Surname.Equals(stat.Surname); foreach (Individual i in ft.AllIndividuals.Filter(indSurnames)) { dsInd.Add(i); } dgIndividuals.DataSource = dsInd; SortIndividuals(); dgIndividuals.Dock = DockStyle.Fill; bool famSurnames(Family x) => x.ContainsSurname(stat.Surname, ignoreCase); SortableBindingList <IDisplayFamily> dsFam = new SortableBindingList <IDisplayFamily>(); foreach (Family f in ft.AllFamilies.Filter(famSurnames)) { dsFam.Add(f); } dgFamilies.DataSource = dsFam; SortFamilies(); splitContainer.Panel2Collapsed = false; UpdateStatusCount(); }