<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"--><%if WS_S.MemberPriv("WS_SystemSetMemberPriv")<>1 then HX_GoBack "对不起,您的权限不够!",""
columnName="":Tablename="HX_MemberPriv":action=request("action"):MPID=request("MPID")
if MPID<>"" and isnumeric(MPID) then Orderby=" where WS_MPID="&MPID else Orderby=" ORDER BY WS_OrderBy ASC"
set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
WS_MemberPrivName=WS_S.HX_Replace(request.form("WS_MemberPrivName")):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_MemberPrivName
       set SERS=WS_S.HX_SetRSD(ColumnName,Tablename," where WS_MemberPrivName='"&WS_MemberPrivName&"'")	 
	   If SERS.recordcount>0 then  HX_GoBack "添加失败:\n此管理名称已存在!",""
	   WS_S.HX_RSClose SERS  
       msg="“"&WS_MemberPrivName&"”管理名称添加成功!"
       rs.addnew :rs("WS_MemberPrivName")=WS_MemberPrivName:rs("WS_OrderBy")=WS_OrderBy:rs.update
	   Call WS_S.SaveAdminLog(LOGINUSERNAME,LogAppointment,msg)
       HX_GoBack msg,"MemberPriv.asp"
case "editsaveinfo"
       WS_S.HX_Isnull "管理名称不能为空",WS_MemberPrivName
       set SERS=WS_S.HX_SetRSD(ColumnName,Tablename," where WS_MemberPrivName='"&WS_MemberPrivName&"' and WS_MPID<>"&MPID)	 
	   If SERS.recordcount>0 then  HX_GoBack "修改失败:\n此已存在!",""
       msg="“"&rs("WS_MemberPrivName")&"”管理名称修改成功!"
	   rs("WS_MemberPrivName")=WS_MemberPrivName:rs("WS_OrderBy")=WS_OrderBy:rs.update
	   call WS_S.SaveAdminLog(LOGINUSERNAME,LogAppointment,msg)
       HX_GoBack msg,"MemberPriv.asp"
case "del"
	 if conn.execute("select * from HX_CompanyUser where WS_MemberPriv="&MPID).eof then
       msg="“"&rs("WS_MemberPrivName")&"”删除成功"
	   conn.execute("delete from HX_MemberPriv where WS_MPID="&MPID)	   
	 else
	   msg="“"&rs("WS_MemberPrivName")&"”删除失败\n此角色下有用户，请先删除此角色下的用户！"
	 end if  
	 call WS_S.SaveAdminLog(LOGINUSERNAME,LogAppointment,msg) 
	 HX_GoBack msg,"MemberPriv.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='42%'><div align='center'>管理名称</div></td><td width='34%'><div align='center'>排 序</div></td><td><div align='center'>操 作</div></td></tr><tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td align='center'><input type='text' name='WS_MemberPrivName' size='18' value=''></td><td width='34%' align='center'><input type='text' name='WS_OrderBy' size='10' value='"&rs.recordcount+1&"' onKeyPress='event.returnValue=IsDigit();' style='ime-mode:disabled'></td><td width='24%' 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='11%'><div align='center'>序　号</div></td><td width='32%'><div align='center'>管理组名称</div></td><td><div align='center'>排 序</div></td><td><div align='center'>操 作</div></td></tr>"
if rs.recordcount<=0 then
 response.write "<tr><td height=30 align=center colspan=4 bgcolor=FFFBE8>暂 无 数 据</td></tr>"
else
do while not rs.EOF
 response.Write "<form name='form1' method='post' action='?action=editsaveinfo&MPID="&rs("WS_MPID")&"'><tr bgcolor='#FFFBE8' onmouseover=javascript:this.bgColor='#F9F8F2' onmouseout=javascript:this.bgColor='#FFFBE8'><td align='center'>"&rs("WS_MPID")&"</td><td align='center'><input type='text' name='WS_MemberPrivName' size='18' value='"&rs("WS_MemberPrivName")&"'></td><td width='19%' align='center'><input type='text' name='WS_OrderBy' size='4' value='"&rs("WS_OrderBy")&"' onKeyPress='event.returnValue=IsDigit();' style='ime-mode:disabled'></td><td width='38%' align='center'><input type='submit' name='Submit' value=' 修改 '>&nbsp;<input type='button' name='Submit' value=' 权限 ' onclick=""location.href='MemberPrivManage.asp?MPID="&rs("WS_MPID")&"';"">"
 response.Write " &nbsp;<input type='button' name='Submit' value=' 删除 ' onclick=""javascript:if(!confirm('是否要删除此管理组！')) return false;else location.href='MemberPriv.asp?action=del&MPID="&rs("WS_MPID")&"';""></td></tr></form>"
rs.movenext
loop
end if
WS_S.HX_RSClose RS  
response.Write "</table></td></tr></table>"
%>