<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>团购管理</title>
<link href="../skins/css/main.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>
<%
dim db
const DatabaseType="ACCESS"     
db="/data/jyrcw.asp"           
         On Error Resume Next
	dim ConnStr
	dim conn
		ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
		Set conn = Server.CreateObject("ADODB.Connection")
	conn.Open connstr
	If Err Then
		err.Clear
		Set Conn = Nothing
		Response.Write "数据库连接出错，请检查Conn.asp文件中的数据库参数设置。"
		Response.End
	End If
sub CloseConn()
	On Error Resume Next
	If IsObject(Conn) Then
		conn.close
		set conn=nothing
	end if
end sub
%>
<body>


<%if  request.QueryString("action1")="del1" then%>



<%for it=1 to request.form("selectbookid").count

danweiid=replace(request.form("selectbookid")(it),"'","")

conn.execute ("delete from tuangou where id="&danweiid)

'conn.execute ("delete from uploadpic where idclass="&danweiid)

next
response.Redirect "Adminproduct.asp"%>


<%end if%>
<table width="730" border="0" cellspacing="0" cellpadding="0">
		<%'=request.Cookies("js116")("username")%>
		


          <tr>
            <td width="730" height="40"  bgcolor="#F1F5F2" align="left" valign="middle"  style="text-indent:15px; font-size:14px; color:#666666; font-weight:bold;">产品管理&nbsp;</td>

          </tr>
		  
	
		  
		  <tr><td class="line4"  align="center"   valign="top" >
		
		  <form name="form1" method="post" action="Adminproduct.asp?action1=del1">
		  	<%
				Const MaxPerPage=20
   				dim totalPut   
   				dim CurrentPage
   				dim TotalPages
   				dim j
   				dim sql
                 
    				if Not isempty(request("page")) then
      				currentPage=Cint(request("page"))
   				else
      				currentPage=1
   				end if 
			set rs=server.CreateObject("adodb.recordset")
		
           		rs.open "select * from tuangou order by riqi desc",conn,1,1
		  
		    	if err.number<>0 then
				response.write "数据库中无数据"
				end if
  				if rs.eof And rs.bof then
       				Response.Write "<p align='center' class='contents'> 数据库中无数据！</p>"
   				else
	  				totalPut=rs.recordcount
      				if currentpage<1 then
          				currentpage=1
      				end if
      				if (currentpage-1)*MaxPerPage>totalput then
	   					if (totalPut mod MaxPerPage)=0 then
	     					currentpage= totalPut \ MaxPerPage
	   					else
	      					currentpage= totalPut \ MaxPerPage + 1
	   					end if
      				end if
       				if currentPage=1 then
            			showContent
            			showpage totalput,MaxPerPage,"Adminproduct.asp"
       				else
          				if (currentPage-1)*MaxPerPage<totalPut then
            				rs.move  (currentPage-1)*MaxPerPage
            				dim bookmark
            				bookmark=rs.bookmark
            				showContent
             				showpage totalput,MaxPerPage,"Adminproduct.asp"
        				else
	        				currentPage=1
           					showContent
           					showpage totalput,MaxPerPage,"Adminproduct.asp"
	      				end if
	   				end if
   				   	end if
   				sub showContent
       				dim i
	   			i=0%>
		  
		  <table class="tableBorder" width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr> 
<td colspan="5"  height="5"></td>
</tr>
<tr >
  <td width="5%" align="center" >序号</td>
<td width="23%" align="center" >图片</td>
<td width="43%" align="center">商品名称</td>
<td width="18%" align="center" >加入时间</td>
<td width="11%" align="center" >选 择</td>
</tr>
<%do while not rs.eof%>




<tr >
  <td align="center" height="64"><%=rs("id")%></td>
<td align="center">			
 <%set rs4=server.CreateObject("adodb.recordset")
rs4.Open "select * from bianhaoyf where bianhaoyf='"&rs("bianhao")&"' order by id desc",conn,1,3%>


<%set rs5=server.CreateObject("adodb.recordset")


rs5.Open "select top 1 * from bianhaoyf where id<"&rs4("id")&" order by id desc",conn,1,3%>



			 <%set rs1=server.CreateObject("adodb.recordset")
rs1.Open "select * from uploadpic where idclass='"&rs5("bianhaoyf")&"' order by id desc",conn,1,3%>

<%if not(rs1.eof or rs1.bof) then%>
<a href="editproduct.asp?id=<%=rs("id")%>"><img src="/UpLoadFile/<%=rs1("cppic")%>" alt="<%=rs("proname")%>" width="120" height="120" border="0"   class="line1Copy"/></a>
<%end if%>
</td>
<td width="43%" STYLE='PADDING-LEFT: 10px' align="left" valign="middle"><a href="editproduct.asp?id=<%=rs("id")%>">
<%=rs("proname")%>
</a>
  <span class="STYLE1">(<%=rs("tuanjia")%>)</span>&nbsp;<span class="STYLE1">编号：<%=rs("cpbh")%></span></td>
<td align="center"> <%=rs("riqi")%></td>
<td align="center">
<input name="selectbookid" type="checkbox" id="selectbookid" value="<%=rs("id")%>">
</td></tr>

          <%i=i+1
		if i>=MaxPerPage then Exit Do
		rs.movenext
		loop
		rs.close
		set rs=nothing%>
<tr > 
<td height="30" colspan="5" align="right">全选 
<input type="checkbox" name="checkbox" value="Check All" onClick="mm()">
<input type="submit" name="Submit" value="删 除" onClick="return test();" style="font-size:12px;">
&nbsp;</td>
</tr>


<tr><td colspan="5" align="center" valign="middle"><%  
				End Sub   
				Function showpage(totalnumber,maxperpage,filename)  
  				Dim n
				If totalnumber Mod maxperpage=0 Then  
					n= totalnumber \ maxperpage  
				Else
					n= totalnumber \ maxperpage+1  
				End If
				Response.Write "<form method=Post action="&filename&"?selectm="&selectm&"&selectkey="&selectkey&" >"  
				Response.Write "<p align='center' class='contents'> "  
				If CurrentPage<2 Then  
					Response.Write "<font class='contents'>首页 上一页</font> "  
				Else  
					Response.Write "<a href="&filename&"?page=1&selectm="&selectm&"&selectkey="&selectkey&" class='contents'>首页</a> "  
					Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&selectm="&selectm&"&selectkey="&selectkey&" class='contents'>上一页</a> "  
				End If
				If n-currentpage<1 Then  
					Response.Write "<font class='contents'>下一页 尾页</font>"  
				Else  
					Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&selectm="&selectm&"&selectkey="&selectkey&" class='contents'>"  
					Response.Write "下一页</a> <a href="&filename&"?page="&n&"&selectm="&selectm&"&selectkey="&selectkey&" class='contents'>尾页</a>"  
				End If  
					Response.Write "<font class='contents'> 页次：</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> "  
					Response.Write "<font class='contents'> 共有"&totalnumber&"种商品 " 
					Response.Write "<font class='contents'>转到：</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="&currentpage&">"  
					Response.Write "&nbsp;<input type='submit'  class='contents' value='GO' name='cndok' ></form>"  
				End Function  
			%>
			
			
			
			

			
			</td></tr>
</table>
		  
		  
		  
		  
		  
		  </form>
		  
		  
		  
		  
		  
		  
		  
		  
		  </td></tr>
		  
        </table>
</body>
</html>
<script>
function test()
{
  if(!confirm('确认删除吗？')) return false;
}
</script>
<script language=javascript>
function mm()
{
   var a = document.getElementsByTagName("input");
   if(a[0].checked==true){
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = false;
   }
   else
   {
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = true;
   }
}
</script>