<!--#include file="Include/Const.Asp" -->
<!--#include file="Include/NoSQL.Asp" -->
<!--#include file="Include/ConnSiteData.Asp" -->
<%
Call SiteInfo()
If ISHTML = 1 Then
    Response.expires = 0
    Response.expiresabsolute = Now() - 1
    Response.addHeader "pragma", "no-cache"
    Response.addHeader "cache-control", "private"
    Response.CacheControl = "no-cache"
End If
If request.QueryString("SortID") = "" Then
    SeoTitle = "产品询价"
ElseIf Not IsNumeric(request.QueryString("SortID")) Then
    SeoTitle = "参数错误"
ElseIf conn.Execute("select * from Shenbi_ProductSort Where ViewFlag and  ID="&request.QueryString("SortID")).EOF Then
    SeoTitle = "参数错误"
Else
    Set rs = server.CreateObject("adodb.recordset")
    sql = "select * from Shenbi_ProductSort where ViewFlag and ID="&request.QueryString("SortID")
    rs.Open sql, conn, 1, 1
    SeoTitle = rs("SortName")
    rs.Close
    Set rs = Nothing
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><% =SeoTitle %> - <% =SiteTitle %></title>
<meta name="keywords" content="<% =Keywords %>" />
<meta name="description" content="<% =Descriptions %>" />
</head>
<!--#include file="Top.Asp" -->
<div id="mainmain">
	<div id="main_con" class="web_bg">
    
    <div id="left">		
<div class="art_list" style='position:relative;'>
<table width="100%"  class="blk_t">
<tr>
<td width="50%"><h3>产品列表</h3></td>  <td width="45%" align="right"><%=WebLocation()%>&nbsp;&nbsp;&nbsp;</td>
</tr>
</table>
	<div id="sta_content">
	<p align="left">
<%=WebContent("Shenbi_ProductSort",request.QueryString("SortID"),"")%>
    </p>	</div>
</div>
		</div>
		
		<div id="right">
		<div id="MODBLK_275" class="mod_block mb_SMab9Qin_block">
<h3 class="blk_t">产品分类</h3>

<div class="list_main category">
	<div class="prod_type">
	<div id="pro_type_9Q6Akf">
    <div class="SortBg">
      <h5><%Folder(0)%></h5>
    </div>	
	</div>
	</div>
	<div class="list_bot"></div>
</div>
<div class="blankbar"></div>
</div>
<!--#include file="new_left.Asp" -->
		</div>
        <div class="blankbar"></div>
 
	</div>
  </div>
  </div>
  </div>
  </div>

<!--#include file="End.Asp"-->
<%
Function Folder(id)
    Dim rs, sql, i, ChildCount, FolderType, FolderName, onMouseUp, ListType
    Set rs = server.CreateObject("adodb.recordset")
    sql = "Select * From Shenbi_ProductSort where ParentID="&id&" order by id"
    rs.Open sql, conn, 1, 1
    If id = 0 And rs.recordcount = 0 Then
        response.Write ("<center>暂无产品分类</center>")
        Exit Function
    End If
    i = 1
    response.Write("<table border=""0"" cellspacing=""0"" cellpadding=""0"">")
    While Not rs.EOF
        ChildCount = conn.Execute("select count(*) from Shenbi_ProductSort where ParentID="&rs("id"))(0)
        If ChildCount = 0 Then
            If i = rs.recordcount Then
                FolderType = "SortFileEnd"
            Else
                FolderType = "SortFile"
            End If
            FolderName = rs("SortName")
            onMouseUp = ""
        Else
            If i = rs.recordcount Then
                FolderType = "SortEndFolderClose"
                ListType = "SortEndListline"
                onMouseUp = "EndSortChange('a"&rs("id")&"','b"&rs("id")&"');"
            Else
                FolderType = "SortFolderClose"
                ListType = "SortListline"
                onMouseUp = "SortChange('a"&rs("id")&"','b"&rs("id")&"');"
            End If
            FolderName = rs("SortName")
        End If
        datafrom = "Shenbi_ProductSort"
        If ISHTML = 1 Then
            AutoLink = ""&ProSortName&""&Separated&""&rs("ID")&""&Separated&"1."&HTMLName&""
        Else
            AutoLink = "ProductList.Asp?SortID="&rs("ID")&""
        End If
        response.Write("	<tr height=""23"">")
        response.Write("		<td nowrap id=""b"&rs("id")&""" class="""&FolderType&"""></td><td nowrap style=""padding-top: 2px""><a href="""&AutoLink&""">"&FolderName&"</a></td>")
        response.Write("	</tr>")
        If ChildCount>0 Then
%>
<tr id="a<%= rs("id")%>" style="display:yes">
  <td class="<%= ListType%>" nowrap></td>
  <td><% Folder(rs("id")) %></td>
</tr>
<%
End If
rs.movenext
i = i + 1
Wend
response.Write("</table>")
rs.Close
Set rs = Nothing
End Function

Function WebLocation()
    WebLocation = "&nbsp;当前位置：<a href=""index.Asp"" class=""agray"">首页</a> - <a href=""ProductAdvisory.Asp"" class=""agray"">产品询价</a>"&vbCrLf
    If request.QueryString("SortID") = "" Then
        WebLocation = WebLocation
    ElseIf Not IsNumeric(request.QueryString("SortID")) Then
        WebLocation = WebLocation&"参数错误"
    ElseIf conn.Execute("select * from Shenbi_ProductSort Where ViewFlag and  ID="&request.QueryString("SortID")).EOF Then
        WebLocation = WebLocation&"参数错误"
    Else
        Dim rs, sql
        Set rs = server.CreateObject("adodb.recordset")
        sql = "select * from Shenbi_ProductSort where ViewFlag and ID="&request.QueryString("SortID")
        rs.Open sql, conn, 1, 1
        WebLocation = WebLocation&SortPathTXT("Shenbi_ProductSort", rs("ID"))
        rs.Close
        Set rs = Nothing
    End If
End Function

Function ChildSort()
    Dim ParentID
    ParentID = request.QueryString("SortID")
    If ParentID = "" Or (Not IsNumeric(ParentID)) Then Exit Function
    Dim rs, sql
    Set rs = server.CreateObject("adodb.recordset")
    sql = "select * from Shenbi_ProductSort where ViewFlag and ParentID="&ParentID&" order by ID desc"
    rs.Open sql, conn, 1, 1
    If rs.bof And rs.EOF Then
        Exit Function
    Else
        While Not rs.EOF
            If ISHTML = 1 Then
                AutoLink = ""&ProSortName&""&Separated&""&rs("ID")&""&Separated&"1."&HTMLName&""
            Else
                AutoLink = "ProductList.Asp?SortID="&rs("ID")&""
            End If
            response.Write "<a href="""&AutoLink&""">"&rs("SortName")&"</a> | "
            rs.movenext
        Wend
    End If
    rs.Close
    Set rs = Nothing
End Function

Function SortPathTXT(DataFrom, ID)
    Dim rs, sql
    Set rs = server.CreateObject("adodb.recordset")
    sql = "Select * From "&DataFrom&" where ViewFlag and ID="&ID
    rs.Open sql, conn, 1, 1
    If Not rs.EOF Then
        If ISHTML = 1 Then
            AutoLink = ""&ProSortName&""&Separated&""&rs("ID")&""&Separated&"1."&HTMLName&""
        Else
            AutoLink = "ProductList.Asp?SortID="&rs("ID")&""
        End If
        SortPathTXT = SortPathTXT(DataFrom, rs("ParentID"))&" - <a href="""&AutoLink&""">"&rs("SortName")&"</a>"
    End If
    rs.Close
    Set rs = Nothing
End Function

Function WebContent(DataFrom, ID, SortPath)
    Dim rs, sql
    Dim HideSort
    Set rs = server.CreateObject("adodb.recordset")
    If ID = "" Then
        SortPath = "0,"
    ElseIf Not IsNumeric(ID) Then
        response.Write "<center>暂无相关信息</center>"
        Exit Function
    ElseIf conn.Execute("select * from "&DataFrom&" Where ViewFlag and  ID="&ID).EOF Then
        response.Write "<center>暂无相关信息</center>"
        Exit Function
    Else
        SortPath = conn.Execute("select * from "&DataFrom&" Where ViewFlag and  ID="&ID)("SortPath")
        conn.Execute("update "&DataFrom&" set ClickNumber=ClickNumber+1 Where ID="&ID)
    End If
    sql = "select * from "&DataFrom&" Where not(ViewFlag) and Instr(SortPath,'"&SortPath&"')>0"
    rs.Open sql, conn, 1, 1
    While Not rs.EOF
        HideSort = "and not(Instr(SortPath,'"&rs("SortPath")&"')>0) "&HideSort
        rs.movenext
    Wend
    rs.Close
    Dim idCount
    Dim pages
    pages = ProInfo
    Dim pagec
    Dim page
    page = CLng(request("Page"))
    Dim pagenc
    pagenc = 5
    Dim pagenmax
    Dim pagenmin
    Dim pageprevious
    Dim pagenext
    datafrom = "Shenbi_Products"
    Dim datawhere
    datawhere = "where ViewFlag and Instr(SortPath,'"&SortPath&"')>0 "&HideSort& " "
    Dim sqlid
    Dim Myself, PATH_INFO, QUERY_STRING
    PATH_INFO = request.servervariables("PATH_INFO")
    QUERY_STRING = request.ServerVariables("QUERY_STRING")'
    If QUERY_STRING = "" Then
        Myself = PATH_INFO & "?"
    ElseIf InStr(PATH_INFO & "?" & QUERY_STRING, "Page=") = 0 Then
        Myself = PATH_INFO & "?" & QUERY_STRING & "&"
    Else
        Myself = Left(PATH_INFO & "?" & QUERY_STRING, InStr(PATH_INFO & "?" & QUERY_STRING, "Page=") -1)
    End If
    Dim taxis
    taxis = "order by id desc "
    Dim i
    sql = "select count(ID) as idCount from ["& datafrom &"]" & datawhere
    Set rs = server.CreateObject("adodb.recordset")
    rs.Open sql, conn, 0, 1
    idCount = rs("idCount")
    If(idcount>0) Then
    If(idcount Mod pages = 0)Then
    pagec = Int(idcount / pages)
Else
    pagec = Int(idcount / pages) + 1
End If
sql = "select id from ["& datafrom &"] " & datawhere & taxis
Set rs = server.CreateObject("adodb.recordset")
rs.Open sql, conn, 1, 1
rs.pagesize = pages
If page < 1 Then page = 1
If page > pagec Then page = pagec
If pagec > 0 Then rs.absolutepage = page
For i = 1 To rs.pagesize
    If rs.EOF Then Exit For
    If(i = 1)Then
    sqlid = rs("id")
Else
    sqlid = sqlid &","&rs("id")
End If
rs.movenext
Next
End If
If(idcount>0 And sqlid<>"") Then
sql = "select * from ["& datafrom &"] where id in("& sqlid &") "&taxis
Set rs = server.CreateObject("adodb.recordset")
rs.Open sql, conn, 0, 1
Response.Write "<table width=""98%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&vbCrLf
Response.Write "<form action=""ProductBuy.Asp"" method=""Post"" name=""Inquire"" target=""_blank"">"&vbCrLf
Response.Write "  <tr height=""32"">"&vbCrLf
Response.Write "    <td width=""300"" style=""color:#FFFFFF; font-weight:bold; background:url(Images/split.gif) no-repeat right center; background-color:#2585a6"">&nbsp;&nbsp;&nbsp;&nbsp;信息标题</td>"&vbCrLf
Response.Write "    <td align=""center"" bgcolor=""#2585a6"" style=""color:#FFFFFF; font-weight:bold; background:url(Images/split.gif) no-repeat right center; background-color:#2585a6"">产品编号</td>"&vbCrLf
Response.Write "    <td align=""center"" bgcolor=""#2585a6"" style=""color:#FFFFFF; font-weight:bold; background:url(Images/split.gif) no-repeat right center; background-color:#2585a6"">产品型号</td>"&vbCrLf
Response.Write "    <td align=""center"" bgcolor=""#2585a6"" style=""color:#FFFFFF; font-weight:bold; background:url(Images/split.gif) no-repeat right center; background-color:#2585a6"">计价单位</td>"&vbCrLf
Response.Write "    <td align=""center"" bgcolor=""#2585a6"" style=""color:#FFFFFF; font-weight:bold; background:url(Images/split.gif) no-repeat right center; background-color:#2585a6"">库存数量</td>"&vbCrLf
Response.Write "    <td align=""center"" bgcolor=""#2585a6"" style=""color:#FFFFFF; font-weight:bold"">发布日期</td>"&vbCrLf
Response.Write "  </tr>"&vbCrLf
While Not rs.EOF
    If ISHTML = 1 Then
        AutoLink = ""&ProName&""&Separated&""&rs("ID")&"."&HTMLName&""
    Else
        AutoLink = "ProductView.Asp?ID="&rs("ID")&""
    End If
    Response.Write "  <tr height=""28"">"&vbCrLf
    Response.Write "    <td style=""background:url(Images/bg2.gif) repeat-x left bottom;""> <input name=""ProductNo"" type=""checkbox"" id=""ProductNo"" value="""&Trim(rs("ProductNo"))&""" class=""inputnoborder""> <a href="""&AutoLink&""">"&rs("ProductName")&"</a></td>"&vbCrLf
    Response.Write "    <td align=""center"" style=""background:url(Images/bg2.gif) repeat-x left bottom; color:#999999"">"&rs("ProductNo")&"</td>"&vbCrLf
    Response.Write "    <td align=""center"" style=""background:url(Images/bg2.gif) repeat-x left bottom; color:#999999"">"&rs("ProductModel")&"</td>"&vbCrLf
    Response.Write "    <td align=""center"" style=""background:url(Images/bg2.gif) repeat-x left bottom; color:#999999"">"&rs("Unit")&"</td>"&vbCrLf
    Response.Write "    <td align=""center"" style=""background:url(Images/bg2.gif) repeat-x left bottom; color:#999999"">"&rs("Stock")&"</td>"&vbCrLf
    Response.Write "    <td align=""center"" style=""background:url(Images/bg2.gif) repeat-x left bottom; color:#999999"">"&FormatDate(rs("Addtime"), 13)&"</td>"&vbCrLf
    Response.Write "  </tr>"&vbCrLf
    rs.movenext
Wend
Response.Write "  <tr>"&vbCrLf
Response.Write "    <td height=""50"" align=""center"" colspan=""6""><input type=""image"" src=""images/buy.gif"" border=""0"" class=""inputnoborder"" /></td>"&vbCrLf
Response.Write "  </tr>"&vbCrLf
Response.Write "</form>"&vbCrLf
Response.Write "</table>"&vbCrLf
Else
    response.Write "<center>暂无相关信息</center>"
    Exit Function
End If
Response.Write "<table width=""98%"" border=""0"" cellspacing=""0"" cellpadding=""0"">"&vbCrLf
Response.Write "  <tr height=""35"">"&vbCrLf
Response.Write "    <td align=""center"">"&vbCrLf
Response.Write "共<strong style=""color:red"">"&idcount&"</strong>条记录 页次：<strong style=""color:red"">"&page&"</strong>/"&pagec&" 每页：<strong style=""color:red"">"&pages&"</strong>条记录" & vbCrLf
pagenmin = page - pagenc
pagenmax = page+pagenc
If(pagenmin<1) Then pagenmin = 1
If ISHTML = 1 Then
    If ID = "" Then
        If(page>1) Then response.Write ("<a href="""&AdvisoryNameDiy&""&Separated&"1."&HTMLName&""" title=""回到第一页""><font face=""webdings"" color=""#000000"">9</font></a> ")
    Else
        If(page>1) Then response.Write ("<a href="""&AdvisoryNameDiy&""&Separated&""&ID&""&Separated&"1."&HTMLName&""" title=""回到第一页""><font face=""webdings"" color=""#000000"">9</font></a> ")
    End If
Else
    If(page>1) Then response.Write ("<a href="""& myself &"Page=1"" title=""回到第一页""><font face=""webdings"" color=""#000000"">9</font></a> ")
End If
If page - (pagenc * 2 + 1)<= 0 Then
    pageprevious = 1
Else
    pageprevious = page - (pagenc * 2 + 1)
End If
If ISHTML = 1 Then
    If ID = "" Then
        If(pagenmin>1) Then response.Write ("<a href="""&AdvisoryNameDiy&""&Separated&""&pageprevious&"."&HTMLName&""" title=""第"& pageprevious &"页""><font face=""webdings"" color=""#000000"">3</font></a> ")
    Else
        If(pagenmin>1) Then response.Write ("<a href="""&AdvisoryNameDiy&""&Separated&""&ID&""&Separated&""&pageprevious&"."&HTMLName&""" title=""第"& pageprevious &"页""><font face=""webdings"" color=""#000000"">3</font></a> ")
    End If
Else
    If(pagenmin>1) Then response.Write ("<a href="""& myself &"Page="& pageprevious &""" title=""第"& pageprevious &"页""><font face=""webdings"" color=""#000000"">3</font></a> ")
End If
If(pagenmax>pagec) Then pagenmax = pagec
For i = pagenmin To pagenmax
    If(i = page) Then
    response.Write ("&nbsp;<strong style=""color:red"">"& i &"</strong>&nbsp;")
Else
    If ISHTML = 1 Then
        If ID = "" Then
            response.Write ("[<a href="""&AdvisoryNameDiy&""&Separated&""&i&"."&HTMLName&""">"& i &"</a>]")
        Else
            response.Write ("[<a href="""&AdvisoryNameDiy&""&Separated&""&ID&""&Separated&""&i&"."&HTMLName&""">"& i &"</a>]")
        End If
    Else
        response.Write ("[<a href="""& myself &"Page="&i&""">"& i &"</a>]")
    End If
End If
Next
If page+(pagenc * 2 + 1)>= pagec Then
    pagenext = pagec
Else
    pagenext = page+(pagenc * 2 + 1)
End If
If ISHTML = 1 Then
    If ID = "" Then
        If(pagenmax<pagec) Then response.Write (" <a href="""&AdvisoryNameDiy&""&Separated&""&pagenext&"."&HTMLName&""" title=""跳转到第"&pagenext&"页""><font face=""webdings"" color=""#999999"">:</font></a> ")
        If(page<pagec) Then response.Write (" <a href="""&AdvisoryNameDiy&""&Separated&""&pagec&"."&HTMLName&""" title=""跳转到第"&pagec&"页""><font face=""webdings"" color=""#000000"">:</font></a>")
    Else
        If(pagenmax<pagec) Then response.Write (" <a href="""&AdvisoryNameDiy&""&Separated&""&ID&""&Separated&""&pagenext&"."&HTMLName&""" title=""跳转到第"&pagenext&"页""><font face=""webdings"" color=""#999999"">:</font></a> ")
        If(page<pagec) Then response.Write (" <a href="""&AdvisoryNameDiy&""&Separated&""&ID&""&Separated&""&pagec&"."&HTMLName&""" title=""跳转到第"&pagec&"页""><font face=""webdings"" color=""#000000"">:</font></a>")
    End If
Else
    If(pagenmax<pagec) Then response.Write (" <a href="""& myself &"Page="& pagenext &""" title=""跳转到第"&pagenext&"页""><font face=""webdings"" color=""#999999"">:</font></a> ")
    If(page<pagec) Then response.Write (" <a href="""& myself &"Page="& pagec &""" title=""跳转到第"&pagec&"页""><font face=""webdings"" color=""#000000"">:</font></a>")
End If
Response.Write "    </td>"&vbCrLf
Response.Write "  </tr>"&vbCrLf
Response.Write "</table>"&vbCrLf
rs.Close
Set rs = Nothing
End Function
%>