<!--#include file="../Include/Class_Conn.asp" -->
<!--#include file="../Include/Class_Main.asp" -->
<!--#include file="../Public/School_Cookies.asp" -->
<% 
'地区分站参数
Dim c_City,c_Name
If Session("c_City") = "" Then 
 Response.Redirect "../Index.asp"
 Response.End()
End if
c_City = Session("c_City")
c_Name = Session("c_Name")

Dim Schid,Username,Tmp
Dim Cmd,Rs,Action

Action = Request.QueryString("action")
If Action = "submit" Then Call Submit() '//调用保存数据的函数

'//获取会员登陆的标记
If Not IsArray(Session("School")) Then 
 Response.write "<script>alert('-登录后才能进行该操作！-');location.href='../Public/MemberLogin.asp';</script>"
Else
 Username  = Session("School")(0)
 Schid     = Session("School")(2)
End if

'//调用存储过程
Set Cmd = Server.CreateObject("ADODB.Command")
Cmd.ActiveConnection = Conn
Cmd.CommandText = "Sch_Account"
Cmd.CommandType = 4
Cmd.Parameters.Append Cmd.CreateParameter("@Schid",200,1,30)
Cmd.Parameters("@Schid") = Schid
Set Rs = Cmd.Execute
If Rs.Eof Then
 CloseRs
 Set Cmd = Nothing
 CloseDB
 Response.write "没有找到会员资料！"
 Response.End()
End if

Tmp = Rs.GetRows() '//将数据填充到数组

'//0院校名,1院校性质
'//如 Tmp(0,0) 表示院校名称
CloseRs
Set Cmd = Nothing

'//功能代码
SchoolName              = Tmp(0,0)
Properity               = Tmp(1,0)

If School_Memo <> "" Then School_Memo = Replace(School_Memo,"<br>",Chr(13))
SchoolType = Cls_SchoolType(Properity)
 %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../Css/Style.css" type=text/css rel=stylesheet>
<title><%= Cls_WebName&" | "&c_Name&"站" %> -- 院校会员管理中心 -- 推荐毕业生</title>
</head>
<body>
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" bgcolor="#FFFFFF">
      <!--#include file="../c_Header/School_User.asp" --> <table width="950" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
        <tr> 
          <td height="4"></td>
        </tr>
      </table>
      <table width="950" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
        <tr> 
          <td width="175" valign="top"> 
            <!--#include file="../Lefter/School_All.asp" -->
          </td>
          <td width="5">&nbsp;</td>
          <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="25"><img src="../Images/icon.gif" width="11" height="11" align="absmiddle"> 
                  <%= SchoolName %> [<%= SchoolType %>]</td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <form action="?action=submit" name="edit" method="post" onSubmit="return form_check();">
			  <script language="JavaScript">
			   function form_check()
			   {
			     if(document.edit.username.value=="")
				 {
				   alert("-请输入毕业生在网站的帐号名-");
				   document.edit.username.focus();
				   return false;
				 }
			   }
			  </script>
                <tr> 
                  <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="eeeeee">
                      <tr> 
                        <td bgcolor="#FFFFFF"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr> 
                              <td height="2"></td>
                            </tr>
                          </table>
                          <table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="eeeeee">
                            <tr> 
                              <td height="25" bgcolor="f5f5f5"><b><font color="#000000">&nbsp;推荐毕业生</font></b></td>
                            </tr>
                          </table>
                          <table width="99%" border="0" align="center" cellpadding="0" cellspacing="1">
                            <tr> 
                              <td width="18%" height="25" align="right" bgcolor="f9f9f9"><STRONG><FONT 
                  color=#ff6600>*</FONT></STRONG> 帐号名：</td>
                              <td height="25" bgcolor="f9f9f9"><input name="username" type="text" id="username" size="20" maxlength="30">
                                [毕业生在网站上的注册会员名] </td>
                            </tr>
                          </table>
                          <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr> 
                              <td height="2"></td>
                            </tr>
                          </table>
                          
                        </td>
                      </tr>
                    </table></td>
                </tr>
                <tr> 
                  <td height="40" align="center"> <input type="submit" name="Submit" value=" 推 荐 " style="height:35px;"> 
                  </td>
                </tr>
              </form>
            </table></td>
        </tr>
      </table> 
      </td>
  </tr>
</table>
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="center" bgcolor="#FFFFFF">
      <!--#include file="../c_Include/Footer.asp" -->
    </td>
  </tr>
</table>

</body>
</html>
<% 
Sub Submit() '保存企业基本数据
 Check_Url() '//跨站提交数据检测
 Schid                   = Session("School")(2)
 Username                = Replace_Text(Request.Form("Username"))
 '获取会员ID
 SQL = "Select Perid From [pH_Person_Base] Where Username='"&Username&"'"
 Set Rs = Conn.Execute(SQL)
 If Rs.Eof Then
  Response.write "<script>alert('错误！没有找到该会员...');history.back(-1);</script>"
  Response.End()
 End if
 Perid = Rs(0) 
 Rs.Close
 '检测该会员是否已经在毕业生表内
 SQL = "Select Perid From [pH_School_Student] Where Perid='"&Perid&"'"
 Set Rs = Conn.Execute(SQL)
 If Not Rs.Eof Then
  Response.write "<script>alert('错误！该个人会员已经被加入毕业生表...');history.back(-1);</script>"
  Response.End()
 End if
 Rs.Close

 '检测会员的类型判断是否能推荐毕业生
 SudCount = 0
 SQL = "Select VipFlag,VipDate,VipEndDate From [pH_School_Base] Where Schid='"&Schid&"'"
 Set Rs = Conn.Execute(SQL)
 If Rs("VipFlag") = 0 Then '未审核会员
  Response.write "<script>alert('对不起！未审核会员不能推荐毕业生，请联系客服人员...');history.back(-1);</script>"
  Response.End()	
 Elseif Rs("VipFlag") = 2 Then '免费会员
  Set Re = Conn.Execute("Select Count(*) From [pH_School_Student] Where Schid='"&Schid&"'")
  If Not Re.Eof Then SudCount = Re(0)
  Re.Close
  If SudCount >=5 Then '超过5名毕业生
    Response.write "<script>alert('对不起！免费会员最多能推荐5名学生，请联系客服人员...');history.back(-1);</script>"
    Response.End()	
  End if
 Else
  If DateDiff("d",Rs("VipEndDate"),Date()) > 0 Then
    Response.write "<script>alert('对不起！您的VIP权限已经到期，暂时不能推荐学生\n\n请联系客服人员...');history.back(-1);</script>"
    Response.End()
  End if
  
 End if
 Rs.Close
 '插入记录
 SQL = "Insert Into [pH_School_Student] (Schid,Perid,AddDate) Values('"&Schid&"','"&Perid&"',GetDate())"
 Conn.Execute(SQL)
 
 Response.redirect "Sch_SudManage.asp"
End Sub


'//关闭数据库连接
CloseDB
 %>
