使用集合捕获员工时间
我想创建一个时间表应用程序,我需要一个应用程序来收集登录用户在特定日期工作的小时数的数据。
用户将需要登录一个应用程序,该应用程序将捕获他们的凭据和员工 ID。
用户将看到一个表格,其中列出了一周中的几天以及用于输入时间(十进制)的相应文本框。下表是我对参赛表格的设想(基本)。
周一周二周三周四周五周六周日 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
我需要将信息存储在一个表中,我需要在其中存储: 入职日期 (DateTime) 工作日期 EmpID (Int) 员工 ID RptHours(十进制) 工作小时数
我正在尝试设计流程,以便简化流程并易于交互。当前的流程将是: 1. 读取当前登录用户报告的时间和日期的表格 2. 显示本周的日期 3. 显示工作时间(截至目前已报告的天数)。 4.允许用户输入/编辑数据(文本框) 5. 将数据保存回表中。
这个数据结构表明它应该是一个类,但是我的问题是我不确定如何设计一个类来允许我访问一周中所有 7 天的信息。我知道我可以使用数组来执行此操作,但我认为实现一个类会更专业,并且有机会学习。
我相当确定我会使用集合(如列表),但是我没有看到可以访问和修改日期和日期的解决方案。一段时间(7 天)的次数。
我正在使用 C#。谁能帮我朝正确的方向推(踢裤子)?我将不胜感激任何帮助和见解。
谢谢 射线
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将有一个
Employee
类,其中包含员工 ID、姓名等信息。然后我将有一个WorkingInfo
(或类似)类,它具有以下属性:员工
、日期
、开始时间
、结束时间
。然后您就有了一个List
集合。要计算员工的工作时间,您可以使用
TimeSpan
类来获取Start
和EndTime
属性之间的差异。I would have a class for
Employee
which has information like their employee ID, name, etc. Then I would have aWorkingInfo
(or similar) class which has the following properties:Employee
,Date
,StartTime
,EndTime
. You then have aList<WorkingInfo>
collection.To calculate how long the employee worked, you would use the
TimeSpan
class to get the difference between yourStart
andEndTime
properties.