Dear Sir,
I want to display hours difference between Lodge Date and Closed Date
<%@ Page Language="C#" AutoEventWireup="true" Codefile="itdashboard.aspx.cs" Inherits="OCMS.itdashboard" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link href="css/StyleSheet2.css" rel="stylesheet" />
<title>ocms</title>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head2" runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
height: 83px;
width: 316px;
margin-left: 0px;
}
.auto-style2 {
font-weight: normal;
background-color: #333399;
width: 268435456px;
}
#defaultOpen {
height: 30px;
width: 125px;
}
.tablinks {
height: 30px;
width: 108px;
}
.auto-style4 {
font-size: xx-large;
}
.auto-style5 {
font-size: xx-large;
width: 8%;
background-color: #333399;
}
.auto-style7 {
font-size: medium;
width: 83px;
text-align: left;
}
.auto-style9 {
background-color: #333399;
color: white;
width:10%;
}
.auto-style10 {
font-size: medium;
color: #FFFFFF;
}
#right{float:right;width:0%px;}
#right1{float:right;width:80%px;}
#center{margin:center;width:200px;
</style>
</head>
<form id="form1" runat="server">
<body align="center" style="background-color:#CAC9C9;">
<table height="30" border="0" cellpadding="1" cellspacing="1" style="width: 100%">
<tr bgcolor="#3090C7">
<!--<td colspan="1" > <a href="http://10.1.246.6/munpl/" target="_parent"><img src="home.jpg" width="20" height="20" /><a></td> -->
<td class="auto-style5"><span class="auto-style23"> </span><img src="images/m1.png" class="auto-style24"/><span class="auto-style23"> </span> </td>
<th colspan="5" class="auto-style2" ><u><span class="auto-style22">IT - D A S H B O A R D</span></u></th>
<th class="auto-style9" >
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lblTime" runat="server"></asp:Label>
<asp:Timer ID="Timer1" runat="server" OnTick="OnTime" Interval="1000">
</asp:Timer>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Label ID="lbldatetime" runat="server" Text=""></asp:Label>
<strong>Refresh Time:
<asp:Label ID="lblCountDown" runat="server"></asp:Label>
</strong>
<span class="auto-style17">
<span id='ct6' style="background-color:white">
<br />
</th>
</tr></table>
<style type="text/css">
.auto-style17 {
color: #003366;
}
.auto-style18 {
font-size: x-large;
color: #FFFFFF;
}
.auto-style19 {}
.auto-style21 {
font-size: x-large;
}
.auto-style22 {
width: 92px;
height: 96px;
font-size: xx-large;
color: #FFFFFF;
}
.auto-style23 {
color: #006666;
}
.auto-style24 {
width: 83px;
height: 83px;
color: #006666;
}
#right{float:right;width:441px;
height: 27px;
margin-left: 130px;
}
#left{float:left;width:50%px;}
#center{margin:0 auto;width:895px;
height: 207px;
}
#left {
width: 451px;
text-align: left;
height: 28px;
margin-left: 29px;
}
</style>
</head>
<body>
<div>
<strong><span class="auto-style17">Complaint's Status :   
<td class="auto-style6">Open : </span>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<span class="auto-style17">
</td>    
<td class="auto-style6">Closed : </span>
<asp:Label ID="Label2" runat="server" Text="" ></asp:Label>
<span class="auto-style17">
</td>    
<td class="auto-style6">Total :
</span>
<asp:Label ID="Label3" runat="server" Text="" ></asp:Label><span class="auto-style17"></td>
</tr>
</span>
</strong>
</div>
<div class="tooltip">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="COMP_ID" EmptyDataText="***COMPLAINT(S) NOT FOUND.***"
OnRowDataBound="GridView1_RowDataBound" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" Height="182px" Width="1905px" CssClass="auto-style19" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical" >
<AlternatingRowStyle BackColor="#DCDCDC" />
<Columns>
<asp:TemplateField HeaderText = "Sl. No." >
<ItemTemplate>
<asp:Label ID="lblRowNumber" Text='<%# Container.DataItemIndex + 1 %>' runat="server" />
</ItemTemplate>
<ItemStyle Width="200px"></ItemStyle>
</asp:TemplateField>
<asp:BoundField DataField="COMP_ID" HeaderText="Comp.No." >
<ItemStyle Width="200px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="EMP_ID" HeaderText="Emp.No." ItemStyle-CssClass="EMP_ID">
<ItemStyle Width="200px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="EMP_NAME" HeaderText="Name" >
<ItemStyle Width="500px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="EMP_DSG" HeaderText="Designation" >
<ItemStyle Width="500px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="DEPT_ID" HeaderText="Department" >
<ItemStyle Width="500px"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="Mobile">
<ItemTemplate>
<%# (!string.IsNullOrEmpty(Eval("PHONE_MOB").ToString()) && Eval("PHONE_MOB").ToString().Length > 10) ? "" + Eval("PHONE_MOB").ToString().Substring(2, 10) : Eval("PHONE_MOB").ToString() %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Intercom">
<ItemTemplate>
<asp:Label ID="lblintrcm" Text='<%# Eval("INTERCOM") %>' runat="server" />
</ItemTemplate>
<ItemStyle Width="100px"></ItemStyle>
</asp:TemplateField>
<asp:BoundField DataField="COMP_MESSAGE" HeaderText="Complaint's Message" >
<ItemStyle Width="3000px"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="Lodge Date">
<ItemTemplate>
<asp:Label ID="lblDate" Text='<%# Eval("COMP_LODGE_DATE") %>' runat="server" />
</ItemTemplate>
<ItemStyle Width="500px"></ItemStyle>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<RowStyle ForeColor="Black" BackColor="#EEEEEE" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#0000A9" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#000065" />
</asp:GridView>
</div>
<div id="dialog" style="display: none">
</div>
</div>
</table>
<table>
<tr><td>
<div class="auto-style14">
<strong><span class="auto-style21">Closed Complaint's By IT FMS</span></strong> <strong><span class="auto-style21">(UPL)</span></strong></div>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" EmptyDataText="***COMPLAINT(S) NOT FOUND.***" BackColor="White" BorderColor="#999999"
BorderStyle="None" BorderWidth="1px" CellPadding="3" CssClass="auto-style3" Height="50px" Width="1905px" GridLines="Vertical">
<AlternatingRowStyle BackColor="#DCDCDC" />
<Columns>
<asp:TemplateField HeaderText = "Sl. No." >
<ItemTemplate>
<asp:Label ID="lblRowNumber" Text='<%# Container.DataItemIndex + 1 %>' runat="server" />
</ItemTemplate>
<ItemStyle Width="60px"></ItemStyle>
</asp:TemplateField>
<asp:BoundField ItemStyle-Width="70px" DataField="COMP_ID" HeaderText="Comp.No." >
<ItemStyle Width="100px"></ItemStyle>
</asp:BoundField>
<asp:BoundField ItemStyle-Width="70px" DataField="EMP_ID" HeaderText="Emp.No." >
<ItemStyle Width="90px"></ItemStyle>
</asp:BoundField>
<asp:BoundField ItemStyle-Width="150px" DataField="EMP_NAME" HeaderText="Name" >
<ItemStyle Width="160px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="EMP_DSG" HeaderText="Designation" >
<ItemStyle Width="180px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="DEPT_ID" HeaderText="Department" >
<ItemStyle Width="195px"></ItemStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="Mobile">
<ItemTemplate>
<%# (!string.IsNullOrEmpty(Eval("PHONE_MOB").ToString()) && Eval("PHONE_MOB").ToString().Length > 10) ? "" + Eval("PHONE_MOB").ToString().Substring(2, 10) : Eval("PHONE_MOB").ToString() %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Intercom">
<ItemTemplate>
<asp:Label ID="lblintrcm" Text='<%# Eval("INTERCOM") %>' runat="server" />
</ItemTemplate>
<ItemStyle Width="80px"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="Complaint's Message">
<ItemTemplate>
<asp:Label ID="lblId" Text='<%# Eval("COMP_MESSAGE") %>' runat="server" /><br />
(<font color="blue"><i>Remark :<asp:Label ID="Label4" Text='<%# Eval("REMARKS") %>' runat="server" /> ,   Closed By : <asp:Label ID="Label5" Text='<%# Eval("ATTEND_BY") %>' runat="server" /></i>)
</ItemTemplate>
<ItemStyle Width="710px"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField HeaderText="Lodge Date">
<ItemTemplate>
<asp:Label ID="lblDate" Text='<%# Eval("COMP_LODGE_DATE") %>' runat="server" />
</ItemTemplate>
<ItemStyle Width="500px"></ItemStyle>
</asp:TemplateField>
<asp:BoundField ItemStyle-Width="100px" DataField="CLOSING_DATE" DataFormatString="{0:M/dd/yyyy}" HeaderText="Closed Date" >
<ItemStyle Width="160px"></ItemStyle>
</asp:BoundField>
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#0000A9" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#000065" />
</asp:GridView>
</div>
<div id="Div1" style="display: none">
</div>
</div>
</td>
</tr>
</table>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
<script type="text/javascript">
$(function () {
$('.EMP_ID').tooltip({
position: { my: "left center", at: "left center" },
items: "tr",
content: function () {
var PhotoPath = $(this).closest('tr').attr('title');
if (PhotoPath !== undefined) {
return "<img src='" + PhotoPath + "' />";
}
}
});
});
</script>
<script language="javaScript" type="text/javascript">
var i = 1;
var _StartTime = "15000"; //MiliSecound - Here it is 60 Secound
var _seconds = 0;
var _minutes = 0;
var _hrs = 0;
var pad = "00";
setTimeout("location.reload(true);", _StartTime);
function GetCount() {
var _s = _StartTime;
var ms = _s % 1000;
_s = (_s - ms) / 1000;
var _seconds = _s % 60;
_s = (_s - _seconds) / 60;
var _minutes = _s % 60;
var _hrs = (_s - _minutes) / 60;
var Sec = pad.substring(0, pad.length - String(_seconds).length) + _seconds;
var Min = pad.substring(0, pad.length - String(_minutes).length) + _minutes;
var Hr = pad.substring(0, pad.length - String(_hrs).length) + _hrs;
document.getElementById('lblCountDown').innerText = Hr + ":" + Min + ":" + Sec;
_StartTime = _StartTime - 1000;
if (_StartTime >= 0)
setTimeout("GetCount()", 1000);
}
window.onload = GetCount;
</script>
</form>
public void refreshdata()
{
con.Open();
//SqlCommand cmd = new SqlCommand("select * from comp_box where closing_date IS NULL ORDER BY COMP_ID DESC ", con);
SqlCommand cmd = new SqlCommand("select * from comp_box,emp where closing_date IS NULL and comp_box.emp_id=emp.emp_id order by COMP_ID asc", con);
// SqlCommand cmd = new SqlCommand("select * from comp_box,emp ", con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
con.Close();
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
}
public void refreshdata1()
{
con.Open();
//SqlCommand cmd = new SqlCommand("select * from comp_box where closing_date IS NULL ORDER BY COMP_ID DESC ", con);
// SqlCommand cmd = new SqlCommand("SELECT COMP_ID, EMP_ID, COMP_MESSAGE, COMP_LODGE_DATE, CLOSING_DATE, REMARKS, STATUS_ID,ATTEND_BY FROM comp_box where STATUS_ID='02' and COMP_LODGE_DATE=CAST(GETDATE() AS DATE)", con);
SqlCommand cmd = new SqlCommand("select * from comp_box a ,emp b where a.EMP_ID=b.EMP_ID and STATUS_ID='02' and COMP_LODGE_DATE=CAST(GETDATE() AS DATE)", con);
// SqlCommand cmd = new SqlCommand("select * from comp_box,emp ", con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
con.Close();
this.GridView2.DataSource = dt;
this.GridView2.DataBind();
}
sql :
COMP_ID int Unchecked
EMP_ID nvarchar(10) Checked
COMP_MESSAGE nvarchar(MAX) Checked
Comp_type varchar(20) Checked
STATUS_ID nvarchar(10) Unchecked
COMP_LODGE_DATE nvarchar(50) Checked
CLOSING_DATE nvarchar(50) Checked
REMARKS varchar(255) Checked
S_GUID uniqueidentifier Checked
remote_ip nvarchar(50) Checked
who nvarchar(50) Checked
user_feedback nvarchar(255) Checked
type nvarchar(255) Checked
ATTEND_DATE datetime Checked
ATTEND_BY varchar(255) Checked
Image varchar(50) Checked
mob_nm nchar(12) Checked
remote_A_ip nvarchar(50) Checked