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

📄 projectmaint.asp

📁 BugTrack is a basic, yet fully functional web based Bug Tracking system that you may use as a framew
💻 ASP
字号:
<!-- #INCLUDE FILE="Common.asp" -->

<%
'
'   Filename: ProjectMaint.asp
'   Generated with CodeCharge 1.2.0
'   ASPTemplates.ccp build 5/9/2001
'


sFileName = "ProjectMaint.asp"
sTemplateFileName = "ProjectMaint.html"


' ProjectMaint Open Event start
' ProjectMaint Open Event end


' ProjectMaint PageSecurity begin

CheckSecurity(3)

' ProjectMaint PageSecurity end

' ProjectMaint OpenAnyPage Event start
' ProjectMaint OpenAnyPage Event end


LoadTemplate sAppPath & sTemplateFileName, "main"

LoadTemplate sHeaderFileName, "Header"


SetVar "FileName", sFileName


sProjectMaintErr = ""

sAction = GetParam("FormAction")
sForm = GetParam("FormName")
Select Case sForm
  Case "ProjectMaint"
    ProjectMaintAction(sAction)
end select

Menu_Show
ProjectMaint_Show
Parse "Header", False
Parse "main", False
Response.write PrintVar("main")

' ProjectMaint Close Event start
' ProjectMaint Close Event end


'--------------------------------------------------


Sub ProjectMaintAction(sAction)
  dim bExecSQL: bExecSQL = true
  
  ' ProjectMaint Action begin
  sActionFileName = "ProjectList.asp"
  
  

  sWhere = ""
  bErr = False  


  ' Create WHERE statement
  if sAction = "update" or sAction = "delete" then
    pPKproject_id = GetParam("PK_project_id")
    if IsEmpty(pPKproject_id) then exit sub
    sWhere = "project_id=" & ToSQL(pPKproject_id, "Number")
  end if


  ' Load all form fields into variables

  fldproject_name = GetParam("project_name")
  fldemployee_id = GetParam("employee_id")
  ' Validate fields
  if sAction = "insert" or sAction = "update" then
    if IsEmpty(fldproject_name) then
      sProjectMaintErr = sProjectMaintErr & "The value in field Project Name is required.<br>"
    end if
    if IsEmpty(fldemployee_id) then
      sProjectMaintErr = sProjectMaintErr & "The value in field Responsible User is required.<br>"
    end if
    if not isNumeric(fldemployee_id) then
      sProjectMaintErr = sProjectMaintErr & "The value in field Responsible User is incorrect.<br>"
    end if
' ProjectMaint Check Event start
' ProjectMaint Check Event end

    If len(sProjectMaintErr) > 0 then
      exit sub
    end if
  end if


  sSQL = ""
  ' Create SQL statement

  select case sAction
    case "insert"
      
' ProjectMaint Insert Event start
' ProjectMaint Insert Event end

      sSQL = "insert into projects (" & _
          "[project_name]," & _
          "[employee_id])" & _
          " values (" & _
          ToSQL(fldproject_name, "Text") & "," & _
          ToSQL(fldemployee_id, "Number") & _
          ")"
    case "update"
      
' ProjectMaint Update Event start
' ProjectMaint Update Event end

      sSQL = "update projects set " & _
        "[project_name]=" & ToSQL(fldproject_name, "Text") & _
        ",[employee_id]=" & ToSQL(fldemployee_id, "Number")
      sSQL = sSQL & " where " & sWhere
    case "delete"
' ProjectMaint Delete Event start
' ProjectMaint Delete Event end

      sSQL = "delete from projects where " & sWhere
  end select

  ' Execute SQL statement
  
' ProjectMaint BeforeExecute Event start
' ProjectMaint BeforeExecute Event end

  if len(sProjectMaintErr) > 0 then Exit Sub
  on error resume next
  if bExecSQL then 
    cn.execute sSQL
  end if
  sProjectMaintErr = ProceedError
  if len(sProjectMaintErr) > 0 then Exit Sub
  on error goto 0
  response.redirect sActionFileName
  ' ProjectMaint Action end
end sub

Sub ProjectMaint_Show()

  ' ProjectMaint Show begin
  Dim sWhere, bPK
  sWhere = ""
  
  bPK = True

  if sProjectMaintErr = "" then
    ' Load primary key and form parameters
    fldproject_id = GetParam("project_id")
    pproject_id = GetParam("project_id")
    SetVar "ProjectMaintError", ""
  else
    ' Load primary key, form parameters and form fields
    fldproject_id = GetParam("project_id")
    fldproject_name = GetParam("project_name")
    fldemployee_id = GetParam("employee_id")
    pproject_id = GetParam("PK_project_id")
    SetVar "sProjectMaintErr", sProjectMaintErr
    Parse "ProjectMaintError", False
  end if

  
  if IsEmpty(pproject_id) then bPK = False
  
  sWhere = sWhere & "project_id=" & ToSQL(pproject_id, "Number")
  SetVar "PK_project_id", pproject_id
' ProjectMaint Open Event start
' ProjectMaint Open Event end


  sSQL = "select * from projects where " & sWhere

  openrs rs, sSQL
	

  if bPK and not(sAction = "insert" and sForm = "ProjectMaint") and not rs.eof then 
    
    fldproject_id = GetValue(rs, "project_id")
    if sProjectMaintErr = "" then
      ' Load data from recordset when form displayed first time
      fldproject_name = GetValue(rs, "project_name")
      fldemployee_id = GetValue(rs, "employee_id")
    end if
    SetVar "ProjectMaintInsert", ""
    Parse "ProjectMaintEdit", False
' ProjectMaint ShowEdit Event start
' ProjectMaint ShowEdit Event end

  else
    if sProjectMaintErr = "" then
      fldproject_id = ToHTML(GetParam("project_id"))
    end if
    SetVar "ProjectMaintEdit", ""
    Parse "ProjectMaintInsert", False
' ProjectMaint ShowInsert Event start
' ProjectMaint ShowInsert Event end

  end if
  SetVar "ProjectMaintCancel", ""
' ProjectMaint Show Event start
' ProjectMaint Show Event end

  ' Show form field
  
      SetVar "project_id", ToHTML(fldproject_id)
      SetVar "project_name", ToHTML(fldproject_name)
      SetVar "LBemployee_id", ""
      openrs rsemployee_id, "select employee_id, employee_name from employees order by 2"
      while not rsemployee_id.EOF
        SetVar "ID", GetValue(rsemployee_id, 0) : SetVar "Value", GetValue(rsemployee_id, 1)
        if cstr(GetValue(rsemployee_id, 0)) = cstr(fldemployee_id) then SetVar "Selected", "SELECTED" else SetVar "Selected", ""
        Parse "LBemployee_id", True
        rsemployee_id.MoveNext
      wend
      set rsemployee_id = nothing
    
  Parse "FormProjectMaint", False
  
' ProjectMaint Close Event start
' ProjectMaint Close Event end

  ' ProjectMaint Show end
  
End Sub

%>

<!-- #INCLUDE FILE="Header.asp" -->

⌨️ 快捷键说明

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