Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 4 Website Programming Problem Design Solution section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 2nd, 2015, 02:40 AM
Registered User
Points: 24, Level: 1
Points: 24, Level: 1 Points: 24, Level: 1 Points: 24, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2015
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Code for Call timer

I hardly understood this code, but what this essentially does is; In the code behind it calculates the timespan in milliseconds, and In the asp page, we call getSecs() function on load, which will calculate the call timer. (They want to capture, how much time a customer care associate is spending on the call, in HH:MM:SS format). When the application page loads it should be 00:00:00 and it should increment the timer as the time progress. We doesn't want to refresh the time, when we refresh the page or when we browse thru other tabs / windows. We do reset the time when we hit "New Trip" or "Close without Save" or "Clone trip" buttons, and after saving the trip. To rest the trip we use 3 lines in below if condition. This code doesn't seem to be working all the time, we get some negative hours, and incorrect minutes at times, not sure what is the issue.. can you please look into it, when you get some time.. if you could rewrite the code or point me to right direction, that would be really helpful.

In the code behind we are using this code

if (Session["calltimer"] == null)
TimeSpan t = (DateTime.Now - new DateTime(1970, 01, 01).AddMilliseconds(0));
Session["calltimer"] = (Int64)(t.TotalMilliseconds + 0.5);
txtstarttimeforcurrentcall.Text = Session["calltimer"].ToString();
txtstarttimeforcurrentcall.Text = Session["calltimer"].ToString();

Onload we are using this code....

function getSecs() {
var myTime1 = new Date();
var numCurrTimer = document.getElementById('txtstarttimeforcurrentcal l').value;
strSS = (Math.round((myTime1.getTime() - numCurrTimer) / 1000)) % 60;
strMin = Math.round((Math.round((myTime1.getTime() - numCurrTimer) / 1000) - 30) / 60) % 60;
strHR = Math.ceil(((Math.round((myTime1.getTime() - numCurrTimer) / 1000)) / 60) / 60) - 9;
if (strHR == -1) strHR = 0;
strHR = "0" + strHR;
strMin = strMin + "";
strSS = strSS + "";
if ((strMin.length) == 1) strMin = "0" + strMin;
if ((strSS.length) == 1) strSS = "0" + strSS;
document.getElementById("txtCurrentCall").value = strHR + ":" + strMin + ":" + strSS;
window.setTimeout('getSecs()', 1000);
Reply With Quote

Watch Furious 7 Online

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code for Call timer ravikiran1976 BOOK: ASP.NET 4 Website Programming Problem Design Solution 0 April 6th, 2011 12:53 AM
Button code to call URL Zozozo BOOK: Beginning ASP 3.0 0 June 11th, 2007 08:06 AM
call activex from jsp code missneg JSP Basics 1 January 24th, 2007 03:07 AM
call activex from jsp code missneg Pro JSP 0 May 3rd, 2006 03:27 AM
Call code from page mushu Excel VBA 0 September 21st, 2004 10:04 AM

All times are GMT -4. The time now is 03:26 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.