%
'
' Filename: comcliopenrec.asp
' Generated with CodeCharge 2.0.5
' ASP 2.0.ccp build 01/22/2002
'
'-------------------------------
' comcliopenrec CustomIncludes begin
%>
<%
' comcliopenrec CustomIncludes end
'-------------------------------
'===============================
' Save Page and File Name available into variables
'-------------------------------
sFileName = "comcliopenrec.asp"
'===============================
'===============================
' comcliopenrec PageSecurity begin
' comcliopenrec PageSecurity end
'===============================
'===============================
' comcliopenrec Open Event start
' comcliopenrec Open Event end
'===============================
'===============================
' comcliopenrec OpenAnyPage Event start
' comcliopenrec OpenAnyPage Event end
'===============================
'===============================
' Save the name of the form and type of action into the variables
'-------------------------------
sAction = GetParam("FormAction")
sForm = GetParam("FormName")
'===============================
' comcliopenrec Show begin
'===============================
' Page execution
'-------------------------------
'Initialize error variables
'-------------------------------
scommandescliErr = ""
'-------------------------------
' Select the FormAction
'-------------------------------
Select Case sForm
Case "commandescli"
commandescliAction(sAction)
end select
'===============================
'===============================
' HTML Page layout
'-------------------------------
%>
Commandes clients
<%
' comcliopenrec Show end
' comcliopenrec Close Event start
' comcliopenrec Close Event end
'-------------------------------
' Destroy connection object
'-------------------------------
cn.close
Set cn = nothing
'===============================
'********************************************************************************
'===============================
' Action of the Record Form
'-------------------------------
Sub commandescliAction(sAction)
'-------------------------------
' Initialize variables
'-------------------------------
Dim bExecSQL: bExecSQL = true
Dim sActionFileName : sActionFileName = ""
Dim sWhere : sWhere = ""
Dim bErr : bErr = False
Dim pPKidCommande : pPKidCommande = ""
Dim fldidCli : fldidCli = ""
Dim fldDateCommande : fldDateCommande = ""
Dim fldDescCommande : fldDescCommande = ""
Dim fldidStatut : fldidStatut = ""
'-------------------------------
'-------------------------------
' commandescli Action begin
'-------------------------------
sActionFileName = "comcliopen.asp"
'-------------------------------
' CANCEL action
'-------------------------------
if sAction = "cancel" then
'-------------------------------
' commandescli BeforeCancel Event start
' commandescli BeforeCancel Event end
'-------------------------------
cn.Close
Set cn = Nothing
response.redirect sActionFileName
end if
'-------------------------------
'-------------------------------
' Build WHERE statement
'-------------------------------
if sAction = "update" or sAction = "delete" then
pPKidCommande = GetParam("PK_idCommande")
if IsEmpty(pPKidCommande) then exit sub
sWhere = "idCommande=" & ToSQL(pPKidCommande, "Number")
end if
'-------------------------------
'-------------------------------
' Load all form fields into variables
'-------------------------------
fldidCli = GetParam("idCli")
fldDateCommande = GetParam("DateCommande")
fldDescCommande = GetParam("DescCommande")
fldidStatut = GetParam("idStatut")
'-------------------------------
' Validate fields
'-------------------------------
if sAction = "insert" or sAction = "update" then
if IsEmpty(fldidCli) then
scommandescliErr = scommandescliErr & "The value in field Client : is required.
"
end if
if IsEmpty(fldidStatut) then
scommandescliErr = scommandescliErr & "The value in field Statut : is required.
"
end if
if not isNumeric(fldidCli) then
scommandescliErr = scommandescliErr & "The value in field Client : is incorrect.
"
end if
if not isNumeric(fldidStatut) then
scommandescliErr = scommandescliErr & "The value in field Statut : is incorrect.
"
end if
'-------------------------------
' commandescli Check Event start
' commandescli Check Event end
'-------------------------------
If len(scommandescliErr) > 0 then
exit sub
end if
end if
'-------------------------------
'-------------------------------
' Create SQL statement
'-------------------------------
select case sAction
case "insert"
'-------------------------------
' commandescli Insert Event start
' commandescli Insert Event end
'-------------------------------
sSQL = "insert into commandescli (" & _
"idCli," & _
"DateCommande," & _
"DescCommande," & _
"idStatut)" & _
" values (" & _
ToSQL(fldidCli, "Number") & "," & _
ToSQL(fldDateCommande, "Text") & "," & _
ToSQL(fldDescCommande, "Memo") & "," & _
ToSQL(fldidStatut, "Number") & _
")"
case "update"
'-------------------------------
' commandescli Update Event start
' commandescli Update Event end
'-------------------------------
sSQL = "update commandescli set " & _
"idCli=" & ToSQL(fldidCli, "Number") & _
",DateCommande=" & ToSQL(fldDateCommande, "Text") & _
",DescCommande=" & ToSQL(fldDescCommande, "Memo") & _
",idStatut=" & ToSQL(fldidStatut, "Number")
sSQL = sSQL & " where " & sWhere
case "delete"
'-------------------------------
' commandescli Delete Event start
' commandescli Delete Event end
'-------------------------------
sSQL = "delete from commandescli where " & sWhere
end select
'-------------------------------
'-------------------------------
' commandescli BeforeExecute Event start
' commandescli BeforeExecute Event end
'-------------------------------
'-------------------------------
' Execute SQL statement
'-------------------------------
if len(scommandescliErr) > 0 then Exit Sub
on error resume next
if bExecSQL then
cn.execute sSQL
end if
scommandescliErr = ProcessError
on error goto 0
if len(scommandescliErr) > 0 then Exit Sub
cn.Close
Set cn = Nothing
response.redirect sActionFileName
'-------------------------------
' commandescli Action end
'-------------------------------
end sub
'===============================
'===============================
' Display Record Form
'-------------------------------
Sub commandescli_Show()
'-------------------------------
' commandescli Show begin
'-------------------------------
sWhere = ""
Dim sFormTitle: sFormTitle = "Insérer / Modifier"
bPK = true
%>
<%
'-------------------------------
' commandescli Close Event start
' commandescli Close Event end
'-------------------------------
Set rs = Nothing
'-------------------------------
' commandescli Show end
'-------------------------------
End Sub
'===============================
%>