Latest developer linksBookmark and Share
 
HomeThis WeekTop MonthTop AlltimeSearchRegisterFAQ
  
 
Submit Your Link
Please login to submit your Link
 

Sum''ing up time stamps across multiple lines.

Posted: Jan/22/2011   By: nikhil   Points:15   Category: .NET  - ASP.Net    Views:107   Vote Up (0)   Vote Down (0)    

Hi all,

I am trying to analyse phone call durations for call center data but although I can get the relevant parts of the time stamps using datediff, I can't think of a good way to add up all the hours, minutes, seconds, hence if I have 120 seconds then that would become 2 mintues and I would add that to the minute column and hence the same thing with minute, when I get to 60 minutes that becomes an hour to be added to the hour column.

The code that I am using is :-

DATEDIFF(hour,callstarttime, callendtime) as hours,

DATEDIFF

(minute,callstarttime, callendtime) as minutess,

DATEDIFF(second,callstarttime, callendtime) as seconds

which gets me a line per call with hours/minutes/seconds but I need to add them all up across all the lines that I am looking at, if that makes sense.

If anyone can help it would be much appreciated.

Thanks Phil

View Complete Post


Comments:
Be the first to comment this post.
 
Post Comment
Please login to post your comment
More Related Resources

Selecting multiple Checkboxes inside multiple GridViews

  
Selecting multiple checkboxes inside a GridView control has been lot in discussion but I was unable to find any solution to following problems:



If page has two or more GridViews?
If Gridviews are in usercontrol?
If page has a Masterpage?

So to sort out these problems I picked an article that was of great help "GridView CheckBox Selection With a Twist". And here are few changes

Gridview paging and multiple row delete using checkbox

  
This article gives you information about GridView paging and multiple row deletion using CheckBox selection and LINQ.

Selecting and Highlighting Multiple Columns in a Data Grid

  
Many times you want to select multiple columns in a DataGrid and highlight the columns selected.

In the DataGrid MouseDown Event you will find out if you have selected a column header through the hit test. You then find the co-ordinate of the column and construct a rectangle out of that. If you are selecting multiple columns you can store the index of the columns and the rectangle in ArrayList.

Make sure you clear the ArrayList when you HitType is None.

Multiple validator issue

  

A CompareValidator to check the textbox for date type and a RangeValidation the check the date range is applied to a textbox. But if user enters incorrect date format, both validators are triggered. Is there any way to set the trigger sequence so that only one validator fires in this scenaio?

Thanks.

 


multiple dropdowns posting back to gridview help

  

Hello,

I have a form that has 2 dropdowns that are getting data from sql server 2005 db's to populate their dropdowns with dropdown2 depending on the values chosen from dropdown. after i choose the 1st value from dropdown1, then it shapes what can be chosen from dropdown2 and i choose that value, nothing happens, (well the webform flickers real quick like it hit the db and returned no values to fill in the gridview.) Can someone please please please check my code and tell me what i am doing wrong here? Or post a correct  dropdown-->dropdown-->gridview  example

 thank you

 

<form id="form1" runat="server">

 <table border="0" cellpadding="0" cellspacing="1" width="98%">

<tr>

<td bgcolor="#3366cc" height="24">

<div align="center">

<span class="style2" style="color: #ffffff">&nbsp; Query Builder </span>

</div>

</td>

<td bgcolor="#3366cc" style="width: 331px">

 

<div align="center" >

<span class="style2" style="color: #ffffff">(Choose Your Test Criteria)</span></div>

</td>

</tr>

<

Trying to prevent multiple submits with a dataview item updating

  

I have a button in my dataview that drives the update:

                    <asp:Button ID="btnUpdate" runat="server" Text="Submit Bid" CommandName="Update"
                        ValidationGroup="response" CssClass="buttonDarkBlue"  />

                    <asp:Button ID="btnUpdate" runat="server" Text="Submit Bid" CommandName="Update"

                        ValidationGroup="response" CssClass="buttonDarkBlue"  />

If you hit the button quickly multiple times, the code below gets run and multiple database updates occur.  
I added the Response.Redirect because I saw that as a technique to prevent this problem.  It seems to have worked on another page, but not this one.
Thoughts on a best solution?

    protected void dvwResponse_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
    {
                 // (do a database update)
                Response.Redirect("~/MySite/SamePage.aspx");


        }
    }



Manually Calling Update on ObjectDataSource Causing Multiple Updates

  

I have GridView that is bound to an ObjectDataSource and within that GridView I have CheckBox, DropDownList, TextBox and Label controls.  All the controls except the CheckBoxs are working like a champ or normal display and Delete (Insert is handled outside the GridView, it works also). 

The CheckBox values are passed into the update method for the ObjectDataSource as type byte.  Without doing any custom coding the CheckBoxs were always unchecked (regardless of the data being 1 or 0)  and when I edit a row in the GridView and saved the values the CheckBox controls would always be 0 even if the check boxes where checked. 

After searching web I found a suggestion to change the binding on the CheckBox controls from, Bind("Monday") to this, CheckUncheck(DataBinder.Eval(Container.DataItem, "Monday")) with CheckUncheck being a method to make 0 or null = false and 1 = true.  This seemed to the do the trick and it set the CheckBoxs correctly in the DataGrid, I was giving myself high-fives, until. I tried to update a row. 

When doing the update, as with my first attempt, it would always set the CheckBox values to 0, thus ignoring the checked property of the CheckBox.  So I search the web again and found a suggestion to handle the update manually, due to the binding being one way. So I created a myUnhappyGrid_RowUpdating event handler and changed all the columns in the GridView to template so I could do the old school .FindControl on them and grab the values.  Once I was able to grab the values from the row to be updated I added them to the ObjectDataSource .UpdateParameters and called ObjectDataSource.Update() and it worked, kind of. 

Now came the next trial, it did the update into the database just fine and I was happy, until..  I finished stepping though the code.  As I stepped through the code the update on the ObjectDataSource got called two more times, thus undoing what I had just spent hours fixing.

First, is the road traveled the right way to do it?

Second, if I am on the correct road how can I suppress the additional two updates that follow my manual .update call on the ObjectDataSource?

Please help!


MVC - how to have multiple users with their own information

  

Hi All,

I am new to MVC. I am trying to write a simple web app - for learning purposes only, that allows multiple users to log in and enter their top 10 favorite movies. Each user can only see and edit their own list. The can have no knowledge of the other users or their lists.

In regular ASP.Net I would do somthing like a session variable to store the user id so I could use it to test against the database and return that users information. I as I understand it that is not the way things are done in MVC. My question is how would I do this in MVC?

thanks for any tips or advice!

-Chris


Can I change the default "ASP.NET Web Application" that appears every time I create a new project?

  

I'm using VS2010 and I'm trying to follow along with these videos: http://www.asp.net/general/videos and the guy in the video is using Visual Web Developer Express and when he creates a new website it's all nice and simple with a bare bones Default webpage and that's cool. Well, me in my Visual Studio 2010 when I create a new project I get this elaborate "My ASP.NET Application" page with an About page and a Login page and CSS and Jquery and it's just too, too much. Now, of course I could just create an empty ASP.NET application, but that goes too far the other way; I have to start from scratch and add the default page myself and try to reproduce exactly what the code in the video looks like and I can't really see the screen that well. Is there any way I could change my default template to what the gentleman in the video uses?


Html.ListBox cannot select multiple items

  

I'm trying to use the ListBox html helper in a simple form.

verhuurPrijzenLst is a simple list that gets put into the ListBox, I think I need "MultiSelectList", but I cannot use it (MVC framework needed)?

I don't know exactly how to do that ( bin folder and @inherits ? )

So it's nice to have a helper at hand, but if you cannot use it properly without using the MVC framework, that is a pity.


   List<SelectListItem> verhuurPrijzenLst = new List<SelectListItem>();
   foreach (string dataLine in verhuurPrijzen) {
        var verhuurPrijslijn = dataLine.Split(delimiterChar)[0].AsDateTime().ToString("dd MMMM") + " - " + dataLine.Split(delimiterChar)[0].AsDateTime().AddDays(7).ToString("dd MMMM") + " ? " + dataLine.Split(delimiterChar)[1] + ",00";
        var selecteer = false;
        if(Request["Huurperiode"] != null)
        {
            if(Request["Huurperiode"].Contains(verhuurPrijslijn))
            {
                selecteer = true;
            }
        }
        verhuurPrijzenLst.Add(new SelectListItem { Text = verhuurPrijslijn, Selected = selecteer });
    }
    @Html.ListBox("Huurperiode",verhuurPrijzenLst,new {size="15", multiple="multiple"});





 
Categories:
.NET
Java
PHP
C/C++/VC++
HTML/XML
SAP
MainFrames
Data Warehousing
Testing
MySQL
SQL Server
Oracle
Javascript/VB Script
Others
Login
 
 
 
 
 Forgot password
 Contact Us   Terms Of use   Share your knowledge