473,473 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Timeclock application

145 New Member
I have a web form where I am about to put 4 buttons (time in, lunch out, lunch in, time out). When an emploee good enough and click all 4 buttons in a day then system should only create 2 records. (time in and time out goes together in a same record)

1. Employee will come in the morning and click on Time In button.
>>> Good, Simple insert into table
2. Employee will click on Lunch Out button.
>>> need to make sure my UPDATE (not insert) is updating the moring record when employee timed in.
3. Employee will clock in upon arriving from Lunch "Lunch In".
>>> Another insert statement however I need to make sure the prior record has lunch out punched in and also calculate hours and plug it in the first record. If "lunch out" is missing then flag the record (update status column "AUDIT") and display a message (response.write "something")
4. time out. Very critical. an employee may be going home early so he/she is not taking lunch. so "time out" then should check whether employee has a record with time in only and no time out and then update the record with the new time out value. another scenerio, employee took lunch but forgot to lunch out, and came back and just did lunch in. in that case you will have 2 records both with time in value populated and time out value empty. in that case the lunch in record's timeout column will be update.

I hope this makes sense. I need few ideas where should I write these business logic. In sql server or .net (create a class with bool factor and create object out of it). LOST. PLEASE suggest.
Jun 19 '09 #1
9 4730
tlhintoq
3,525 Recognized Expert Specialist
I do desktop apps, not web apps so this may be useless but...

I did a security app that included a digital camera and employee badge readers. It had to have the same sort of thing, plus photos at clock-in and out as theft prevention. No buttons, just a reader for 'in' and a reader for 'out'. It was client/server not web.

In that case the clients just reported the times to the server, to do all the heavy thinking.
Jun 19 '09 #2
dorandoran
145 New Member
Thanks for your respond. Can you please share some code related to the business logic I posted? Also, client wants web based due to maintenance reasons.
Again, Thanks
Jun 19 '09 #3
dorandoran
145 New Member
so far i have this but it has some serious glitch.

Expand|Select|Wrap|Line Numbers
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5. alter PROCEDURE [dbo].[sp_timeOut] 
  6.     -- Add the parameters for the stored procedure here
  7. @emp_id int,
  8. @clocking_date datetime,
  9. @time_out datetime,
  10. @record_status varchar(15),
  11. @rec_operator varchar(30)
  12.  
  13. AS
  14. BEGIN
  15.     -- SET NOCOUNT ON added to prevent extra result sets from
  16.     -- interfering with SELECT statements.
  17.     SET NOCOUNT ON;
  18.  
  19.     -- Insert statements for procedure here
  20.  
  21.  
  22. IF EXISTS(
  23. select * from clocking_details
  24. where emp_id=@emp_id and clocking_date = @clocking_date and time_out is null
  25. )
  26.     IF(select count(1)  from clocking_details
  27.         where emp_id=@emp_id and 
  28.         clocking_date = @clocking_date and time_out is null) =1
  29.         update clocking_details
  30.         set time_out=@time_out
  31.         where (emp_id=@emp_id and clocking_date = @clocking_date and time_out is null)
  32.     ELSE
  33.     IF(select count(1)  from clocking_details
  34.         where emp_id=@emp_id and 
  35.         clocking_date = @clocking_date and time_out is null) >1
  36.         update clocking_details
  37.         set time_out=@time_out
  38.         where DETAIL_NUMBER = (SELECT MAX(DETAIL_NUMBER) FROM CLOCKING_DETAILS
  39.         where emp_id=@emp_id and clocking_date = @clocking_date    and time_out is null)
  40.     RETURN
  41.  
  42.  
  43. END
Jun 19 '09 #4
tlhintoq
3,525 Recognized Expert Specialist
@tlhintoq
I'm afraid not: Its production code and in place at a customer site. My boss is really particular about such things.

Besides, it probably wouldn't do much good. There is no database to query along the format you have in your example.
Jun 19 '09 #5
dorandoran
145 New Member
That's kool. I was just going to get an idea. But it's kool. I am progressing.

Thanks.....
Jun 19 '09 #6
Frinavale
9,735 Recognized Expert Moderator Expert
What database management system are you using?

I would recommend creating all of your stored procedures before attempting to do the web portion of the application. You should test them thoroughly before using them in your app.
Jun 19 '09 #7
Frinavale
9,735 Recognized Expert Moderator Expert
@tlhintoq
I do that every day :)
For the web even :)
Jun 19 '09 #8
dorandoran
145 New Member
Only 2 buttons are required: PunchIn and PunchOut.

The table would look something like this.

Expand|Select|Wrap|Line Numbers
  1. PunchCard
  2. ----------
  3. Id (PK)
  4. UserId (FK)
  5. TimeIn
  6. TimeOut
  7.  
the logic would be simple.

Expand|Select|Wrap|Line Numbers
  1. sqlCommand.CommandText = @"select count(1) from PunchCard where UserId = @user and TimeOut is null";
  2. //set user id
  3. var result = (int)sqlCommand.ExecuteScalar();
  4. PunchInButton.Enabled = result == 0;
  5. PunchOutButton.Enabled = result == 1;
Jun 19 '09 #9
r035198x
13,262 MVP
Why should there be two records?
Why not just one record for the whole process and have the four columns time in, lunch out, lunch in and time out in the table?
Jun 24 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: J. Baute | last post by:
I'm caching data in the Application object to speed up certain pages on a website The main reason is that the retrieval of this data takes quite a while (a few seconds) and fetching the same data...
3
by: Amit Dedhia | last post by:
Hi I am developing a Dot net application (involving image processing) on a uni processor. It works well on my machine. I then take all my code on a multi processor, build and run the application...
6
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
20
by: Peter Oliphant | last post by:
How does one launch multiple forms in an application? Using Photoshop as an example, this application seems to be composed of many 'disjoint' forms. Yet, they all seem somewhat 'active' in...
6
by: Josef Brunner | last post by:
Hi, I published my application (VS 2005) and am now trying to install it when I get this error message. It worked before...even on a different machine. Here is the detailed description: ...
9
by: jeff | last post by:
Hi All. I realize that when my Deployed winforms application starts, Windows needs to load the .net 2 framework before control is given to my application.... Is there anyway to either ... -...
3
by: asadikhan | last post by:
Hi, I have written a windows application with a GUI (let's call it MENU). I own the code for this application and have access to it. We have another application that is a third-part windows...
2
by: Michael Kalika | last post by:
Hi, We have developed a VSTO 2005 Excel application and we would like to leverage ClickOnce deployment mechanism for distribution of this application. How can we do that? I was digging in MSDN...
0
by: Tifer | last post by:
Hello, I am building my first .Net Application. The first couple of Publish and Installs I did went fine. But after a couple of builds, I get a modal dialogue box error every time upon trying...
0
by: =?Utf-8?B?SkhhbGV5?= | last post by:
Our system is: IIS Server: dual Intel Xeon 2.80 GHz, 4 GB Ram Windows Server 2003 SP2 IIS 6.0 SQL Server: dual Intel Xeon 2.80 GHz, 4 GB Ram (separate server) Windows Server 2003 SP2 SQL...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.