Auto Test

 

Tests.asp

Download

 

 

ASP Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>AlarmTraq - Test by Site</TITLE>
<META http-equiv=Content-Type content="text/html; charset=unicode"><%response.Charset="utf-8"%>
<meta http-equiv="refresh" content="30" >
<STYLE type=text/css><!--a{text-decoration:none}//--></STYLE>

<STYLE type=text/css><!--a:hover{color:Red; }--></STYLE>

<%

' Dimension Local variables
Dim objConn, objOutgoing, strDSN, strSQL, intTotalColumns, intCounter, PBXID, i, aIndex

' Set the ADO Constants if you are not including
' the adovbs.inc file
Const adOpenStatic = 3
Const adLockReadOnly = 1

Set objConn = Server.CreateObject("ADODB.Connection")
Set objOutgoing = Server.CreateObject("ADODB.Recordset")

strDSN = "DSN=AlarmTraqODBC;uid=;pwd=;"
objConn.ConnectionTimeout=60
objConn.Open strDSN

dim fs
dim FileObject
dim FileName
dim ConfigFileName
Dim strAltColor ' To hold alternating color values
Dim bColor ' Boolean we use to alternate colors

set fs=Server.CreateObject("Scripting.FileSystemObject")

'print out body...
Response.Write "<body style=""background-color:#ffffff; font-family:Verdana; font-size:10pt;"

'print out the background image if exists...
FileName = Server.MapPath ("BackGround.gif")
if fs.FileExists(FileName)=true then
Response.Write " background-image:url(BackGround.gif); background-attachment:fixed;"
end if

'close the opening body tag
Response.Write """>"

FileName = Server.MapPath ("Logo1.gif")
if fs.FileExists(FileName)=true then
Response.Write "<p align=""center"" style=""margin-bottom: 0""><img border=""0"" src=""Logo1.gif"" alt="""" />"
end if

FileName = Server.MapPath ("Logo2.gif")
if fs.FileExists(FileName)=true then
Response.Write "<p align=""center"" style=""margin-bottom: 0""><img border=""0"" src=""Logo2.gif"" alt="""" />"
end if

PBXID = CStr(Request("productid"))
aIndex = CStr(Request("alarmindex"))

if PBXID="" then
PBXID="0"
end if

if aIndex = "" then
aIndex = "0"
end if

Dim MyPage
Dim MyPages

'Open the Outgoing table
objOutgoing.PageSize=20

if clng(aIndex) > 0 then
strSQL = "SELECT RecordNumber,ProductID,TestTime,AlarmIndex,CompanyName,Command1,Command1Results,Command2,Command2Results,Command3,Command3Results,Command4,Command4Results,Command5,Command5Results,Command6,Command6Results FROM Outgoing WHERE AlarmIndex = " & aIndex
elseif PBXID = "0" then
strSQL = "SELECT RecordNumber,ProductID,TestTime,AlarmIndex,CompanyName,Command1,Command1Results,Command2,Command2Results,Command3,Command3Results,Command4,Command4Results,Command5,Command5Results,Command6,Command6Results FROM Outgoing ORDER BY RecordNumber DESC"
else
strSQL = "SELECT RecordNumber,ProductID,TestTime,AlarmIndex,CompanyName,Command1,Command1Results,Command2,Command2Results,Command3,Command3Results,Command4,Command4Results,Command5,Command5Results,Command6,Command6Results FROM Outgoing WHERE ProductID = '" & PBXID & "' ORDER BY RecordNumber DESC"

end if

objOutgoing.Open strSQL, objConn, adOpenStatic,adLockReadOnly

if objOutgoing.RecordCount > 0 then
'Response.Write "<hr />"
Response.Write "<div style=""text-align:center; font-family:Arial;""><span style=""font-size:14pt; color:#000080;"">Automatic Tests</span></div>"
' Response.Write "<span style=""font-size:14pt"">" & objOutgoing(1).Value & "</span><br><br>"
' Response.Write "<span style=""font-size:12pt"">" & "<a href=""SiteAlarms.asp?productid=" & cstr(objOutgoing(1).Value) & """>View Alarms</span></div>"
else
Response.Write "</a><font size=4>No Tests found.</a></font><br><br></a></b>"
' Response.Write "</a><font size=3>To view all tests for Product ID " & PBXID & " <a href=""tests.asp?productid=" & PBXID & """>Click Here</span></div></a></p><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>"
'
end if

MyPages = cint(objOutgoing.PageCount)
MyPage = cint(Request.QueryString("pg"))

if MyPages = 1 then
MyPage = 1
objOutgoing.AbsolutePage = 1
Response.Write "</p></a><b>Events&nbsp; Page "& MyPage & " of " & MyPages & "</a></b></p>"

elseif MyPage = "" or MyPage = 0 or MyPage = 1 then
MyPage = 1
objOutgoing.AbsolutePage = 1
Response.Write "<br></p></a><b>Events&nbsp; Page "& MyPage & " of " & MyPages & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=""tests.asp?productid=" & PBXID & "&amp;pg=" & MyPage+1 & """>[Next &gt;&gt;]</a></b></p>"

elseif MyPage >= MyPages then
MyPage = MyPages
objOutgoing.AbsolutePage = MyPage
Response.Write "<br></p></a><b>Events&nbsp; Page "& MyPage & " of " & MyPages & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=""tests.asp?productid=" & PBXID & "&amp;pg=" & MyPage-1 & """>[&lt;&lt;Prev]</a></b></p>"

else
objOutgoing.AbsolutePage = MyPage
Response.Write "<br></p></a><b>Events&nbsp; Page "& MyPage & " of " & MyPages & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=""tests.asp?productid=" & PBXID & "&amp;pg=" & MyPage-1 & """>[&lt;&lt;Prev]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=""tests.asp?productid=" & PBXID & "&amp;pg=" & MyPage+1 & """>[Next &gt;&gt;]</a></b></p>"

end if

'Response.Write "<br></p><p style=""font-weight:bold; font-family:Arial; font-size:10pt;""><a href=""tests.asp?productid=" & PBXID & "&amp;pg=" & MyPage-1 & """><b>[&lt;&lt;Prev]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Events&nbsp; Page "& MyPage & " of " & MyPages & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=""tests.asp?productid=" & PBXID & "&amp;pg=" & MyPage+1 & """>[Next &gt;&gt;]</a></b></p>"

%>
<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
<BODY>
<DIV align=left>
<table border="1" cellpadding="2" cellspacing="2" width="400%" id="Table1" style="BORDER-COLLAPSE: collapse" align=left>
<tr style="COLOR: #ffffff; BACKGROUND-COLOR: #0000cc">

<th width="144" font size="1"><FONT face=Arial><b><FONT
style="BACKGROUND-COLOR: #0000cc" size=2>Date and
Time </FONT></FONT></B> </th>

<th width="40" font size="1"><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
face=Arial>Alarm</FONT></th>

<th width="250" font size="1">
<P align=left><FONT face=Arial><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
>Site </FONT></FONT></P> </th>

<th width="250" font size="1">
<P align=left><FONT face=Arial><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
>Command 1 </FONT></FONT></P> </th>

<th width="250" width="144" font size="1">
<P align=left><FONT face=Arial><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
>Results 1 </FONT></FONT></P> </th>

<th width="250" font size="1">
<P align=left><FONT face=Arial><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
>Command 2 </FONT></FONT></P> </th>

<th width="250" width="144" font size="1">
<P align=left><FONT face=Arial><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
>Results 2 </FONT></FONT></P> </th>

<th width="250" font size="1">
<P align=left><FONT face=Arial><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
>Command 3 </FONT></FONT></P> </th>

<th width="250" font size="1">
<P align=left><FONT face=Arial><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
>Results 3 </FONT></FONT></P> </th>

<th width="250" font size="1">
<P align=left><FONT face=Arial><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
>Command 4 </FONT></FONT></P> </th>

<th width="250" width="144" font size="1">
<P align=left><FONT face=Arial><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
>Results 4 </FONT></FONT></P> </th>

<th width="250" font size="1">
<P align=left><FONT face=Arial><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
>Command 5 </FONT></FONT></P> </th>

<th width="250" font size="1">
<P align=left><FONT face=Arial><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
>Results 5 </FONT></FONT></P> </th>

<th width="250" font size="1">
<P align=left><FONT face=Arial><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
>Command 6 </FONT></FONT></P> </th>

<th width="250" font size="1">
<P align=left><FONT face=Arial><FONT
style="BACKGROUND-COLOR: #0000cc" size=2
>Results 6 </FONT></FONT></P> </th>

</tr>
<%

' get the total number of columns
intTotalColumns = objOutgoing.Fields.Count - 1

' now loop through the recordset and display the data
i = 0
Do while i < objOutgoing.PageSize and not objOutgoing.EOF and MyPage <= MyPages
i = i+1
Response.Write "<tr>" & vbcrlf

' Toggle to the opposite color as the last row.</FONT>
bColor = Not bColor
If bColor Then
strAltColor = "#FFFFFF" ' White
Else
strAltColor = "#FFFFE0" ' Light tan
End If

For intCounter = 0 To intTotalColumns

if intCounter = 0 then 'Index
'Response.Write "<td><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf

elseif intCounter = 1 then 'PBXID
'Response.Write "<td><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf

elseif intCounter = 2 then 'Date and Time
Response.Write "<td bgcolor=" & strAltColor & "><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf

elseif intCounter = 3 then 'AlarmIndex
Response.Write "<td bgcolor=" & strAltColor & "><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf

elseif intCounter = 4 then 'CompanyName
'Response.Write "<td><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
Response.Write "<td bgcolor=" & strAltColor & " style=""color:#0000ff""><font size=1><b><a target=_blank href=""sitealarms.asp?productid=" & cstr(objOutgoing(1).Value) & """>" & objOutgoing(intCounter).Value & "</a></td>" & vbcrlf

elseif intCounter = 5 then 'Command1
Response.Write "<td bgcolor=" & strAltColor & "><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf

elseif intCounter = 6 then 'Results1
if objOutgoing(intCounter).Value = "Command failed" then
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#ff0000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf

elseif objOutgoing(intCounter).Value = "Command successfully completed" then
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#008000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
else
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#000000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
end if

elseif intCounter = 7 then 'Command2
Response.Write "<td bgcolor=" & strAltColor & "><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf

elseif intCounter = 8 then 'Results2
if objOutgoing(intCounter).Value = "Command failed" then
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#ff0000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf

elseif objOutgoing(intCounter).Value = "Command successfully completed" then
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#008000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
else
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#000000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
end if

elseif intCounter = 9 then 'Command3
Response.Write "<td bgcolor=" & strAltColor & "><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf

elseif intCounter = 10 then 'Results3
if objOutgoing(intCounter).Value = "Command failed" then
Response.Write "<td style=""font-weight:bold; color:#ff0000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
elseif objOutgoing(intCounter).Value = "Command successfully completed" then
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#008000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
else
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#000000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
end if

elseif intCounter = 11 then 'Command4
Response.Write "<td bgcolor=" & strAltColor & "><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf

elseif intCounter = 12 then 'Results4
if objOutgoing(intCounter).Value = "Command failed" then
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#ff0000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
elseif objOutgoing(intCounter).Value = "Command successfully completed" then
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#008000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
else
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#000000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
end if

elseif intCounter = 13 then 'Command5
Response.Write "<td bgcolor=" & strAltColor & "><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf

elseif intCounter = 14 then 'Results5
if objOutgoing(intCounter).Value = "Command failed" then
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#ff0000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
elseif objOutgoing(intCounter).Value = "Command successfully completed" then
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#008000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
else
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#000000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
end if

elseif intCounter = 15 then 'Command6
Response.Write "<td bgcolor=" & strAltColor & "><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf

elseif intCounter = 16 then 'Results6
if objOutgoing(intCounter).Value = "Command failed" then
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#ff0000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
elseif objOutgoing(intCounter).Value = "Command successfully completed" then
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#008000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
else
Response.Write "<td bgcolor=" & strAltColor & " style=""font-weight:bold; color:#000000""><font size=1>" & objOutgoing(intCounter).Value & "</td>" & vbcrlf
end if
end if

Next

objOutgoing.Movenext
Loop
%>
</table></DIV>
<%
' Close Recordset
objOutgoing.Close
Set objOutgoing = Nothing

objConn.Close
Set objConn = Nothing
%>

<%

' Response.Write "<br><p style=""font-weight:bold; font-family:Arial; font-size:10pt;""><a href=""tests.asp?productid=" & PBXID & "&amp;pg=" & MyPage-1 & """><b>[&lt;&lt;Prev]</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Events&nbsp; Page "& MyPage & " of " & MyPages & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=""tests.asp?productid=" & PBXID & "&amp;pg=" & MyPage+1 & """>[Next &gt;&gt;]</a></b></p>"
'Response.Write "<p style=""font-family:Arial; font-size:10pt; font-weight:bold"">Notes: " & CompanyNotes & "</p><br /><br />"
' Response.Write "</table></p><br></font></a><p style=""font-family:Arial; font-size:12pt; text-align:center""><a href=""http://www.alarmtraq.com/"">www.alarmtraq.com</a></p>"

%>
</BODY>
</html>