<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p20")
'''''''''''''''''''''''''''''''''''''''''''''''
const recpage=15
dim i,classid,currentpage,BeginTime,key,bykey,IsLock,paras,IsCheck,IsRem
BeginTime=Timer

bykey=trim(request.QueryString("bykey"))
key=trim(request.QueryString("key"))
if(request.QueryString("IsLock")<>"") then
	IsLock=Cint(request.QueryString("IsLock"))
else
	IsLock=0
end if
if(request.QueryString("IsCheck")<>"") then
	IsCheck=Cint(request.QueryString("IsCheck"))
else
	IsCheck=0
end if
if(request.QueryString("IsRem")<>"") then
	IsRem=Cint(request.QueryString("IsRem"))
else
	IsRem=0
end if
if not isempty(request.QueryString("page")) then 
	currentpage=Clng(request.QueryString("page"))
else 
	currentpage=1
end if
paras="key="&key&"&bykey="&bykey&"&IsLock="&IsLock&"&IsCheck="&IsCheck&"&IsRem="&IsRem
%>
<html>
<head>
<title>中介管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
	font-size:12px;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
form{margin:0;}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script language="javascript">
function goto(frm)
{
	var gourl ="?<%=paras%>&";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href=gourl;
}
function ConfirmDel()
{
   if(confirm("确认删除？并且不能恢复！确定要删除此信息吗？"))
     return true;
   else
     return false;
	 
}
</script>
</head>
<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>

<form name="form3" method="get" action="?">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><div align="center"><a href="agent_add.asp"><strong>添加中介-&gt;</strong></a> 关键字：
<input name="key" type="text" id="key" value="<%=key%>">
      按：
      <select name="bykey" id="bykey">
        <option value="UserId" <%if(bykey="UserId") then response.write("selected=""selected""") end if%>>中介ID</option>
        <option value="UserName" <%if(bykey="UserName") then response.write("selected=""selected""") end if%>>中介名称</option>
        <option value="Email" <%if(bykey="Email") then response.write("selected=""selected""") end if%>>中介邮箱</option>
      </select>
      <select name="IsLock" id="IsLock">
        <option value="1" <%if(IsLock=1) then response.write("selected=""selected""") end if%>>锁定</option>
        <option value="0" <%if(IsLock=0) then response.write("selected=""selected""") end if%>>未锁定</option>
        <option value="-1" <%if(IsLock=-1) then response.write("selected=""selected""") end if%>>全部</option>
      </select>
      <select name="IsCheck" id="IsCheck">
        <option value="1" <%if(IsCheck=1) then response.write("selected=""selected""") end if%>>已通过审核</option>
        <option value="0" <%if(IsCheck=0) then response.write("selected=""selected""") end if%>>未通过审核</option>
        <option value="-1" <%if(IsCheck=-1) then response.write("selected=""selected""") end if%>>全部</option>
      </select>
      <select name="IsRem" id="IsRem">
        <option value="1" <%if(IsRem=1) then response.write("selected=""selected""") end if%>>推荐中介</option>
        <option value="0" <%if(IsRem=0) then response.write("selected=""selected""") end if%>>未推荐</option>
        <option value="-1" <%if(IsRem=-1) then response.write("selected=""selected""") end if%>>全部</option>
      </select>
      <input type="submit" value="搜索中介">
      </div></td>
    </tr>
  </table>
</form>
<form action="staff_do.asp" name="form1" method="post" enctype="application/x-www-form-urlencoded">
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr bgcolor="#FF9900">
    <td height="22" colspan="10"><div align="center" class="style1">◆ 中介管理 ◆</div></td>
  </tr>
  <tr bgcolor="#EEEEEE">
    <td width="6%" bgcolor="#EEEEEE"><div align="center">id</div></td>
    <td width="7%" height="20"><div align="center">登录ID</div></td>
    <td width="13%"><div align="center">姓名</div></td>
    <td width="16%"><div align="center">所属中介公司</div></td>
    <td width="12%"><div align="center">性别</div></td>
    <td width="10%"><div align="center">电话</div></td>
    <td width="8%"><div align="center">推荐</div></td>
    <td width="8%"><div align="center">锁定</div></td>
    <td width="10%"><div align="center">审核</div></td>
    <td width="10%"><div align="center">修改</div></td>
    </tr>
  <!-- 开始按行循环----------------------->
  <%
  		dim countSql,querySql,newsArr
		set rs=server.createobject("adodb.recordset")
		countSql="select count(*) from t_agent_staff where 1=1"		
		if(key<>"") then
			Select Case bykey
					Case "UserId"
						countSql=countSql&" and UserId like '%"&key&"%'"
					Case "UserName"
						countSql=countSql&" and UserName like '%"&key&"%'"
					Case "Email"
						countSql=countSql&" and Email like '%"&key&"%'"				
					Case Else				
			End Select
		end if
		if(IsLock>=0) then
			countSql=countSql&" and IsLock="&IsLock
		end if
		if(IsCheck>=0) then
			countSql=countSql&" and IsCheck="&IsCheck
		end if
		if(IsRem>=0) then
			countSql=countSql&" and Recommend="&IsRem
		end if
  	rs.open countSql,conn,3,1
		allrec=rs(0)
		rs.close
		set rs=nothing
		totalpage=int((allrec+recpage-1)/recpage)		
		set rs=server.createobject("adodb.recordset")
		'查询sql
		querySql="select top "&recpage&" id,UserId,UserName,Sex,Email,Tel,Mobile,Recommend,Hits,IsCheck,IsLock,LastLoginDate,Photo,AgentId,AgentName from t_agent_staff where id <=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from t_agent_staff where 1=1"
		if(key<>"") then
			Select Case bykey
					Case "UserId"
						querySql=querySql&" and UserId like '%"&key&"%'"
					Case "UserName"
						querySql=querySql&" and UserName like '%"&key&"%'"
					Case "Email"
						querySql=querySql&" and Email like '%"&key&"%'"
					Case Else				
			End Select
		end if
		if(IsLock>=0) then
			querySql=querySql&" and IsLock="&IsLock
		end if
		if(IsCheck>=0) then
			querySql=querySql&" and IsCheck="&IsCheck
		end if
		if(IsRem>=0) then
			querySql=querySql&" and Recommend="&IsRem
		end if
		querySql=querySql&" order by id desc) as t) "
		if(key<>"") then
			Select Case bykey
					Case "UserId"
						querySql=querySql&" and UserId like '%"&key&"%'"
					Case "UserName"
						querySql=querySql&" and UserName like '%"&key&"%'"
					Case "Email"
						querySql=querySql&" and Email like '%"&key&"%'"
					Case Else				
			End Select
		end if
		if(IsLock>=0) then
			querySql=querySql&" and IsLock="&IsLock
		end if
		if(IsCheck>=0) then
			querySql=querySql&" and IsCheck="&IsCheck
		end if
		if(IsRem>=0) then
			querySql=querySql&" and Recommend="&IsRem
		end if
		querySql=querySql&" order by id desc "
		'response.write(querySql)
		rs.open querySql,conn,3,1
		if rs.eof or rs.bof then
			response.Write("未找到相关信息!")
			response.End()
		else
			newsArr=rs.GetRows()
		end if
		rs.close
		set rs=nothing
		if(isarray(newsArr)) then
			for i=0 to ubound(newsArr,2)
	%>
  <tr>
    <td bgcolor="#FFFFFF"><div align="center"><input type="checkbox" name="newsid" value="<%=newsArr(0,i)%>"></div></td>
    <td height="20" bgcolor="#FFFFFF"><div align="center"><%=newsArr(1,i)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=newsArr(2,i)%></div></td>
    <td bgcolor="#FFFFFF">
	<div align="center"><a href="/zj/agent.asp?id=<%=newsArr(13,i)%>" target="_blank"><%=newsArr(14,i)%></a></div></td>
    <td bgcolor="#FFFFFF">
	  <div align="center"><%=newsArr(3,i)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=newsArr(5,i)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center">
      <%
	if(newsArr(7,i)=0) then
		response.Write("否")
	else
		response.Write("<font color=""red"">推荐</font>")
	end if
	%>
    </div></td>
    <td bgcolor="#FFFFFF"><div align="center">
      <%
	if(newsArr(10,i)=0) then
		response.Write("否")
	else
		response.Write("<font color=""red"">是</font>")
	end if
	%>
    </div></td>
    <td bgcolor="#FFFFFF"><div align="center">
    <%
		if(newsArr(9,i)=0) then
			response.Write("<span style=""color:gray;"">正在审核</span>&nbsp;<a href=""staff_check.asp?id="&newsArr(0,i)&"&vals=1""><span style=""color:red;"">通过?</span></a>")
		else
			response.Write("<span style=""color:green;"">已通过审核</span>&nbsp;<a href=""staff_check.asp?id="&newsArr(0,i)&"&vals=0"">取消?</a>")
		end if
		%>
    </div></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="staff_modify.asp?id=<%=newsArr(0,i)%>">修改</a> <a href="dele.asp?id=<%=newsArr(0,i)%>&table=t_agent_staff" onClick="return confirm('确认删除？并且不能恢复！确定要删除此信息吗？')">删除</a></div></td>
    </tr>
  
  <%
		next
	else
		response.Write("没有数据")
	end if
  %>
  <tr>
    <td height="22" colspan="10" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="47%">
          <div align="right">
            <input class=Button type="button" name="chkall" value="全选" onClick="CheckAll(this.form)">
            <input class=Button type="button" name="chksel" value="反选" onClick="ContraSel(this.form)">
            管理选项：
            <select name="act">
              <option value="0">请选择操作选项↓</option>
              <option value="del">→批量删除</option>
              <option value="lock">→批量锁定</option>
              <option value="unlock">→取消锁定</option>
              <option value="rem">→批量推荐</option>
              <option value="unrem">→取消推荐</option>
            </select>
            </div></td>
        <td width="21%"><input class=Button type="submit" name="Submit2" value="执行操作" onClick="return confirm('您确定执行该操作吗?')"></td>
      </tr>
    </table></td>
  </tr>
  <!--按行循环结束------------------------>
</table>
</form>
<table width="100%" height="20"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td>
	<form name="form2" method="post" action="" style="margin:0 0 0 0">
      <div align="center">
<%
dim n,p
n=currentpage+1
p=currentpage-1
if p>0then
response.write("["&"<a href='?"&paras&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else response.write("上一页&nbsp;&nbsp;&nbsp;")
end if 
if (n-1)*recpage>=allrec then 
response.write("下一页" )
else
response.Write("["&"<a href='?"&paras&"&page="&cstr(n)&"'>下一页</a>]")
end if
response.write("&nbsp;共"&allrec&"条&nbsp;")
response.Write("&nbsp;共"&totalpage&"页&nbsp;")
response.Write("&nbsp;第"&currentpage&"页&nbsp;")
%>
            <input type="hidden" name="hid" value="<%=totalpage%>">
&nbsp;&nbsp;跳至
<input name="page" type="text" size="5" onKeyPress="if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;" onChange="goto(this.form)" style="border:1px solid #000000;height:18px ">
          页
          <input type="button" name="Button22" value="Go->" style="font-size:12px ;border:1px solid #000000;height:18px ">
        </div>
    </form></td>
  </tr>
</table>
<script language="javascript">
function CheckAll(form) {  
	for (var i=0;i<form.elements.length;i++)  {  
		var e = form.elements[i];  
		if (e.name != 'chkall')  
		e.checked = true // form.chkall.checked;  
	}  
} 
 
function ContraSel(form) {
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if (e.name != 'chkall')
		e.checked=!e.checked;
	}
}
</script>
</body>
</html>
<%
call connclose()
%>
执行时间：<%=CStr(FormatNumber((Timer-BeginTime)*1000,2))& "毫秒"%>             