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
Your Filters
Interested
Ignored
     
0 Shai Vashdi 1,448
1 Tadit Dash 270
2 OriginalGriff 223
3 Sergey Alexandrovich Kryukov 215
4 Peter Leow 180
0 Sergey Alexandrovich Kryukov 9,440
1 OriginalGriff 5,618
2 Peter Leow 4,280
3 Maciej Los 3,540
4 Abhinav S 3,363


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 28 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid