views:

19

answers:

1

I want to create a timesheet application where I need an application that will collect data from the logged in user regarding the number of hours they worked on a specific date.

The user will be required to log into an application which will capture their credentials and employee ID.

Users will be presented with a form that will list the days of the week and a corresponding textbox for entering their hours (decimal). The following table is my vision of the entry form (basic).

Mon Tue Wed Thu Fri Sat Sun 9/6 9/7 9/8 9/9 9/10 9/11 9/12 0.00 0.00 0.00 0.00 0.00 0.00 0.00

I will need to store the information in a table where I will need to store: Entry Date (DateTime) The date worked EmpID (Int) The Employee’s ID RptHours (Decimal) The number of hours worked

I am attempting to design the process that so that it will be streamlined and easy to interface. The current process will be: 1. Read table for reported hours and dates for the current logged in user 2. Display the dates for the current week 3. Display the hours worked (for the days that have been reported to date). 4. Allow the user to enter/edit data (textbox) 5. Save the data back to the table.

This data structure sticks out that it should be a class however my problem is that I am uncertain how to design a class which will allow me to access the information for all seven days of the week. I know that I can perform this using an array however I think that implementing a class will be more professional as well as a chance to learn.

I am fairly certain that I would use a collection (like List) however I am not seeing the solution where I can access and modify dates & times for a time period (7 days).

I am using C#. Can anyone give me a push (kick in the pants) in the right direction? I will appreciate any help and insight.

Thanks Ray

A: 

I would have a class for Employee which has information like their employee ID, name, etc. Then I would have a WorkingInfo (or similar) class which has the following properties: Employee, Date, StartTime, EndTime. You then have a List<WorkingInfo> collection.

To calculate how long the employee worked, you would use the TimeSpan class to get the difference between your Start and EndTime properties.

Stu