<!--#include file="../../oa/SQLconn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>保存公告文件</title>

<link rel="stylesheet" type="text/css" href="../images/<%=request.cookies("imgdir")%>/css/style.css" media="all"/>
</head>
<body  topmargin="5" leftmargin="5">

<p>
<%
  
			 
		APPID=request("APPID")
		sendto=request("sendto")
		title=request("title")
		author=request("author")
		content=request("content")
		checkboxDuanxin=request("checkboxDuanxin")
		Tname=request("Tname")
		
		'检查				 
		  set rscheck=server.createobject("adodb.recordset")
		  rscheckSQL="select * from teachers where APPID='"&APPID&"'" 
		  rscheck.open rscheckSQL,conn,1,3
		  if  rscheck.eof and  rscheck.bof then
				response.end
		  end if 
			
			
		    dim rsgonggaosql
			dim rsgonggao
			
			dim filename
			
			
			dim strdateandtime
			if  dateandtime<>"" then
			   strdate=cdate(dateandtime)
			else  
			   strNow=now()
			 end if

			
			'从存储过程取得gonggaoid
			dim fid 
			Set cmd = server.CreateObject("ADODB.Command")
			set Cmd.ActiveConnection = conn
			with Cmd
			   .CommandText = "incid"
			   .CommandType = 4
			   .parameters.Refresh
			   .parameters("@name") ="AllID"
			   .execute
			   fid = .parameters("@id")
			end with

              ''分开部门字段
              dim mysendto
		      mysendto=split(sendto,"|")
		      bumen=""
			  for each sendtoinf in mysendto
			    if bumen="" then 
				   bumen=bumen+"'"+sendtoinf+"'"
				else
				    bumen=bumen+",'"+sendtoinf+"'"
				end if
			  next


			if title="" then   '防止发送无标题文件
			else
			set rsgonggao=server.createobject("adodb.recordset")
			rsgonggaosql="select * from gonggao where (id is null)" 
			
			rsgonggao.open rsgonggaosql,conn,1,3
			rsgonggao.addnew
			
			rsgonggao("id")=fid
			rsgonggao("ftype")="通知"
			rsgonggao("sendto")=sendto
			rsgonggao("title")=title
			rsgonggao("author")=author
			rsgonggao("fdate")=now()
			rsgonggao("content")=content
			rsgonggao("updateandtime")=strdate
			rsgonggao("上交资料")=shangjiaoziliao
			rsgonggao("截止日期")=jiezhidate
			rsgonggao("hits")="0"
			rsgonggao("updatetime")=now()
			rsgonggao("upname")=Tname
			strip=Request.ServerVariables("REMOTE_ADDR")
			rsgonggao("upip")=strip
			rsgonggao("ontop")=""
			rsgonggao.update
			end if 
					 
		
			rsgonggao.close
			
'标记发送文件给个人
if checkboxDuanxin="1" then duanxin="已短信提醒"
if sendto="全部部门" then

		set rssended=server.createobject("adodb.recordset")
		rssendedsql="INSERT   INTO gonggaosee(fid,tname,短信提醒)  select '"&fid& "',tname,'"&duanxin& "'  from Teachers where show=1  order by tname"
		rssended.open rssendedsql,conn,1,3

else
		
		set rssended=server.createobject("adodb.recordset")
	    rssendedsql="INSERT   INTO gonggaosee(fid,tname,短信提醒)  select '"&fid& "',tname,'"&duanxin& "'  from (select tname  from teachergroup  where owner='admin' and  groupname in ("&bumen&")  GROUP BY Tname)  newtname" 
		rssended.open rssendedsql,conn,1,3
        rssended.close
end if 




	Set MyOAASPObj = Server.CreateObject("YFSchoolOApro.YFSchoolDll")
           call  MyOAASPObj.SendToOAJingLing("通知",fid)
		    set MyOAASPObj=nothing
  
   '发送短信到手机
    if checkboxDuanxin="1" then
        Set MyOAASPObj = Server.CreateObject("YFSchoolOApro2.YFSchoolDll2")
        call     MyOAASPObj.GongGaoSendtophone(fID,title,author)
        set MyOAASPObj=nothing
	end if

     
		Upload.Dispose ' 释放内存 
		Set Upload = Nothing 

			%>
</p>
<p>&nbsp;</p>
<div align="center">



  <table border="1" cellspacing="0" width="700" bordercolorlight="#11B1FF" bordercolordark="#F0F8FF">
    <tr>
      <td width="100%" height="32">
      <p align="center" class="STYLE1 STYLE2">发布成功</td>
    </tr>
  </table>
</div>

</body>  
  
</html>  




 