Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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
Edited 28-May-12 5:45am
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
0 Sergey Alexandrovich Kryukov 483
1 OriginalGriff 333
2 Maciej Los 305
3 CHill60 220
4 manoj kumar choubey 184
0 OriginalGriff 6,367
1 Sergey Alexandrovich Kryukov 5,296
2 Maciej Los 3,384
3 Peter Leow 3,259
4 DamithSL 2,490


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 28 May 2012
Copyright © CodeProject, 1999-2014
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