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

📄 pdocedit.aspx

📁 一个完整的办公自动化源码,免费提供给大家下载
💻 ASPX
字号:
<%@ Page Language="VB" ContentType="text/html" debug="true" %>
<%@ Import Namespace="system.data" %>
<%@ Import Namespace="system.data.oledb" %>
<%@ Import Namespace="system.io" %>
<!--#include file="webmaster/ckqx.aspx" -->
<html>
<head>
<title>公文列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="CSS.CSS" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#CCCCCC">
<form runat="server">
<input type="hidden" runat="server" id="zfilter">
<table width="549" height="24" border="0" cellpadding="0" cellspacing="0" background="pic/002.png">
  <tr> 
      <td><font color="#FFFFFF"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编辑公文列表</strong></font></td>
  </tr>
</table>
<table width="549" height="380" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#008080" bordercolordark="#FFFFFF">
  <tr> 
    <td valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        
        
        <tr>
          <td>
		  <asp:datagrid runat="server" ID="mygrid"
		  		 DataKeyField="id"
		  		 AutoGenerateColumns="false"
		  		 AllowPaging="true"
				 PageSize="15"
				 OnPageIndexChanged="zscpage"
				 BorderColor="#CCCCCC"
				 HorizontalAlign="Center"
				 Width="98%"
				 OnEditCommand="zscedit"
				 OnDeleteCommand="zscdel"
				 >
				 <headerstyle Font-Bold="true" HorizontalAlign="center" />
				 <itemstyle HorizontalAlign="center" />
				 <pagerstyle Mode="NumericPages" PageButtonCount="5" HorizontalAlign="right" />
				 <columns>
					<asp:templatecolumn HeaderText="公文主题">
						<itemtemplate>
							<a href="#" onClick="javascript:window.open('docviewshow.aspx?id=<%# container.dataitem("id") %>','','scrollbars=yes,width=570,height=405')"><%# container.dataitem("otitle") %></a>
						</itemtemplate>
					</asp:templatecolumn>
					<asp:boundcolumn DataField="oworkroom" HeaderText="发文部门" />
					<asp:boundcolumn DataField="odate" HeaderText="发文日期" DataFormatString="{0:m}" />
					<asp:templatecolumn HeaderText="操作">
						<itemtemplate>
							<asp:linkbutton runat="server" CommandName="edit" Text="编辑" />
							&nbsp;&nbsp;
							<asp:linkbutton runat="server" CommandName="delete" Text="删除" />
						</itemtemplate>
					</asp:templatecolumn>
				 </columns>
			</asp:datagrid>
		  </td>
        </tr>
      </table>
      
    
      <table border="0" width="78%">
        <tr> 
          <td width="23%" align="center">  </td>
          <td width="31%" align="center">  </td>
          <td width="23%" align="center">  </td>
          <td width="23%" align="center">  </td>
        </tr>
      </table>
</td>
  </tr>
</table>
</form>
</body>
</html>
<script language="VB" runat="server">
	sub page_load(s as object,e as eventargs)
		if not ispostback then 
			if not (checkqx("c")) then response.redirect("webmaster/error.aspx")
			bindlist()
		end if
	end sub
	sub bindlist()
		dim conn as new oledbconnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("office.mdb"))
		conn.open()
		dim objada as new oledbdataadapter()
		objada.selectcommand=new oledbcommand
		objada.selectcommand.connection=conn
		dim oinfo()=session("lguinfo")
		objada.selectcommand.commandtext="select * from userdata where yourid=" & oinfo(0) & " and (not isnumeric(outid)) order by id desc"
		'由于邮件和公文都保存在userdata表,所以在此要判断用户发的是邮件还是公文,
		'但在表中并没有专门设置一个字段来标识该条记录是公文还是普通邮件。
		'唯一能区分的就是邮件只可能一次发给一个人,而公文一次可以发给多个人或所有人
		'在添加公文时,会在收件人后面加上Str,而使不整个字串不能转换成有效的数字
		dim ds as new dataset()
		objada.fill(ds,"userdata")
		mygrid.datasource=ds.tables("userdata")
		mygrid.databind()
		conn.close()
	end sub
	sub zscpage(s as object,e as DataGridPageChangedEventArgs)
		s.currentpageindex=e.newpageindex
		bindlist()
	end sub
	sub zscedit(s as object,e as DataGridCommandEventArgs)
		response.redirect("pdocmodify.aspx?id=" & s.datakeys(e.item.itemindex))
	end sub
	sub zscdel(s as object,e as DataGridCommandEventArgs)
		dim conn as new oledbconnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath("office.mdb"))
		conn.open()
		'删除相关附件
		dim objcmd as new oledbcommand("select sizeZ,ofilename from userdata where id=" & s.datakeys(e.item.itemindex),conn)
		dim objrd as oledbdatareader=objcmd.executereader()
		if objrd.read() then
			'如果找到相关记录
			if objrd("sizeZ")<>"N/S"
				'如果有附件
				dim lsfile as string
				lsfile=session("docuppath") & objrd("ofilename")
				if file.Exists(lsfile) then
					file.delete(lsfile)
				end if
			end if
		end if
		objrd.close()
		objcmd=new oledbcommand("delete from userdata where id=" & s.datakeys(e.item.itemindex),conn)
		objcmd.executenonquery()
		conn.close()
		bindlist()
	end sub
</script>

⌨️ 快捷键说明

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