⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addunder.asp

📁 办公自动化系统 适用于办公室的各种几本功能的操作 功能比较简单
💻 ASP
字号:
<!--#include file="../inc/Secure.asp"-->
<!-- #include file = "../inc/connection.asp" -->
<!-- #include file = "../inc/def_color.asp" -->
<!-- #include file = "../inc/treeUser.asp" -->
<!--#include file="verson.asp"-->

<%
PlanID=trim(request("PlanID"))
LoginID=trim(session("LoginID"))
if LoginID="" then LoginID=0
ID=trim(request("ID"))
if ID="" then ID=LoginID
public bFindPlan
bFindPlan=false

if isEmpty(PlanID) then%>
	操作错误!
	<a HREF="AddPlan.asp?SelectDate=<%=DATE()%>"><img SRC="../images/add.gif" BORDER="0" HEIGHT="30" WIDTH="100" ALT="Add Event"></a>
	<%
	Conn.close
	response.end
end if

set rs=server.createobject("adodb.recordset")
sql="select * from tblPlan where ID="& PlanID
rs.open sql,Conn
if not rs.eof then
	title=trim(rs("Title"))
	startTime=trim(rs("startTime"))
	endTime=trim(rs("EndTime"))
	body=trim(rs("EndTime"))
	remark=trim(rs("remark"))
	URL=trim(rs("URL"))
	dengji=trim(rs("dengji"))
end if
rs.close
set rs=nothing

addid = request("addid")
addName=GetTableValue ("tblUser","Name","ID",addID)
if addid <>"" and isnumeric(addid) then	
	AddPlanUser PlanID,addID,addName
	if not bFindPlan then
		AddPlan(addID)
	end if
end if

deleteid = request("deleteid")
if deleteid <>"" and isnumeric(deleteid) then	
	Conn.execute "delete tblPlanUser where PlanID="& PlanID &" and UserID="& Deleteid
	Conn.execute "delete tblPlan where AddID="& LoginID &" and UserID="& Deleteid &" and Title='"& title &"' and StartTime='"& startTime &"'"

end if
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../css/main.css">
</head>
<body>
<p>注:每个事件至少有一名人员,否则该事件将会被删除!</p>
<table border=0 width="100%">
<tr>
<td width="100%">
	<table border="0" align="left" width="100%" cellspacing=0 cellpadding=5>
		<tr>
			<td align=center>
				<b>事件标题:</b> <%=Title%><br>

				<%If StartTime <> EndTime Then%>
					<b>开始时间:</b> <%=StartTime%><br>
					<b>截止时间:</b>&nbsp;<%=EndTime%><br>
				<%else%>
					<b>时间:</b> <%=StartTime%><br>
				<%end if%>
			</td>
		</tr>
		<tr>
			<td><b>参与该事件的有:</b></td>
		</tr>
		<tr>
			<td><%GetPlanUsers PlanID%></td>
		</tr>
	</table>
</td></tr>

<tr><td width="100%">
<table border=0 width="100%" bgcolor="<%=bgcolor%>" cellpadding=3 cellspacing=1>
		<%ATree "tblUser"%>
</table>
</td></tr>

<tr><td>
	<table border=0 width="100">
	<tr><td><a HREF="plan.asp?SelectDate=<%=date()%>">
	<img SRC="../images/Return.gif" BORDER="0" WIDTH="39" HEIGHT="46"></a>
	</td></tr>
	</table>
</td></tr>

</table>

</body>
</html>
<%
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,Conn,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

function checkUser(PlanID,UserID)
set Rstmp=server.createobject("adodb.recordset")
	SQL="select * from tblPlanUser where PlanID = " & PlanID & "and UserId = " & UserID
	
	rstmp.Open sql, Conn
	if not rstmp.eof then
		checkUser=true
	else
		checkUser=false
	end if
	rstmp.Close
	set rstmp=nothing
end function

sub GetPlanUsers(PlanID)
	set Rstmp=server.createobject("adodb.recordset")
	SQL="select * from tblPlanUser where PlanID = " & PlanID &" order by id"
	rstmp.Open sql, Conn
	while not rstmp.eof
	response.write trim(rstmp("UserName"))&"&nbsp;&nbsp;"
	rstmp.movenext
	wend
	
	rstmp.Close
	set rstmp=nothing
end sub

sub AddPlan(UserID)
	sql="SET NOCOUNT ON;"
	sql=sql&" INSERT INTO tblPlan(AddID, UserID, StartTime,EndTime,Title,Body,Remark,URL,class,dengji) VALUES(" & LoginID & _
		","& UserID & _
		",'" & StartTime & _
		"','"& EndTime & _
		"','"& Title & _
		"','"& Body & _
		"','"& Remark & _
		"','"& URL & _
		"',"& nClass & _
		","& dengji & _
		");"
	sql=sql & "Select @@IDENTITY AS NewID;"
	Set Rstmp=Conn.execute (sql)
	NewID = Rstmp("NewID")
end sub
sub AddPlanUser(PlanID,UserID,UserName)

	Set rstmp=server.createobject("adodb.recordset")
	sql="select * from tblPlanUser where PlanID="& PlanID &" and UserID="& UserID
	rstmp.open sql,Conn
	if not rstmp.eof then
	bFindPlan=true
	else
		sql=sql&" INSERT INTO tblPlanUser(UserID, PlanID,UserName) VALUES(" & UserID & _
			","& PlanId & _
			",'"& UserName & _
			"');"
		Conn.execute (sql)
	end if
	rstmp.close
	set rstmp=nothing
end sub
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -