<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/md5.asp"-->
<!--#include file="../inc/function.asp"-->
<!--#include file="checklogin.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>招聘管理</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
ul{margin:0px; padding:0px;}
li{margin:2px; padding:0px;}
-->
</style>
<script language="javascript">
function check(obj){
	if(obj.Title.value==""){
		alert("招聘职位不能为空!");
		obj.Title.focus();
		obj.Title.select();
		return false;
	}
	return true;
}
function goto(frm)
{
	var gourl ="?";
	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>
<!--#include file="top.asp"-->
<%
dim act
act=trim(request.QueryString("act"))
if isempty(act) or act="" then
	call News_List
elseif(act="add") then
	call News_Add
elseif(act="addok") then
	call News_AddOk
elseif(act="mod") then
	call News_Mod
elseif(act="modok") then
	call News_ModOk
elseif(act="del") then
	call News_Del
end if
%>
<%
Sub News_Add
%>
<FORM method="POST" name="form1" action="?act=addok" style="margin:0 0 0 0;" onSubmit="return check(this)">
  <TABLE width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#ffffff" class="border">
<TR bgcolor="#FF9900">
  <TD height="24" colspan="2" bgcolor="#FF9900" class="th_title"><span class="style3">添加招聘</span></TD>
  </TR>
<TR bgcolor="#F5F5F5">
  <TD width="13%" height="24"><div align="right">招聘职位：</div></TD>
  <TD width="87%"><input name="Title" type="text" id="Title" size="50">
    (*)</TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">学历要求：</TD>
  <TD><input name="Xueli" type="text" id="Xueli" size="50" /></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">招聘人数：</TD>
  <TD><input name="Pnum" type="text" id="Pnum" size="50" /></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">工作经验： </TD>
  <TD><input name="Gzjy" type="text" id="Gzjy" size="50" /></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">工作地区：</TD>
  <TD><input name="Area" type="text" id="Area" size="50" /></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">性别要求：</TD>
  <TD><input type="radio" name="Sexs" id="radio" value="男" />
    男
      <input type="radio" name="Sexs" id="radio2" value="女" />
      女
      <input name="Sexs" type="radio" id="radio3" value="不限" checked="checked" />
      不限</TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">年龄要求：</TD>
  <TD><input name="Ages" type="text" id="Ages" size="50" /></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">待遇水平：</TD>
  <TD><input name="Salary" type="text" id="Salary" size="50" /></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD width="13%"><div align="right">其它要求：</div></TD>
  <TD width="87%">
  <INPUT type="hidden" name="content1" value="">
	<IFRAME ID="eWebEditor1" src="webedit/editor.html" frameborder="0" scrolling="no" width="98%" height="350"></IFRAME>
  </TD>
</TR>
<TR bgcolor="#F5F5F5">
	<TD align=right>&nbsp;	  </TD>
    <TD height="32" align=right><div align="left"> 
        <input type=submit name=b1 value="提 交">&nbsp;&nbsp;
        <input type=reset name=b2 value="重 填">       
    </div></TD>
</TR>
</TABLE>
</FORM>
<%
end Sub
Sub News_Del
	dim id
	id=Clng(request.QueryString("id"))
	conn.execute("delete from t_member_job where id="&id)
	response.Redirect(request.ServerVariables("HTTP_REFERER"))
end Sub

Sub News_AddOk
	dim comname
	sql="select UserName from t_member_e where UserId='"&checkusername&"'"
	set rs=server.CreateObject("adodb.recordset")
	rs.open sql,conn,3,1
	if not rs.eof then		
		comname=rs(0)
	end if
	rs.close
	set rs=nothing
	
	dim title,Xueli,Pnum,Gzjy,Area,Sexs,Ages,Salary,Content
	title=replace(request.Form("Title"),"'","")
	Xueli=request.Form("Xueli")
	Pnum=request.Form("Pnum")
	Gzjy=request.Form("Gzjy")
	Area=request.Form("Area")
	Sexs=request.Form("Sexs")
	Ages=request.Form("Ages")
	Salary=request.Form("Salary")
	Content=request.Form("content1")
	set rs=server.createobject("adodb.recordset")
	rs.open "select top 1 * from t_member_job where 1=0",conn,3,3
	rs.addnew
	rs("MemberId")=checkusername
	rs("ComName")=comname
	rs("Title")=title
	rs("Xueli")=Xueli
	rs("Pnum")=Pnum
	rs("Gzjy")=Gzjy
	rs("Area")=Area
	rs("Sexs")=Sexs
	rs("Ages")=Ages
	rs("Salary")=Salary
	rs("Content")=content
	rs("PubDate")=now()	
	rs.update	
	response.Write("<p align=""center"">发布招聘成功~!<br>")
	response.Write("<br><a href=""?"">返回</a></p>")
	rs.close
	set rs=nothing
end Sub
Sub News_ModOk
	dim id,title,Xueli,Pnum,Gzjy,Area,Sexs,Ages,Salary,Content
	id=Clng(request.QueryString("id"))
	title=replace(request.Form("Title"),"'","")
	Xueli=request.Form("Xueli")
	Pnum=request.Form("Pnum")
	Gzjy=request.Form("Gzjy")
	Area=request.Form("Area")
	Sexs=request.Form("Sexs")
	Ages=request.Form("Ages")
	Salary=request.Form("Salary")
	Content=request.Form("content1")
	set rs=server.createobject("adodb.recordset")
	rs.open "select top 1 * from t_member_job where MemberId='"&checkusername&"' and id="&id,conn,3,3
	if not rs.eof then		
		rs("Title")=title
		rs("Xueli")=Xueli
		rs("Pnum")=Pnum
		rs("Gzjy")=Gzjy
		rs("Area")=Area
		rs("Sexs")=Sexs
		rs("Ages")=Ages
		rs("Salary")=Salary
		rs("Content")=content
		rs("PubDate")=now()	
		rs.update	
		response.Write("<p align=""center"">修改招聘成功~!")
		response.Write("<br><a href=""?"">返回</a></p>")
	end if
	rs.close
	set rs=nothing
end Sub
Sub News_Mod
	dim id,rs
	id=Clng(request.QueryString("id"))
	set rs=conn.execute("select * from t_member_job where id="&id)
	if not rs.eof then
%>
<FORM method="POST" name="form1" action="?act=modok&id=<%=id%>" style="margin:0 0 0 0;" onSubmit="return check(this)">
  <TABLE width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#ffffff" class="border">
<TR bgcolor="#FF9900">
  <TD height="24" colspan="2" class="th_title"><span class="style3">修改招聘</span></TD>
  </TR>
<TR bgcolor="#F5F5F5">
  <TD width="13%" height="24"><div align="right">招聘职位：</div></TD>
  <TD width="87%"><input name="Title" type="text" id="Title" value="<%=rs("Title")%>" size="50"></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">学历要求：</TD>
  <TD><input name="Xueli" type="text" id="Xueli" value="<%=rs("Xueli")%>" size="50" /></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">招聘人数：</TD>
  <TD><input name="Pnum" type="text" id="Pnum" value="<%=rs("Pnum")%>" size="50" /></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">工作经验： </TD>
  <TD><input name="Gzjy" type="text" id="Gzjy" value="<%=rs("Gzjy")%>" size="50" /></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">工作地区：</TD>
  <TD><input name="Area" type="text" id="Area" value="<%=rs("Area")%>" size="50" /></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">性别要求：</TD>
  <TD><input name="Sexs" type="text" id="Sexs" value="<%=rs("Sexs")%>" size="50" /></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">年龄要求：</TD>
  <TD><input name="Ages" type="text" id="Ages" value="<%=rs("Ages")%>" size="50" /></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD height="24" align="right">待遇水平：</TD>
  <TD><input name="Salary" type="text" id="Salary" value="<%=rs("Salary")%>" size="50" /></TD>
</TR>
<TR bgcolor="#F5F5F5">
  <TD width="13%"><div align="right">其它要求：</div></TD>
  <TD width="87%">
  <textarea name="content1" style="display:none; "><%=rs("Content")%></textarea>
	<IFRAME ID="eWebEditor1" src="webedit/editor.html" frameborder="0" scrolling="no" width="98%" height="350"></IFRAME>
  </TD>
</TR>
<TR bgcolor="#F5F5F5">
	<TD align=right>&nbsp;	  </TD>
    <TD height="32" align=right><div align="left"> 
        <input type=submit name=b1 value="提 交">&nbsp;&nbsp;
        <input type=reset name=b2 value="重 填">       
    </div></TD>
</TR>
</TABLE>
</FORM>
<%
	end if
	rs.close
	set rs=nothing
end Sub
Sub News_List
	dim BeginTime,i,currentpage,allrec,totalpage,n,p
	BeginTime=Timer
	const recpage=20
	if not isempty(request("page")) and request("page")<>"" then 
		currentpage=Clng(request("page"))
	else
		currentpage=1
	end if
%>
<div style="line-height:30px; text-align:left; padding:0p 0px 0px 10px; font-weight:bold; width:98%; margin:0px auto;"><a href="?act=add">添加招聘--&gt;</a></div>
<table width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#ffffff" class="border">
  <tr bgcolor="#FF9900">
    <td height="22" colspan="11" bgcolor="#FF9900" class="th_title">招聘管理</td>
  </tr>
  <tr bgcolor="#EEEEEE">
    <td width="3%" height="22"><div align="center">id</div></td>
    <td width="29%"><div align="center">标题</div></td>
    <td width="11%" align="center">学历要求</td>
    <td width="9%" align="center">招聘人数</td>
    <td width="13%" align="center">工作经验</td>
    <td width="8%" align="center">工作地区</td>
    <td width="12%"><div align="center">日期</div></td>    
    <td width="8%"><div align="center">修改</div></td>
    <td width="7%"><div align="center">删除</div></td>
  </tr>
  <%
  		set rs=server.createobject("adodb.recordset")
  		rs.open "select count(*) AS co from t_member_job where MemberId='"&checkusername&"'",conn,3,1
		allrec=rs(0)
		totalpage=int((allrec+recpage-1)/recpage)
		rs.close
		set rs=nothing
		set rs=server.createobject("adodb.recordset")
		sql="select top "&recpage&" id,Title,Xueli,Pnum,Gzjy,Area,Sexs,Ages,Salary,PubDate from t_member_job where id<=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from t_member_job where MemberId='"&checkusername&"' order by id desc) as t) and MemberId='"&checkusername&"' order by id desc "
		rs.open sql,conn,3,1		
		do while not rs.eof		
	%>
  <tr>
    <td height="20" bgcolor="#FFFFFF"><div align="center"><%=rs(0)%></div></td>    
    <td height="24" align="left" bgcolor="#FFFFFF"><div align="left">&nbsp;<a href="/show.asp?id=<%=checkusername%>&act=job_show&vars=<%=rs(0)%>" target="_blank"><%=rs(1)%></a></div></td>
    <td align="center" bgcolor="#FFFFFF"><%=rs(2)%></td>
    <td align="center" bgcolor="#FFFFFF"><%=rs(3)%></td>
    <td align="center" bgcolor="#FFFFFF"><%=rs(4)%></td>
    <td align="center" bgcolor="#FFFFFF"><%=rs(5)%></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=rs(9)%></div></td>    
    <td bgcolor="#FFFFFF"><div align="center"><a href="?act=mod&id=<%=rs(0)%>">修改</a></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="?act=del&id=<%=rs(0)%>" onClick="return ConfirmDel()">删除</a></div></td>
  </tr>
  <%
			rs.movenext
	  loop
	  rs.close
	  set rs=nothing
  %>
  <tr>
    <td height="22" colspan="11" bgcolor="#FFFFFF">
	<div align="center">
	<form name="form1" method="post" action="" style="margin:0 0 0 0">
	<%
	n=currentpage+1
	p=currentpage-1
	if p>0then
		response.write("["&"<a href='?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='?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" 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 ">
        </form></div></td>
  </tr>
</table>
<%end Sub%>
</body>
</html>
<%
call connclose()
%>