<% ' ' Filename: eb_customersRecord.asp ' Generated with CodeCharge 2.0.5 ' ASP 2.0.ccp build 01/22/2002 ' '------------------------------- ' eb_customersRecord CustomIncludes begin %> <% ' eb_customersRecord CustomIncludes end '------------------------------- '=============================== ' Save Page and File Name available into variables '------------------------------- sFileName = "eb_customersRecord.asp" '=============================== '=============================== ' eb_customersRecord PageSecurity begin CheckSecurity(1) ' eb_customersRecord PageSecurity end '=============================== '=============================== ' eb_customersRecord Open Event start ' eb_customersRecord Open Event end '=============================== '=============================== ' eb_customersRecord OpenAnyPage Event start ' eb_customersRecord OpenAnyPage Event end '=============================== '=============================== ' Save the name of the form and type of action into the variables '------------------------------- sAction = GetParam("FormAction") sForm = GetParam("FormName") '=============================== ' eb_customersRecord Show begin '=============================== ' Page execution '------------------------------- 'Initialize error variables '------------------------------- seb_customersErr = "" '------------------------------- ' Select the FormAction '------------------------------- Select Case sForm Case "eb_customers" eb_customersAction(sAction) end select '=============================== '=============================== ' HTML Page layout '------------------------------- %> EB Agenda
<% EBMenu_Show %>
<% eb_customers_Show %>
<% ' eb_customersRecord Show end ' eb_customersRecord Close Event start ' eb_customersRecord Close Event end '------------------------------- ' Destroy connection object '------------------------------- cn.close Set cn = nothing '=============================== '******************************************************************************** '=============================== ' Action of the Record Form '------------------------------- Sub eb_customersAction(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 fldNbStreet : fldNbStreet = "" Dim fldCity : fldCity = "" Dim fldPostCode : fldPostCode = "" Dim fldCountry : fldCountry = "" Dim fldTelGeneral : fldTelGeneral = "" Dim fldContactResp : fldContactResp = "" Dim fldTelResp : fldTelResp = "" Dim fldContactTech : fldContactTech = "" Dim fldTelTech : fldTelTech = "" Dim fldContactLinge : fldContactLinge = "" Dim fldTelLinge : fldTelLinge = "" Dim fldidTypeInstall : fldidTypeInstall = "" Dim fldDescAccesLocal : fldDescAccesLocal = "" Dim fldTypeContrat : fldTypeContrat = "" Dim fldDebutContrat : fldDebutContrat = "" Dim fldFinContrat : fldFinContrat = "" Dim fldTypeFactContr : fldTypeFactContr = "" Dim fldContratEcheanceSuiv : fldContratEcheanceSuiv = "" Dim fldEndWarranty : fldEndWarranty = "" '------------------------------- '------------------------------- ' eb_customers Action begin '------------------------------- sActionFileName = "EBcustomers.asp" '------------------------------- ' CANCEL action '------------------------------- if sAction = "cancel" then '------------------------------- ' eb_customers BeforeCancel Event start ' eb_customers 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") fldNbStreet = GetParam("NbStreet") fldCity = GetParam("City") fldPostCode = GetParam("PostCode") fldCountry = GetParam("Country") fldTelGeneral = GetParam("TelGeneral") fldContactResp = GetParam("ContactResp") fldTelResp = GetParam("TelResp") fldContactTech = GetParam("ContactTech") fldTelTech = GetParam("TelTech") fldContactLinge = GetParam("ContactLinge") fldTelLinge = GetParam("TelLinge") fldidTypeInstall = GetParam("idTypeInstall") fldDescAccesLocal = GetParam("DescAccesLocal") fldTypeContrat = GetParam("TypeContrat") fldDebutContrat = GetParam("DebutContrat") fldFinContrat = GetParam("FinContrat") fldTypeFactContr = GetParam("TypeFactContr") fldContratEcheanceSuiv = GetParam("ContratEcheanceSuiv") fldEndWarranty = GetParam("EndWarranty") '------------------------------- ' Validate fields '------------------------------- if sAction = "insert" or sAction = "update" then if IsEmpty(fldName) then seb_customersErr = seb_customersErr & "The value in field Name : is required.
" end if if IsEmpty(fldFriendName) then seb_customersErr = seb_customersErr & "The value in field Friend Name : is required.
" end if if IsEmpty(fldidTypeInstall) then seb_customersErr = seb_customersErr & "The value in field Type Install : is required.
" end if if not isNumeric(fldidTypeInstall) then seb_customersErr = seb_customersErr & "The value in field Type Install : is incorrect.
" end if '------------------------------- ' eb_customers Check Event start ' eb_customers Check Event end '------------------------------- If len(seb_customersErr) > 0 then exit sub end if end if '------------------------------- '------------------------------- ' Create SQL statement '------------------------------- select case sAction case "insert" '------------------------------- ' eb_customers Insert Event start ' eb_customers Insert Event end '------------------------------- sSQL = "insert into eb_customers (" & _ "Name," & _ "FriendName," & _ "Street," & _ "NbStreet," & _ "City," & _ "PostCode," & _ "Country," & _ "TelGeneral," & _ "ContactResp," & _ "TelResp," & _ "ContactTech," & _ "TelTech," & _ "ContactLinge," & _ "TelLinge," & _ "idTypeInstall," & _ "DescAccesLocal," & _ "TypeContrat," & _ "DebutContrat," & _ "FinContrat," & _ "TypeFactContr," & _ "ContratEcheanceSuiv," & _ "EndWarranty)" & _ " values (" & _ ToSQL(fldName, "Text") & "," & _ ToSQL(fldFriendName, "Text") & "," & _ ToSQL(fldStreet, "Text") & "," & _ ToSQL(fldNbStreet, "Text") & "," & _ ToSQL(fldCity, "Text") & "," & _ ToSQL(fldPostCode, "Text") & "," & _ ToSQL(fldCountry, "Text") & "," & _ ToSQL(fldTelGeneral, "Text") & "," & _ ToSQL(fldContactResp, "Text") & "," & _ ToSQL(fldTelResp, "Text") & "," & _ ToSQL(fldContactTech, "Text") & "," & _ ToSQL(fldTelTech, "Text") & "," & _ ToSQL(fldContactLinge, "Text") & "," & _ ToSQL(fldTelLinge, "Text") & "," & _ ToSQL(fldidTypeInstall, "Number") & "," & _ ToSQL(fldDescAccesLocal, "Memo") & "," & _ ToSQL(fldTypeContrat, "Text") & "," & _ ToSQL(fldDebutContrat, "Date") & "," & _ ToSQL(fldFinContrat, "Date") & "," & _ ToSQL(fldTypeFactContr, "Text") & "," & _ ToSQL(fldContratEcheanceSuiv, "Date") & "," & _ ToSQL(fldEndWarranty, "Date") & _ ")" case "update" '------------------------------- ' eb_customers Update Event start ' eb_customers Update Event end '------------------------------- sSQL = "update eb_customers set " & _ "Name=" & ToSQL(fldName, "Text") & _ ",FriendName=" & ToSQL(fldFriendName, "Text") & _ ",Street=" & ToSQL(fldStreet, "Text") & _ ",NbStreet=" & ToSQL(fldNbStreet, "Text") & _ ",City=" & ToSQL(fldCity, "Text") & _ ",PostCode=" & ToSQL(fldPostCode, "Text") & _ ",Country=" & ToSQL(fldCountry, "Text") & _ ",TelGeneral=" & ToSQL(fldTelGeneral, "Text") & _ ",ContactResp=" & ToSQL(fldContactResp, "Text") & _ ",TelResp=" & ToSQL(fldTelResp, "Text") & _ ",ContactTech=" & ToSQL(fldContactTech, "Text") & _ ",TelTech=" & ToSQL(fldTelTech, "Text") & _ ",ContactLinge=" & ToSQL(fldContactLinge, "Text") & _ ",TelLinge=" & ToSQL(fldTelLinge, "Text") & _ ",idTypeInstall=" & ToSQL(fldidTypeInstall, "Number") & _ ",DescAccesLocal=" & ToSQL(fldDescAccesLocal, "Memo") & _ ",TypeContrat=" & ToSQL(fldTypeContrat, "Text") & _ ",DebutContrat=" & ToSQL(fldDebutContrat, "Date") & _ ",FinContrat=" & ToSQL(fldFinContrat, "Date") & _ ",TypeFactContr=" & ToSQL(fldTypeFactContr, "Text") & _ ",ContratEcheanceSuiv=" & ToSQL(fldContratEcheanceSuiv, "Date") & _ ",EndWarranty=" & ToSQL(fldEndWarranty, "Date") sSQL = sSQL & " where " & sWhere end select '------------------------------- '------------------------------- ' eb_customers BeforeExecute Event start ' eb_customers BeforeExecute Event end '------------------------------- '------------------------------- ' Execute SQL statement '------------------------------- if len(seb_customersErr) > 0 then Exit Sub on error resume next if bExecSQL then cn.execute sSQL end if seb_customersErr = ProcessError on error goto 0 if len(seb_customersErr) > 0 then Exit Sub cn.Close Set cn = Nothing response.redirect sActionFileName '------------------------------- ' eb_customers Action end '------------------------------- end sub '=============================== '=============================== ' Display Record Form '------------------------------- Sub eb_customers_Show() '------------------------------- ' eb_customers Show begin '------------------------------- sWhere = "" Dim sFormTitle: sFormTitle = "eb_customers" bPK = true %> <% if not (seb_customersErr = "") then %> <% end if %> <% '------------------------------- ' Load primary key and form parameters '------------------------------- if seb_customersErr = "" then fldid = GetParam("id") pid = GetParam("id") else fldid = GetParam("id") fldName = GetParam("Name") fldFriendName = GetParam("FriendName") fldStreet = GetParam("Street") fldNbStreet = GetParam("NbStreet") fldCity = GetParam("City") fldPostCode = GetParam("PostCode") fldCountry = GetParam("Country") fldTelGeneral = GetParam("TelGeneral") fldContactResp = GetParam("ContactResp") fldTelResp = GetParam("TelResp") fldContactTech = GetParam("ContactTech") fldTelTech = GetParam("TelTech") fldContactLinge = GetParam("ContactLinge") fldTelLinge = GetParam("TelLinge") fldidTypeInstall = GetParam("idTypeInstall") fldDescAccesLocal = GetParam("DescAccesLocal") fldTypeContrat = GetParam("TypeContrat") fldDebutContrat = GetParam("DebutContrat") fldFinContrat = GetParam("FinContrat") fldTypeFactContr = GetParam("TypeFactContr") fldContratEcheanceSuiv = GetParam("ContratEcheanceSuiv") fldEndWarranty = GetParam("EndWarranty") 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_customers Open Event start ' eb_customers Open Event end '------------------------------- '------------------------------- ' Build SQL statement and open recordset '------------------------------- sSQL = "select * from eb_customers where " & sWhere openStaticRS rs, sSQL bIsUpdateMode = (bPK and not(sAction = "insert" and sForm = "eb_customers") 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_customersErr = "" then fldName = GetValue(rs, "Name") fldFriendName = GetValue(rs, "FriendName") fldStreet = GetValue(rs, "Street") fldNbStreet = GetValue(rs, "NbStreet") fldCity = GetValue(rs, "City") fldPostCode = GetValue(rs, "PostCode") fldCountry = GetValue(rs, "Country") fldTelGeneral = GetValue(rs, "TelGeneral") fldContactResp = GetValue(rs, "ContactResp") fldTelResp = GetValue(rs, "TelResp") fldContactTech = GetValue(rs, "ContactTech") fldTelTech = GetValue(rs, "TelTech") fldContactLinge = GetValue(rs, "ContactLinge") fldTelLinge = GetValue(rs, "TelLinge") fldidTypeInstall = GetValue(rs, "idTypeInstall") fldDescAccesLocal = GetValue(rs, "DescAccesLocal") fldTypeContrat = GetValue(rs, "TypeContrat") fldDebutContrat = GetValue(rs, "DebutContrat") fldFinContrat = GetValue(rs, "FinContrat") fldTypeFactContr = GetValue(rs, "TypeFactContr") fldContratEcheanceSuiv = GetValue(rs, "ContratEcheanceSuiv") fldEndWarranty = GetValue(rs, "EndWarranty") end if '------------------------------- ' eb_customers ShowEdit Event start ' eb_customers ShowEdit Event end '------------------------------- else if seb_customersErr = "" then fldid = ToHTML(GetParam("id")) end if '------------------------------- ' eb_customers ShowInsert Event start ' eb_customers ShowInsert Event end '------------------------------- end if '------------------------------- ' eb_customers Show Event start ' eb_customers Show Event end '------------------------------- '------------------------------- ' Show form fields '------------------------------- %>
<%=sFormTitle%>
<%= seb_customersErr %>
Name :
Friend Name :
Street :
N° :
City :
Post Code :
Country :
Tel General :
Contact Resp :
Tel Resp :
Contact Tech :
Tel Tech :
Contact Linge :
Tel Linge :
Type Install :
Acces Local :
Type Contrat :
Debut Contrat :
Fin Contrat :
Type Facturation :
Echeance Suivante :
End Warranty :
<% if not bIsUpdateMode then %> <% end if %> <% if bIsUpdateMode then %> <% end if %>
<% '------------------------------- ' eb_customers Close Event start ' eb_customers Close Event end '------------------------------- Set rs = Nothing '------------------------------- ' eb_customers Show end '------------------------------- End Sub '=============================== %>