Click here to Skip to main content
12,511,920 members (42,836 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: SQL-server-2005 C# ASP.NET , +
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
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 28-May-12 1:03am
Updated 28-May-12 5:45am
Sangunni11.2K
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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
protected void Page_Load(object sender, EventArgs e)
    {
 
if(exist)
{
 button1.OnClientClick="return confirm('you have already timein .Do you want to timeout(punchout)?');"
}
}
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160929.1 | Last Updated 28 May 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100