<!--#include file="../../Conn.asp" -->
<!--#include file="../../Comm/Site_Class.asp" -->
<!--#include file="../../Comm/Function.asp" -->
<%
PagePath = "../../"

Set Qsite = New Site_Class

Qsite.SiteConfig_Master()
%>
<!--#include file="../Check_Login.asp" -->
<%
Qsite.Check_AdminFlag(arrAdminFlag(1 , 1))

If Request.Form <> "" Then
	Response.Redirect("Company_List.asp?CompanyName="& Qsite.chgStr(Trim(Request.Form("CompanyName"))))
	Response.End()
End If

Dim Rs,Sql,i,CurrentPage,FileName
Dim CompanyName,ViewType
Dim ComId
Dim Act,IsLock,IsYear,IsSh
Dim TodayDate

TodayDate = Qsite.FormatDate(Date())

CompanyName = Qsite.chgStr(Trim(Request.QueryString("CompanyName")))
ViewType = Qsite.chgStr(Trim(Request.QueryString("ViewType")))

Set Rs = server.CreateObject("ADODB.recordset")

If CompanyName <> "" Then
	Sql = "select * from CompanyTbl where UserName like '%"& CompanyName &"%' or CompanyName like '%"& CompanyName &"%' or Email like '%"& CompanyName &"%' order by EditDate desc"
Else
	If ViewType = "IsYear" Then
		Sql = "select * from CompanyTbl where IsYear = '1' order by EditDate desc"
	ElseIf ViewType = "NoLock" Then
		Sql = "select * from CompanyTbl where IsLock = '0' order by EditDate desc"
	ElseIf ViewType = "IsLock" Then
		Sql = "select * from CompanyTbl where IsLock = '1' order by EditDate desc"
	ElseIf ViewType = "IsSh" Then
		Sql = "select * from CompanyTbl where IsSh = '1' order by EditDate desc"
	ElseIf ViewType = "Member0" Then
		Sql = "select * from CompanyTbl where MemberType = 0 order by EditDate desc"
	ElseIf ViewType = "Member1" Then
		Sql = "select * from CompanyTbl where MemberType = 1 order by EditDate desc"
	ElseIf ViewType = "Member2" Then
		Sql = "select * from CompanyTbl where MemberType = 2 order by EditDate desc"
	ElseIf ViewType = "Member3" Then
		Sql = "select * from CompanyTbl where MemberType = 3 order by EditDate desc"
	ElseIf ViewType = "Member4" Then
		Sql = "select * from CompanyTbl where MemberType = 4 order by EditDate desc"
	Else
		Sql = "select * from CompanyTbl order by EditDate desc"
	End If
End If

FileName = "Company_List.asp?ViewType="& ViewType &"&CompanyName="& CompanyName

Act = Qsite.chgStr(Trim(Request.QueryString("action")))

If Act = "IsLock" Then
	IsLock = Qsite.chgStr(Trim(Request.QueryString("IsLock")))
	ComId = Qsite.chgStr(Trim(Request.QueryString("ComId")))
	CurrentPage = Qsite.chgStr(Trim(Request.QueryString("Page")))
	If CurrentPage = "" Or Not IsNumeric(CurrentPage) Then CurrentPage = 1
	If IsLock = "" Or Not IsNumeric(IsLock) Then IsLock = 0
	If ComId = "" Or Not IsNumeric(ComId) Then ComId = 0
	Conn.Execute("update CompanyTbl set IsLock = '"& IsLock &"' where ComId = "& ComId)
	Response.Redirect(FileName & "&page="& CurrentPage)
	Response.End()
ElseIf Act = "IsYear" Then
	IsYear = Qsite.chgStr(Trim(Request.QueryString("IsYear")))
	ComId = Qsite.chgStr(Trim(Request.QueryString("ComId")))
	CurrentPage = Qsite.chgStr(Trim(Request.QueryString("Page")))
	If CurrentPage = "" Or Not IsNumeric(CurrentPage) Then CurrentPage = 1
	If IsYear = "" Or Not IsNumeric(IsYear) Then IsYear = 0
	If ComId = "" Or Not IsNumeric(ComId) Then ComId = 0
	Conn.Execute("update CompanyTbl set IsYear = '"& IsYear &"' where ComId = "& ComId)
	Response.Redirect(FileName & "&page="& CurrentPage)
	Response.End()
ElseIf Act = "IsSh" Then
	IsSh = Qsite.chgStr(Trim(Request.QueryString("IsSh")))
	ComId = Qsite.chgStr(Trim(Request.QueryString("ComId")))
	CurrentPage = Qsite.chgStr(Trim(Request.QueryString("Page")))
	If CurrentPage = "" Or Not IsNumeric(CurrentPage) Then CurrentPage = 1
	If IsSh = "" Or Not IsNumeric(IsSh) Then IsSh = 0
	If ComId = "" Or Not IsNumeric(ComId) Then ComId = 0
	Conn.Execute("update CompanyTbl set IsSh = '"& IsSh &"' where ComId = "& ComId)
	Response.Redirect(FileName & "&page="& CurrentPage)
	Response.End()
ElseIf Act = "del" Then
	ComId = Qsite.chgStr(Trim(Request.QueryString("ComId")))
	CurrentPage = Qsite.chgStr(Trim(Request.QueryString("Page")))
	If ComId = "" Or Not IsNumeric(ComId) Then ComId = 0
	If CurrentPage = "" Or Not IsNumeric(CurrentPage) Then CurrentPage = 1
	
	Conn.Execute("delete * from CompanyBoxTbl where ComId = "& ComId)
	Conn.Execute("delete * from CompanyPerPoolTbl where ComId = "& ComId)
	Conn.Execute("delete * from CompanySendBoxTbl where ComId = "& ComId)
	Conn.Execute("delete * from PersonBoxTbl where ComId = "& ComId)
	Conn.Execute("delete * from PersonComPoolTbl where ComId = "& ComId)
	Conn.Execute("delete * from PersonSendBoxTbl where ComId = "& ComId)
	Conn.Execute("delete * from RecruitTbl where ComId = "& ComId)
	Conn.Execute("delete * from CompanyTbl where ComId = "& ComId)
	
	Response.Redirect(FileName & "&page="& CurrentPage)
	Response.End()
End If
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>企业管理</title>
<link href="../skins/css/main.css" rel="stylesheet" type="text/css">
<script language="javascript">
function DelCompany(ComId , CompanyName , ViewType , Page)
{
	var question = confirm("你确定要删除此条记录吗？");
	if (question !="0")
	{
		location.href = "Company_List.asp?action=del&CompanyName=" + CompanyName + "&ViewType=" + ViewType + "&Page=" + Page + "&ComId=" + ComId;
	}
}

function SetMember(ComId)
{
	window.open('Company_SetMember.asp?ComId=' + ComId , 'SetMember' , 'width=350,height=180,top=200,left=300');
}
</script>
</head>

<body>
<table width="100%" border="0" cellspacing="1" cellpadding="5">
	<tr>
		<td height="25" class="td_title">企业信息搜索</td>
	</tr>
	<tr>
		<td height="23" class="td_content"><form name="SearchForm" method="post" action="Company_List.asp" style="margin:0">
			用户名/公司名称/邮箱：
			    <input name="CompanyName" type="text" class="input_1" id="CompanyName" size="50" value="<%=CompanyName%>">
			<input name="Submit" type="submit" class="input_1" value="搜索">
		</form>
		
		</td>
	</tr>
</table>
<br>
<table width="100%" border="0" cellspacing="1" cellpadding="5">
	<tr>
		<td height="25" colspan="7" class="td_title">企业列表 -- [<a href="Company_List.asp">所有企业</a> | <a href="Company_List.asp?ViewType=IsYear">常年招聘企业</a> | <a href="Company_List.asp?ViewType=NoLock">正常企业</a> | <a href="Company_List.asp?ViewType=IsLock">锁定企业</a>
		<%
		If Qsite.NewComSh = "1" Then
		%>
		 | <a href="Company_List.asp?ViewType=IsSh">待审核企业</a>
		 <%
		 End If
		 %>
		 || 会员： <a href="Company_List.asp?ViewType=Member0">普通</a> | <a href="Company_List.asp?ViewType=Member1">月度</a> | <a href="Company_List.asp?ViewType=Member2">季度</a> | <a href="Company_List.asp?ViewType=Member3">半年</a> | <a href="Company_List.asp?ViewType=Member4">年度</a>] </td>
	</tr>
	<tr>
		<td width="11%" class="td_content"><strong>用户名</strong></td>
		<td width="25%" class="td_content"><strong>公司名称</strong>(点击查看发布的职位)</td>
		<td width="11%" class="td_content"><strong>联系人</strong></td>
		<td width="11%" class="td_content"><strong>状态(操作)</strong></td>
		<td width="9%" class="td_content"><strong>常年招聘</strong></td>
		<td width="16%" class="td_content"><strong>会员类型</strong>(点击操作)</td>
		<td width="17%" class="td_content"><strong>操作</strong></td>
	</tr>
<%
Rs.Open Sql , Conn , 1 , 1
If Rs.Eof Then
%>
	<tr>
		<td height="45" colspan="7" class="td_content">暂无企业信息</td>
	</tr>
<%
Else
	Rs.PageSize = 20
	CurrentPage = Clng(Request("page"))
	If CurrentPage < 1 Then CurrentPage = 1
	If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
	Rs.AbsolutePage = CurrentPage
	i = 0
	Do While Not Rs.Eof
%>
	<tr>
		<td class="td_content"><a href="../../Company_View.asp?ComId=<%=Rs("ComId")%>" target="_blank"><%=Rs("UserName")%></a></td>
		<td class="td_content"><a href="Recruit_List.asp?ComId=<%=Rs("ComId")%>"><%=Rs("CompanyName")%></a></td>
		<td class="td_content"><%=Rs("Contact")%></td>
		<td class="td_content"><%
		If Rs("IsLock") = "0" Then
			Response.Write("正常 (<a href="""& FileName &"&page="& CurrentPage &"&action=IsLock&IsLock=1&ComId="& Rs("ComId") &""">锁定</a>)")
		Else
			Response.Write("<font color=""#FF0000"">锁定</font> (<a href="""& FileName &"&page="& CurrentPage &"&action=IsLock&IsLock=0&ComId="& Rs("ComId") &""">开启</a>)")
		End If
		%></td>
		<td class="td_content"><%
		If Rs("IsYear") = "1" Then
			Response.Write("<font color=""#FF0000"">是</font>(<a href="""& FileName &"&page="& CurrentPage &"&action=IsYear&IsYear=0&ComId="& Rs("ComId") &""">取消</a>)")
		Else
			Response.Write("否(<a href="""& FileName &"&page="& CurrentPage &"&action=IsYear&IsYear=1&ComId="& Rs("ComId") &""">设定</a>)")
		End If
		%></td>
		<td class="td_content"><a href="#" onClick="SetMember('<%=Rs("ComId")%>');return false;"><%=Member_Name(Rs("MemberType"))%></a><%
		If Rs("MemberBeginDate") > TodayDate And Rs("MemberType") <> "0" Then
			Response.Write("(<font color=""#FF0000"">未开通</font>)")
		ElseIf Rs("MemberEndDate") < TodayDate And Rs("MemberType") <> "0" Then
			Response.Write("(<font color=""#FF0000"">已过期</font>)")
		Else
			Response.Write("(正常)")
		End If
		%></td>
		<td class="td_content"><%
		If Qsite.NewComSh = "1" Then
			If Rs("IsSh") = "0" Then
				Response.Write("<a href="""& FileName &"&page="& CurrentPage &"&action=IsSh&IsSh=1&ComId="& Rs("ComId") &""">已审核</a> | ")
			Else
				Response.Write("<a href="""& FileName &"&page="& CurrentPage &"&action=IsSh&IsSh=0&ComId="& Rs("ComId") &"""><font color=""#FF0000"">未审核</font></a> | ")
			End If
		End If
		%>
		<a href="Company_Edit.asp?strCompanyName=<%=CompanyName%>&ViewType=<%=ViewType%>&Page=<%=CurrentPage%>&ComId=<%=Rs("ComId")%>">修改</a> | <a href="#" onClick="DelCompany('<%=Rs("ComId")%>' , '<%=CompanyName%>' , '<%=ViewType%>' , '<%=CurrentPage%>');return false;">删除</a></td>
	</tr>
<%
	i = i + 1
	Rs.MoveNext
	If i >= Rs.PageSize Then Exit Do
	Loop
%>
	<tr>
		<td colspan="7" class="td_content">
<%
	Qsite.Page_Cn CurrentPage , Rs.PageCount , Rs.RecordCount , FileName
%>
		</td>
	</tr>
<%
End If
Rs.Close
%>
</table>
</body>
</html>
