Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am going to design employee attendance regiter using ASP.NET, to track the
employees login time, logout time with date, i.e user when access the site
it asks for login details (user name and password). if it is correct user
enter the second screen and clicks the button, after clicking the button
automatically current time with date has to be stored. using ASP.NET and in
the same way the logout also.
I need
any sample source code.
Posted
Comments
[no name] 13-Sep-11 3:39am    
use google for it
Herman<T>.Instance 13-Sep-11 3:56am    
www.google.com

I think you are new in asp.net. First learn basics so you follow this link

http://www.aspnetbook.com/basics/aspnet_basics.php[^]

http://www.aspspider.com/tutorials/[^]

http://www.asp.net/general/videos[^]
 
Share this answer
 
If you are going to post your homework, at least try to make it look like you have attempted to do something yourself!

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, or learn the Magic Words: "Do you want fries with that?"
 
Share this answer
 
Comments
rkthiyagarajan 13-Sep-11 3:44am    
Nice Griff
// inside login page.
private UserDataContext dc = new UserDataContext();

protected void Page_Load(object sender, EventArgs e)
{
string username = txtUsername.Text.Trim();// TextBox/login control for username
string password = txtPassword.Text.Trim();// TextBox/loginfor password.
bool loggedIn = IsValidUser(username,password);
if(loggedIn)

VisitTracker vistiTracker= (from c in dc.VisitTracker where c.sername==username && c.Passowrd == password select c).FirstOrdefault();
vistiTracker.dateLogged=DateTime.Now();
FormsAuthenticationTicket ticket = New FormsAuthenticationTicket(1,username, DateTime.Now(),DateTime.Now.AddMinutes(120),FormsAuthentication.FormsCookiePath);
Seesion["sername"] = username;
}
else
{
Response.Redirect("Login.aspx?msg=Invalid Account");
}
}
protected bool IsValidUser(string username, string password)
{
Account account = (from c in dc.Accounts where c.Username==username && c.Password==password select c).FirstOrDefault();

if(account !=null)
return true;
else
return false;
}

/// on default/Home page. have a logout button.
private Username{
get{return Convert.ToString(ViewState["username"]);}
set {ViewState["username"] = value;}
}
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
if(ViewState["username"]!=null)
{
Username = Convert.ToString(ViewState["username"]);
}
}
}
btnLoggout_Clicked(object sender, EventArgs e)
{

FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
VisitTracker vistiTracker= (from c in dc.VisitTracker where c.username==Username c.Passowrd == password select c).FirstOrdefault();
vistiTracker.SignoutDate=DateTime.Now();
dc.SubmitChanges();
}

///Webconfig

<authentication mode="Forms">
<forms defaulturl="Default.aspx" loginurl="~/Login.aspx">
timeout="60">





/////Employee Attandance Page
NameSpace{
private UserDataContext dc = new UserDataContext();

protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostback)
{
PopulateGridWithUserTimes();
}

}
protected void PopulateGridWithUserTimes()
{// Your grid must have columns: username, LoginTime, LogOutTime
var list = (from c in dc.VisitTracker select c).ToList();
userGrid.DataSource = list;
userGird.DataBind();
}

}
 
Share this answer
 
Comments
jayanthik 14-Sep-11 7:56am    
tx so much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900