<!--#include file="conn.asp"-->
<!--#include file="inc/cook2.asp"-->
<!--#include file="inc/dimflag.asp"-->
<!--#include file="top.asp"-->
<%
tid=request("tid")
%>
<%
id=request.QueryString("id")
action=request.querystring("action")
tid=request("tid")
select case action

'//添加新数据
case "add" 
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from com_size",conn,1,3
rs.AddNew
rs("ClassNamecn")=trim(request("ClassNamecn2"))
rs("pid")=int(request("pid2"))
rs.Update
rs.Close
set rs=nothing
response.Redirect "book_size.asp?tid="&tid&""

'//修改数据
case "edit"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from com_size where id="&id,conn,1,3
rs("ClassNamecn")=trim(request("ClassNamecn"))
rs("pid")=int(request("pid"))
rs.Update
rs.Close
set rs=nothing
response.Redirect "book_size.asp?tid="&tid&""

'//删除数据
case "del"
conn.execute ("delete from com_size where id="&id)
conn.execute ("delete from com_size where cid="&id)
conn.execute ("delete from com_PCR where sizeid="&id)
response.Redirect "book_size.asp?tid="&tid&""
end select
%>

<div id="container">
<div class="top_but">
 <li class="left"></li>
 <li><a href="#"><img src="images/but_1.gif" alt="添加" ></a></li>
 <li><a href="book_manage.asp?tid=<%=tid%>" onClick="parent.frmleft.bb(0,10,'b');"><img src="images/but_11.gif" alt="管理"></a></li>
 <li><img src="images/but_8.gif" alt="刷新" style="cursor:hand" onClick="window.location.reload(true);"></li>
 <li><img src="images/but_9.gif" alt="打印" style="cursor:hand;" onClick="window.print() "/></li>
</div>

<div class="tableAll titlebgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:150px;">分类</li>
 <li style="width:50px;">排序</li>
 <li style="width:80px;">操作</li>
</div>
<%
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from com_size order by pid asc,id desc ",conn,1,1
dim paixu
if rs.EOF and rs.BOF then
response.write conn_eof
paixu=0
else
while not rs.EOF
%>
<form name="form<%=rs("id")%>" method="post" action="book_size.asp?action=edit&id=<%=int(rs("id"))%>&tid=<%=tid%>">
 <div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:150px;"><input name="ClassNamecn" type="text" value="<%=trim(rs("ClassNamecn"))%>"></li>
 <li style="width:50px;"><input name="pid" type="text" id="pid" size="2" value="<%=int(rs("pid"))%>"></li>
 <li style="width:80px;"><a href="javascript:form<%=rs("id")%>.submit();">修改</a> <a href="book_size.asp?id=<%=int(rs("id"))%>&action=del&tid=<%=tid%>" onClick="return confirm('此操作会删除此些类下包含的所有信息！您确定进行删除操作吗？')">删除</a></li>
 </div>
</form>
<%
rs.MoveNext
wend
paixu=rs.RecordCount
end if
%>
<div class="tableAll titlebgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:700px">添加大类(注意：各项名称不能含有非法字符)</li>
</div>
<form name="formadd" method="post" action="book_size.asp?action=add&tid=<%=tid%>">
 <div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:150px;"><input name="ClassNamecn2" type="text"></li>

 <li style="width:50px;"><input name="pid2" type="text" id="pid2" size="2" value="<%=paixu+1%>"></li>
 <li style="width:80px;"><a href="javascript:formadd.submit();">添加</a></li>
 </div>



</form>
</div>
<!--#include file="footer.asp"-->