<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<!--METADATA TYPE="DesignerControl" startspan
<OBJECT classid="clsid:3A8081D8-AA56-11D2-A34D-00104B9E90B5" id=FontVelocityDTC1
style="LEFT: 0px; TOP: 0px">
<PARAM NAME="_ExtentX" VALUE="6165">
<PARAM NAME="_ExtentY" VALUE="1931">
<PARAM NAME="Recordset" VALUE="">
<PARAM NAME="Field" VALUE="">
<PARAM NAME="UseRecordset" VALUE="0">
<PARAM NAME="ID" VALUE="FontVelocity1">
<PARAM NAME="Tag" VALUE='<IMG SRC="%SRC%" ALT="%ALT%">'>
<PARAM NAME="Text" VALUE="N">
<PARAM NAME="FontFile" VALUE="GeorgiaI.TTF">
<PARAM NAME="ImageFile" VALUE="Logo1.gif">
<PARAM NAME="PointSize" VALUE="36">
<PARAM NAME="ForeColor" VALUE="0">
<PARAM NAME="BackColor" VALUE="16777215">
<PARAM NAME="Transparent" VALUE="-1">
<PARAM NAME="Tracking" VALUE="0">
<PARAM NAME="Leading" VALUE="8">
<PARAM NAME="ImageWidth" VALUE="0">
<PARAM NAME="ImageHeight" VALUE="0">
<PARAM NAME="Alignment" VALUE="0">
<PARAM NAME="Justification" VALUE="1">
<PARAM NAME="AntiAlias" VALUE="-1">
<PARAM NAME="AutoLeading" VALUE="0">
<PARAM NAME="UseRandomFilename" VALUE="0">
<PARAM NAME="PadLeft" VALUE="5">
<PARAM NAME="PadTop" VALUE="8">
<PARAM NAME="PadRight" VALUE="-2">
<PARAM NAME="PadBottom" VALUE="2">
<PARAM NAME="PadAsPercentage" VALUE="0">
<PARAM NAME="ShadowDepth" VALUE="0">
<PARAM NAME="ShadowBlur" VALUE="2">
<PARAM NAME="EmitFontVelocitySub" VALUE="-1"></OBJECT>
-->
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub FontVelocity(alwaysRender, tag, text, fontFile, imageURL, ptsize, fgcolor, _
bgcolor, transparent, tracking, width, height, alignment, _
justification, leading, antiAlias, shadowDepth, shadowBlur, _
leftPadding, topPadding, rightPadding, bottomPadding, paddingType)
On Error Resume Next
Dim hostFilePath, rootPath
hostFilePath= Request.ServerVariables("PATH_TRANSLATED")
rootPath= Request.ServerVariables("APPL_PHYSICAL_PATH")
' This is necessary to handle different IIS service pack levels.
If Mid(rootPath, Len(rootPath), 1) <> "\" Then rootPath= rootPath & "\"
Dim fso
Set fso= Server.CreateObject("Scripting.FileSystemObject")
' Determine the image file's path.
Dim imagePath
If imageURL = "" Then
' Use a temporary file in the FVImages folder.
If Not fso.FolderExists(rootPath & "FVImages") Then _
fso.CreateFolder(rootPath & "FVImages")
imageURL= "FVImages/" & fso.GetTempName() & ".gif"
alwaysRender= True
End If
imagePath= Server.MapPath(imageURL)
' Determine whether or not to render the image.
Dim b
If alwaysRender Then
b= True
ElseIf Not fso.FileExists(imagePath) Then
b= True
ElseIf fso.GetFile(imagePath).DateLastModified < _
fso.GetFile(hostFilePath).DateLastModified Then
b= True
Else
b= False
End If
If b Then
Dim ren
Set ren= Server.CreateObject("Vertigo.FontVelocityEngine")
ren.SetPadding leftPadding, topPadding, rightPadding, bottomPadding, _
paddingType
ren.ShadowDepth= shadowDepth
ren.ShadowBlur= shadowBlur
ren.Render text, fontFile, imagePath, ptsize, fgcolor, bgcolor, _
transparent, tracking, width, height, alignment, justification, _
leading, antiAlias
End If
If err = 0 Then
tag= Replace(tag, "%SRC%", imageURL)
tag= Replace(tag, "%ALT%", text)
Response.Write(tag)
Else
Response.Write("<BR><B>Rendering failed (error #" & Hex(err) & "): " _
& err.Description & "</B><BR>")
If err = &h80070013 Then ' opening the output file failed.
Response.Write("The most common cause is" _
& " insufficient permissions for the target directory:<BR><B>" _
& Left(imagePath, InStrRev(imagePath, "\") - 1) & "</B><BR>" _
& "Change the permissions for the IUSR_<machinename> " _
& "account to allow write access for this directory and files " _
& "within it.<BR><BR>")
End If
End If
End Sub
</SCRIPT>
<%
FontVelocity false, "<IMG SRC=""%SRC%"" ALT=""%ALT%"">", "N", _
Server.MapPath("GeorgiaI.TTF"), "Logo1.gif", 36, 0, 16777215, _
true, 0, 0, 0, 0, 1, 8, true, 0, 2, 5, 8, -2, 2, 0
%>
<!--METADATA TYPE="DesignerControl" endspan-->
<!--METADATA TYPE="DesignerControl" startspan
<OBJECT classid="clsid:3A8081D8-AA56-11D2-A34D-00104B9E90B5" id=FontVelocityDTC2
style="LEFT: 0px; TOP: 0px">
<PARAM NAME="_ExtentX" VALUE="6165">
<PARAM NAME="_ExtentY" VALUE="1931">
<PARAM NAME="Recordset" VALUE="">
<PARAM NAME="Field" VALUE="">
<PARAM NAME="UseRecordset" VALUE="0">
<PARAM NAME="ID" VALUE="FontVelocity2">
<PARAM NAME="Tag" VALUE='<IMG SRC="%SRC%" ALT="%ALT%">'>
<PARAM NAME="Text" VALUE="orthWind Traders">
<PARAM NAME="FontFile" VALUE="GeorgiaI.TTF">
<PARAM NAME="ImageFile" VALUE="Logo2.gif">
<PARAM NAME="PointSize" VALUE="18">
<PARAM NAME="ForeColor" VALUE="0">
<PARAM NAME="BackColor" VALUE="16777215">
<PARAM NAME="Transparent" VALUE="-1">
<PARAM NAME="Tracking" VALUE="0">
<PARAM NAME="Leading" VALUE="8">
<PARAM NAME="ImageWidth" VALUE="0">
<PARAM NAME="ImageHeight" VALUE="0">
<PARAM NAME="Alignment" VALUE="0">
<PARAM NAME="Justification" VALUE="1">
<PARAM NAME="AntiAlias" VALUE="-1">
<PARAM NAME="AutoLeading" VALUE="0">
<PARAM NAME="UseRandomFilename" VALUE="0">
<PARAM NAME="PadLeft" VALUE="0">
<PARAM NAME="PadTop" VALUE="2">
<PARAM NAME="PadRight" VALUE="0">
<PARAM NAME="PadBottom" VALUE="8">
<PARAM NAME="PadAsPercentage" VALUE="0">
<PARAM NAME="ShadowDepth" VALUE="0">
<PARAM NAME="ShadowBlur" VALUE="2">
<PARAM NAME="EmitFontVelocitySub" VALUE="-1"></OBJECT>
-->
<%
FontVelocity false, "<IMG SRC=""%SRC%"" ALT=""%ALT%"">", "orthWind Traders", _
Server.MapPath("GeorgiaI.TTF"), "Logo2.gif", 18, 0, 16777215, true, 0, 0, _
0, 0, 1, 8, true, 0, 2, 0, 2, 0, 8, 0
%>
<!--METADATA TYPE="DesignerControl" endspan-->
</HEAD>
<BODY>
<P>
<TABLE border=0 cellPadding=1 cellSpacing=1 width=75%>
<TR>
<TD><A href="NTraderCustomer.asp">Customers</A>
</TD>
</TR>
<TR>
<TD>
</TD>
</TR>
<TR>
<TD>
</TD>
</TR>
<TR>
<TD>
</TD>
</TR>
</TABLE>
</P>
</BODY>
</HTML>
Figure 5 NTraderCustomer.asp
<%@ Language=VBScript %>
<html>
<head>
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<img SRC="Logo1.gif" ALT="N" WIDTH="39" HEIGHT="37"><img SRC="Logo2.gif" ALT="orthWind Traders">
</head>
<body>
<p>
</p>
<p>
</p>
<%
dim oCustomer
dim vCustomerList
set oCustomer = CreateObject("NorthWindClient.Customer")
vCustomerList = oCustomer.Retrieve
%>
<p align="center">
<table border="1" cellPadding="1" cellSpacing="1" width="75%">
<tr>
<td><strong>Customer Name</strong></td>
<td><strong>Contact Name</strong></td>
<td><strong>Contact Title</strong></td></tr>
<%
for i = 0 to ubound(vCustomerList) -1
%>
<tr>
<td>
<a HREF="NTraderCustomerDetail.asp?CustomerID=
<%=vCustomerList(0,i)%>">
<%=vCustomerList(1,i)%></a></td>
<td>
<%=vCustomerList(2,i)%></td>
<td>
<%=vCustomerList(3,i)%></td></tr>
<%
next
%>
</table>
</p>
<div align="center">
<%
set oCustomer = nothing
%>
</div>
</body>
</html>
Figure 6 NTraderCustomerDetail
Figure 7 FormState
<%
dim CustomerID, FormState
dim oCustomer
dim vCustomerList
CustomerID = request("CustomerID")
if CustomerID = "" then
Response.Redirect("NTraderCustomer.asp")
end if
set oCustomer = CreateObject("NorthWindClient.Customer")
%>
<script ID="serverEventHandlersVBS" LANGUAGE="vbscript" RUNAT="Server">
Sub cmdSave_onclick()
UpdateCustomer
End Sub
</script>
<%
RetrieveCustomer
sub RetrieveCustomer()
vCustomerList = oCustomer.Retrieve(CustomerID)
if not isnull(vCustomerList(0,0)) then
txtCustomerID.value = vCustomerList(0,0)
end if
if not isnull(vCustomerList(1,0)) then
txtCustomerName.value = vCustomerList(1,0)
end if
if not isnull(vCustomerList(2,0)) then
txtContactName.value = vCustomerList(2,0)
end if
if not isnull(vCustomerList(3,0)) then
txtContactTitle.value = vCustomerList(3,0)
end if
if not isnull(vCustomerList(4,0)) then
txtAddress.value = vCustomerList(4,0)
end if
if not isnull(vCustomerList(5,0)) then
txtCity.value = vCustomerList(5,0)
end if
if not isnull(vCustomerList(6,0)) then
txtRegion.value = vCustomerList(6,0)
end if
if not isnull(vCustomerList(7,0)) then
txtPostalCode.value = vCustomerList(7,0)
end if
if not isnull(vCustomerList(8,0)) then
txtCountry.value = vCustomerList(8,0)
end if
end sub
sub UpdateCustomer()
dim CustomerID, CustomerName, ContactName
dim ContactTitle, Address, City, State
dim Region, PostalCode, Country, Status
if not isnull(txtCustomerID.value) then
CustomerID = txtCustomerID.value
end if
if not isnull(txtCustomerName.value) then
CustomerName = txtCustomerName.value
end if
if not isnull(txtContactName.value) then
ContactName = txtContactName.value
end if
if not isnull(txtContactTitle.value) then
ContactTitle = txtContactTitle.value
end if
if not isnull(txtAddress.value) then
Address = txtAddress.value
end if
if not isnull(txtCity.value) then
City = txtCity.value
end if
if not isnull(txtRegion.value) then
Region = txtRegion.value
end if
if not isnull(txtPostalCode.value) then
PostalCode = txtPostalCode.value
end if
if not isnull(txtCountry.value) then
Country = txtCountry.value
end if
Status = oCustomer.Update(CustomerID, _
CustomerName, ContactName, _
ContactTitle, Address, _
City, PostalCode, Country)
end sub
%>
<%
set oCustomer = nothing
%>