Iterate Through List To New List And Then Run Logic

nbaylot46

New member
Joined
Apr 27, 2015
Messages
1
Programming Experience
Beginner
I was wondering if you could help me out on my project. I have a List called Jobs and a List called JobListOrder. List<Jobs> is where the original project information is stored. List<JobListOrder> is where I would like it to go into so that I can run some logic to get the EndTimes. I have been trying stuff out for weeks and I just got to this.
Here is the Jobs List

C#:
public class Jobs
        {
            public int JobNum { get; set; }
            public int Priority { get; set; }
            public DateTime DueDate { get; set; }
            public string WS1 { get; set; }
            public int Seq1 { get; set; }
            public string WS2 { get; set; }
            public int Seq2 { get; set; }
            public string WS3 { get; set; }
            public int Seq3 { get; set; }
            public string WS4 { get; set; }
            public int Seq4 { get; set; }
        }
What it looks like
C#:
new Jobs {JobNum = 1, Priority = 0, DueDate = DateTime.Today, WS1 = "Milling", Seq1 = 1, WS2 = "CNC", Seq2 = 1, WS3 = "Drilling", Seq3 = 1, WS4 = "Finish", Seq4 = 1 },
new Jobs {JobNum = 2, Priority = 0, DueDate = DateTime.Today, WS1 = "Milling", Seq1 = 2, WS2 = "Drilling", Seq2 = 1, WS3 = "Milling", Seq3 = 1, WS4 = "Finish", Seq4 = 1 },
new Jobs {JobNum = 3, Priority = 1, DueDate = DateTime.Today, WS1 = "Drilling", Seq1 = 1, WS2 = "CNC", Seq2 = 1, WS3 = "Milling", Seq3 = 1, WS4 = "Finish", Seq4 = 1 }
        };

Here is the JobListOrder
C#:
public class JobListOrder
       {
           public int JobNum { get; set; }
           public string Workstation { get; set; }
           public int Sequence { get; set; }
           public int ProcTime { get; set; }
           public int EndHour { get; set; }
           public DateTime StartTime { get; set; }
           public DateTime EndTime { get; set; }
       }

I would like the JobListOrder to look like this.
JobNumWorkstationSequenceProcTimeEndHourStartTimeEndTime
1Milling11CalculatedCalculatedCalculated
2Milling11CalculatedCalculatedCalculated
3Drilling11CalculatedCalculatedCalculated
1CNC21CalculatedCalculatedCalculated
2Drilling21CalculatedCalculatedCalculated
3CNC21CalculatedCalculatedCalculated
1Drilling31CalculatedCalculatedCalculated
2Milling31CalculatedCalculatedCalculated
3Milling31CalculatedCalculatedCalculated
1Finish41CalculatedCalculatedCalculated
2Finish41CalculatedCalculatedCalculated
3Finish41CalculatedCalculatedCalculated


Afterwards I wanna take the max of the current indexes JobNum (example Max of all Job 1's EndHour) and the max of the current indexes Workstation (example Max of all Milling EndHour) then add ProcTime to the max of JobNumMax and WorkstationMax and place it in EndHour.

 
Back
Top Bottom