<% ' ' Filename: eb_clientsRecord.asp ' Generated with CodeCharge 2.0.5 ' ASP 2.0.ccp build 01/22/2002 ' '------------------------------- ' eb_clientsRecord CustomIncludes begin %> <% ' eb_clientsRecord CustomIncludes end '------------------------------- '=============================== ' Save Page and File Name available into variables '------------------------------- sFileName = "eb_clientsRecord.asp" '=============================== '=============================== ' eb_clientsRecord PageSecurity begin CheckSecurity(1) ' eb_clientsRecord PageSecurity end '=============================== '=============================== ' eb_clientsRecord Open Event start ' eb_clientsRecord Open Event end '=============================== '=============================== ' eb_clientsRecord OpenAnyPage Event start ' eb_clientsRecord OpenAnyPage Event end '=============================== '=============================== ' Save the name of the form and type of action into the variables '------------------------------- sAction = GetParam("FormAction") sForm = GetParam("FormName") '=============================== ' eb_clientsRecord Show begin '=============================== ' Page execution '------------------------------- 'Initialize error variables '------------------------------- seb_clientsErr = "" '------------------------------- ' Select the FormAction '------------------------------- Select Case sForm Case "eb_clients" eb_clientsAction(sAction) end select '=============================== '=============================== ' HTML Page layout '------------------------------- %> EB Agenda
<% EBMenu_Show %>
<% eb_clients_Show %>
<% ' eb_clientsRecord Show end ' eb_clientsRecord Close Event start ' eb_clientsRecord Close Event end '------------------------------- ' Destroy connection object '------------------------------- cn.close Set cn = nothing '=============================== '******************************************************************************** '=============================== ' Action of the Record Form '------------------------------- Sub eb_clientsAction(sAction) '------------------------------- ' Initialize variables '------------------------------- Dim bExecSQL: bExecSQL = true Dim sActionFileName : sActionFileName = "" Dim sWhere : sWhere = "" Dim bErr : bErr = False Dim pPKid : pPKid = "" Dim fldName : fldName = "" Dim fldFriendName : fldFriendName = "" Dim fldStreet : fldStreet = "" Dim fldCity : fldCity = "" Dim fldPostCode : fldPostCode = "" Dim fldCountry : fldCountry = "" Dim fldTelGeneral : fldTelGeneral = "" Dim fldidTypeClient : fldidTypeClient = "" Dim fldagName1 : fldagName1 = "" Dim fldagName2 : fldagName2 = "" Dim fldagName3 : fldagName3 = "" Dim fldagName4 : fldagName4 = "" Dim fldagName5 : fldagName5 = "" '------------------------------- '------------------------------- ' eb_clients Action begin '------------------------------- sActionFileName = "eb_clientsGrid.asp" '------------------------------- ' CANCEL action '------------------------------- if sAction = "cancel" then '------------------------------- ' eb_clients BeforeCancel Event start ' eb_clients BeforeCancel Event end '------------------------------- cn.Close Set cn = Nothing response.redirect sActionFileName end if '------------------------------- '------------------------------- ' Build WHERE statement '------------------------------- if sAction = "update" or sAction = "delete" then pPKid = GetParam("PK_id") if IsEmpty(pPKid) then exit sub sWhere = "id=" & ToSQL(pPKid, "Number") end if '------------------------------- '------------------------------- ' Load all form fields into variables '------------------------------- fldName = GetParam("Name") fldFriendName = GetParam("FriendName") fldStreet = GetParam("Street") fldCity = GetParam("City") fldPostCode = GetParam("PostCode") fldCountry = GetParam("Country") fldTelGeneral = GetParam("TelGeneral") fldidTypeClient = GetParam("idTypeClient") fldagName1 = GetParam("agName1") fldagName2 = GetParam("agName2") fldagName3 = GetParam("agName3") fldagName4 = GetParam("agName4") fldagName5 = GetParam("agName5") '------------------------------- ' Validate fields '------------------------------- if sAction = "insert" or sAction = "update" then if IsEmpty(fldidTypeClient) then seb_clientsErr = seb_clientsErr & "La valeur dans le domaine idTypeClient est exigée.
" end if if not isNumeric(fldidTypeClient) then seb_clientsErr = seb_clientsErr & "La valeur dans le domaine idTypeClient est incorrecte.
" end if '------------------------------- ' eb_clients Check Event start ' eb_clients Check Event end '------------------------------- If len(seb_clientsErr) > 0 then exit sub end if end if '------------------------------- '------------------------------- ' Create SQL statement '------------------------------- select case sAction case "insert" '------------------------------- ' eb_clients Insert Event start ' eb_clients Insert Event end '------------------------------- sSQL = "insert into eb_clients (" & _ "Name," & _ "FriendName," & _ "Street," & _ "City," & _ "PostCode," & _ "Country," & _ "TelGeneral," & _ "idTypeClient," & _ "agName1," & _ "agName2," & _ "agName3," & _ "agName4," & _ "agName5)" & _ " values (" & _ ToSQL(fldName, "Text") & "," & _ ToSQL(fldFriendName, "Text") & "," & _ ToSQL(fldStreet, "Text") & "," & _ ToSQL(fldCity, "Text") & "," & _ ToSQL(fldPostCode, "Text") & "," & _ ToSQL(fldCountry, "Text") & "," & _ ToSQL(fldTelGeneral, "Text") & "," & _ ToSQL(fldidTypeClient, "Number") & "," & _ ToSQL(fldagName1, "Text") & "," & _ ToSQL(fldagName2, "Text") & "," & _ ToSQL(fldagName3, "Text") & "," & _ ToSQL(fldagName4, "Text") & "," & _ ToSQL(fldagName5, "Text") & _ ")" case "update" '------------------------------- ' eb_clients Update Event start ' eb_clients Update Event end '------------------------------- sSQL = "update eb_clients set " & _ "Name=" & ToSQL(fldName, "Text") & _ ",FriendName=" & ToSQL(fldFriendName, "Text") & _ ",Street=" & ToSQL(fldStreet, "Text") & _ ",City=" & ToSQL(fldCity, "Text") & _ ",PostCode=" & ToSQL(fldPostCode, "Text") & _ ",Country=" & ToSQL(fldCountry, "Text") & _ ",TelGeneral=" & ToSQL(fldTelGeneral, "Text") & _ ",idTypeClient=" & ToSQL(fldidTypeClient, "Number") & _ ",agName1=" & ToSQL(fldagName1, "Text") & _ ",agName2=" & ToSQL(fldagName2, "Text") & _ ",agName3=" & ToSQL(fldagName3, "Text") & _ ",agName4=" & ToSQL(fldagName4, "Text") & _ ",agName5=" & ToSQL(fldagName5, "Text") sSQL = sSQL & " where " & sWhere case "delete" '------------------------------- ' eb_clients Delete Event start ' eb_clients Delete Event end '------------------------------- sSQL = "delete from eb_clients where " & sWhere end select '------------------------------- '------------------------------- ' eb_clients BeforeExecute Event start ' eb_clients BeforeExecute Event end '------------------------------- '------------------------------- ' Execute SQL statement '------------------------------- if len(seb_clientsErr) > 0 then Exit Sub on error resume next if bExecSQL then cn.execute sSQL end if seb_clientsErr = ProcessError on error goto 0 if len(seb_clientsErr) > 0 then Exit Sub cn.Close Set cn = Nothing response.redirect sActionFileName '------------------------------- ' eb_clients Action end '------------------------------- end sub '=============================== '=============================== ' Display Record Form '------------------------------- Sub eb_clients_Show() '------------------------------- ' eb_clients Show begin '------------------------------- sWhere = "" Dim sFormTitle: sFormTitle = "eb_clients" bPK = true %> <% if not (seb_clientsErr = "") then %> <% end if %> <% '------------------------------- ' Load primary key and form parameters '------------------------------- if seb_clientsErr = "" then fldid = GetParam("id") pid = GetParam("id") else fldid = GetParam("id") fldName = GetParam("Name") fldFriendName = GetParam("FriendName") fldStreet = GetParam("Street") fldCity = GetParam("City") fldPostCode = GetParam("PostCode") fldCountry = GetParam("Country") fldTelGeneral = GetParam("TelGeneral") fldidTypeClient = GetParam("idTypeClient") fldagName1 = GetParam("agName1") fldagName2 = GetParam("agName2") fldagName3 = GetParam("agName3") fldagName4 = GetParam("agName4") fldagName5 = GetParam("agName5") pid = GetParam("PK_id") end if '------------------------------- ' Load all form fields '------------------------------- '------------------------------- ' Build WHERE statement if IsEmpty(pid) then bPK = False sWhere = sWhere & "id=" & ToSQL(pid, "Number") PK_id = pid '------------------------------- '------------------------------- ' eb_clients Open Event start ' eb_clients Open Event end '------------------------------- '------------------------------- ' Build SQL statement and open recordset '------------------------------- sSQL = "select * from eb_clients where " & sWhere openrs rs, sSQL bIsUpdateMode = (bPK and not(sAction = "insert" and sForm = "eb_clients") and not rs.eof) '------------------------------- '------------------------------- ' Load all fields into variables from recordset or input parameters '------------------------------- if bIsUpdateMode then fldid = GetValue(rs, "id") '------------------------------- ' Load data from recordset when form displayed first time '------------------------------- if seb_clientsErr = "" then fldName = GetValue(rs, "Name") fldFriendName = GetValue(rs, "FriendName") fldStreet = GetValue(rs, "Street") fldCity = GetValue(rs, "City") fldPostCode = GetValue(rs, "PostCode") fldCountry = GetValue(rs, "Country") fldTelGeneral = GetValue(rs, "TelGeneral") fldidTypeClient = GetValue(rs, "idTypeClient") fldagName1 = GetValue(rs, "agName1") fldagName2 = GetValue(rs, "agName2") fldagName3 = GetValue(rs, "agName3") fldagName4 = GetValue(rs, "agName4") fldagName5 = GetValue(rs, "agName5") end if '------------------------------- ' eb_clients ShowEdit Event start ' eb_clients ShowEdit Event end '------------------------------- else if seb_clientsErr = "" then fldid = ToHTML(GetParam("id")) end if '------------------------------- ' eb_clients ShowInsert Event start ' eb_clients ShowInsert Event end '------------------------------- end if '------------------------------- ' eb_clients Show Event start ' eb_clients Show Event end '------------------------------- '------------------------------- ' Show form fields '------------------------------- %>
<%=sFormTitle%>
<%= seb_clientsErr %>
Name :
FriendName :
Street :
City :
PostCode :
Country :
TelGeneral :
idTypeClient
Agenda 1 :
Agenda 2 :
Agenda 3 :
Agenda 4 :
Agenda 5 :
<% if not bIsUpdateMode then %> <% end if %> <% if bIsUpdateMode then %> <% end if %>
<% '------------------------------- ' eb_clients Close Event start ' eb_clients Close Event end '------------------------------- Set rs = Nothing '------------------------------- ' eb_clients Show end '------------------------------- End Sub '=============================== %>