<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<%if WS_S.MemberPriv("WS_PublicAffairsDocumentTypeMange")<>1 then HX_GoBack "对不起,您的权限不够!",""
ColumnName="":Tablename="HX_DocumentClass":action=request("action"):WS_DCID=request("WS_DCID")
if WS_DCID<>"" and isnumeric(WS_DCID) then Orderby=" where WS_DCID="&WS_DCID else Orderby=" ORDER BY WS_OrderBy ASC"
set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
WS_DocumentName=WS_S.HX_Replace(request.form("WS_DocumentName"))
WS_OrderBy=WS_S.HX_Replace(request.form("WS_OrderBy"))
if WS_OrderBy="" then WS_OrderBy=1
select case action
case "addsaveinfo"
       WS_S.HX_Isnull "类别名称不能为空",WS_DocumentName
       set SERS=WS_S.HX_SetRSD(ColumnName,Tablename," where WS_DocumentName='"&WS_DocumentName&"'")	 
	   If SERS.recordcount>0 then
	   HX_GoBack "添加失败:\n此类别已存在!",""
	   End If
	   Call WS_S.HX_RSClose(SERS)  
       msg="“"&WS_DocumentName&"”类别添加成功!"
       rs.addnew    
       rs("WS_DocumentName")=WS_DocumentName
       rs("WS_OrderBy")=WS_OrderBy
       rs.update
	   Call WS_S.SaveAdminLog(LOGINUSERNAME,LogAppointment,msg)
       HX_GoBack msg,"setdocument.asp"
case "editsaveinfo"
       WS_S.HX_Isnull "类别名称不能为空",WS_DocumentName
       set SERS=WS_S.HX_SetRSD(ColumnName,Tablename," where WS_DocumentName='"&WS_DocumentName&"' and WS_DCID<>"&WS_DCID)	 
	   If SERS.recordcount>0 then
	   HX_GoBack "修改失败:\n此类别已存在!",""
	   End If
       msg="“"&rs("WS_DocumentName")&"”类别修改成功!"
	   rs("WS_DocumentName")=WS_DocumentName
       rs("WS_OrderBy")=WS_OrderBy
       rs.update
	   call WS_S.SaveAdminLog(LOGINUSERNAME,LogAppointment,msg)
       HX_GoBack msg,"setdocument.asp"
case "del"
     msg="“"&rs("WS_DocumentName")&"”类别删除成功"
     conn.execute("delete from HX_DocumentClass where WS_DCID="&WS_DCID)
	 conn.execute("delete from HX_Document where WS_DCID="&WS_DCID)
	 call WS_S.SaveAdminLog(LOGINUSERNAME,LogAppointment,msg) 
	 HX_GoBack msg,"setdocument.asp"  
end select
response.Write "<head><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title></title><link rel=stylesheet type=text/css href='../HXinclude/HX_Style.css'></head><body topmargin='20' leftmargin='0' bottommargin='0'><table width='596'  border='0' cellspacing='1' cellpadding='0' align=center bgcolor='#613c25'><tr><td colspan='2' bgcolor=FFFBE8><table width='100%'  border='0' cellspacing='0' cellpadding='0'><tr><td height='25' background='../hximages/titleline.gif'><font class='fontmenu'>类别管理</font></td></tr></table><table width='100%'  border='0' cellspacing='1' cellpadding='0' bgcolor=FFFBE8><tr bgcolor='#FFFBE8'><td width='27%'><table width='100%'  border='0' cellspacing='1' cellpadding='3' bgcolor='#613c25'><form name='form1' method='post' action='?action=addsaveinfo'><tr bgcolor='#BF9B73' class='td4'><td width='52%'><div align='center'>类别名称</div></td><td width='26%'><div align='center'>排　序</div></td><td width='22%'><div align='center'>操　作</div></td></tr><tr bgcolor='#FFFBE8'><td><div align='center'><input type='text' name='WS_DocumentName' size='25' value=''></div></td><td><div align='center'><input type='text' name='WS_OrderBy' size='10' value='"&rs.recordcount+1&"' onKeyPress='event.returnValue=IsDigit();' style='ime-mode:disabled'></div></td><td><div align='center'><input type='submit' name='Submit' value=' 添 加 '></div></td></tr></form></table><br><table width='100%'  border='0' cellspacing='1' cellpadding='3' bgcolor='#613c25'><tr bgcolor='#BF9B73' class='td4'><td width='10%'><div align='center'>序号</div></td><td width='42%'><div align='center'>类别名称</div></td><td width='26%'><div align='center'>排　序</div></td><td width='22%'><div align='center'>操　作</div></td></tr>"
    if rs.recordcount<=0 then
	 response.write "<tr><td height=30 align=center colspan=4 bgcolor=FFFBE8 onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'>暂 无 数 据</td></tr>"
	else
	do while not rs.EOF
	response.write "<form name='form1' method='post' action='?action=editsaveinfo&WS_DCID="&rs("WS_DCID")&"'><tr bgcolor=FFFBE8 onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td><div align='center'>"&rs("WS_DCID")&"</div></td><td><div align='center'><input type='text' name='WS_DocumentName' size='25' value='"&rs("WS_DocumentName")&"'></div></td><td><div align='center'><input type='text' name='WS_OrderBy' size='10' value='"&rs("WS_OrderBy")&"' onKeyPress='event.returnValue=IsDigit();' style='ime-mode:disabled'></div></td><td><div align='center'><input type='submit' name='Submit' value=' 修改 '>&nbsp;<input type='button' name='Submit' value=' 删除 ' onclick=""javascript:if(!confirm('是否要删除此类别及其下面的文档！')) return false; else location.href='setdocument.asp?action=del&WS_DCID="&rs("WS_DCID")&"';""></div></td></tr></form>"
	  rs.movenext
      loop
  end if
  call WS_S.HX_RSClose(RS) 
  response.write "</table></td></tr></table></td></tr></table>"
%>