📄 meetdb.inc
字号:
<!--#include file="../include/common.inc"-->
<%
public function checkRoomNameConflict(strName)
checkSession
dim adoRS
dim strQuery
strQuery="select * from room where roomname='" & strName & "'"
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
if adoRS.EOF then
checkRoomNameConflict = 0
else
checkRoomNameConflict = 1
end if
set adoRS = Nothing
end function
public sub addRoom(name,pos,content,note)
checkSession
if getUserRank() <> 1 then
raiseErr "您无权增加会议室"
end if
if checkRoomNameConflict(name) = 1 then
raiseErr "会议名称已存在"
end if
Dim strInsert
strInsert = "insert into room(roomname,roompos,content,note) values('"
strInsert = strInsert & name & "','" & pos & "'," & content & ",'" & note & "')"
getConnection().Execute strInsert
addlog "add room" & name, "room"
end sub
public sub removeRoom(name)
checkSession
dim strQuery
if getUserRank() <> 1 then
closeConnection
raiseErr "您无权删除会议室"
end if
strQuery="delete from room where roomname='" & name & "'"
getConnection().Execute strQuery
addlog "remove room" & name, "room"
end sub
public sub updateRoom(name,pos,content,note)
checkSession
if getUserRank() <> 1 then
closeConnection
raiseErr "您无权修改会议室信息"
end if
if checkRoomNameConflict(name) = 0 then
closeConnection
raiseErr "该会议室不存在"
response.End()
end if
Dim strUpdate
strUpdate = "update room set "
strUpdate = strUpdate & "roompos='" & "" & pos & "',"
strUpdate = strUpdate & "content=" & content & ","
strUpdate = strUpdate & "note='" & note & "' "
strUpdate = strUpdate & "where roomname='" & name & "'"
getConnection().Execute strUpdate
addlog "update room:" & name,"room"
end sub
public function getRoomRSByName(name)
checkSession
dim adoRS
dim strQuery
strQuery="select * from room where roomname='" & name & "'"
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
set getRoomRSByName = adoRS
end function
public sub writeRoomListOption(roomname)
checkSession
dim selRoom
dim adoRS
dim strQuery
selDept = "" & roomname
strQuery="select * from room"
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
while not adoRS.EOF
WriteOption adoRS("roomname"),selRoom,adoRS("roomname")
adoRS.MoveNext
Wend
set adoRS = Nothing
end sub
public function checkMeetingConflictByPerson(personName,begintime,endtime)
checkSession
dim adoRS
dim strQuery
strQuery = "select * from meeting where not ((begintime<='" & begintime & "' and endtime<='" & begintime & "') or (begintime>='"
strQuery = strQuery & endtime & "' and endtime>='" & endtime & "')) and person like '%" & personName & "%'"
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
if adoRS.EOF then
checkMeetingConflictByPerson = 0
else
checkMeetingConflictByPerson = 1
end if
set adoRS = Nothing
end function
public function checkMeetingConflictByRoom(roomName,begintime,endtime)
checkSession
dim adoRS
dim strQuery
strQuery = "select * from meeting where not ((begintime<='" & begintime & "' and endtime<='" & begintime & "') or (begintime>='"
strQuery = strQuery & endtime & "' and endtime>='" & endtime & "')) and addr ='" & roomName & "'"
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
if adoRS.EOF then
checkMeetingConflictByRoom = 0
else
checkMeetingConflictByRoom = 1
end if
set adoRS = Nothing
end function
public function addMeeting(name,addr,begintime,endtime,person,content)
checkSession
dim strRet
dim strInsert
dim intCount
dim personArray
dim strPerson
strRet = "会议添加成功<BR>"
personArray = split(person,"#")
strPerson = "" & getUser()
if checkMeetingConflictByRoom(addr,begintime,endtime) = 1 then
response.write "hi checkroom"
raiseErr "会议室在您安排的时间内有其他会议!"
end if
for intCount = 0 to UBound(personArray)
if checkMeetingConflictByPerson(Trim(personArray(intCount)),begintime,endtime) = 1 then
strRet = strRet & personArray(intCount) & " "
elseif Trim(personArray(intCount)) <> getUser() then
strPerson = strPerson & "#" & Trim(personArray(intCount))
end if
next
strInsert = "insert into meeting(name,addr,begintime,endtime,person,builder,content,attr) values('"
strInsert = strInsert & name & "','" & addr & "','" & begintime & "','" & endtime & "','" & strPerson & "','" & getUser() & "','" & content & "',0)"
getConnection().Execute strInsert
addlog "add meeting" & name, "meeting"
if strRet <> "会议添加成功<BR>" then
strRet = strRet & "在您安排的时间内已有会议,不能出席您安排的会议"
end if
addMeeting = strRet
end function
public function getMeetingRS(name,addr,person,builder,attr)
checkSession
dim adoRS
dim strAttr,strName,strAddr,strPerson,strBuilder,strQuery
strAttr = "" & attr
if strAttr = "" then
raiseErr "查询条件有问题"
end if
strName = "" & name
strAddr = "" & addr
strPerson = "" & person
strBuilder = "" & builder
strQuery = "select * from meeting where attr=" & CInt(attr)
if strAddr <> "" then
strQuery = strQuery & " and addr='" & strAddr & "'"
end if
if strName <> "" then
strQuery = strQuery & " and name like '%" & strName & "%'"
end if
if strBuilder <> "" then
strQuery = strQuery & " and builder='" & strBuilder & "'"
end if
if strPerson <> "" then
strQuery = strQuery & " and person like '%" & strPerson & "%'"
end if
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
set getMeetingRS = adoRS
end function
public function getMeetingRSById(id)
checkSession
dim adoRS
dim strQuery
strQuery="select * from meeting where id=" & id
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
set getMeetingRSById = adoRS
end function
public function getMeetingAttrById(id)
checkSession
dim adoRS
dim strQuery
strQuery="select * from meeting where id=" & id
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
if adoRS.EOF then
getMeetingAttrById = null
else
getMeetingAttrById = adoRS("attr")
end if
set adoRS = nothing
end function
public function getMeetingNameById(id)
checkSession
dim adoRS
dim strQuery
strQuery="select * from meeting where id=" & id
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
if adoRS.EOF then
getMeetingNameById = ""
else
getMeetingNameById = adoRS("name")
end if
set adoRS = nothing
end function
public function getMeetingBuilderById(id)
checkSession
dim adoRS
dim strQuery
strQuery="select * from meeting where id=" & id
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
if adoRS.EOF then
getMeetingBuilderById = ""
else
getMeetingBuilderById = adoRS("builder")
end if
set adoRS = nothing
end function
public function getMeetingOrganizerById(id)
checkSession
dim adoRS
dim strQuery
strQuery="select * from meeting where id=" & id
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
if adoRS.EOF then
getMeetingOrganizerById = ""
else
getMeetingOrganizerById = adoRS("organizer")
end if
set adoRS = nothing
end function
public function getMeetingPersonById(id)
checkSession
dim adoRS
dim strQuery
strQuery="select * from meeting where id=" & id
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
if adoRS.EOF then
getMeetingPersonById = ""
else
getMeetingPersonById = adoRS("person")
end if
set adoRS = nothing
end function
public function getMeetingContentById(id)
checkSession
dim adoRS
dim strQuery
strQuery="select * from meeting where id=" & id
set adoRS=server.createobject("ADODB.Recordset")
adoRS.Open strQuery, getConnection(), , , adCmdText
if adoRS.EOF then
getMeetingContentById = ""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -