Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In attendance system,when I enter first time ,user name and password INTIME is calculated.When I enter second time a confirmation message box should be open and ask you have already time-in .Do you want to timeout(punch out)?
If I click 'yes' , timeout should be calculated and inserted into table. If I click 'no' no value inserted into row.

My Sql code is
SQL
ALTER PROCEDURE dbo.InOutRegisterSP
	
	(
	@loccation varchar(40),
	@name varchar(30),
	@password varchar(30),
	@remark varchar(50)
	)
	
AS
begin
declare @empcode int,@loccode int,@TimeIn datetime,@TimeOut datetime --declaration section
--select @empcode=EmpCode from MstUser where UserName=@name and UserPass=@password
if(exists(select @empcode=EmpCode from MstUser where UserName=@name and UserPass=@password))
begin
     if(exists(select max(TimeIn) from InOutRegister where PunchDate=getdate()and EmpCode=@empcode ))
     return 0;
     else
     begin
     select @loccode=LocCode from MstLocation where LocName=@loccation
     insert into InOutRegister values(@empcode,@loccode,getdate(),convert(varchar, getdate(), 8),'',@remark)
     end
end   
else
return -1;




	RETURN
	end
Posted
Updated 28-May-12 5:45am
v2

1 solution

when page loads
you should retrive information about intime entry exist or not
if exist then
add function of js to confirm this
if not exist then
no needed to add function and post your data direct

like
C#
protected void Page_Load(object sender, EventArgs e)
    {

if(exist)
{
 button1.OnClientClick="return confirm('you have already timein .Do you want to timeout(punchout)?');"
}
}
 
Share this answer
 

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