<%
if len(trim(Request.QueryString("MSG")))>0 then
Response.Write("
You have exceeded your search limit for today. Please come back and try again tomorrow. ")
%>
<%
end if
%>
<%
strSQLCT = ""
strSQLZC = ""
'Response.Write("C:" & sCity & " Z:" & sZipCode & " ")
if (len(trim(sAreaCode))>0 or len(trim(sCity))>0 or len(trim(sZipCode))>0) then
if len(trim(sCity))>0 then
strSQLCT = " where (City like '" & replace(sCity,"'","''") & "%' "
end if
if len(trim(sZipCode))>0 and len(trim(sCity))>0 then
'strSQLZC = strSQLCT & " or Zip like '" & replace(sZipCode,"'","''") & "%'"
'sBoolean
strSQLZC = strSQLCT & " " & sBoolean & " Zip like '" & replace(sZipCode,"'","''") & "%') "
else
if len(trim(sZipCode))>0 then
strSQLZC = " where (Zip like '" & replace(sZipCode,"'","''") & "%') "
else
strSQLZC = strSQLCT & ")"
end if
end if
'strSQL = "select * from tStoreLocations " & strSQLZC & " order by City, Zip asc"
strSQL = "select distinct City, State from tStoreLocations " & strSQLZC
'Response.Write( strSQL )
'Response.Write ( cstr(iCntMAX))
Set ConnPress = Server.CreateObject("ADODB.Connection")
ConnPress.Open "Provider=MSDASQL;Driver={SQL Server}; Server=cove.safesecureweb.com; Database=devElita01;uid=dbelita;pwd=iNc0gnito"
Set RSPress = Server.CreateObject("ADODB.Recordset")
RSPress.Open strSQL,ConnPress,1,3
%>
|
<%
'Display the group based on city
If NOT RSPress.EOF Then
Response.Write ""
RSPress.MoveFirst
iCnt = 0
sCityLast = ""
maxrecs = RSPress.RecordCount
Response.Write(" ")
While NOT RSPress.EOF
'sShipToName=trim(RSPress.Fields("ShipToName"))
'sAddr1=trim(RSPress.Fields("Addr1"))
'sAddr2=trim(RSPress.Fields("Addr2"))
sCity=trim(RSPress.Fields("City"))
sState=trim(RSPress.Fields("State"))
'sZip=trim(RSPress.Fields("Zip"))
sZip = trim(sZipCode)
if sCity <> sCityLast then
sCityLast = sCity
if (iCnt < iCntMAX) then
'Response.Write( cstr(iCnt+1) & ". " & sCity & ", " & sState & "," & sZip & " " )
'Response.Write( cstr(iCnt+1) & ". " & sCity & ", " & sState & "," & sZip & " " )
'if len(sZip) > 0 then
' Response.Write( cstr(iCnt+1) & ". " & sCity & ", " & sState & "," & sZip & " " )
'else
Response.Write( cstr(iCnt+1) & ". " & sCity & ", " & sState & " " )
nextpage = ""
'end if
end if
iCnt = iCnt + 1
end if
RSPress.MoveNext
Wend
Response.Write(" ")
RSPress.MoveFirst
Response.Write ""
else
'Response.Write("The system is unable to locate your city. ")
'Response.Write("Please fill in the form below for us to locate the store nearest to you. Thank you.")
%>
|
The system was unable find a match for your city. Please
fill in the customer support to request a manual search for locate the store
nearest to you. Thank you.
<%
end if
RSPress.Close
ConnPress.Close
end if
%>
<%
'Determine if search by city or store
if len(sCityQuery) > 0 then
%>
| Store
matches |
<%
Response.Write nextpage & "View More Choices" & ""
%>
|
<%
if len(trim(Request.QueryString("MSG"))) <= 0 then
%>
<%
' Display all that of rank = 50
strSQL = "select * from tStoreLocations " & strSQLZC & " and rank = '50'"
strSQLCnt = "select count(*) as MaxCnt from tStoreLocations " & strSQLZC & " and rank = '50'"
strSQLRank = "select * from tStoreLocationsRank where sRank = '50'"
'Response.Write (strSQL)
'Response.Write (strSQLCnt)
Set ConnPress = Server.CreateObject("ADODB.Connection")
ConnPress.Open "Provider=MSDASQL;Driver={SQL Server}; Server=cove.safesecureweb.com; Database=devElita01;uid=dbelita;pwd=iNc0gnito"
Set RSPress = Server.CreateObject("ADODB.Recordset")
RSPress.Open strSQL,ConnPress,1,3
Set RSPressCnt = Server.CreateObject("ADODB.Recordset")
RSPressCnt.Open strSQLCnt,ConnPress,1,3
MaxCnt = RSPressCnt.Fields("MaxCnt").Value
Set RSPressRank = Server.CreateObject("ADODB.Recordset")
RSPressRank.Open strSQLRank,ConnPress,1,3
MaxRank = trim(RSPressRank.Fields("nMaxMatch").Value)
if isnumeric(MaxCnt) then
MaxCnt = clng(MaxCnt)
else
MaxCnt = 0
end if
'Display the result
If NOT RSPress.EOF Then
RSPress.MoveFirst
iCnt = 1
arrIndex = clng(MaxRank)
iNumFound = 1
if MaxCnt < arrIndex then
arrIndex = MaxCnt
end if
redim arrRND(arrIndex+1)
for i=1 to arrIndex
bLoopNext = true
while bLoopNext
Randomize ' Initialize random-number generator.
RndV1 = clng( ((MaxCnt-1) * Rnd) + 1 )
found = false
j=1
while (not found) and (j<=i)
for j=1 to i
if arrRND(j)=RndV1 then
found = true
exit for
end if
next
wend
if not found then
arrRND(i) = RndV1
bLoopNext = false
else
bLoopNext = true
end if
wend
next
'for i=1 to arrIndex
' Response.Write( arrRND(i) & ":" )
'next
'Response.Write(" ")
While NOT RSPress.EOF
sShipToName=trim(RSPress.Fields("ShipToName"))
sRank=trim(RSPress.Fields("Rank"))
sAddr1=trim(RSPress.Fields("Addr1"))
sAddr2=trim(RSPress.Fields("Addr2"))
sCity=trim(RSPress.Fields("City"))
sState=trim(RSPress.Fields("State"))
sZip=trim(RSPress.Fields("Zip"))
for i=1 to arrIndex
if (arrRND(i) = clng(iCnt))then
'Response.Write( "" & sShipToName & " Rank(" & sRank & ") " )
Response.Write ""
Response.Write( "" & sShipToName & " " )
Response.Write( "" & sAddr1 & " " )
Response.Write( "" & sCity & ", " & sState & "," & sZip & " " )
Response.Write " "
exit for
end if
next
iCnt = iCnt + 1
RSPress.MoveNext
wend
end if
RSPress.Close
ConnPress.Close
%>
<%
' Display all that of rank = 10
strSQL = "select * from tStoreLocations " & strSQLZC & " and rank = '10'"
strSQLCnt = "select count(*) as MaxCnt from tStoreLocations " & strSQLZC & " and rank = '10'"
strSQLRank = "select * from tStoreLocationsRank where sRank = '10'"
'Response.Write (strSQL)
'Response.Write (strSQLCnt)
Set ConnPress = Server.CreateObject("ADODB.Connection")
ConnPress.Open "Provider=MSDASQL;Driver={SQL Server}; Server=cove.safesecureweb.com; Database=devElita01;uid=dbelita;pwd=iNc0gnito"
Set RSPress = Server.CreateObject("ADODB.Recordset")
RSPress.Open strSQL,ConnPress,1,3
Set RSPressCnt = Server.CreateObject("ADODB.Recordset")
RSPressCnt.Open strSQLCnt,ConnPress,1,3
MaxCnt = RSPressCnt.Fields("MaxCnt").Value
Set RSPressRank = Server.CreateObject("ADODB.Recordset")
RSPressRank.Open strSQLRank,ConnPress,1,3
MaxRank = trim(RSPressRank.Fields("nMaxMatch").Value)
if isnumeric(MaxCnt) then
MaxCnt = clng(MaxCnt)
else
MaxCnt = 0
end if
'Display the result
If NOT RSPress.EOF Then
RSPress.MoveFirst
iCnt = 1
arrIndex = clng(MaxRank)
iNumFound = 1
if MaxCnt < arrIndex then
arrIndex = MaxCnt
end if
redim arrRND(arrIndex+1)
for i=1 to arrIndex
bLoopNext = true
while bLoopNext
Randomize ' Initialize random-number generator.
RndV1 = clng( ((MaxCnt-1) * Rnd) + 1 )
found = false
j=1
while (not found) and (j<=i)
for j=1 to i
if arrRND(j)=RndV1 then
found = true
exit for
end if
next
wend
if not found then
arrRND(i) = RndV1
bLoopNext = false
else
bLoopNext = true
end if
wend
next
'for i=1 to arrIndex
' Response.Write( arrRND(i) & ":" )
'next
'Response.Write(" ")
While NOT RSPress.EOF
sShipToName=trim(RSPress.Fields("ShipToName"))
sRank=trim(RSPress.Fields("Rank"))
sAddr1=trim(RSPress.Fields("Addr1"))
sAddr2=trim(RSPress.Fields("Addr2"))
sCity=trim(RSPress.Fields("City"))
sState=trim(RSPress.Fields("State"))
sZip=trim(RSPress.Fields("Zip"))
for i=1 to arrIndex
if (arrRND(i) = clng(iCnt))then
'Response.Write( " " & sShipToName & " Rank(" & sRank & ") " )
Response.Write ""
Response.Write( "" & sShipToName & " " )
Response.Write( "" & sAddr1 & " " )
Response.Write( "" & sCity & ", " & sState & "," & sZip & " " )
Response.Write " "
exit for
end if
next
iCnt = iCnt + 1
RSPress.MoveNext
wend
end if
RSPress.Close
ConnPress.Close
%>
<%
else
Response.Write(" You have exceeded your search limit for today. Please come back to visit our store tomorrow. Thankyou. ")
%>
| Store
matches |
<%
Response.Write nextpage & "More" & ""
%>
|
<%
end if
%>
<%
end if
%> |