|
|
 |
|
Back to Find a
Shop
<%
IF Request.form("Find") <> "" Then
%>
Automotive Repair Shops In or Near <%=Request.Form("zip")%>
Shops are listed in Zip Code order
Distances are measured from the center of each zip code
Know a
good shop in your area?
Click here to recommend one that we
should add to this list
Found a listing with
wrong information?
Click here to let us know or for other general comments
<% 'if we have 1 or more shops that are valid, write the results to the page
Dim i, shops
totaldealers = 0
shops = ""
For i = 0 to mydistance
shops = shops &BuildZipList(Request.Form("zip"), i, Request.Form("measurement"))
next
'Give a total for shops found within this distance
Response.Write("")
Response.Write(totaldealers &" Shops found within " & Request.Form("distance") & " " & Request.Form("measurement"))
Response.Write(" of " & Request.Form("zip") &"")
Response.Write(" ")
If totaldealers > 0 Then
Response.Write(shops)
End If
End IF
%> |
<%
Function BuildZipList(Zip, mydistance, measurement)
Dim Shops
DIM SQL1, SQL2, sql_list, objRS1, rs, ziplist
DIM connection, dealers, total_distance,total_dist
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.open "DSN=familycar-sql;DRIVER={SQL Server};UID=famcar;PWD=@goawayhackers@"
'Connection.open "DSN=famcar-test;UID=famcar;PWD=@shadow@"
'Connection.open "DSN=familycar"
'grab the location of the user's submitted postal code
SQL1 = "SELECT * From US_ZIP where zip= '" & Request.Form("zip") & "'"
Set objRS1 = Connection.Execute(SQL1)
'get a list of locations for all of our dealers by joining on ZIP
'SQL_list = "SELECT Latitude, Longitude, address, city, state, zip, email, directions "
SQL_list = "SELECT DISTINCT * From Shops INNER JOIN US_ZIP ON Shops.PostalCode = US_ZIP.ZIP Where Shops.hold=0 order by Shops.PostalCode"
set rs = Connection.Execute(SQL_list)
'Set distance = Server.CreateObject("calculate.dist")
'response.write(SQL1)
'response.write(SQL_List)
Do while not rs.eof and not objRS1.eof
IF Not objRS1.EOF Then
'compare the submitted location with each item in our dealer list and return the distance
total_distance = round(distance(objRS1("Latitude"),objRS1("longitude"),rs("Latitude"),rs("longitude"),Request.Form("measurement")),1)
End IF
IF total_distance > cInt(mydistance - 1) And total_distance =< cInt(mydistance) and len(total_distance) > 0 Then
shops = shops & ""
shops = shops & ""
shops = shops & ""
shops = shops &rs("ShopName") & ""
If Not rs("Web") = "" Then
shops = shops & " Click Here to view this shop's website"
End If
shops = shops & " " & rs("Address")
shops = shops & " " & rs("City")
shops = shops & ", " & rs("State")
shops = shops & " " & rs("ZIP")
shops = shops & " " & rs("Phone1")
If Not rs("Phone2") = "" Then
shops = shops & " or " & rs("Phone2")
End If
If Not rs("Email") = "" Then
shops = shops & " Email " &rs("Email") &""
End If
If Not rs("Blurb") = "" Then
shops = shops & " " & rs("Blurb")
End If
Service = ""
If rs("AirConditioning") = True Then
Service = Service &" Air Conditioning Service"
End If
If rs("Alignment") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Wheel Alignment"
End If
If rs("AutoBody") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Body & Fender Work"
End If
If rs("Balancing") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Wheel Balancing"
End If
If rs("Brakes") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Brake Service"
End If
If rs("ComputerizedEngineTesting") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Computerized Engine Testing"
End If
If rs("CoolingSystemService") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Cooling System Service"
End If
If rs("Electrical") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Electrical Work"
End If
If rs("EngineRepair") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Engine Repair"
End If
If rs("Exhaust") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Exhaust System Repair"
End If
If rs("FrontEnd") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Front End Repair"
End If
If rs("GeneralRepair") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" General Repairs"
End If
If rs("OilChange") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Oil Change Service"
End If
If rs("RadiatorRepair") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Radiator Repair"
End If
If rs("StateInspection") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" State Inspections"
End If
If rs("Tires") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Tires"
End If
If rs("Transmissions") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Transmission Repair"
End If
If rs("TuneUps") = True Then
If Not Service = "" Then
Service = Service & ", "
End If
Service = Service &" Tune Ups"
End If
If Not Service = "" Then
shops = shops & " Services this shop performs include: " & Service
End If
Map = "MAP"
'Rate = "Rate This Shop"
shops = shops & " " & Map &" " & Rate &" "
shops = shops & " | "
shops = shops & ""
if total_distance <> "0" then
shops = shops & "Less than " & abs(int(-total_distance)) & " " & Request.Form("measurement")
Else
shops = shops & "Located in the same Zip Code"
End if
shops = shops & " | "
shops = shops & " "
totaldealers = totaldealers + 1
End IF
rs.movenext
Loop
Set objRS1 = Nothing
Set rs = Nothing
Connection.Close
Set Connection = Nothing
BuildZipList = Shops
End Function
%> |