aspx file page
<%@ Page Title="" Language="C#" MasterPageFile="~/View/Admin/Admin.master" AutoEventWireup="true" CodeFile="Dashboard.aspx.cs" Inherits="View_Admin_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$('#container').highcharts({
chart: {
plotBackgroundColor:null,
plotBorderWidth: 1,
plotShadow: false
},
title: {
text: 'Login Details, <%=currentdate %>'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.y}</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.y}',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
series: [{
type: 'pie',
name: 'Dash Board',
data: [
//['Total Logins Today', 45], ['Total Failure logins', 27], ['login in last 2 hours', 40], ['Current Online Users', 67], ['Log file size', 70]
<%=Audit %>
]
}]
});
});
</script>
<style type="text/css">
.divchart
{
border: 1px dashed #cccccc;
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h4 class="text-primary text-center">Welcome to Admin</h4>
<script src="../../Highchart/js/highcharts.js"></script>
<script src="../../Highchart/js/modules/exporting.js"></script>
<div id="container" ></div>
</asp:Content>
-------------------------------------
C# file code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using System.Data.SqlClient;
public partial class View_Admin_Default : System.Web.UI.Page
{
public string Audit { get; set; }
protected void Page_Init()
{
Browser.ClearBrowserData();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
LoginAudit();
NDate();
}
}
private void LoginAudit()
{
try
{
DataTable dt=new DataTable();
dt = Luminious.DataAcessLayer.SqlHelper.ExecuteDataTable(Luminious.Connection.Configuration.ConnectionString, CommandType.StoredProcedure, "USP_LOGIN_AUDIT_REPORT", new SqlParameter[] { new SqlParameter("@DT", System.DateTime.Now.Date) });
// dt = new BLL_LoginAuditReportTableAdapters.USP_LOGIN_AUDIT_REPORTTableAdapter().GetData(DateTime.Now.Date);
if (dt!=null && dt.Rows.Count > 0)
{
DataRow dr=dt.Rows[0];
//['Total Logins Today', 45], ['Total Failure logins', 27], ['logins in last 2 hours',40], ['Current Online Users',67], ['Log file size',70]
StringBuilder sb = new StringBuilder();
sb.Append("['Total Sucess Login Today', " + Convert.ToString(dr["TOTAL_LOGIN_TODAY"]) + "], ['Total login Failure Today', " + Convert.ToString(dr["TOTAL_FAILURE_LOGIN_TODAY"]) + "], ['login in last 2 hours'," + Convert.ToString(dr["LOGIN_IN_LAST2HOURS"]) + "], ['Current Online User'," + Convert.ToString(dr["CURRENT_ONLINE_USER"]) + "]");
Audit = sb.ToString();
}
}
catch (Exception ex)
{
ExceptionHandler.WriteException(ex.Message);
}
}
public string currentdate { set; get; }
public string NDate()
{
return currentdate = System.DateTime.Now.ToString("dd/MM/yyyy");
}
}
----------------------------------------------
Create table MST_LOGIN_AUDIT
No comments:
Post a Comment