📄 user.inc
字号:
<%'************************************************************************************************' 函数名 : FormUserTable(sAccountid)' 输 入 : sAccountid: 用户id,如果是新增用户,那么sAccountid="",表示一张空的表' 输 出 : 一张用户信息表(新的或者是旧的供修改的),可以提交' 功能描述: 根据用户id,将相应的角色信息显示出来' 调用模块: user.inc' 作 者 : weilin' 日 期 : 2002-11-08' 版 本 : '************************************************************************************************Function FormUserTable(sAccountid) '------------------------------------ ' 根据sAccountid,显示相应的用户信息,供修改 '------------------------------------ dim sSQL,iEmpid,iRoleid,iStatus dim sTemp, sTempButtons dim rs, sError dim i sSQL = "select * from t_account where account_id = "& ToSQL(sAccountid,"text") set rs = openRS(conn,sSQL) if not rs.eof then '存在该用户,显示该用户信息 iEmpid=GetValue(rs,"emp_id") iRoleid=GetValue(rs,"role_id") iStatus=GetValue(rs,"status") if iEmpid="" then sTemp="非员工用户" else sTemp=DLookUp(conn, "select name from t_employee where emp_id="&ToSQL(iEmpid,"number")) end if sTempButtons=_ " <img border=0 src=""../images/button/update.gif"" style=""cursor:hand"" name=btnUpdate>" & _ " <img border=0 src=""../images/button/delete.gif"" style=""cursor:hand"" name=btnDelete>" & _ " <img border=0 src=""../images/button/resetpwd.gif"" style=""cursor:hand"" name=btnResetpwd>" & _ " <img border=0 src=""../images/button/reset.gif"" style=""cursor:hand"" name=btnReset>" FormUsertable=_ TableTitle("用户信息维护", 600, "", "#0040a0") & _ "<table cellspacing=0 cellpadding=0 width=600 align=center border=0 >" & _ "<form name=""frmuser"" method=post action=""user.asp"">" FormUserTable = FormUserTable & _ "<tr height=30>" & _ " <td width=115 align=right>用户名:</td>"&_ " <td width=485 >"&sAccountid&"</td>"&_ "</tr>" FormUserTable = FormUserTable & _ "<tr height=30>" & _ " <td width=115 align=right>员工名:</td>"&_ " <td width=485 >"&sTemp&"</td>"&_ "</tr>" FormUserTable = FormUserTable & _ "<tr height=30>" & _ " <td width=115 align=right>用户角色:</td>"&_ " <td width=200><select name=""roleid"" style=""width:86px"">" &_ SelectOptions(conn, "select * from t_role", "role_id", "role_desp", iRoleid)&_ " </select>" & _ " </td>" & _ "</tr>" FormUserTable = FormUserTable & _ "<tr height=30>" & _ " <td width=115 align=right>用户状态:</td>"&_ " <td width=200><select name=""status"" style=""width:86px"">" &_ " <option value=0 "&optionselect(iStatus,"0")&"> 正常</option>"&_ " <option value=1 "&optionselect(iStatus,"1")&"> 锁定</option>"&_ " </select>"&_ " </td>" & _ "</tr>" FormUserTable = FormUserTable & _ "<tr height=50>" & _ " <td colspan=2 align=center>" & sTempButtons & _ " </td>" & _ "</tr>" & _ "<tr height=30>" & _ " <input type=hidden name=formaction>" & _ " <input type=hidden name=sAccountid value="""&sAccountid&""">" & _ "</tr>" & _ "</form>" & _ "</table>" else '不存在该角色,显示空的角色信息 sTempButtons=_ " <img border=0 src=""../images/button/submit.gif"" style=""cursor:hand"" onclick=""btnSubmit_OnClick();"">" & _ " <img border=0 src=""../images/button/reset.gif"" style=""cursor:hand"" name=btnReset>" '因为传入sql中不能带(),所以无法调用SelectOptions dim Res : Res = "" dim sql:sql="select * from t_employee where emp_id not in (select emp_id from t_account where emp_id is not null ) and dismissed=0" dim rs1: set rs1 = openRS(conn,sql) while not rs1.EOF Res = Res & "<option value=""" & GetValue(rs1, "emp_id") & """>" & GetValue(rs1, "name") & "</option>" rs1.MoveNext wend CloseRS(rs1) FormUsertable=_ TableTitle("新增用户", 600, "", "#0040a0") & _ "<table cellspacing=0 cellpadding=0 width=600 align=center border=0 >" & _ "<form name=""frmuser"" method=post action=""user.asp"">" FormUserTable = FormUserTable & _ "<tr height=30>" & _ " <td width=115 align=right>用户名:</td>"&_ " <td width=485 ><input name=""sAccountid"" size=64 type=""text"" maxlength=100></td>"&_ "</tr>" FormUserTable = FormUserTable & _ "<tr height=30>" & _ " <td width=115 align=right>员工:</td>"&_ " <td width=200><select name=""empid"" style=""width:86px"">" &_ " <option value=""-1"" selected>非员工用户</option>"&_ Res&_ " </select>" & _ " </td>" & _ "</tr>" FormUserTable = FormUserTable & _ "<tr height=30>" & _ " <td width=115 align=right>用户角色:</td>"&_ " <td width=200><select name=""roleid"" style=""width:86px"">" &_ SelectOptions(conn, "select * from t_role", "role_id", "role_desp", "")&_ " </select>" & _ " </td>" & _ "</tr>" FormUserTable = FormUserTable & _ "<tr height=30>" & _ " <td width=115 align=right>用户状态:</td>"&_ " <td width=200><select name=""status"" style=""width:86px"">" &_ " <option value=0 selected > 正常</option>"&_ " <option value=1 > 锁定</option>"&_ " </select>"&_ " </td>" & _ "</tr>" FormUserTable = FormUserTable & _ "<tr height=50>" & _ " <td colspan=2 align=center>" & sTempButtons & _ " </td>" & _ "</tr>" & _ "<tr height=30>" & _ " <input type=hidden name=formaction>" & _ "</tr>" & _ "</form>" & _ "</table>" end if CloseRS(rs) End Function'************************************************************************************************' 函数名 : Updateuser()' 输 入 : ' 输 出 : ' 功能描述' 调用模块: user.asp' 作 者 : weilin' 日 期 : 2002-11-11' 版 本 : '************************************************************************************************Sub UpdateUser()' 定义变量 dim sSQL, sError, sFormaction, rs,sAccountid,iEmpid,iRoleid,iStatus,sName,conn1,sFileAddr dim newid, temp' 获取表单的数据 sFormaction=GetParam("formaction") sAccountid = GetParam("sAccountid") iEmpid = GetParam("empid") iRoleid=GetParam("roleid") iStatus=GetParam("status") select case sFormaction case "adduser"'新增用户 '检查有没有相同的用户名称,如果有的话,给出消息,不允许相同 sError="" sSQL = "select * from t_account where account_id = "&ToSQL(sAccountid,"text") set rs = openRS(conn,sSQL) if not rs.eof then response.write "<script language=javascript >window.alert('对不起,该用户已经存在于用户表,请另选用户名称!')</script>" response.write "<script language=javascript >history.go(-1)</script>" response.end end if CloseRS(rs)'如果用户是非员工用户,将不为他增加邮箱账号,所以用户名可以和t_email中的相同'新增以下判断,修改人:蔡晓燕 日期:2003年1月16日 if iEmpid <> "-1" then set conn1=DBConnectionOA
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -