<%@page contentType="text/html; charset=GBK"%><%@include file="../../include/Admin.jsp"%><%@include file="../../include/DBCon.jsp"%><%if(!StrFormat.isNull(request.getParameter("act"))){if(!StrFormat.isNull(request.getParameter("name")) && request.getParameter("act").equals("add")){try{DBStmt = DBCon.createStatement();DBSql = "select name from type where name='"+ StrTrans.toGBK(request.getParameter("name")) +"'";DBRs = DBStmt.executeQuery(DBSql);if(!DBRs.next()){DBSql = "insert into type (name,parent,addid,time) values ('"+ StrTrans.toGBK(request.getParameter("name")) +"','"+request.getParameter("parent")+"','"+AdmID+"','"+DateFormat.getDateTime()+"')";DBStmt.executeUpdate(DBSql);MesStr = "添加成功！";}else{MesStr = "添加失败：该名称已存在，请更换其他名称！";}}catch(Exception ie){MesStr = "添加失败！";if(isShowErr!=0){MesStr += "\\r\\nErrInfo:"+ie;}}finally{if(DBRs!=null)DBRs.close();if(DBStmt!=null)DBStmt.close();}}else{MesStr = "操作错误！";}out.print("<script language=\"javascript\" src=\"../../js/common.js\"></script><script language=\"javascript\">alert(\""+MesStr+"\");BackURL(\"TypeList.jsp\",\"\");</script>");}else{%><html><head><meta http-equiv="Content-Type" content="text/html; charset=GBK" /><meta name="keywords" content="向继根,Xiang Jigen,QQ,190582560"><meta name="description" content="Programmer:向继根 QQ:190582560 Email:190582560@qq.com"><meta name="author" content="向继根,Xiang Jigen" /><title><%=TitleStr%>添加分类</title><link rel="stylesheet" type="text/css" href="../images/Style.css"/><script type="text/javascript" src="../../js/min.js"></script><script type="text/javascript" src="../../js/common.js"></script><script type="text/javascript" src="../../js/css.js"></script><script type="text/javascript">function doCheck(){if(isNull($GenID('name').value)){alert('名称不能为空！');		$GenID('name').focus();return false;}	return true;}</script></head><body><form action="?act=add" method="post" name="form" id="form" onSubmit="return doCheck();"><table cellpadding="0" cellspacing="1" class="table_list"><caption>添加分类</caption><tr><th width="20%"><strong>所属父级</strong></th><td>&nbsp;<select name="parent" id="parent"><option value="0" selected>一级分类</option><%		SortBean tree=new SortBean(DBCon);		out.print(tree.ShowOption("type","0","0",0));		%></select></td></tr><tr><th width="20%"><span class="red">*</span> <strong>名 称</strong></th><td>&nbsp;<input type="text" name="name" id="name" size="30" /></td></tr></table><div id="button"><input type="submit" name="dosubmit" class="button_style" value="确 定" />&nbsp;&nbsp;<input type="reset" name="reset" class="button_style" value="清 除" />&nbsp;&nbsp;<input type="button" name="button" class="button_style" value="返 回" onClick="history.back();"></div></form></body></html><%}%><%@include file="../../include/DBConClose.jsp"%>