我正在开发一种考勤系统,其中通过单击按钮登录和标记出席情况,将记录插入数据库(包括今天日期)按钮后看不到,但是当用户再次登录时再次显示,用户可以再次标记出席情况。该用户即使每天再次登录也只能一天单击一次?
if (present.Checked)
{
btnattendance.Visible = false;
lblattend.Text = "Attendance has been Marked Succsessully" + " " + dateofclass1;
return status1 = "Present";
}
else
{
btnattendance.Visible = false;
lblattend.Text = "Leave Request has been sent to Admin" + " " + dateofclass1;
return status1 = "Leave";
}
答案 0 :(得分:2)
这就是我要做的:
disabled
状态)。检查时间是否早于24小时
var lastClickedOn = ...; // The time from the database.
var now = DateTime.Now;
// Check if the click time is more than, or exactly, 24 hours ago.
if (lastClickedOn <= now.AddHours(-24))
{
// Hide/disable the button
}
答案 1 :(得分:0)