<!--#include file="../Include/Class_Conn.asp" -->
<!--#include file="../Include/Class_Main.asp" -->
<!--#include file="../Public/Educate_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,Temp(3)
Dim Cmd,Rs,Action

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

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

'//调用存储过程
Set Cmd = Server.CreateObject("ADODB.Command")
Cmd.ActiveConnection = Conn
Cmd.CommandText = "Edu_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) 表示院校名称
Rs.Close
'判断会员能否发布
Flag = Tmp(2,0)
If Flag = False Then
 Response.Redirect "../Public/Error.asp?Param=2003"
 Response.End()
End if

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

'//查找培训课程
SQL = "Select Ncid,LessonName,Properity,BeginDate,WebPrice,AddDate,Flag From [pH_Educate_Lesson] Where Schid='"&Schid&"' Order By AddDate Desc"
Rs.open SQL,Conn,1,1
Rs.Pagesize = 15
Psize       = Rs.PageSize
PCount      = Rs.PageCount
RCount      = Rs.RecordCount

PageNo = Cint(Request.QueryString("PageNo"))
If PageNo < 1 Then
 PageNo = 1
Elseif PageNo > PCount Then
 PageNo = PCount
End if
TheRecord = (PageNo-1)*Psize '//计算记录编号的基数
If Not Rs.Eof Then Rs.AbsolutePage = PageNo

 %>
<!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>
<script language="JavaScript">
function SelectAllItem(item)
{
    if( typeof(item.length) == "undefined" )
    {
        item.checked = !item.checked
    }
    else
    {
        for(i=0;i<item.length;i++)
        {
            item[i].checked=!item[i].checked
        }
    }
}

function theForm_Submit(id)
{
		
		if (id=="delsud")
		{
		  if(confirm('确认彻底删除选定的记录'))
		  {
		    form.target='rslt';
			form.action="Sch_Option.asp?param=delsud";
			openwin();
			form.submit();	   
		   }

		}
		
		
}
function openwin()
  {
    disp=window.open("","rslt","width=500,height=320,resizable=yes");
	disp.focus();
  }
</script>

<body>
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" bgcolor="#FFFFFF">
      <!--#include file="../c_Header/Educate_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/Educate_Lesson.asp" -->
          </td>
          <td width="5">&nbsp;</td>
          <td valign="top">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <Form action="" method="post" name="form">
                <tr> 
                  <td><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="eeeeee">
                      <tr> 
                        <td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <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><%= Cls_Page("Sch_Lesson_Manage.asp",PageNo,PCount,RCount) %></td>
                                        </tr>
                                      </table>
                                      <table width="99%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="dddddd">
                                        <tr align="center" bgcolor="f5f5f5"> 
                                          <td width="6%" height="25">选择</td>
                                          <td width="32%" height="25" bgcolor="f5f5f5">课程名称</td>
                                          <td width="12%" bgcolor="f5f5f5">类型</td>
                                          <td width="13%" bgcolor="f5f5f5">开课时间</td>
                                          <td width="13%" height="25" bgcolor="f5f5f5">价格(元)</td>
                                          <td width="9%" height="25" bgcolor="f5f5f5">审核</td>
                                          <td width="8%" bgcolor="f5f5f5">发布日</td>
                                          <td height="25">操作</td>
                                        </tr>
                                        <% 
For i = 1 to Psize
 If Rs.Eof Then Exit For
 Ncid        = Rs("Ncid")
 LessonName	 = Rs("LessonName")
 BeginDate	 = Formatdatetime(Rs("BeginDate"),2)
 WebPrice	 = Rs("WebPrice")
 AddDate     = Month(Rs("AddDate"))&"-"&Day(Rs("AddDate"))
 Flag		 = Rs("Flag")
 Properity	 = Rs("Properity")
%>
                                        <tr align="center"> 
                                          <td height="25" bgcolor="#FFFFFF"><INPUT type=checkbox value=<%= Ncid %> name=perid></td>
                                          <td height="25" align="left" bgcolor="#FFFFFF"><a href="Info/Lesson.asp?Schid=<%= Schid %>&Param=<%= Ncid %>" target="_blank"><%= Lessonname %></a></td>
                                          <td height="25" align="center" valign="baseline" bgcolor="#FFFFFF"><%= Properity %></td>
                                          <td height="25" align="center" valign="baseline" bgcolor="#FFFFFF"><%= BeginDate %></td>
                                          <td height="25" align="center" bgcolor="#FFFFFF">￥<%= WebPrice %></td>
                                          <td height="25" align="center" bgcolor="#FFFFFF"><img src="../Images/Educate/Flag<%= Flag %>.gif" width="41" height="17"></td>
                                          <td height="25" align="center" bgcolor="#FFFFFF"><%= AddDate %></td>
                                          <td height="25" bgcolor="#FFFFFF"> <a href="Sch_Lesson_Edit.asp?Param=<%= Ncid %>">编辑</a> 
                                          </td>
                                        </tr>
                                        <% 
 Rs.Movenext
Next
Rs.Close
 %>
                                      </table>
                                      <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                                        <tr> 
                                          <td align="right"> <INPUT onclick=SelectAllItem(this.form.perid) type=checkbox value=all name=chk_all>
                                            选中所有记录 </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="30" align="right"> <input type="button" name="delsud" value="删 除" onClick="javascript:theForm_Submit('delsud')"> 
                              </td>
                            </tr>
                          </table></td>
                      </tr>
                    </table></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 Edit_Submit()

 Schid              = Session("Educate")(2)
 'LessonName,Property,Begindate,BeginAddr,Currcy,Mubiao,Sudobj,Content,Person,Phone,Fax,Valid
 LessonName			= Replace_Text(Request.Form("LessonName"))
 Property1			= Replace_Text(Request.Form("Property"))
 Begindate			= Replace_Text(Request.Form("Begindate"))
 BeginAddr			= Replace_Text(Request.Form("BeginAddr"))
 Currcy				= Replace_Text(Request.Form("Currcy"))
 Mubiao				= Replace_Text(Request.Form("Mubiao"))
 Sudobj				= Replace_Text(Request.Form("Sudobj"))
 Content			= Replace_Text(Request.Form("Content"))
 Person				= Replace_Text(Request.Form("Person"))
 Phone				= Replace_Text(Request.Form("Phone"))
 Fax				= Replace_Text(Request.Form("Fax"))
 Valid				= Replace_Text(Request.Form("Valid"))
 
 If Mubiao <> "" Then Mubiao = Replace(Mubiao,chr(13),"<br>")
 If Sudobj <> "" Then Sudobj = Replace(Sudobj,chr(13),"<br>")
 If Content <> "" Then Content = Replace(Content,chr(13),"<br>")
 
 SQL = "Insert Into [pH_Educate_Lesson] (Schid,LessonName,Property,Begindate,BeginAddr,Currcy,Mubiao,Sudobj,Content,Person,Phone,Fax,Valid,AddDate) Values ('"&Schid&"','"&LessonName&"','"&Property1&"','"&Begindate&"','"&BeginAddr&"','"&Currcy&"','"&Mubiao&"','"&Sudobj&"','"&Content&"','"&Person&"','"&Phone&"','"&Fax&"','"&Valid&"',getdate())"
 Conn.Execute(SQL)
 Response.Redirect("Sch_Lession.asp")
End Sub

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