I can't - there are so many of them, and for a complete beginner I really don't know - I came to C# from C++, and all the way back to assembler, so I started with knowledge you don't have and the books I used presummed that knowledge. Anything called step-by-step is probably a good starting point!
Don't think of it in C# terms: try to think "How would I do this if it was on a piece of paper?"
I would:
Call this "The List":
Enroll No,194,date2,30/4/2009,time2,0:3:38,Check Out
Enroll No,78,date2,30/4/2009,time2,0:3:43,Check Out
Enroll No,78,date1,30/4/2009,time1,9:44:47,Check In
Enroll No,107,date1,30/4/2009,time1,9:44:52,Check In
Enroll No,108,date1,30/4/2009,time1,9:57:39,Check In
Enroll No,106,date1,30/4/2009,time1,10:40:47,Check In
Enroll No,109,date1,30/4/2009,time1,15:23:30,Check In
Enroll No,107,date2,30/4/2009,time2,17:6:27,Check Out
Enroll No,194,date1,30/4/2009,time1,17:9:44,Check In
Enroll No,132,date1,30/4/2009,time1,17:32:19,Check In
Enroll No,106,date2,30/4/2009,time2,17:35:31,Check Out
Enroll No,78,date2,30/4/2009,time2,17:35:41,Check Out
Enroll No,132,date1,30/4/2009,time1,17:45:2,Check In
Enroll No,108,date2,30/4/2009,time2,18:33:18,Check Out
Enroll No,109,date2,30/4/2009,time2,22:30:18,Check Out
Enroll No,194,date2,1/5/2009,time2,0:4:18,Check Out
Enroll No,132,date2,1/5/2009,time2,0:4:29,Check Out
Get a blank sheet of paper, and a pen.
Look at the first line of the list, make a note of the Enroll number (194).
Beside this, I would write the date and time (30/4/2009 @ 0:3:38) and that this was a check out.
Look at the next line, and do the same. If the Enroll number is already on my piece of paper, then I would add the information to that, otherwise note it down separately.
Continue through the list doing all the lines.
I would then have:
Enroll No194 30/4/2009 @ 0: 3:38,Check Out
Enroll No194 30/4/2009 @ 17: 9:44,Check In
Enroll No194 1/5/2009 @ 0: 4:18,Check Out
Enroll No132 30/4/2009 @ 17:32:19,Check In
Enroll No132 30/4/2009 @ 17:45: 2,Check In
Enroll No132 1/5/2009 @ 0: 4:29,Check Out
Enroll No109 30/4/2009 @ 15:23:30,Check In
Enroll No109 30/4/2009 @ 22:30:18,Check Out
Enroll No108 30/4/2009 @ 9:57:39,Check In
Enroll No108 30/4/2009 @ 18:33:18,Check Out
Enroll No107 30/4/2009 @ 9:44:52,Check In
Enroll No107 30/4/2009 @ 17: 6:27,Check Out
Enroll No106 30/4/2009 @ 10:40:47,Check In
Enroll No106 30/4/2009 @ 17:35:31,Check Out
Enroll No 78 30/4/2009 @ 0: 3:43,Check Out
Enroll No 78 30/4/2009 @ 9:44:47,Check In
Enroll No 78 30/4/2009 @ 17:35:41,Check Out
Now it is easy to see that:
No194 Checked in on 30/4/2009 @ 17: 9:44 and out on 1/5/2009 @ 0: 4:18
so he/she was checked in for some 7 hours.
No132 Checked in on 30/4/2009 @ 17:45: 2 and out on 1/5/2009 @ 0: 4:29
so they were in for 6 1/4 hours or so.
All you have to do is translate that into the C# instructions you do know! I can't tell you what those instructions are because I don't know what instructions you do know - please, do not give me a list. Just have a try, it doesn't have to be good (or even work properly to start with) - you obviously know more than you think, since you are correctly using DateTime and TimeSpan structures already!
Post up what you come up with, and I'm sure we can get it working together.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|