%@ LCID = 3082 %>
<%
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.addHeader "cache-control", "no-cache"
Response.addHeader "cache-control", "no-store"
Response.CacheControl = "no-cache"
%>
<%
ewCurSec = 0 ' Initialise
' User levels
Const ewAllowAdd = 1
Const ewAllowDelete = 2
Const ewAllowEdit = 4
Const ewAllowView = 8
Const ewAllowList = 8
Const ewAllowReport = 8
Const ewAllowSearch = 8
Const ewAllowAdmin = 16
%>
<%
' Initialize common variables
x_idreferencia = Null: ox_idreferencia = Null
x_FECHA = Null: ox_FECHA = Null
x_EMPRESA = Null: ox_EMPRESA = Null
x_DIRECCION = Null: ox_DIRECCION = Null
x_POBLACION = Null: ox_POBLACION = Null
x_TELEFONO = Null: ox_TELEFONO = Null
x_EMAIL = Null: ox_EMAIL = Null
x_ACTIVIDAD = Null: ox_ACTIVIDAD = Null
x_PUESTOS = Null: ox_PUESTOS = Null
x_DESCRIPCION = Null: ox_DESCRIPCION = Null
x_UBICACION = Null: ox_UBICACION = Null
x_EDAD = Null: ox_EDAD = Null
x_SEXO = Null: ox_SEXO = Null
x_VEHICULO = Null: ox_VEHICULO = Null
x_TITULOS = Null: ox_TITULOS = Null
x_IDIOMAS = Null: ox_IDIOMAS = Null
x_CURSOS = Null: ox_CURSOS = Null
x_NIVELES = Null: ox_NIVELES = Null
x_CARNET = Null: ox_CARNET = Null
x_TIPO = Null: ox_TIPO = Null
x_JORNADA = Null: ox_JORNADA = Null
x_DURACION = Null: ox_DURACION = Null
x_SUELDO = Null: ox_SUELDO = Null
%>
<%
Response.Buffer = True
' Load key from QueryString
bCopy = True
x_idreferencia = Request.QueryString("idreferencia")
If x_idreferencia = "" Or IsNull(x_idreferencia) Then
bCopy = False
End If
' Get action
sAction = Request.Form("a_add")
If (sAction = "" Or IsNull(sAction)) Then
If bCopy Then
sAction = "C" ' Copy record
Else
sAction = "I" ' Display blank record
End If
Else
' Get fields from form
x_idreferencia = Request.Form("x_idreferencia")
x_FECHA = Request.Form("x_FECHA")
x_EMPRESA = Request.Form("x_EMPRESA")
x_DIRECCION = Request.Form("x_DIRECCION")
x_POBLACION = Request.Form("x_POBLACION")
x_TELEFONO = Request.Form("x_TELEFONO")
x_EMAIL = Request.Form("x_EMAIL")
x_ACTIVIDAD = Request.Form("x_ACTIVIDAD")
x_PUESTOS = Request.Form("x_PUESTOS")
x_DESCRIPCION = Request.Form("x_DESCRIPCION")
x_UBICACION = Request.Form("x_UBICACION")
x_EDAD = Request.Form("x_EDAD")
x_SEXO = Request.Form("x_SEXO")
x_VEHICULO = Request.Form("x_VEHICULO")
x_TITULOS = Request.Form("x_TITULOS")
x_IDIOMAS = Request.Form("x_IDIOMAS")
x_CURSOS = Request.Form("x_CURSOS")
x_NIVELES = Request.Form("x_NIVELES")
x_CARNET = Request.Form("x_CARNET")
x_TIPO = Request.Form("x_TIPO")
x_JORNADA = Request.Form("x_JORNADA")
x_DURACION = Request.Form("x_DURACION")
x_SUELDO = Request.Form("x_SUELDO")
End If
' Open connection to the database
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str
Select Case sAction
Case "C": ' Get a record to display
If Not LoadData() Then ' Load Record based on key
Session("ewmsg") = "No se han encontrado registros"
conn.Close ' Close Connection
Set conn = Nothing
Response.Clear
Response.Redirect "ofem.asp"
End If
Case "A": ' Add
If AddData() Then ' Add New Record
Session("ewmsg") = "Nuevo Registro Aņadido Satisfactoriamente"
conn.Close ' Close Connection
Set conn = Nothing
Response.Clear
Response.Redirect "ofem.asp"
Else
End If
End Select
%>
Ofertas de Empleo
Volver al Listado
<%
conn.Close ' Close Connection
Set conn = Nothing
%>
<%
'-------------------------------------------------------------------------------
' Function LoadData
' - Load Data based on Key Value
' - Variables setup: field variables
Function LoadData()
Dim sSql, rs, sWhere, sGroupBy, sHaving, sOrderBy
sSql = "SELECT * FROM `ofertasempleo`"
sWhere = ""
sGroupBy = ""
sHaving = ""
sOrderBy = ""
If sWhere <> "" Then sWhere = sWhere & " AND "
sWhere = sWhere & "(`idreferencia` = " & AdjustSql(x_idreferencia) & ")"
sSql = sSql & " WHERE " & sWhere
If sGroupBy <> "" Then
sSql = sSql & " GROUP BY " & sGroupBy
End If
If sHaving <> "" Then
sSql = sSql & " HAVING " & sHaving
End If
If sOrderBy <> "" Then
sSql = sSql & " ORDER BY " & sOrderBy
End If
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sSql, conn
If rs.Eof Then
LoadData = False
Else
LoadData = True
rs.MoveFirst
' Get the field contents
x_idreferencia = rs("idreferencia")
x_FECHA = rs("FECHA")
x_EMPRESA = rs("EMPRESA")
x_DIRECCION = rs("DIRECCION")
x_POBLACION = rs("POBLACION")
x_TELEFONO = rs("TELEFONO")
x_EMAIL = rs("EMAIL")
x_ACTIVIDAD = rs("ACTIVIDAD")
x_PUESTOS = rs("PUESTOS")
x_DESCRIPCION = rs("DESCRIPCION")
x_UBICACION = rs("UBICACION")
x_EDAD = rs("EDAD")
x_SEXO = rs("SEXO")
x_VEHICULO = rs("VEHICULO")
x_TITULOS = rs("TITULOS")
x_IDIOMAS = rs("IDIOMAS")
x_CURSOS = rs("CURSOS")
x_NIVELES = rs("NIVELES")
x_CARNET = rs("CARNET")
x_TIPO = rs("TIPO")
x_JORNADA = rs("JORNADA")
x_DURACION = rs("DURACION")
x_SUELDO = rs("SUELDO")
End If
rs.Close
Set rs = Nothing
End Function
%>
<%
'-------------------------------------------------------------------------------
' Function AddData
' - Add Data
' - Variables used: field variables
Function AddData()
Dim sSql, rs, sWhere, sGroupBy, sHaving, sOrderBy
Dim bCheckKey, sSqlChk, sWhereChk
sSql = "SELECT * FROM `ofertasempleo`"
sWhere = ""
sGroupBy = ""
sHaving = ""
sOrderBy = ""
' Check for duplicate key
bCheckKey = True
sWhereChk = sWhere
If x_idreferencia = "" Or IsNull(x_idreferencia) Then
bCheckKey = False
Else
If sWhereChk <> "" Then sWhereChk = sWhereChk & " AND "
sWhereChk = sWhereChk & "(`idreferencia` = " & AdjustSql(x_idreferencia) & ")"
End If
If bCheckKey Then
sSqlChk = sSql & " WHERE " & sWhereChk
Set rsChk = conn.Execute(sSqlChk)
If Not rsChk.Eof Then
Session("ewmsg") = ""
rsChk.Close
Set rsChk = Nothing
AddData = False
Exit Function
End If
rsChk.Close
Set rsChk = Nothing
End If
' Add New Record
If sWhere <> "" Then sWhere = sWhere & " AND "
sWhere = sWhere & "(0 = 1)"
sSql = sSql & " WHERE " & sWhere
If sGroupBy <> "" Then
sSql = sSql & " GROUP BY " & sGroupBy
End If
If sHaving <> "" Then
sSql = sSql & " HAVING " & sHaving
End If
If sOrderBy <> "" Then
sSql = sSql & " ORDER BY " & sOrderBy
End If
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.Open sSql, conn, 1, 2
rs.AddNew
' Field FECHA
sTmp = EW_UnFormatDateTime(x_FECHA,7)
If IsDate(sTmp) Then
rs("FECHA") = CDate(sTmp)
Else
rs("FECHA") = Null
End If
' Field EMPRESA
sTmp = Trim(x_EMPRESA)
If Trim(sTmp) = "" Then sTmp = Null
rs("EMPRESA") = sTmp
' Field DIRECCION
sTmp = Trim(x_DIRECCION)
If Trim(sTmp) = "" Then sTmp = Null
rs("DIRECCION") = sTmp
' Field POBLACION
sTmp = Trim(x_POBLACION)
If Trim(sTmp) = "" Then sTmp = Null
rs("POBLACION") = sTmp
' Field TELEFONO
sTmp = Trim(x_TELEFONO)
If Trim(sTmp) = "" Then sTmp = Null
rs("TELEFONO") = sTmp
' Field EMAIL
sTmp = Trim(x_EMAIL)
If Trim(sTmp) = "" Then sTmp = Null
rs("EMAIL") = sTmp
' Field ACTIVIDAD
sTmp = Trim(x_ACTIVIDAD)
If Trim(sTmp) = "" Then sTmp = Null
rs("ACTIVIDAD") = sTmp
' Field PUESTOS
sTmp = Trim(x_PUESTOS)
If Trim(sTmp) = "" Then sTmp = Null
rs("PUESTOS") = sTmp
' Field DESCRIPCION
sTmp = Trim(x_DESCRIPCION)
If Trim(sTmp) = "" Then sTmp = Null
rs("DESCRIPCION") = sTmp
' Field UBICACION
sTmp = Trim(x_UBICACION)
If Trim(sTmp) = "" Then sTmp = Null
rs("UBICACION") = sTmp
' Field EDAD
sTmp = Trim(x_EDAD)
If Trim(sTmp) = "" Then sTmp = Null
rs("EDAD") = sTmp
' Field SEXO
sTmp = Trim(x_SEXO)
If Trim(sTmp) = "" Then sTmp = Null
rs("SEXO") = sTmp
' Field VEHICULO
sTmp = Trim(x_VEHICULO)
If Trim(sTmp) = "" Then sTmp = Null
rs("VEHICULO") = sTmp
' Field TITULOS
sTmp = Trim(x_TITULOS)
If Trim(sTmp) = "" Then sTmp = Null
rs("TITULOS") = sTmp
' Field IDIOMAS
sTmp = Trim(x_IDIOMAS)
If Trim(sTmp) = "" Then sTmp = Null
rs("IDIOMAS") = sTmp
' Field CURSOS
sTmp = Trim(x_CURSOS)
If Trim(sTmp) = "" Then sTmp = Null
rs("CURSOS") = sTmp
' Field NIVELES
sTmp = Trim(x_NIVELES)
If Trim(sTmp) = "" Then sTmp = Null
rs("NIVELES") = sTmp
' Field CARNET
sTmp = Trim(x_CARNET)
If Trim(sTmp) = "" Then sTmp = Null
rs("CARNET") = sTmp
' Field TIPO
sTmp = Trim(x_TIPO)
If Trim(sTmp) = "" Then sTmp = Null
rs("TIPO") = sTmp
' Field JORNADA
sTmp = Trim(x_JORNADA)
If Trim(sTmp) = "" Then sTmp = Null
rs("JORNADA") = sTmp
' Field DURACION
sTmp = Trim(x_DURACION)
If Trim(sTmp) = "" Then sTmp = Null
rs("DURACION") = sTmp
' Field SUELDO
sTmp = Trim(x_SUELDO)
If Trim(sTmp) = "" Then sTmp = Null
rs("SUELDO") = sTmp
rs.Update
rs.Close
Set rs = Nothing
AddData = True
End Function
%>