Sunday, May 15, 2011

Dashboard Development using ColdFusion

Code Under construction:

<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Dashboard -- Raghuram</title>

<cfpod name="pod01" headerstyle="background-color:brown; color:yellow;" bodystyle="background-color:gray; color:red;" height="325" width="1000"
title="Contrast Window" name="contrast"
x="0" y="20"
draggable="true" resizable="true"
width="280" height="350" initShow="true">
title="Grid Window" name="gridWindow"
x="280" y="20"
draggable="true" resizable="true"
width="390" height="350" initShow="true">
<!--- Query the database to fill up the grid.
SELECT Course_ID, Dept_ID, CorNumber,CorName, CorLevel
<cfquery name = "GetCourses" dataSource = "cfdocexamples">
SELECT Dept_ID, CorName, CorLevel
FROM CourseList
ORDER by Dept_ID ASC, CorNumber ASC

<h3>Exception Summary </h3>
<i>Grid View</i>
<!--- cfgrid must be inside a cfform tag. --->
<cfgrid name = "FirstGrid" format="Flash"
height="320" width="580"
font="Tahoma" fontsize="12"
query = "GetCourses">
<!---cfchart example --->
<!---The following example analyzes the salary data in the cfdocexamples database and
generates a bar chart showing average salary by department. The body of the
cfchartseries tag includes one cfchartdata tag to include data that is not available
from the query. --->

<!--- Get the raw data from the database. --->
<cfquery name="GetSalaries" datasource="cfdocexamples">
SELECT Departmt.Dept_Name,
FROM Departmt, Employee
WHERE Departmt.Dept_ID = Employee.Dept_ID

<!--- Use a query of queries to generate a new query with --->
<!--- statistical data for each department. --->
<!--- AVG and SUM calculate statistics. --->
<!--- GROUP BY generates results for each department. --->
<cfquery dbtype = "query" name = "DataTable">
SELECT Dept_Name,
AVG(Salary) AS avgSal,
SUM(Salary) AS sumSal
FROM GetSalaries
GROUP BY Dept_Name

<!--- Reformat the generated numbers to show only thousands. --->
<cfloop index = "i" from = "1" to = "#DataTable.RecordCount#">
<cfset DataTable.sumSal[i] = Round(DataTable.sumSal[i]/1000)*1000>
<cfset DataTable.avgSal[i] = Round(DataTable.avgSal[i]/1000)*1000>

title="Test Window2" name="myWindow2"
x="670" y="20"
draggable="true" resizable="true"
width="340" height="350" initShow="true">

<h1>Employee Salary Analysis</h1>
<!--- Bar graph, from Query of Queries --->
<cfchart format="flash"
yaxistitle="Salary Average">

<cfchartseries type="bar"

<cfchartdata item="Facilities" value="35000">

<cfpod name="pod03" title="Exception Report" bodystyle="background-color:MediumOrchid; color:yellow;" height="8" width="1000">
test middle pod
<cfpod name="pod02" title="Summary Report" headerstyle="background-color:brown;" bodystyle="background-color:lightGray; color:red;" height="250" width="1000">
title="Test Window3" name="myWindow3"
x="250" y="470"
draggable="true" resizable="true"
width="200" height="200" initShow="true" >


Friday, April 1, 2011

DB Connection code in Dotnet for Begineers

It should be in aspx.cs
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

string connectionInfo = ConfigurationManager.ConnectionStrings["PDFConnectionString"].ConnectionString;
// Creates Db Connections
SqlConnection myConnection = new SqlConnection(connectionInfo);

objCmd = new SqlCommand("SELECT OrderNumber FROM [dbo].tblEorder WHERE eOrderID = (SELECT eOrderID FROM [dbo].tblTempToken WHERE TempToken='" + strPDFToken + "')", myConnection);
ObjDR = objCmd.ExecuteReader();

//Get PURLtoken(OrderNumber) for the requested form
while (ObjDR.Read())
purltoken = ObjDR["OrderNumber"].ToString();
// Return to Main URL. - Executes client side script
string jScriptString;
/*jScriptString = "<script> parent.window.close(); \n" +
"window.opener.close(); window.opener.opener.location.href = " + "'http://bltrdevm58072/eproducts360/BRWSDemo/main.html?token=" + purltoken + "&formpage=true'";
jScriptString += " </script>";*/
jScriptString = "<script> var objWin=window.opener; parent.window.close(); \n" +
"window.opener.close();objWin.opener.location.href = " + "'http://bltrdevm58072/eproducts360/BRWSDemo/main.html?token=" + purltoken + "&formpage=true'";
jScriptString += " </script>";
ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", jScriptString);

<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
<add name="PDFConnectionString" connectionString="Data source=blitswargd01\sql81;User ID=cf;Password=powercf;Initial Catalog=E360MTJan;"/>