<!--#include file="conn.asp"-->
<!--#include file="checkUser.asp"-->
<%
if request("sort_id")<>"" or request("sort")<>"" then
'------------------------------------类别管理--------------------------------------------------
	 select case request.form("options")
     case "del"
		   sql="delete * from class2 where sort_id="&request("sort_id")&""    '删除总类
		   conn.execute sql
		   sql="delete * from anli where sort_id="&request("sort_id")&""     '删除所属类货物
		   conn.execute sql
		   response.write "<script language=javascript>alert('成功删除ID为"&request("sort_id")&"的总类及相关产品!');location='anli_sort.asp';</script>"
	 case "rename"
	       sql="update class2 set sort='"&request("sort")&"' where sort_id="&request("sort_id")&""
		   conn.execute sql
		   response.write "<script language=javascript>alert('成功将ID为"&request("sort_id")&"更名为"&request("sort")&"!');location='anli_sort.asp';</script>"
	 case "new"
	       sql="insert into class2(sort) values('"&request("sort")&"')"
		   conn.execute sql
		   response.write "<script language=javascript>alert('成功添加总类 "&request("sort")&"!');location='anli_sort.asp';</script>"
     end select
'------------------------------------管理结束---------------------------------------------------
end if
    sql="select * from class2"
    set res=server.createobject("adodb.recordset")
    res.open sql,conn,1,1
%>
<html>
<head>
<link href=style.css rel=STYLESHEET type=text/css>
<title>class</title>
<style type="text/css">
<!--
.style2 {color: #FF0000}
-->
</style>
<link rel="stylesheet" href="Images/Admin_style.css">
</head>
<body topmargin="0" leftmargin="0" bgcolor="#CCCCCC">
<table border="0" width="95%" cellspacing="1" align="center">
<form method="POST" action="anli_sort.asp">
<input type="hidden" name="options" value>
  <tr>
    <td width="100%">
      
        <TABLE cellSpacing=1 cellPadding=0 width="100%" align=center bgColor=#999999 border=0>
        <TR> 
        <TD id=mainbg>
		     <TABLE cellSpacing=1 cellPadding=4 width="100%" border=0 height="145">
             <TR> 
             <TD width="120" height="30" noWrap bgcolor="#93C9FF" id=titlemedium><div align="center"><font color="#FFFFFF">动态类别管理<b></b>-请选择类别</font></div></TD>
             <TD width="458" height="30" noWrap bgcolor="#94CBFF" id=titlemedium><div align="left">
		     <select name="sort_id" size="1" id="sort_id"style="font-size: 9pt">
			 <option value="" selected>选择类别</option>
             <%
	         if res.eof and res.bof then
	            response.write "<option value=>请增加类别"
	         else
             Do while not res.eof
                response.write "<option value='" +  Cstr(res("sort_id")) + "'>" + res("sort") + "</option>"
                res.MoveNext
             Loop
	         end if
             %>
             </select>
             </div>             </TD>
             </TR>
             <TR> 
             <TD bgColor=#ffffff height="30"><div align="center">更改名字</div></TD>
             <TD height="30" align=middle bgColor=#ffffff width="458"> 
             <div align="left">
<input name="sort" type="text" class=smallinput id="sort" style="FONT-SIZE: 12px; WIDTH: 110px" size="20">             
             </div>
             </TD>
             </TR>
             <TR>
               <TD bgColor=#ffffff height="30">&nbsp;</TD>
               <TD height="30" align=middle bgColor=#ffffff>
			     <input name="submit3" type=image id="submit2"  alt=删除 src="images/delete.gif" align=absMiddle width="45" height="20" onClick="form.options.value='del'">
                 <input name="submit" type=image id="submit4" alt=改名 src="IMAGES/mod.gif" align=absMiddle width="45" height="20" onClick="form.options.value='rename'">                 
                 <input name="submit2" type=image id="submit22" alt=新增 src="images/add.gif" align=absMiddle width="74" height="20" onClick="form.options.value='new'"></TD>
             </TR>
             <TR> 
             <TD height="29" colspan="2" bgColor=#ffffff><div align="center" class="style2">注意：在删除类别时将删除所属类别下的所有产品数据<br><br>
               在修改类别名时请先选择类别，对产品数据库不会有影响<br><br>在增加新类别时不需要选择类别，直接键入名字按增加即可。</div></TD>
             </TR>
             <TR bgcolor="#D2E9FF"><TD height="20" colSpan=2 id=mainfoot></TD></TR>
             </TABLE>
	  </TD>
      </TR>
      </TABLE>
      
    </td>
  </tr>
  </form>
</table>

</body>
</html>
<%
res.close
set res=nothing
conn.close
set con=nothing
%>