员工出勤管理 [英] employee attendance management

查看:56
本文介绍了员工出勤管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将使用ASP.NET设计员工出勤提醒器,以跟踪
员工的登录时间,注销时间和日期,即访问网站时的用户
它询问登录详细信息(用户名和密码).如果是正确的用户
进入第二个屏幕并单击按钮,然后单击按钮
自动保存当前日期和时间.使用ASP.NET和in
同样的注销方式.
我需要
任何示例源代码.

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.

推荐答案

我认为您是asp.net的新手.首先学习基础知识,因此您可以点击此链接

http://www.aspnetbook.com/basics/aspnet_basics.php [ http://www.aspspider.com/tutorials/ [ http://www.asp.net/general/videos [
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[^]


如果您要张贴作业,请至少尝试进行看起来您尝试自己做某事!

我们不做您的作业:这是有原因的.在这里,您可以考虑自己被告知的内容,并尝试理解它.也可以在那里帮助您的导师识别您的弱点,并将更多的注意力放在补救措施上.

自己尝试一下,或者学一下神奇的话:您要用它炸薯条吗?"
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?"


//在登录页面中.
私有UserDataContext dc = new UserDataContext();

受保护的void Page_Load(对象发送者,EventArgs e)
{
字符串用户名= txtUsername.Text.Trim();//用于用户名的TextBox/登录控件
字符串密码= txtPassword.Text.Trim();//TextBox/登录密码.
bool loginIn = IsValidUser(用户名,密码);
if(loggedIn)

VisitTracker vistiTracker =(从dc中的c.VisitTracker中,其中c.sername ==用户名&& c.Passowrd ==密码选择c).FirstOrdefault();
vistiTracker.dateLogged = DateTime.Now();
FormsAuthenticationTicket票证=新FormsAuthenticationTicket(1,用户名,DateTime.Now(),DateTime.Now.AddMinutes(120),FormsAuthentication.FormsCookiePath);
Seesion ["sername"] =用户名;
}
其他
{
Response.Redirect("Login.aspx?msg =无效的帐户");
}
}
受保护的布尔IsValidUser(字符串用户名,字符串密码)
{
帐户account =(来自dc中的c.Accounts,其中c.Username == username&& c.Password == password选择c).FirstOrDefault();

if(account!= null)
返回true;
其他
返回false;
}

///在默认/首页上.有一个注销按钮.
私人用户名{
get {return Convert.ToString(ViewState ["username"]));}
设置{ViewState ["username"] =值;}
}
受保护的void Page_Load(对象发送者,EventArgs e)
{
if(!IsPostBack)
{
if(ViewState ["username"]!= null)
{
用户名= Convert.ToString(ViewState [用户名"]));
}
}
}
btnLoggout_Clicked(对象发送者,EventArgs e)
{

FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
VisitTracker vistiTracker =(从dc中的c.VisitTracker中,其中c.username ==用户名c.Passowrd ==密码选择c).FirstOrdefault();
vistiTracker.SignoutDate = DateTime.Now();
dc.SubmitChanges();
}

///Webconfig

< authentication mode =表单">
< forms defaulturl ="Default.aspx" loginurl =〜/Login.aspx">
timeout ="60">





//////员工出勤页面
命名空间{
私有UserDataContext dc = new UserDataContext();

受保护的void Page_Load(对象发送者,EventArgs e)
{
if(!IsPostback)
{
PopulateGridWithUserTimes();
}

}
受保护的void PopulateGridWithUserTimes()
{//您的网格必须具有以下列:用户名,LoginTime,LogOutTime
var list =(从dc中的c.VisitTracker中选择c).ToList();
userGrid.DataSource =列表;
userGird.DataBind();
}

}
// 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();
}

}


这篇关于员工出勤管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆