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

📄 departmentmanage.asp

📁 设计广州农信管理系统,具有一般的存取款功能等客户服务.
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/DatabaseConnection.asp" -->
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) = "AddDepartment") Then

  MM_editConnection = MM_DatabaseConnection_STRING
  MM_editTable = "Departments"
  MM_editRedirectUrl = "DepartmentManage.asp"
  MM_fieldsStr  = "DepartmentName|value|DepartmentID|value|Class|value"
  MM_columnsStr = "DepartmentName|',none,''|DepartmentID|',none,''|Class|',none,''"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
  
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Delete Record: declare variables

if (CStr(Request("MM_delete")) = "form0" And CStr(Request("MM_recordId")) <> "") Then

  MM_editConnection = MM_DatabaseConnection_STRING
  MM_editTable = "Departments"
  MM_editColumn = "ID"
  MM_recordId = "" + Request.Form("MM_recordId") + ""
  MM_editRedirectUrl = "DepartmentManage.asp"

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If
  
End If
%>
<%
' *** Delete Record: declare variables

if (CStr(Request("MM_delete")) = "form1" And CStr(Request("MM_recordId")) <> "") Then

  MM_editConnection = MM_DatabaseConnection_STRING
  MM_editTable = "Departments"
  MM_editColumn = "ID"
  MM_recordId = "" + Request.Form("MM_recordId") + ""
  MM_editRedirectUrl = "DepartmentManage.asp"

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If
  
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then  ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
      MM_tableValues = MM_tableValues & ","
      MM_dbValues = MM_dbValues & ","
    End If
    MM_tableValues = MM_tableValues & MM_columns(MM_i)
    MM_dbValues = MM_dbValues & MM_formVal
  Next
  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

  If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
' *** Delete Record: construct a sql delete statement and execute it

If (CStr(Request("MM_delete")) <> "" And CStr(Request("MM_recordId")) <> "") Then

  ' create the sql delete statement
  MM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordId

  If (Not MM_abortEdit) Then
    ' execute the delete
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
Dim rsDepartment0__MMColParam
rsDepartment0__MMColParam = "0"
If (Request("MM_EmptyValue") <> "") Then 
  rsDepartment0__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim rsDepartment0
Dim rsDepartment0_numRows

Set rsDepartment0 = Server.CreateObject("ADODB.Recordset")
rsDepartment0.ActiveConnection = MM_DatabaseConnection_STRING
rsDepartment0.Source = "SELECT * FROM Departments WHERE Class = '" + Replace(rsDepartment0__MMColParam, "'", "''") + "' ORDER BY DepartmentID ASC"
rsDepartment0.CursorType = 0
rsDepartment0.CursorLocation = 2
rsDepartment0.LockType = 1
rsDepartment0.Open()

rsDepartment0_numRows = 0
%>
<%
Dim rsDepartment1__MMColParam
rsDepartment1__MMColParam = "1"
If (Request("MM_EmptyValue") <> "") Then 
  rsDepartment1__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim rsDepartment1
Dim rsDepartment1_numRows

Set rsDepartment1 = Server.CreateObject("ADODB.Recordset")
rsDepartment1.ActiveConnection = MM_DatabaseConnection_STRING
rsDepartment1.Source = "SELECT * FROM Departments WHERE Class = '" + Replace(rsDepartment1__MMColParam, "'", "''") + "' ORDER BY DepartmentID ASC"
rsDepartment1.CursorType = 0
rsDepartment1.CursorLocation = 2
rsDepartment1.LockType = 1
rsDepartment1.Open()

rsDepartment1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsDepartment0_numRows = rsDepartment0_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index

Repeat2__numRows = -1
Repeat2__index = 0
rsDepartment1_numRows = rsDepartment1_numRows + Repeat2__numRows
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>员工信息查询</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2600.0" Name=GENERATOR>
<link href="home.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
function check()
{
  if(document.AddDepartment.DepartmentName.value=="")
  {
    alert("你还没有填名称!");
    document.AddDepartment.DepartmentName.focus();
    return false;
  }
  if(document.AddDepartment.DepartmentID.value=="")
  {
    alert("你还没有填编号!");
    document.AddDepartment.DepartmentID.focus();
    return false;
  }
  if(isNaN(document.AddDepartment.DepartmentID.value))
  {
    alert("编号必须是数字!");
	document.AddDepartment.DepartmentID.select();
    document.AddDepartment.DepartmentID.focus();
    return false;
  }
  if(document.AddDepartment.DepartmentID.value.length<2)
  {
    alert("编号位数不足2位,与学号规则不符合!");
    document.AddDepartment.DepartmentID.focus();
    return false;
  }
}
</script>
</HEAD>
<BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=0>
<!--#include file="Default_top.asp" -->
<TABLE width="760" border=0 align="center" cellPadding=0 cellSpacing=0>
  <TBODY>
    <TR> 
      <TD width=1 background="images/dotLine_h.gif"><IMG src="images/shim(1).gif" width=1></TD>
      <TD Width="100" align="center" bgcolor="#EEEEEE">&nbsp;</TD>
      <td width="10" bgcolor="#F2FBF2"></td>
      <TD bgcolor="#F2FBF2"><img src="images/ClassManage_Title.GIF" width="500" height="60"><br>
        <form ACTION="<%=MM_editAction%>" METHOD="POST" name="AddDepartment" onSubmit="return check()"  id="AddDepartment">
          <strong>添加新部门或分社:</strong><br>
		  <table width="80%"  border="1" cellpadding="5" cellspacing="1" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
            
            <tr> 
              <td width="80" align="right">名&nbsp;&nbsp;&nbsp;&nbsp;称:</td>
              <td width="100"><input name="DepartmentName" type="text" id="DepartmentName" size="10" maxlength="10"><script language='JavaScript'>document.AddDepartment.DepartmentName.focus();</script></td>
              <td>例如:人事秘书部<br>
                &nbsp;&nbsp;&nbsp;&nbsp;<font color="#FF0000">每个部门或分社的名称不能重复</font> 。
              </td>
            </tr>
            <tr> 
              <td width="80" align="right">编&nbsp;&nbsp;&nbsp;&nbsp;号:</td>
              <td width="100"><input name="DepartmentID" type="text" id="DepartmentID" size="10" maxlength="10"></td>
              <td>例如:01<br>
                &nbsp;&nbsp;&nbsp;&nbsp;<font color="#FF0000">1、每个部门的编号不能重复;<br>
                &nbsp;&nbsp;&nbsp;&nbsp;2、每个分社的编号不能重复。</font></td>
            </tr>
            <tr> 
              <td width="80" align="right">所在单位:</td>
              <td width="100"><select name="Class" id="Class">
                <option value="0">联社</option>
                <option value="1">分社</option>
                </select></td>
              <td>&nbsp;</td>
            </tr>
            <tr> 
              <td colspan="3" align="center">
                <input type="submit" name="Submit" value="添  加"></td>
            </tr>
          </table>
                    
        
          <input type="hidden" name="MM_insert" value="AddDepartment">
</form>
		<strong>已有的部门或分社:</strong> 
        <table width="95%" border="1" cellspacing="3" cellpadding="3">
          <tr align="center" valign="middle" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF"> 
            <td><strong>联社下属部门</strong></td>
            <td><strong>联社下属分社</strong></td>
          </tr>
          <tr align="center" valign="top"> 
            <td><table width="100%" border="0" cellspacing="2" cellpadding="0">
                  <tr align="center" valign="middle"> 
                    <td>部门名称</td>
                    <td>部门编号</td>
                    <td>操作</td>
                  </tr>
                 
                    <% While ((Repeat1__numRows <> 0) AND (NOT rsDepartment0.EOF)) %>
					 <form name="form0" method="POST" action="<%=MM_editAction%>">
                    <tr align="center" valign="middle">
                        <td><%=(rsDepartment0.Fields.Item("DepartmentName").Value)%></td>
                        <td><%=(rsDepartment0.Fields.Item("DepartmentID").Value)%></td>
                        <td>
					<input type="hidden" name="MM_delete" value="form0">
                    <input type="hidden" name="MM_recordId" value="<%= rsDepartment0.Fields.Item("ID").Value %>">
					<input name="Submit0" type="submit" id="Submit0" value="删除"></td>
                    </tr>
					</form>
                    <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsDepartment0.MoveNext()
Wend
%>


            </table></td>
            <td><table width="100%" border="0" cellspacing="2" cellpadding="0">
                  <tr align="center" valign="middle"> 
                    <td>分社名称</td>
                    <td>分社编号</td>
                    <td>操作</td>
                  </tr>

                    <% While ((Repeat2__numRows <> 0) AND (NOT rsDepartment1.EOF)) %>
					<form name="form1" method="POST" action="<%=MM_editAction%>">
                    <tr align="center" valign="middle">
                      <td><%=(rsDepartment1.Fields.Item("DepartmentName").Value)%></td>
                      <td><%=(rsDepartment1.Fields.Item("DepartmentID").Value)%></td>
                      <td><input name="Submit1" type="submit" id="Submit1" value="删除"></td>
                    </tr>
                    <input type="hidden" name="MM_delete" value="form1">
                    <input type="hidden" name="MM_recordId" value="<%= rsDepartment1.Fields.Item("ID").Value %>">
                    </form>
                    <% 
  Repeat2__index=Repeat2__index+1
  Repeat2__numRows=Repeat2__numRows-1
  rsDepartment1.MoveNext()
Wend
%>


            </table></td>
          </tr>
        </table>
        <br>
      </td>
      <TD width=1 background="images/dotLine_h.gif"><IMG src="images/shim(1).gif" width=1></TD>
    </TR>
    <tr> 
      <TD height="1" colspan="7" background="images/dotLine_w.gif"><IMG height=1 src="images/shim(1).gif" width=100></TD>
    </tr>
  </TBODY>
</TABLE>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
		<Iframe src="CopyRight.asp" width="760" height="200" marginheight="0" marginwidth="0" scrolling="NO" frameborder="0" name="CopyRight"></iframe>
	</td>
  </tr>
</table></BODY>
</HTML>
<%
rsDepartment0.Close()
Set rsDepartment0 = Nothing
%>
<%
rsDepartment1.Close()
Set rsDepartment1 = Nothing
%>

⌨️ 快捷键说明

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