Employee timecard implementation: Need help for db select query

CLOSED
Bids
20
Avg Bid (USD)
$53
Project Budget (USD)
$30 - $100

Project Description:
Hello,
I am implementing basic employee time management functionality where I need your help in creating a data base query to
look up last action performed by the user. I have never done any SQL programming so your help would be appreciated.

My Table is: TimeCards

Id int primarykey,notnull
TimeStamp datetime notnull
Action tinyint not null,
User_Id int FK (User.Id, not null)


I have a class TimeCardEntry as below

class TimeCardEntry : IEntity
{
enum TimeCardAction
{
None = 0,
ClockIn = 1,
ClockOut = 2;
}
public TimeCardEntry(User user, TimeCardAction action)
{
_user = user;
Action = (int)action;
TimeStamp = DateTime.Now;
}
public int Id { get; set; }
public int Action { get; set;}
public DateTime TimeStamp { get; set;}
public User User { get { return _user; } set { _user = value; }

private User _user;
}



I need to retrieve a last entry from TimeCards table where

1. TimeCardEntry.User.Id
2. TimeCardEntry.TimeStamp > DateTime.Today (Basically last entry today 12:00 AM)

I tried following function but getting exception.

TimeCardEntry GetLastTimeCardEntry(User user)
{

var entry = Dbo.Select(x=> x, (x=> x.User.Id == user.Id && (DateTime.Compare(x.TimeStamp, DateTime.Today) > 0)).Last()

return entry;
}

Skills required:
Database Administration, MySQL, Software Architecture, SQL, Visual Basic
Hire latinpos
Project posted by:
latinpos United States
Verified
Public Clarification Board
Bids are hidden by the project creator. Log in as the project creator or as one of the bidders to view bids.
You will not be able to bid on this project if you are not qualified in one of the job categories. To see your qualifications click here.