I have a text file which I parse and load parsed results into a collection. I have completed the parsing and have loaded the results into a collection object.
public class Results
{
List<Node> nodes = new List<Node>();
}
public class Node
{
public int id {get;set;}
public DateTime initiationDateTime {get;set;}
}
The next step is to iterate through each list item and if the timestamp difference is more than 30 minutes from the previous minimum date/time then it will be stored as a user selection. for instance from the following recordset the users will view the following choices in the form of checboxes. All I am trying to figure out is how to form the user selection list. Once I show the user selection list to the user, they will re-post the page with their selections and based on the date ranges I will process the records within a selected date range.
User Choices:
1/12/2012 10:09 - 1/12/2012 10:49
1/12/2012 13:25 - 1/12/2012 13:26
1/12/2012 15:30
Parsed List:
ID Test Initiation InitiationChoice CompletionChoice
1 1/12/2012 10:09 Yes
2 1/12/2012 10:09
3 1/12/2012 10:09
4 1/12/2012 10:09
5 1/12/2012 10:09
6 1/12/2012 10:09
7 1/12/2012 10:48
8 1/12/2012 10:48
9 1/12/2012 10:49
10 1/12/2012 10:49
11 1/12/2012 10:49
12 1/12/2012 10:49 Yes
13 1/12/2012 13:25 Yes
14 1/12/2012 13:25
15 1/12/2012 13:25
16 1/12/2012 13:25
17 1/12/2012 13:26
18 1/12/2012 13:26 Yes
19 1/12/2012 15:30 Yes
The following is my attempt to create the users choices, Would appreciate suggestions on this
//First Minimum Date to start as i have already sorted this list based on date.
minimumDateTime = lf.Nodes.ElementAt(0).InitiationDate;
foreach (Node rb in lf.Nodes)
{
TimeSpan intervalMinutes = rb.InitiationDate.Subtract(minimumDateTime);
UserConfirmationErrors confirmationRun = new UserConfirmationErrors();
if (intervalMinutes.TotalMinutes >= 30)
{
//New Minimum Date/Time
minimumDateTime = rb.InitiationDate;
}
}
I’d do this:
List<DateTime> minDatesList<SelectListItem>Thus, my pseudo example looks like this: