%@LANGUAGE="VBSCRIPT"%>
<%
' *** 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
Dim Job_Desc
Dim Selected_JobDesc
Dim MySelectQuery
Dim ID
ID = Request.QueryString("ID")
MySelectQuery ="select * from vacancies where ID=" & ID
if (request.QueryString("ID") > 0) then
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open MM_careers_STRING
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open MySelectQuery, Conn
Selected_JobDesc= rs("Position")
rs.close
conn.close
end if
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & 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")) = "application") Then
MM_editConnection = MM_careers_STRING
MM_editTable = "Applications"
MM_editRedirectUrl = "complete.asp"
MM_fieldsStr = "job_id|value|name|value|gender|value|dob|value|fathersname|value|fathersprofession|value|nic|value|married|value|dependents|value|children|value|health|value|criminal|value|elderbrothers|value|eldersisters|value|youngerbrothers|value|youngersisters|value|email|value|mobile|value|presentadd|value|presentphone|value|permanentadd|value|permanentphone|value|matricmarks|value|matrictotal|value|matricpercent|value|matricsubjects|value|matricpassingyear|value|matricinstitute|value|intermarks|value|intertotal|value|interpercent|value|intersubject|value|interpassingyear|value|interinstitute|value|gradmarks|value|gradtotal|value|gradpercent|value|gradsubjects|value|gradpassingyear|value|gradinstitutre|value|postmarks|value|posttotal|value|postpercent|value|postsubjects|value|postpassingyear|value|postinstitute|value|specialmarks|value|specialtotal|value|specialpercent|value|specialsubjects|value|specialpassintyear|value|specialinstitute|value|othermarks|value|othertotal|value|otherpercent|value|othersubject|value|otherpassingyear|value|otherinstitute|value|organization|value|position|value|from_month|value|from_year|value|to_month|value|to_year|value|assignments|value|salary|value|benefits|value|organization2|value|position2|value|from_month2|value|from_year2|value|to_month2|value|to_year2|value|assignments2|value|salary2|value|benefits2|value|organization3|value|position3|value|from_month3|value|from_year3|value|to_month3|value|to_year3|value|assignments3|value|salary3|value|benefits3|value|organization4|value|position4|value|from_month4|value|from_year4|value|to_month4|value|to_year4|value|assignments4|value|salary4|value|benefits4|value|expectedsalary|value|negotiable|value|work_anywhere|value"
MM_columnsStr = "PositionID|none,none,NULL|Name|',none,''|Gender|',none,''|DateOfBirth|',none,NULL|FathersName|',none,''|FathersProfession|',none,''|NIC|none,none,NULL|Married|none,none,NULL|Dependents|none,none,NULL|Children|none,none,NULL|HealthIssue|',none,''|CirminalRecord|',none,''|ElderBrothers|none,none,NULL|ElderSisters|none,none,NULL|YoungerBrothers|none,none,NULL|YoungerSisters|none,none,NULL|Email|',none,''|Mobile|none,none,NULL|Address_Present|',none,''|Phone_Present|none,none,NULL|Address_Permanent|',none,''|Phone_Permanent|none,none,NULL|Matric_Marks_Obt|none,none,NULL|Matric_Marks_Total|none,none,NULL|Matric_Percent|none,none,NULL|Matric_Subjects|',none,''|Matric_Passing_Year|none,none,NULL|Matric_Institute|',none,''|Inter_Marks_Obt|none,none,NULL|Inter_Marks_Total|none,none,NULL|Inter_Percent|none,none,NULL|Inter_Subjects|',none,''|Inter_Passing_Year|none,none,NULL|Inter_Institute|',none,''|Grad_Marks_Obt|none,none,NULL|Grad_Marks_Total|none,none,NULL|Grad_Percent|none,none,NULL|Grad_Subjects|',none,''|Grad_Passing_Year|none,none,NULL|Grad_Institute|',none,''|PostGrad_Marks_Obt|none,none,NULL|PostGrad_Marks_Total|none,none,NULL|PostGrad_Percent|none,none,NULL|PostGrad_Subjects|',none,''|PostGrad_Passing_Year|none,none,NULL|PostGrad_Institute|',none,''|Special_Marks_Obt|none,none,NULL|Special_Marks_Total|none,none,NULL|Special_Percent|none,none,NULL|Special_Subjects|',none,''|Special_Passing_Year|none,none,NULL|Special_Institute|',none,''|Other_Marks_Obt|none,none,NULL|Other_Marks_Total|none,none,NULL|Other_Percent|none,none,NULL|Other_Subjects|',none,''|Other_Passing_Year|none,none,NULL|Other_Institute|',none,''|Exp1_Organization|',none,''|Exp1_Position|',none,''|Exp1_From_Month|none,none,NULL|Exp1_From_Year|none,none,NULL|Exp1_To_Month|none,none,NULL|Exp1_To_Year|none,none,NULL|Exp1_Assignments|',none,''|Exp1_Salary|',none,''|Exp1_Benefits|',none,''|Exp2_Organization|',none,''|Exp2_Position|',none,''|Exp2_From_Month|none,none,NULL|Exp2_From_Year|none,none,NULL|Exp2_To_Month|none,none,NULL|Exp2_To_Year|none,none,NULL|Exp2_Assignments|',none,''|Exp2_Salary|',none,''|Exp2_Benefits|',none,''|Exp3_Organization|',none,''|Exp3_Position|',none,''|Exp3_From_Month|none,none,NULL|Exp3_From_Year|none,none,NULL|Exp3_To_Month|none,none,NULL|Exp3_To_Year|none,none,NULL|Exp3_Assignments|',none,''|Exp3_Salary|',none,''|Exp3_Benefits|',none,''|Exp4_Organization|',none,''|Exp4_Position|',none,''|Exp4_From_Month|none,none,NULL|Exp4_From_Year|none,none,NULL|Exp4_To_Month|none,none,NULL|Exp4_To_Year|none,none,NULL|Exp4_Assignments|',none,''|Exp4_Salary|',none,''|Exp4_Benefits|',none,''|ExpectedSalary|none,none,NULL|Negotiable|none,none,NULL|WorkAnywhere|none,none,NULL"
' 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
%>
<%
' *** 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 & ")"
Response.Write(MM_editQuery)
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
%>