📄 common.asp
字号:
<%
Dim oConn 'Connection
Dim oRs 'RecordSet
Session("USER_ID")="s0001"
Sub DBConnect(strDSN,strUID,strPW)
'dims
Dim strConn
'make connection
set oConn=Server.CreateObject("ADODB.Connection")
'strConn="Provider=SQLOLEDB;DSN=flowdb;SERVER=(local);User Id=admin;Password=''"
strConn="Provider=SQLOLEDB;DSN=" & strDSN
strConn=strConn & ";SERVER=(local);User Id=" & strUID
strConn=strConn & ";Password=" & strPW
oConn.open strConn
End Sub
Sub DBExecute(strSQL)
oConn.Execute strSQL
End Sub
Sub DBQuery(strSQL)
set oRs=oConn.Execute (strSQL)
End Sub
Sub DBEndQuery
oRs.Close
Set oRs=nothing
End Sub
Sub DBDisconnect
oConn.Close
Set oConn=nothing
End Sub
Sub MyDBConnect
Dim strDSN
Dim strUID
Dim strPW
strDSN=Application("DSN")
strUID=Application("DBUID")
strPW=Application("DBPW")
' DBConnect strDSN,strUID,strPW
DBConnect "flowdb","admin",""
End Sub
Sub MenuIndex
Dim strURL
Dim nodeId
Dim strSplit
Dim strSQL
strURL=Request.ServerVariables("URL")
nPos=InstrRev(strURL,"/")
strFileName=Mid(strURL,nPos+1)
'Response.Write("<p>" & strFileName)
MyDBConnect
strSplit="〉"
strSQL="select * from t_audit_node where node_file='" & strFileName & "'"
DBQuery(strSQL)
strOut=oRs("node_name")
nodeId=oRs("node_parent_id")
DBEndQuery
While nodeId > 0
strSQL="select * from t_audit_node where node_id = " & nodeId
DBQuery(strSQL)
strOut= strSplit & strOut
strOut= oRs("node_name") & "</a>" &strOut
strOut="<a href='" & oRs("node_file") & "'>" & strOut
nodeId=oRs("node_parent_id")
DBEndQuery
Wend
Response.Write(strOut)
DBDisconnect
End Sub
Sub FlowStateChange(flowId,opCode)
MyDBConnect
strSQL="select flow_stat from t_flow where flow_id=" & flowId
DBQuery(strSQL)
'1-运行 2-暂停 3-终止 4-完成
'1-启动流程 2-暂停流程 3-终止流程 4-结束流程
stat=oRs("flow_stat")
Select Case opCode
Case 1
'1-启动流程 2->1
if stat=2 Then
strSQL="update t_flow set flow_stat=1 where flow_id=" & flowId
DBExecute strSQL
strSQL="select cur_step from t_cur_step where flow_id=" & flowId
DBQuery(strSQL)
if oRs("cur_step")=0 Then
strSQL="update t_cur_step set cur_step=cur_step+1 where flow_id=" & flowId
DBExecute strSQL
End If
Else
ErrorDisplay("当前状态不能启动流程")
End If
Case 2
'2-暂停流程 1->2
if stat=1 Then
strSQL="update t_flow set flow_stat=2 where flow_id=" & flowId
DBExecute strSQL
Else
ErrorDisplay("当前状态不能暂停流程")
End If
Case 3
'3-终止流程 1,2->3
if stat=1 Or stat=2 Then
strSQL="update t_flow set flow_stat=3 where flow_id=" & flowId
DBExecute strSQL
Else
ErrorDisplay("当前状态不能终止流程")
End If
Case 4
'4-结束流程
if stat=1 Then
strSQL="update t_flow set flow_stat=4 where flow_id=" & flowId
DBExecute strSQL
Else
ErrorDisplay("当前状态不能结束流程")
End If
Case Else
ErrorDisplay("无法修改流程状态")
End Select
End Sub
Sub ErrorDisplay(str)
'Response.Write(str)
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -