Employee timecard implementation: Need help for db select query

This project received 20 bids from talented freelancers with an average bid price of $53 USD.

Get free quotes for a project like this
Employer working
Project Budget
Total Bids
Project Description

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 ([url removed, login to view], 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 = [url removed, login to view];
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. [url removed, login to view]
2. [url removed, login to view] > [url removed, login to view] (Basically last entry today 12:00 AM)

I tried following function but getting exception.

TimeCardEntry GetLastTimeCardEntry(User user)

var entry = [url removed, login to view](x=> x, (x=> [url removed, login to view] == [url removed, login to view] && ([url removed, login to view]([url removed, login to view], [url removed, login to view]) > 0)).Last()

return entry;

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online