<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"--><%ColumnName="":Tablename="HX_Appointment":action=request("action"):WS_Aid=request("WS_Aid")
if WS_Aid<>"" and isnumeric(WS_Aid) then Orderby=" where WS_Aid="&WS_Aid else Orderby=" ORDER BY WS_OrderBy ASC"
set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
WS_AppointmentName=WS_S.HX_Replace(request.form("WS_AppointmentName")):WS_OrderBy=WS_S.HX_Replace(request.form("WS_OrderBy")):WS_Did=WS_S.HX_Replace(request.form("WS_Did"))
if WS_S.MemberPriv("WS_SystemSetAppointment")<>1 then HX_GoBack "对不起,您的权限不够!",""
if WS_OrderBy="" then WS_OrderBy=1
select case action
case "addsaveinfo"
       WS_S.HX_Isnull "职位名称不能为空",WS_AppointmentName
       set SERS=WS_S.HX_SetRSD(ColumnName,Tablename," where WS_AppointmentName='"&WS_AppointmentName&"'")	 
	   If SERS.recordcount>0 then  HX_GoBack "添加失败:\n此职位已存在!",""
	   Call WS_S.HX_RSClose(SERS)  
       msg="“"&WS_AppointmentName&"”职位添加成功!"
       rs.addnew:rs("WS_Did")=WS_Did:rs("WS_AppointmentName")=WS_AppointmentName:rs("WS_OrderBy")=WS_OrderBy:rs.update
	   Call WS_S.SaveAdminLog(LOGINUSERNAME,LogAppointment,msg)
       HX_GoBack msg,"Appointment.asp"
case "editsaveinfo"
       WS_S.HX_Isnull "职位名称不能为空",WS_AppointmentName
       set SERS=WS_S.HX_SetRSD(ColumnName,Tablename," where WS_AppointmentName='"&WS_AppointmentName&"' and WS_Aid<>"&WS_Aid)	 
	   If SERS.recordcount>0 then  HX_GoBack "修改失败:\n此职位已存在!",""
       msg="“"&rs("WS_AppointmentName")&"”职位修改成功!"
	   rs("WS_Did")=WS_Did:rs("WS_AppointmentName")=WS_AppointmentName:rs("WS_OrderBy")=WS_OrderBy:rs.update
	   call WS_S.SaveAdminLog(LOGINUSERNAME,LogAppointment,msg)
       HX_GoBack msg,"Appointment.asp"
case "del"
     msg="“"&rs("WS_AppointmentName")&"”职位删除成功"
     conn.execute("delete from HX_Appointment where WS_Aid="&WS_Aid)	
	 call WS_S.SaveAdminLog(LOGINUSERNAME,LogAppointment,msg) 
	 HX_GoBack msg,"Appointment.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'><script src='../HXinclude/HX_Function.js'></script></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='3' bgcolor='#FFFBE8'><form name='form1' method='post' action='?action=addsaveinfo'><tr bgcolor='#BF9B73' class='td4'><td width='41%' align='center'>职位名称</td><td width='21%' align='center'>所属部门</td><td width='22%' align='center'>排 序</div></td><td width='16%' align='center'>操 作</div></td></tr><tr bgcolor='#FFFBE8'><td align='center'><input type='text' name='WS_AppointmentName' size='35' value='"&WS_AppointmentName&"'></td><td align='center'><select name='WS_Did'>"
Set ders=WS_S.HX_SetRSD("","HX_Department"," order by WS_OrderBy asc")
if ders.recordcount>0 then
do until ders.eof
response.write "<option value='"&ders("WS_Did")&"'>"&ders("WS_DepartmentName")&"</option>"
ders.movenext
loop
end if
 Call WS_S.HX_RSClose(ders)
 response.write "</select></td><td align='center'><input type='text' name='WS_OrderBy' size='10' value='"&rs.recordcount+1&"' onKeyPress='event.returnValue=IsDigit();' style='ime-mode:disabled'></td><td align='center'><input type='submit' name='Submit' value=' 添 加 '></td></tr></form></table><br><table width='100%'  border='0' cellspacing='1' cellpadding='3' bgcolor='#FFFBE8'><tr bgcolor='#BF9B73' class='td4'><td width='10%' align='center'>序　号</td><td width='39%' align='center'>职位名称</td><td width='15%' align='center'>所属部门</td><td align='center'>排 序</td><td align='center'>操 作</td></tr>"
if rs.recordcount<=0 then
 response.write "<tr><td height=30 align=center colspan=5 bgcolor=FFFBE8>暂 无 数 据</td></tr>"
else
	do while not rs.EOF
	response.write "<form name='form1' method='post' action='?action=editsaveinfo&WS_Aid="&rs("WS_Aid")&"'><tr bgcolor='#FFFBE8'><td align='center'>"&rs("WS_Aid")&"</td><td align='center'><input type='text' name='WS_AppointmentName' size='35' value='"&rs("WS_AppointmentName")&"'></td><td align='center'><select name='WS_Did'>"
	Set ders=WS_S.HX_SetRSD("","HX_Department"," order by WS_OrderBy asc")
	if ders.recordcount>0 then
	do until ders.eof
	response.write "<option value='"&ders("WS_Did")&"' "
	if ders("WS_Did")=rs("WS_Did") then response.write "selected"
	response.write ">"&ders("WS_DepartmentName")&"</option>"
	ders.movenext
	  loop
	  end if
	  Call WS_S.HX_RSClose(ders) 
	  response.write "</select></td><td width='16%' align='center'><input type='text' name='WS_OrderBy' size='10' value='"&rs("WS_OrderBy")&"' onKeyPress='event.returnValue=IsDigit();' style='ime-mode:disabled'></td><td width='20%' align='center'><input type='submit' name='Submit' value=' 修改 '>&nbsp;<input type='button' name='Submit' value=' 删除 ' onclick=""location.href='Appointment.asp?action=del&WS_Aid="&rs("WS_Aid")&"';""></td></tr></form>"
      i=i+1
	  if i>=rs.PageSize then Exit Do
	  rs.movenext
      loop
  end if
  call WS_S.HX_RSClose(RS) 
response.write "</table></td></tr></table>"%>