<%@ Language=VBScript %> <% 'RECUPERO VALORI Dim categoria, cat, scat1, scat2, sotto, contaRec, objRS, view 'PARAMETRI DI PAGINAZIONE Dim iPageSize Dim iPageCount Dim iPageCurrent Dim strOrderBy Dim strSQL Dim iRecordsShown Dim I '************************************************************** 'RICERCA PER CATEGORIE '************************************************************** 'CATEGORIA cat=Replace(Request("cat"),"'","''") if cat<>"" then strCat=split(Replace(cat,"''","'"),"/") end if 'SOTTOCATEGORIA 1 scat1=Replace(Request.QueryString("scat1"),"'","''") if scat1<>"" then strScat1=split(Replace(scat1,"''","'"),"/") end if 'SOTTOCATEGORIA 2 scat2=Replace(Request.QueryString("scat2"),"'","''") if scat2<>"" then strScat2=split(Replace(scat2,"''","'"),"/") end if sotto=Request.QueryString("sotto") %>

<%if cat="" then%>


RICERCA NELLE CATEGORIE

<%else%>


RISULTATO DELLA RICERCA PER CATEGORIE

<%end if%>
<%if cat="" then%>

CATEGORY SEARCH

<%else%>

CATEGORY SEARCH RESULT

<%end if%>
<% ' ************* INIZIO ************** IF cat="" THEN 'SOLO AL PRIMO ACCESSO DAI LINK IN ALTO%>
Seleziona una delle 9 categorie industriali

 
<% ELSE 'NEGLI ALTRI CASI iPageSize = 5 'NUMERO RECORD PER PAGINA If Request.QueryString("page") = "" Then iPageCurrent = 1 Else iPageCurrent = CInt(Request.QueryString("page")) End If If Request.QueryString("order") = "" Then strOrderBy = "priorita, ragsoc" Else strOrderBy = Request.QueryString("order") End If '**************************************************** ' SOTTOCATEGORIA 1 '**************************************************** IF sotto="uno" THEN 'CONTROLLO SE LA SOTTOCATEGORIA 1 ESISTE strSQL="SELECT DISTINCT scat1 FROM tImb WHERE cat='"& cat &"' " Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open strSQL, objConn contaRec=0 Do while not objRS.EOF if objRS("scat1")<>"" then contaRec=contaRec+1 End if objRS.MoveNext Loop objRS.Close set objRS = nothing Set objRS = Server.CreateObject("ADODB.Recordset") if contaRec>0 then 'LA SOTTOCATEGORIA 1 ESISTE strSQL="SELECT DISTINCT cat, scat1 FROM tImb WHERE cat='"& cat &"' ORDER BY scat1" objRS.Open strSQL, objConn contaRec=0 contaFound=0 Do While Not objRS.EOF if objRS("scat1")<>"" then contaRec=contaRec+1 If contaFound=0 then%>

<%=strCat(0)%>
<%=strCat(1)%>

<%contaFound=contaFound+1 end if%> <%objRS.MoveNext End if Loop %>
Selezionare
&scat1=<%=objRS("scat1")%>&sotto=due"><%=objRS("scat1")%>

<% Else 'LA SOTTOCATEGORIA 1 NON ESISTE contaFound=0 strSQL="SELECT * FROM tImb WHERE cat='"& cat &"' ORDER BY priorita, ragsoc" objRS.PageSize = iPageSize objRS.CacheSize = iPageSize objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText reccount = objRS.recordcount iPageCount = objRS.PageCount If iPageCurrent > iPageCount Then iPageCurrent = iPageCount If iPageCurrent < 1 Then iPageCurrent = 1 If iPageCount = 0 Then Response.Write "

Non è stato trovato nessun record.
No record found.

" Else objRS.AbsolutePage = iPageCurrent iRecordsShown = 0 Do While iRecordsShown < iPageSize And Not objRS.EOF 'ESISTE SOLO LA CATEGORIA if contaFound=0 then%>

<%=strCat(0)%>
<%=strCat(1)%>

<%contaFound=contaFound+1 end if%> <% iRecordsShown = iRecordsShown + 1 objRS.movenext view="fornitore" Loop End If objRS.Close set objRS = nothing %><% If iPageCurrent <> 1 Then %> <% End If If iPageCurrent < iPageCount Then %> <% End If %>
&sotto=uno"> Precedente/Previous &sotto=uno"> Successiva/Next
<% If ipagecount = 1 Then %>

<% else %>
Pagina <%=iPageCurrent%> di <%=iPageCount%>
Page of
<% end if end if END IF 'FINE SOTTOCATEGORIA 1 '**************************************************** ' SOTTOCATEGORIA 2 '**************************************************** IF sotto="due" THEN 'CONTROLLO SE LA SOTTOCATEGORIA 2 ESISTE strSQL="SELECT DISTINCT scat2 FROM tImb WHERE cat='"& cat &"' AND scat1='"&scat1&"' " Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open strSQL, objConn contaRec=0 contaFound=0 Do while not objRS.EOF if objRS("scat2")<>"" then contaRec=contaRec+1 End if objRS.MoveNext Loop objRS.Close set objRS = nothing Set objRS = Server.CreateObject("ADODB.Recordset") if contaRec>0 then 'LA SOTTOCATEGORIA 2 ESISTE strSQL="SELECT DISTINCT scat2 FROM tImb WHERE cat='"& cat &"' AND scat1='"& scat1 &"' ORDER BY scat2" objRS.Open strSQL, objConn contaRec=0 contaFound=0 Do While Not objRS.EOF if objRS("scat2")<>"" then contaRec=contaRec+1 If contafound=0 then%>

<%=strCat(0)%> > <%=strScat1(0)%>
<%=strCat(1)%> > <%=strScat1(1)%>

<% contaFound=contaFound+1 end if%> <%objRS.MoveNext End if Loop %>
Selezionare
&scat1=<%=Replace(scat1,"''","'")%>&scat2=<%=objRS("scat2")%>&sotto=tutti"><%=objRS("scat2")%>

<% Else 'LA SOTTOCATEGORIA 2 NON ESISTE contaFound=0 strSQL="SELECT * FROM tImb WHERE cat='"& cat &"' AND scat1='"& scat1 &"' ORDER BY priorita, ragsoc" objRS.PageSize = iPageSize objRS.CacheSize = iPageSize objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText reccount = objRS.recordcount iPageCount = objRS.PageCount If iPageCurrent > iPageCount Then iPageCurrent = iPageCount If iPageCurrent < 1 Then iPageCurrent = 1 If iPageCount = 0 Then Response.Write "

Non è stato trovato nessun record.
No record found.

" Else objRS.AbsolutePage = iPageCurrent iRecordsShown = 0 Do While iRecordsShown < iPageSize And Not objRS.EOF if contaFound=0 then%>

<%=strCat(0)%> > <%=strScat1(0)%>
<%=strCat(1)%> > <%=strScat1(1)%>

<% contaFound=contaFound+1 end if%> <% iRecordsShown = iRecordsShown + 1 objRS.movenext view="fornitore" Loop End If objRS.Close set objRS = nothing %><% If iPageCurrent <> 1 Then %> <% End If If iPageCurrent < iPageCount Then %> <% End If %>
&scat1=<%=Replace(scat1,"''","'")%>&sotto=due"> Precedente/Previous &scat1=<%=Replace(scat1,"''","'")%>&sotto=due"> Successiva/Next
<% If ipagecount = 1 Then %>

<% else %>
Pagina <%=iPageCurrent%> di <%=iPageCount%>
Page of
<% end if End if END IF 'FINE SOTTOCATEGORIA 2 'PRESENTO L'ELENCO DELLE AZIENDE CHE SODDISFANO ENTRAMBE LE SOTTOCATEGORIE IF sotto="tutti" then Set objRS = Server.CreateObject("ADODB.Recordset") strSQL="SELECT * FROM tImb WHERE cat='"& cat &"' AND scat1='"& scat1 &"' AND scat2='"& scat2 &"' ORDER BY priorita, ragsoc" objRS.PageSize = iPageSize objRS.CacheSize = iPageSize objRS.Open strSQL, objConn, adOpenStatic, adLockReadOnly, adCmdText reccount = objRS.recordcount iPageCount = objRS.PageCount If iPageCurrent > iPageCount Then iPageCurrent = iPageCount If iPageCurrent < 1 Then iPageCurrent = 1 If iPageCount = 0 Then Response.Write "

Non è stato trovato nessun record.
No record found.

" Else objRS.AbsolutePage = iPageCurrent iRecordsShown = 0 Do While iRecordsShown < iPageSize And Not objRS.EOF if contaFound=0 then%>

<%=strCat(0)%> > <%=strScat1(0)%> > <%=strScat2(0)%>
<%=strCat(1)%> > <%=strScat1(1)%> > <%=strScat2(1)%>

<%contaFound=contaFound+1 end if%> <% iRecordsShown = iRecordsShown + 1 objRS.movenext view="fornitore" Loop End If objRS.Close set objRS = nothing %><% If iPageCurrent <> 1 Then %> <% End If If iPageCurrent < iPageCount Then %> <% End If %>
&scat1=<%=Replace(scat1,"''","'")%>&scat2=<%=Replace(scat2,"''","'")%>&sotto=tutti"> Precedente/Previous &scat1=<%=Replace(scat1,"''","'")%>&scat2=<%=Replace(scat2,"''","'")%>&sotto=tutti"> Successiva/Next
<% If ipagecount = 1 Then %>

<% else %>
Pagina <%=iPageCurrent%> di <%=iPageCount%>
Page of
<% end if End if END IF 'FINE CATEGORIA, SOTTOCATEGRIA 1 E SOTTTOCATEGORIA 2 ' ************* FINE ************** objConn.Close set objConn = nothing %>

 

 

 

 

 

 

 

<%if view<>"fornitore" then%>
S
E
L
E
Z
I
O
N
A

S
E
L
E
C
T

 

<%end if%>