首页 > 开发 > 综合 > 正文

办公自动化系统公文归档代码

2024-07-21 02:16:26
字体:
来源:转载
供稿:网友

商业源码热门下载www.html.org.cn

(由于长度限制,删除了部分代码)
'-----------------------------------------------------------------------------------------------------------------
'页面初始代码
'-----------------------------------------------------------------------------------------------------------------
private sub page_load(byval sender as system.object, byval e as system.eventargs) handles mybase.load

if not page.ispostback then
sqlconnection1.open()

receivedeptid = convert.tostring("dsgd1111ads")
userid = convert.todouble("af00000sra")
username = convert.tostring("1111").trim
'--------------------------------------------------------------------------------
ddl_year.items.add(convert.tostring(today().year - 2))
ddl_year.items.add(convert.tostring(today().year - 1))
ddl_year.items.add(convert.tostring(today().year))
ddl_year.items.add(convert.tostring(today().year + 1))
ddl_year.selectedindex = -1
ddl_year.items.findbyvalue(convert.tostring(today().year)).selected = true
bindgrid()
btn_reg.enabled = false
bindtree()
else
response.write("<script language=javascript>function init(){document.form1.page_pos.value = " + request("page_pos") + "; window.scrollby(0,document.form1.page_pos.value); }window.onload=init;</script>")
end if
end sub


'---------------------------------------------------------------------
'绑定公文表
'---------------------------------------------------------------------
private function bindgrid()
receivedeptid = convert.tostring("00550000")
dim tpcnt as integer
with new documentsystem()
tmpdpr = .getdocuarchiveinfo(receivedeptid, convert.tostring(ddl_year.selecteditem.value), "wait")
end with
if tmpdpr.tables(0).rows.count > 0 then
'btn_reg.enabled = true
l_tips.text = ""
tpcnt = tmpdpr.tables(0).rows.count / dg_dpr.pagesize
if tmpdpr.tables(0).rows.count mod dg_dpr.pagesize > 0 then
tpcnt = tpcnt + 1
end if
if tpcnt < dg_dpr.pagecount then
if dg_dpr.currentpageindex > tpcnt - 1 then
dg_dpr.currentpageindex = tpcnt - 1
end if
end if
else
btn_reg.enabled = false
l_tips.visible = true
l_tips.text = "现在没有要归档得公文!"
end if
dg_dpr.datasource = tmpdpr
dg_dpr.databind()
if tmpdpr.tables(docupublishregdata.docupublishreg_table).rows.count = 0 then
l_pagecount.text = "共0页!"
ib_first.visible = false
ib_pre.visible = false
ib_next.visible = false
ib_last.visible = false
label5.visible = false
tb_pageno.visible = false
label7.visible = false
ib_first.enabled = false
ib_pre.enabled = false
ib_next.enabled = false
ib_last.enabled = false
else
ib_first.visible = true
ib_pre.visible = true
ib_next.visible = true
ib_last.visible = true
label5.visible = true
tb_pageno.visible = true
label7.visible = true
ib_first.enabled = true
ib_pre.enabled = true
ib_next.enabled = true
ib_last.enabled = true
l_pagecount.text = "第" + convert.tostring(dg_dpr.currentpageindex + 1) + "页!共" + convert.tostring(dg_dpr.pagecount) + "页!"
if dg_dpr.currentpageindex + 1 = dg_dpr.pagecount then
ib_next.enabled = false
ib_last.enabled = false
end if
if dg_dpr.currentpageindex + 1 = 1 then
ib_pre.enabled = false
ib_first.enabled = false
end if
tb_pageno.text = convert.tostring(dg_dpr.currentpageindex + 1)
end if
tb_archive.text = ""
ddl_archive.selectedindex = -1
end function


'----------------------------------------------------------------------------------------------------------------
'归档按钮点击触发事件
'----------------------------------------------------------------------------------------------------------------
private sub btn_reg_click(byval sender as system.object, byval e as system.eventargs) handles btn_reg.click

dim i as integer
dim j as integer

if lb_archivevalue.text = "" or lb_archivevalue.text <> convert.tostring(ddl_archive.selecteditem.value) then '必须初始化对象?

lb_archivename.text = "归档不成功,请先选择档案库及案卷!!"
lb_archivename.visible = true
else
lb_archivename.visible = false
if dg_dpr.items.count > 0 then
dim checkdocuselected as boolean
checkdocuselected = false
for i = dg_dpr.items.count - 1 to 0 step -1
dim tmpdocuid as double = convert.todouble(dg_dpr.items(i).cells(4).text)
dim deptid as string = trim(dg_dpr.items(i).cells(3).text)
dim myremovecmd as checkbox = ctype(dg_dpr.items(i).findcontrol("cb_dj"), checkbox)
if myremovecmd.checked then
checkdocuselected = true
dim data as documentsdata
with new documentsystem()
data = .getdocumentbydocuid(convert.tostring(tmpdocuid))
end with

'将公文信息(除正文、附件)插入档案系统数据库
'---------------------------------------------
dim aaa as string
dim bbb as string
dim wid
dim b1 as string
dim a1 as string
dim a2 as string
dim a3 as string
dim a4 as string
dim a5 as string
dim a6 as string
dim a7 as string
dim a8 as string
dim a9 as string
dim a10 as string

b1 = convert.tostring(lb_filetablename.text).trim
a1 = guid.newguid.tostring
a2 = convert.tostring(lb_archivevalue.text).trim
a3 = convert.tostring(data.tables(0).rows(0).item("docutt")).trim
a4 = convert.tostring(data.tables(0).rows(0).item("keyword")).trim
a5 = convert.tostring(data.tables(0).rows(0).item("docusigner")).trim
a6 = convert.tostring(data.tables(0).rows(0).item("writedate")).trim
a7 = convert.tostring(data.tables(0).rows(0).item("dispatchyear")).trim
a8 = convert.tostring(data.tables(0).rows(0).item("dispatchdeptname")).trim()
a9 = "正文"
a10 = trim(dg_dpr.items(i).cells(1).text)
sqlinsertcommand1.commandtext = "insert into " & b1 & _
" (guid,relations,subject,mainword,duteman,filedate,years,filecomeunit,textfield,filenum,flags)" & _
" values ('" & a1 & "','" & a2 & "','" & a3 & "','" & a4 & "','" & a5 & "','" & a6 & "','" & a7 & "','" & a8 & "','" & a9 & "','" & a10 & "',2)"

sqlconnection1.open()
sqlinsertcommand1.executenonquery()
sqlconnection1.close()


'确定路径并判断文件夹是否存在
'--------------------------------------------------------
dim address as string
dim address1 as string
address = lb_filetablename.text
address1 = convert.tostring(session("file_save"))
address1 = address1 & address
if io.directory.exists(address1) = false then
io.directory.createdirectory(address1)
else
end if

'输出公文正文
'-------------------------------------------------------
dim bytedata as byte()
bytedata = ctype(data.tables(0).rows(0).item("docucontent"), byte())
dim bytedatasize as long = bytedata.length
dim filename as string
filename = convert.tostring(data.tables(0).rows(0).item("docutitle")) & convert.tostring(data.tables(0).rows(0).item("filetype"))
dim fsdoc as filestream
fsdoc = new filestream(address1 & "/" & filename, filemode.create, fileaccess.write)
fsdoc.write(bytedata, 0, bytedatasize)
fsdoc.close()


'输出公文附件
'-------------------------------------------------------
dim data1 as docuattachdata
with new documentsystem()
data1 = .getdocuattachbydocuid(convert.tostring(tmpdocuid))
end with
dim aid as string
if data1.tables(0).rows.count > 0 then
aid = convert.tostring(data1.tables(0).rows(0).item("aid"))
dim tmpdocuattachdata as docuattachdata
with new documentsystem()
tmpdocuattachdata = .getdocuattachcontentbyaid(convert.todouble(aid))
end with
if tmpdocuattachdata.tables(0).rows.count > 0 then

dim fname as string
for j = 0 to tmpdocuattachdata.tables(0).rows.count - 1
bytedata = ctype(tmpdocuattachdata.tables(0).rows(j).item("acontent"), byte())
bytedatasize = bytedata.length
fname = address1 & "/" & trim(convert.tostring(tmpdocuattachdata.tables(0).rows(j).item("filename")))
fsdoc = new filestream(fname, filemode.create, fileaccess.write)
fsdoc.write(bytedata, 0, bytedatasize)
fsdoc.close()
next
end if
end if

'修改公文归档状态
'----------------------------------------------------------------------------------------------
dim dacuphasedata as documentphasedata
with new documentphasesystem()
dacuphasedata = .getdocumentphaseinfo(convert.todouble(tmpdocuid), "wait", "dpgd")
end with
dim phasedataid as documentphasedata
with new documentphasesystem()
if dacuphasedata.tables(0).rows.count > 0 then
phasedataid = .getphasebysequenceid(convert.todouble(dacuphasedata.tables(0).rows(0).item("sequenceid")))
phasedataid.tables(0).rows(0).item(phasedataid.currentstatus_field) = "over"
phasedataid.tables(0).rows(0).item(phasedataid.handlerid_field) = convert.todouble(session("userid"))
phasedataid.tables(0).rows(0).item(phasedataid.handler_field) = convert.tostring(session("username"))

' phasedataid.tables(0).rows(0).item(phasedataid.currentstatus_field) = "wait"
' phasedataid.tables(0).rows(0).item(phasedataid.handlerid_field) = system.dbnull.value 'convert.todouble(session("userid"))
' phasedataid.tables(0).rows(0).item(phasedataid.handler_field) = system.dbnull.value 'convert.tostring(session("username"))
end if
end with
dim updata as boolean
with new documentphasesystem()
updata = .updatedocumentphase(phasedataid)
if updata = true then
lb_archivename.text = "归档成功!"
lb_archivename.visible = true
end if
end with
end if
next
if checkdocuselected = false then
lb_archivename.text = "归档不成功,请先选择要归档的公文!"
lb_archivename.visible = true
end if

end if

end if
bindgrid()
end sub


'----------------------------------------------------------------------------------------------------------------
'绑定树结点
'----------------------------------------------------------------------------------------------------------------



'---------------------------------------------------------------------
'treeview1触发事件
'---------------------------------------------------------------------
private sub treeview1_selectedindexchange(byval sender as system.object, byval e as microsoft.web.ui.webcontrols.treeviewselecteventargs) handles treeview1.selectedindexchange
btn_reg.enabled = true
lb_tablename.text = convert.tostring(treeview1.getnodefromindex(e.newnode).nodedata).trim
dim aaa as string '参数“length”必须大于或等于零!!!
aaa = convert.tostring(lb_tablename.text).trim
dim bbb as integer
bbb = aaa.length()
if bbb >= 2 then
lb_filetablename.text = "f_" & right(aaa, bbb - 2)
lb_filetablename.text = convert.tostring(lb_filetablename.text).trim
else
lb_tablename.text = ""
end if
lb_archivename.visible = false
bindarchive("", convert.tostring(lb_tablename.text))
end sub


'--------------------------------------------------------------------------------------------------------------------
'给ddl_archive下拉列表框绑定案卷数据
'--------------------------------------------------------------------------------------------------------------------
private function bindarchive(byval serch as string, byval tablename as string)
ddl_archive.items.clear()
dim cataitem1 as new listitem()
cataitem1.text = ""
cataitem1.value = ""
ddl_archive.items.add(cataitem1)
ddl_archive.selectedindex = -1
if tablename <> "" then
try
sqldataadapter1.selectcommand.commandtext = " select subject ,guid from " & tablename & " where subject like '%" & serch & "%' order by subject"
sqldataadapter1.fill(dataset11, "sys_usertable7")
if dataset11.tables("sys_usertable7").rows.count > 0 then
dim i as integer
for i = 0 to dataset11.tables("sys_usertable7").rows.count - 1
dim cataitem as new listitem()
cataitem.text = convert.tostring(dataset11.tables("sys_usertable7").rows(i).item("subject"))
cataitem.value = convert.tostring(dataset11.tables("sys_usertable7").rows(i).item("guid"))
ddl_archive.items.add(cataitem)
ddl_archive.selectedindex = -1
next
dataset11.tables("sys_usertable7").clear()
end if
catch
end try
end if
end function


'---------------------------------------------------------------------
'“查询案卷”按钮点击触发事件
'---------------------------------------------------------------------
private sub bt_archiveserch_click(byval sender as system.object, byval e as system.eventargs) handles bt_archiveserch.click
bindarchive(convert.tostring(tb_archive.text).trim, convert.tostring(lb_tablename.text).trim)
lb_archivename.visible = false
end sub


'--------------------------------------------------------------------------------------------------------------------------
'(下拉列表框)案卷改变触发事件
'--------------------------------------------------------------------------------------------------------------------------
private sub ddl_archive_selectedindexchanged(byval sender as system.object, byval e as system.eventargs) handles ddl_archive.selectedindexchanged
lb_archivevalue.text = convert.tostring(ddl_archive().selecteditem().value()).trim
lb_archivename.visible = false
btn_reg.enabled = true
end sub


'---------------------------------------------------------------------
'改变年份下拉列表框触发事件
'---------------------------------------------------------------------
private sub ddl_year_selectedindexchanged(byval sender as system.object, byval e as system.eventargs) handles ddl_year.selectedindexchanged
bindgrid()
end sub
end class

end namespace


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表