<!--#include file="../Include/Class_Conn.asp" -->
<!--#include file="../Public/Person_Cookies.asp" -->
<!--#include file="../Include/Class_Main.asp" -->
<% 
Dim Rs,Cmd,Tmp,Action
Dim Perid,UserName,UserType,Works,JobTitle
Action = Request.QueryString("action")
If Action <> "" Then 
 Select Case Action
  Case "submit"
   Call Submit()  '//跳转到保存数据的函数
  Case "del"
   Call Del_Works()  '//跳转到保存数据的函数   
 End Select
End if

'//判断用户身份
If IsArray(Session("Person")) Then
 Perid = Session("Person")(2)
 UserName = Session("Person")(0)
Else
 Session.Abandon() 
 Response.write "<script>alert('-登录后才能进行该操作！-');location.href='../Public/MemberLogin.asp';</script>"
End if

'//调用存储过程
Set Cmd = Server.Createobject("ADODB.Command")
Cmd.ActiveConnection = Conn
Cmd.CommandText = "Per_Works"
Cmd.CommandType = 4
Cmd.Parameters.Append Cmd.CreateParameter("@Perid",200,1,30)
Cmd.Parameters("@Perid") = Perid
Set Rs = Cmd.Execute

If Rs.Eof Then
 CloseRs
 Set Cmd = Nothing
 CloseDB
 Response.write "没有找到会员资料！"
 Response.End()
End if
Tmp = Rs.GetRows() '//将数据填充到数组
'//0姓名,1会员类型,2工作年数,3工作的企业数,4职称
'//如：Tmp(1,0)表示 用户的姓名
CloseRs
Set Cmd = Nothing
'//功能代码
RealName = Tmp(0,0)
UserType = Cls_Usertype(Tmp(1,0))
Works    = Tmp(2,0)
JobTitle = Tmp(4,0)
 %>
<!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 %> -- 简历中心 -- 工作经历</title>
</head>
<script language="JavaScript" src="../js/Person_Works.js"></script>
<body>
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td>
      <!--#include file="../Header/Person_Resume.asp" -->
    </td>
  </tr>
</table>
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td><table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td height="4"></td>
        </tr></table>
      <table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="175" valign="top"> 
            <!--#include file="../Lefter/Person_BasicInfo.asp" -->
          </td>
          <td width="5">&nbsp;</td>
          <td valign="top">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <form action="?action=submit" name="edit" method="post" onSubmit="return form_check();">
                <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="0">
                            <tr> 
                              <td height="25"> <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                                  <tr> 
                                    <td width="18%" height="25" align="right"><strong><font 
                  color=#ff6600>*</font></strong> 职 称：</td>
                                    <td height="25"> <select name="jobtitle" id="jobtitle" style="width:120px;">
                                        <option value="0">-请选择-</option>
                                        <option value="1" <% If Jobtitle = 1 Then Response.write "Selected" %>>初级职称</option>
                                        <option value="2" <% If Jobtitle = 2 Then Response.write "Selected" %>>中级职称</option>
                                        <option value="3" <% If Jobtitle = 3 Then Response.write "Selected" %>>高级职称</option>
                                        <option value="4" <% If Jobtitle = 4 Then Response.write "Selected" %>>其他</option>
                                      </select> </td>
                                  </tr>
                                  <tr> 
                                    <td width="18%" height="25" align="right"><strong><font 
                  color=#ff6600>*</font></strong> 工作年限：</td>
                                    <td height="25" bgcolor="f9f9f9"><select name="works" id="works" style="width:120px;">
                                        <option value="0" <% If Works = 0 Then Response.write "Selected" %>>一年以内</option>
                                        <option value="1" <% If Works = 1 Then Response.write "Selected" %>>一年以上</option>
                                        <option value="2" <% If Works = 2 Then Response.write "Selected" %>>二年以上</option>
                                        <option value="3" <% If Works = 3 Then Response.write "Selected" %>>三年以上</option>
                                        <option value="4" <% If Works = 4 Then Response.write "Selected" %>>四年以上</option>
                                        <option value="5" <% If Works = 5 Then Response.write "Selected" %>>五年以上</option>
                                        <option value="10" <% If Works = 10 Then Response.write "Selected" %>>十年以上</option>
                                        <option value="20" <% If Works = 20 Then Response.write "Selected" %>>二十年以上</option>
                                        <option value="30" <% If Works = 30 Then Response.write "Selected" %>>三十年以上</option>
                                        <option value="50" <% If Works = 50 Then Response.write "Selected" %>>退休人员</option>
                                      </select></td>
                                  </tr>
                                  <tr> 
                                    <td width="18%" height="25" align="right">工作的企业：</td>
                                    <td height="25"><input name="workcompanys" type="text" id="workcompanys2" size="4" maxlength="4" value="<%= Tmp(3,0) %>">
                                      家企业</td>
                                  </tr>
                                </table></td>
                            </tr>
                          </table>
                          <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"> <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                                  <tr> 
                                    <td width="50%"><b><font color="#000000">工作经验列表</font></b></td>
                                    <td width="50%" align="right"><a href="per_Works_add.asp"><u>添加工作经验</u></a></td>
                                  </tr>
                                </table></td>
                            </tr>
                          </table>
                          <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="2" cellspacing="1" bgcolor="eeeeee">
                            <tr align="center" bgcolor="f9f9f9"> 
                              <td width="30%" height="22">企业名称</td>
                              <td width="35%" height="22">担任职位</td>
                              <td height="22">时间范围</td>
                              <td width="12%" height="22">操 作</td>
                            </tr>
                            <% 
SQL = "Select Ncid,Begin_Year,Begin_Month,End_Year,End_Month,CompanyName,WorkName From [pH_Person_Work] Where Perid='"&Perid&"' And Username='"&Username&"'"
Set Rs = Conn.Execute(SQL)
While Not Rs.Eof
 Ncid          = Rs("Ncid")
 Begin_Year    = Rs("Begin_Year")
 Begin_Month   = Rs("Begin_Month")
 End_Year      = Rs("End_Year")
 End_Month     = Rs("End_Month")
 CompanyName   = Rs("CompanyName")
 WorkName      = Rs("WorkName")
 BeginAndEndTime = Begin_Year&"年"&Begin_Month&"月-"&End_Year&"年"&End_Month&"月"
 %>
                            <tr bgcolor="#FFFFFF"> 
                              <td height="22"><%= CompanyName %></td>
                              <td height="22"><%= WorkName %></td>
                              <td height="22"><%= BeginAndEndTime %></td>
                              <td height="22" align="center"><a href="?action=del&paramid=<%= Ncid %>" onClick="return confirm('是否需要删除该信息');"><u>删除</u></a> 
                                <a href="Per_Works_Edit.asp?paramid=<%= Ncid %>"><u>编辑</u></a></td>
                            </tr>
                            <% 
 Rs.Movenext
Wend
Rs.Close
 %>
                          </table>
                          <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr> 
                              <td width="18%" height="30" align="right">保存后返回：</td>
                              <td height="30"> <select name="prevurl">
                                  <option value="1">-附加信息-</option>
                                  <option value="2">-工作经历-</option>
                                  <option value="3">-会员中心-</option>
                                </select> </td>
                            </tr>
                          </table>
                          <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr> 
                              <td height="4"></td>
                            </tr>
                          </table></td>
                      </tr>
                    </table></td>
                </tr>
                <tr> 
                  <td height="40" align="center"> <input name="perid" type="hidden" id="perid" value="<%= Perid %>"> 
                    <input type="submit" name="Submit" value=" 保存工作经历数据 " style="height:30px;"> 
                  </td>
                </tr>
              </form>
            </table></td>
        </tr>
      </table>

<!--#include file="../Include/Footer.asp" -->
	  </td>
  </tr>
</table>

</body>
</html>
<% 
Sub Submit()
 Call Check_url()    '防止外部站点提交数据
 '//提交数据
 Perid                = Session("Person")(2)
 Works                = Replace_Text(Request.Form("Works"))
 WorkCompanys         = Replace_Text(Request.Form("WorkCompanys"))
 JobTitle             = Replace_Text(Request.Form("JobTitle"))
 If WorkCompanys = "" Then WorkCompanys = 0
 
 SQL = "Update [pH_Person_Info] Set Works="&Works&",WorkCompanys="&WorkCompanys&",JobTitle="&JobTitle&" Where Perid='"&Perid&"'"
 Conn.Execute(SQL)

 '//更改最后修改时间
 SQL = "Update [pH_Person_Base] Set LastUpdate_Time=getdate() Where Perid='"&Perid&"'"
 Conn.Execute(SQL)
 
 CloseDB
 'Response.redirect "Per_Works.asp"
  Prevurl = Request.Form("prevurl")
 Select Case Prevurl
  Case "1":Response.Redirect "Per_Addons.asp"
  Case "2":Response.Redirect "Per_Works.asp"
  Case "3":Response.Redirect "User_Center.asp"
 End Select
End Sub

Sub Del_Works() '//删除工作经历
 Call Check_url()    '防止外部站点提交数据
 '//提交数据
 Perid                = Session("Person")(2)
 Ncid                = Replace_Text(Request("paramid"))
 Check_Id(Ncid)
 
 SQL = "Delete From [pH_Person_Work] Where Perid='"&Perid&"' And Ncid="&Cstr(Ncid)
 Conn.Execute(SQL)

 '//更改最后修改时间
 SQL = "Update [pH_Person_Base] Set LastUpdate_Time=getdate() Where Perid='"&Perid&"'"
 Conn.Execute(SQL)
 
 CloseDB
 Response.redirect "Per_Works.asp"

End Sub

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