private List <DataGridViewRow> GetMatchingRows(SortBy sortingOrder) { List <DataGridViewRow> rows = new List <DataGridViewRow>(); List <SubnetLevel> subnets = projectLevel.Subnets; EngineeringCompare.Sort(subnets, sortingOrder); subnets.ForEach(sn => { EngineeringCompare.Sort(sn.IoSystems, sortingOrder); sn.IoSystems.ForEach(ioSystemLvl => { rows.Add(IoControllerRow(ioSystemLvl)); EngineeringCompare.Sort(ioSystemLvl.IoDevices, sortingOrder); ioSystemLvl.IoDevices.ForEach(iod => { rows.Add(IoDeviceRow(iod, ioSystemLvl)); }); }); EngineeringCompare.Sort(sn.SubnetLvlDevItems, sortingOrder); sn.SubnetLvlDevItems.ForEach(sdi => { rows.Add(SubnetDeviceRow(sdi)); }); }); EngineeringCompare.Sort(projectLevel.UnusedDeviceItems, sortingOrder); projectLevel.UnusedDeviceItems.ForEach(udi => { rows.Add(UnusedDeviceRow(udi)); }); return(rows); }
private List <DataGridViewRow> GetMatchingRows(SortBy sortingOrder, string searchText) { List <DataGridViewRow> rows = new List <DataGridViewRow>(); List <SubnetLevel> subnets = projectLevel.Subnets; EngineeringCompare.Sort(subnets, sortingOrder); subnets.ForEach(sn => { EngineeringCompare.Sort(sn.IoSystems, sortingOrder); sn.IoSystems.ForEach(ioSystemLvl => { List <DataGridViewRow> ioDevicesRows = new List <DataGridViewRow>(); DataGridViewRow ioControllerRow = IoControllerRow(ioSystemLvl); EngineeringCompare.Sort(ioSystemLvl.IoDevices, sortingOrder); ioSystemLvl.IoDevices.ForEach(iod => { DataGridViewRow ioDeviceRow = IoDeviceRow(iod, ioSystemLvl); if (ContainsSearchText(ioDeviceRow, searchText)) { ioDevicesRows.Add(ioDeviceRow); } }); if (ContainsSearchText(ioControllerRow, searchText) | ioDevicesRows.Count != 0) { rows.Add(ioControllerRow); rows.AddRange(ioDevicesRows); } }); EngineeringCompare.Sort(sn.SubnetLvlDevItems, sortingOrder); sn.SubnetLvlDevItems.ForEach(sdi => { DataGridViewRow subnetDeviceRow = SubnetDeviceRow(sdi); if (ContainsSearchText(subnetDeviceRow, searchText)) { rows.Add(subnetDeviceRow); } }); }); EngineeringCompare.Sort(projectLevel.UnusedDeviceItems, sortingOrder); projectLevel.UnusedDeviceItems.ForEach(udi => { DataGridViewRow unusedDeviceRow = UnusedDeviceRow(udi); if (ContainsSearchText(unusedDeviceRow, searchText)) { rows.Add(unusedDeviceRow); } }); return(rows); }