<% LoginID=trim(session("LoginID")) if LoginID="" then LoginID=0 UserName=GetTableValue ("tblUser","Name","ID",LoginID) Department = GetTableValue ("tblUser","Department","ID",LoginID) nMailInbox_n = GetMailIn (LoginID,0,0) %>

您的单位公告箱里暂时为空。
您的收件箱里有 4 封新邮件。
今天您的任务栏暂时为空。
您新的日程安排暂时为空。
没有检查到有需要您参加的会议。
没有新信息。

<% Private Function GetBulletin (byval LoginID,byval NowDate,byval Department) set RsTmp=Server.CreateObject("ADODB.RecordSet") sql="select * from tblBulletin where FromID<>"& LoginID &" and (ToID<>'' or ToAll=1 or toDepartment="& Department &" ) Order by ID desc" 'sql="select count(*) as nTotal from tblBulletin where (ToID="& LoginID &" or ToAll=1 or toDepartment="& Department &" ) and Times>'"&NowDate-10&"'" Rstmp.open sql,oConn nCount=0 while not RsTmp.eof toAll=trim(RsTmp("ToAll")) toDepartment=trim(RsTmp("toDepartment")) strHaveRead=trim(RsTmp("HaveRead")) arrHaveRead=split(strHaveRead,",") bHave=false for i=0 to ubound(arrHaveRead) if trim(LoginID)=trim(arrHaveRead(i)) then bHave=true exit for end if next strToID=trim(RsTmp("ToID")) arrToID=split(strToID,",") dim bToID bToID=false for k=0 to ubound(arrToID) if trim(LoginID)=trim(arrToID(k)) then bToID=true exit for end if next if (bToID=true or Toall="1" or toDepartment=trim(Department)) and (bHave=false) then nCount=nCount+1 end if RsTmp.movenext wend if nCount<>"0" then GetBulletin="您的单位公告箱里有 "& nCount &" 条新记录。点击查看>>" else GetBulletin="您的单位公告箱里暂时为空。" end if Rstmp.close set Rstmp=nothing end Function Function GetMailIn(ToID, Status, Isread) 'isRead 0代表未读，1代表已读 Status 0代表正常 1代表已发入垃圾箱 2代表彻底删除 Set Rstmp = Server.CreateObject("ADODB.RecordSet") intMail=0 strSql = "Select count(id) as intNumber from tblMailIn where ToID ="&ToID &" and Status="& status &" And Isread="& Isread RsTmp.Open strSql,oConn if not Rstmp.eof then intMail=Rstmp("intNumber") end if Rstmp.close set Rstmp = nothing GetMailIn=IntMail End Function Private Function GetTask (byval SelectID,byval NowDate, nClass) set Rstmp=Server.CreateObject("ADODB.RecordSet") sql="select Count(*) as nTotal from tblPlan where class="& nClass &" and StartTime>'"& cdate(NowDate)-1 &"' and Finish=0 and UserID="& SelectID 'response.write sql Rstmp.open sql,oConn select case trim(nClass) case "0" if trim(rsTmp("nTotal"))<>"0" then GetTask="您的日程安排里有 "& trim(rsTmp("nTotal")) &" 条新记录。点击查看>>" else GetTask="您新的日程安排暂时为空。" end if case "1" GetTask="您的工作日志栏里有 "& trim(rsTmp("nTotal")) &" 条新记录。点击查看>>" case "2" if trim(rsTmp("nTotal"))<>"0" then GetTask="今天您的任务栏里有 "& trim(rsTmp("nTotal")) &" 条新记录。点击查看>>" else GetTask="今天您的任务栏暂时为空。" end if end select Rstmp.close set Rstmp=nothing end function Private Function GetTask2 (byval SelectID,byval NowDate) set Rstmp=Server.CreateObject("ADODB.RecordSet") sql="select Count(*) as nTotal from tblPlan where class=2 and StartTime>'"& cdate(NowDate)-1 &"' and Finish=0 and UserID="& SelectID 'response.write sql Rstmp.open sql,oConn if trim(rsTmp("nTotal"))<>"0" then set Rstmp1=Server.CreateObject("ADODB.RecordSet") sql="select EndTime from tblPlan where class=2 and StartTime>'"& cdate(NowDate)-1 &"' and Finish=0 and UserID="& SelectID&" order by EndTime" Rstmp1.open sql,oConn if not rstmp1.eof then EndDate=trim(Rstmp1("EndTime")) else EndDate=date() end if Rstmp1.close set Rstmp1=nothing GetTask2="我们将检查5天内的任务情况！
您的任务栏里有 "& trim(rsTmp("nTotal")) &" 条新任务。点击查看>>" else GetTask2="今天您的任务栏暂时为空。" end if Rstmp.close set Rstmp=nothing end function Function GetTableValue(TableName,Field,ValueField,Value) if TableName<>"" and Value<>"" then Set RsTmp = Server.Createobject("Adodb.recordset") strSql = "Select "& Field &" from "& TableName &" where "& ValueField &"='"& Value &"'" Rstmp.open strSql,oConn,1,1 If not Rstmp.eof then GetTableValue=trim(Rstmp(Field)) else GetTableValue="" end if Rstmp.close 'set RsTmp = Nothing else GetTableValue="" end if End Function Private Function GetMeeting(byval LoginID, byval NowTime,byval Department) set rstmp=Server.CreateObject("ADODB.RecordSet") sql="select ID,JoinID,JoinEvery,JoinDepartment,StartTime,HaveRead from tblMeetingOrder where Starttime>='"& NowTime &"' and EndTime>='"& now() &"'" rstmp.open sql,oConn,1,1 bHave=false hNumber=0 while not rstmp.eof if trim(rstmp("JoinEvery"))="1" then bHave=true end if arrJoinID=split(trim(rstmp("JoinID")),",") for i=0 to ubound(arrJoinID) if trim(arrJoinID(i))=trim(LoginID) then bHave=true exit for end if next if trim(rstmp("JoinDepartment"))=trim(Department) then bHave=true end if strHaveRead=trim(rstmp("HaveRead")) arrHaveRead=split(strHaveRead,",") bHaveRead=false for j=0 to ubound(arrHaveRead) if trim(LoginID)=trim(arrHaveRead(j)) then bHaveRead=true exit for end if next if bHave and (not bHaveRead) then bNumber=bNumber+1 GetMeeting="检查到 "& bNumber &" 条需要您参加的会议记录，查看>>" exit function end if rstmp.movenext wend if (not bHave) or (bHave and bHaveRead) then GetMeeting="没有检查到有需要您参加的会议。" end if rstmp.close set rstmp=nothing end function Private Function GetDocument(byval LoginID, byval Department) set rstmp=server.createobject("adodb.recordset") sql="select count(*) as nCount from tblDoc where pigeonhole=0 and CurrentID="& LoginID rstmp.open sql,oConn if not rstmp.eof then nCount=trim(rstmp("nCount")) end if rstmp.close set rs=Server.CreateObject("ADODB.RecordSet") sql="select * from tblDoc where (ReadIDs<>'' or ReadEvery=1 or ReadDepartment="& Department &" ) Order by ID desc" rs.open sql,oConn nCount=cint(nCount) while not rs.eof ReadEvery=trim(rs("ReadEvery")) ReadDepartment=trim(rs("ReadDepartment")) strHaveRead=trim(rs("HaveRead")) arrHaveRead=split(strHaveRead,",") bHave=false for i=0 to ubound(arrHaveRead) if trim(LoginID)=trim(arrHaveRead(i)) then bHave=true exit for end if next strReadIDs=trim(rs("ReadIDs")) arrReadIDs=split(strReadIDs,",") dim bReadIDs bReadIDs=false for k=0 to ubound(arrReadIDs) if trim(LoginID)=trim(arrReadIDs(k)) then bReadIDs=true exit for end if next if (bReadIDs=true or ReadEvery="1" or ReadDepartment=trim(Department)) and (bHave=false) and trim(rs("pigeonhole"))="0" then nCount=nCount+1 end if rs.movenext wend rs.close if nCount="0" then GetDocument="没有新信息。" else GetDocument="有新信息到达，共 "& nCount &" 条" end if end function %>