(由于長度限制,刪除了部分代碼) '----------------------------------------------------------------------------------------------------------------- '頁面初始代碼 '----------------------------------------------------------------------------------------------------------------- private sub page_load(byval sender as system.object, byval e as system.eventargs) handles mybase.load
'--------------------------------------------------------------------- '綁定公文表 '--------------------------------------------------------------------- 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
'確定路徑并判斷文件夾是否存在 '-------------------------------------------------------- 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
'--------------------------------------------------------------------- '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”必須大于或等于零!?。?br> 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