&"andpersonrecord.userzwlike'%"&zw&"%'"
endif
endif
ifdzyj<>""then
ifaddandflag=0then
condition=condition&"personrecord.emaillike'%"&dzyj&"%'"
addandflag=1
else
condition=condition&"andpersonrecord.emaillike'%"&dzyj&"%'"
endif
endif
sql=sql&condition&"andpersontype.id=personrecord.recordtypeandpersonrecord.thisinfousername='"&oabusyusername&"'"
setconn=opendb("oabusy","conn","accessdsn")
setrs=server.createobject("adodb.recordset")
rs.opensql,conn,1
ifrs.eofandrs.bofthen
conn.close
setconn=nothing
setrs=nothing
response.write("
没有找到符合条件的通讯录!")
response.write("")
else
%>
4.2.6个人通讯录主页面设计
在办公自动化系统主界面中点击个人通讯录就把通讯录中的默认的第一个通讯录类别中的所有资料全部显示出来了。在MacromediaDreamweaver中建立personlist.asp页面,具体设计如图4.6所示:
图4.7个人通讯录
读出数据代码如下:
'--------------------------------------
'打开数据库,读出通讯录类型
setconn=opendb("oabusy","conn","accessdsn")
setrs=server.createobject("adodb.recordset")
sql="select*frompersontypewhereusername='"&oabusyusername&"'"
rs.opensql,conn,1
ifrs.eoforrs.bofthen
conn.close
setrs=nothing
response.redirect"personaddtype.asp"
response.end
endif
email))%>
关闭时退出数据库,释放资源代码:
<%
rs.movenext
wend
conn.close
setrs=nothing%>
4.3工作计划模块实现
这个模块主要是建立一个工作计划,每个用户可以对自己的计划进行添加,删除和查询,以免自己忘记。还可以对工作计划的重要程度,完成与否进行设置。
4.3.1工作计划模块设计
这个模块主要由五个页面组成,分别是monthlycal.asp、displayworkrec.asp、addworkrep.asp、editworkrep.asp、dayrep.asp。monthlycal.asp是建立月历的。Displayworkrec.asp是查看工作计划的,个人可以在这里查看计划的重要程度和完成与否。addworkrep.asp是增加计划的。dayrep.asp是显示本月的工作计划的。
下面画出工作计划模块各个页面的流程图:
图4.8工作计划流程
因工作计划涉及到年份,日期等,先建一个月历放在monthlycal.asp中,首先进入工作计划页面就要取得计算机中当前的日期,并计算出今天是星期几
代码如下:
<%
submonthlycal(username,superior)
oabusyusername=request.cookies("oabusyusername")
'取得当前年月的1日日期
thismonthfirday=myyear&"-"&mymonth&"-1"
'取得下个月1日的日期
nextmonthfirday=dateadd("m",1,thismonthfirday)
'取得当前月的天数
totaldays=DateDiff("d",thismonthfirday,nextmonthfirday)
firdayweek=weekday(thismonthfirday)
%>
4.3.2增加工作计划
建立addworkrep.asp文件输入标题和内容,其中标题是一定要添加的,内容可加可不加的,然后把数据提交给Displayworkrec.asp页面,刷新后在Displayworkrec.asp中显示出来。例如要在2006年6月5日中增加'开会'工作任务,先点击2006年6月5日日期,打开增加工作任务addworkrep.asp页面,在简要标题中输入"开会",详细说明可加可不加,如图4.7所示。然后点击"增加这项工作计划"按钮,出现"成功增加工作计划"字样,说明已成功增加了工作计划,刷新后就可显示。如果不增加则点击"返回"按钮直接返回。
图4.7增加工作任务
代码如下:
<%
ifrequest.form("addworkrep")="增加这项工作"then
title=request.form("title")
remark=request.form("remark")
sql="InsertIntoworkrep(username,recdate,title,remark,superior)Values("
sql=sql&SqlStr(username)&","
sql=sql&"#"&recdate&"#"&","
sql=sql&SqlStr(title)&","
sql=sql&SqlStr(remark)&","
sql=sql&SqlStr(superior)&")"
conn.Executesql
ifsuperior<>""then
setrs=server.createobject("adodb.recordset")
sql="selectIDfromuserinfwhereusername='"&username&"'"
rs.opensql,conn,1
ifnotrs.eofandnotrs.bofthen
emailtitle="您好,"&oabusyname&"给您增加一条工作任务,请查阅!"
emailcontent="工作任务标题:["&title&"]"&chr(13)&chr(10)
emailcontent=emailcontent&"工作任务日期:["&recdate&"]"&chr(13)&chr(10)
emailcontent=emailcontent&"详细说明:["&remark&"]"
errstr="对不起,系统自动发送您的工作任务安排出错,请手动发送邮件通知对方!"
errinfo=send_event_email(emailtitle,oabusyuserid,rs("ID"),emailcontent,errstr)
iferrinfo<>""then
setrs=nothing
conn.close
response.redirect"asp/disperrorinfo.asp?errorinfo="&errinfo
response.end
endif
else
setrs=nothing
conn.close
response.redirect"asp/disperrorinfo.asp?errorinfo="&errstr
response.end
endif
endif
%>
4.3.3查询设计
在Displayworkrec.asp中可以查看本月的跟以前的工作计划,并且可以看到重要程度跟完成与否。例如要查询2006年6月5日的工作计划,则点击2006年6月5日日期,显示Displayworkrec.asp页面,可以查看该日的有无工作计划,完成与否等资料。具体设计图见图4.8所示
图4.8查看工作计划
代码如下:
<%
'打开数据库,读出日期为recdate,用户名为username的记录
setrs=server.createobject("adodb.recordset")
sql="select*fromworkrepwhereusername="&sqlstr(username)&"andrecdate="&"#"&recdate&"#"
rs.opensql,conn,1
whilenotrs.eofandnotrs.bof
'读出任务委派者姓名
ifrs("superior")<>""then
setconn=opendb("oabusy","conn","accessdsn")
setrs1=server.createobject("adodb.recordset")
sql="selectnamefromuserinfwhereusername="&sqlstr(rs("superior"))
rs1.opensql,conn,1
superiorname=rs1("name")
else
superiorname="本人安排"
endif
%>
4.3.4编辑工作计划
在上述Displayworkrec.asp页面中点击"编辑"进入editworkrep.asp页面,可以对已经保存的工作计划进行修改,例如把上诉的"开会"工作计划时间改成3:00,重要程度从"一般"改成"重要",如图4.9所示:点击"修改"按钮,出现"编辑工作计划成功!"字样就说明已成功对工作计划进行了修改,刷新页面后就可以显示。
图4.9编辑工作计划
代码如下:
<%
ifrequest.form("submit")="修改"then
title=request.form("title")
remark=request.form("remark")
finished=request.form("finished")
imp1=request.form("imp")
superior=request.form("superior")
sql="updateworkrepsetfinished="&sqlstr(finished)&",imp="&sqlstr(imp1)&",title="&sqlstr(title)&",remark="&sqlstr(remark)&"whereid="&id
conn.Executesql
setrs1=server.createobject("adodb.recordset")
sql1="selectsuperiorfromworkrepwheeid="r&id
rs1.opensql1,conn,1
ifnotrs1.eofandnotrs1.bofthen
superior=rs1("superior")
setrs=server.createobject("adodb.recordset")
sql=""
iffinished="yes"andsuperior<>""andsuperior<>oabusyusernamethen
sql="selectuserinf.IDfromuserinf,workrepwhereworkrep.id="&id&"andworkrep.superior=userinf.username"
elseifsuperior=oabusyusernameandsuperior<>""then
sql="selectuserinf.IDfromuserinf,workrepwhereworkrep.id="&id&"andworkrep.username=userinf.username"
endif
ifsql<>""then
rs.opensql,conn,1
ifnotrs.eofandnotrs.bofthen
iffinished="yes"andsuperior<>""andsuperior<>oabusyusernamethen
emailtitle="您好,您给"&oabusyname&"分配的工作任务已完成!["&title&"]"
emailcontent="工作任务标题:["&title&"]"&chr(13)&chr(10)
emailcontent=emailcontent&"详细说明:["&remark&"]"
errstr="对不起,系统自动发送您完成工作任务邮件出错,请手动发送邮件通知对方!"
errinfo=send_event_email(emailtitle,oabusyuserid,rs("ID"),emailcontent,errstr)
elseifsuperior=oabusyusernameandsuperior<>""then
emailtitle="您好,"&oabusyname&"为您修改了工作任务!["&title&"]"
emailcontent="工作任务标题:["&title&"]"&chr(13)&chr(10)
emailcontent=emailcontent&"详细说明:["&remark&"]"
errstr="对不起,系统自动发送您修改工作任务邮件出错,请手动发送邮件通知对方!"
errinfo=send_event_email(emailtitle,oabusyuserid,rs("ID"),emailcontent,errstr)
endif
iferrinfo<>""then
setrs=nothing
setrs1=nothing
conn.close
response.redirect"asp/disperrorinfo.asp?errorinfo="&errinfo
response.end
endif
else
setrs=nothing
setrs1=nothing
conn.close
response.redirect"asp/disperrorinfo.asp?errorinfo="&errstr
response.end
endif
endif
endif
%>
4.3.6显示本月工作计划
上述是页面建好后输入的信息通过数据库连接最后都在dayrep.asp页面中显示。
具体设计图见图4.10所示
图4.10个人工作计划
连接代码:
username=oabusyusername
'取得当前日期
mydate=d
上一篇:ASP022个人网站(论文和程序)
下一篇:恋沫