<!--#include file="CommonCode.asp"-->
<!--#include file="../Include/PowerEasy.ProductList.asp"-->
<%
'**************************************************************
' Software name: PowerEasy SiteWeaver
' Web: http://www.powereasy.net
' Copyright (C) 2005－2009 佛山市动易网络科技有限公司 版权所有
'**************************************************************

PageTitle = "厂商信息"
Dim strList, aValue
Dim ProducerName, i
Dim rsProducer, sqlProducer, ProducerID
Dim TimeData

strFileName = "ShowProducer.asp?ChannelID=" & ChannelID

TimeData = Trim(Request("Data"))
If TimeData = "" Or Not (IsDate(TimeData)) Then
    TimeData = "0"
Else
    TimeData = FormatDateTime(TimeData, 2)
    strFileName = strFileName & "&Data=" & TimeData
End If

MaxPerPage = 20
strNavPath = strNavPath & strNavLink & "&nbsp;" & PageTitle

ProducerName = Trim(Request("ProducerName"))

If ProducerName = "" Then
    Call WriteErrMsg("请指定要查看的厂商名称", ComeUrl)
    Response.End
End If
ProducerName = ReplaceBadChar(ProducerName)
strFileName = strFileName & "&ProducerName=" & ProducerName

'取频道参数
Call GetChannel(ChannelID)
        
sqlProducer = "select top 1 * from PE_Producer where ProducerName='" & ProducerName & "' and ChannelID=" & ChannelID & " and Passed=" & PE_True
Set rsProducer = Server.CreateObject("ADODB.Recordset")
rsProducer.Open sqlProducer, Conn, 1, 1
If rsProducer.BOF And rsProducer.EOF Then
    rsProducer.Close
    Set rsProducer = Nothing
    Call WriteErrMsg("找不到指定的厂商", ComeUrl)
    Response.End
End If

strHtml = GetTemplate(0, 14, 0)
strHtml = Replace(strHtml, "{$ShowName}", ProducerName)
Call ReplaceCommonLabel

strHtml = Replace(strHtml, "{$PageTitle}", SiteTitle & " >> " & PageTitle)
strHtml = Replace(strHtml, "{$ShowPath}", strNavPath)
strHtml = Replace(strHtml, "{$MenuJS}", GetMenuJS("", False))
strHtml = Replace(strHtml, "{$Skin_CSS}", GetSkin_CSS(0))

If ChannelID > 0 Then
    strHtml = Replace(strHtml, "{$Rss}", "<a href='" & InstallDir & "rss.asp?ChannelID=" & ChannelID & "&AuthorName=" & ProducerName & "' Target='_blank'><img src='" & strInstallDir & "images/rss.gif' border=0></a>")
    strHtml = Replace(strHtml, "{$ShowList}", "ShowProducer.asp?Action=List&ChannelID=" & ChannelID)
Else
    strHtml = Replace(strHtml, "{$Rss}", "")
    strHtml = Replace(strHtml, "{$ShowList}", "ShowProducer.asp?Action=List")
End If

ProducerID = rsProducer("ProducerID")
strHtml = Replace(strHtml, "{$ShowProducerShortName}", ReplaceSpace(rsProducer("ProducerShortName")))
If rsProducer("ProducerPhoto") = "" Or IsNull(rsProducer("ProducerPhoto")) Then
    strHtml = Replace(strHtml, "{$ShowPhoto}", "<img src='ProducerPic/default.gif' width='150' height='175'>")
Else
    strHtml = Replace(strHtml, "{$ShowPhoto}", "<img src='" & rsProducer("ProducerPhoto") & "' width='150' height='175'>")
End If
strHtml = Replace(strHtml, "{$ShowBirthDay}", ReplaceSpace(rsProducer("BirthDay")))
strHtml = Replace(strHtml, "{$ShowAddress}", ReplaceSpace(rsProducer("Address")))
strHtml = Replace(strHtml, "{$ShowTel}", ReplaceSpace(rsProducer("Phone")))
strHtml = Replace(strHtml, "{$ShowFax}", ReplaceSpace(rsProducer("Fax")))
strHtml = Replace(strHtml, "{$ShowZipCode}", ReplaceSpace(rsProducer("Postcode")))
strHtml = Replace(strHtml, "{$ShowEmail}", ReplaceSpace(rsProducer("Email")))
strHtml = Replace(strHtml, "{$ShowHomePage}", ReplaceSpace(rsProducer("HomePage")))
If rsProducer("ProducerType") = 1 Then
    strHtml = Replace(strHtml, "{$ShowType}", XmlText("ShowSource", "ShowProducer/ProducerType1", "大陆厂商"))
ElseIf rsProducer("ProducerType") = 2 Then
    strHtml = Replace(strHtml, "{$ShowType}", XmlText("ShowSource", "ShowProducer/ProducerType2", "港台厂商"))
ElseIf rsProducer("ProducerType") = 3 Then
    strHtml = Replace(strHtml, "{$ShowType}", XmlText("ShowSource", "ShowProducer/ProducerType3", "日韩厂商"))
ElseIf rsProducer("ProducerType") = 4 Then
    strHtml = Replace(strHtml, "{$ShowType}", XmlText("ShowSource", "ShowProducer/ProducerType4", "欧美厂商"))
Else
    strHtml = Replace(strHtml, "{$ShowType}", XmlText("ShowSource", "ShowProducer/ProducerType5", "其他厂商"))
End If
strHtml = PE_Replace(strHtml, "{$ShowIntro}", rsProducer("ProducerIntro") & "")

regEx.Pattern = "\{\$ShowTrademarkList\((.*?)\)\}"
Set Matches = regEx.Execute(strHtml)
For Each Match In Matches
    aValue = ChannelID & "," & ProducerID & "," & Replace(Match.SubMatches(0), Chr(34), "")
    strList = GetTrademarkList(aValue)
    strHtml = Replace(strHtml, Match.value, strList)
Next

regEx.Pattern = "\{\$ShowProductList\((.*?)\)\}"
Set Matches = regEx.Execute(strHtml)
For Each Match In Matches
    aValue = ProducerName & "," & ChannelID & "," & ChannelDir & "," & UploadDir & "," & Replace(Match.SubMatches(0), Chr(34), "")
    strList = GetProductList(aValue, 1)
    strHtml = Replace(strHtml, Match.value, strList)
Next
If InStr(strHtml, "{$ShowPage}") > 0 Then strHtml = Replace(strHtml, "{$ShowPage}", ShowPage(strFileName, totalPut, MaxPerPage, CurrentPage, True, True, XmlText("ShowSource", "ShowProducer/ProductItem", "个商品"), False))
If InStr(strHtml, "{$ShowPage_en}") > 0 Then strHtml = Replace(strHtml, "{$ShowPage_en}", ShowPage_en(strFileName, totalPut, MaxPerPage, CurrentPage, True, True, XmlText("ShowSource", "ShowProducer/ProductItem", "个商品"), False))
Response.Write strHtml
rsProducer.Close
Set rsProducer = Nothing
Set PE_Content = Nothing
Call CloseConn

Function GetTrademarkList(ByVal str1)
    Dim strtmp, rsTrademark
    Dim strTemp, arrTemp
    If str1 = "" Then
        GetTrademarkList = ""
        Exit Function
    End If

    arrTemp = Split(str1, ",")
    If UBound(arrTemp) < 2 Then
        GetTrademarkList = "函数式标签：{$ShowTrademarkList()}的参数个数不对。请检查模板中的此标签。"
        Exit Function
    End If
    Set rsTrademark = Conn.Execute("select top " & arrTemp(2) & " TrademarkID,ChannelID,ProducerID,TrademarkName from PE_Trademark Where ChannelID=" & arrTemp(0) & " and ProducerID= " & arrTemp(1) & " and Passed=" & PE_True & " order by onTop " & PE_OrderType & ",TrademarkID desc")
    If rsTrademark.BOF And rsTrademark.EOF Then
        strtmp = ""
    Else
        strtmp = "<table width='100%'>"
        Do While Not rsTrademark.EOF
            strtmp = strtmp & ("<tr><td align=center><a href='ShowTrademark.asp?ChannelID=" & rsTrademark("ChannelID") & "&TrademarkName=" & rsTrademark("TrademarkName") & "'>" & rsTrademark("TrademarkName") & "</a></td></tr>")
            rsTrademark.MoveNext
        Loop
        strtmp = strtmp & "</table>"
    End If
    rsTrademark.Close
    GetTrademarkList = strtmp
End Function


%>
