rahul ahuja

rahul ahuja

  • NA
  • 80
  • 35.8k

Highlight the overlap records in the list

Jul 30 2014 4:27 PM
I have list of  ItemFileRecords which contains records like following. I want to find out which records overlap with other record range using LINQ and aslo highlight record which overlap in the grid

SR|File_ID | Item_code | start_page | End_page 
01|1        | 4319         | 1              | 10
02|1        | 4321         | 5              | 9
03|1        | 4321         | 11            | 15
04|1        | 4322         | 14            | 19
05|1        | 4323         | 20            |25
06|1        | 4324         | 26            | 30
07|1        | 4325         | 30            | 35       



SR|File_ID | Item_code | start_page | End_page 
01|1        | 4319         | 1              | 10              (Overlap with rec 2 change color to red)
02|1        | 4321         | 5              | 9                (Overlap with rec 1 change color to red)
03|1        | 4321         | 11            | 15               (Overlap with rec 4 change color to red)
04|1        | 4322         | 14            | 19               (Overlap with rec 3 change color to red)
05|1        | 4323         | 20            |25                        
06|1        | 4324         | 26            | 30                (overlap with rec 7 change color to red)
07|1        | 4325         | 30            | 35               (overlap with rec 6 change color to red)

I have with nested for loop but want to avoid nested for loop, 
If any know any other way to do this can suggest me 

Thanks.       



Answers (3)