<% ' ' Filename: CustomerInterv.asp ' Generated with CodeCharge 2.0.5 ' ASP 2.0.ccp build 01/22/2002 ' '------------------------------- ' CustomerInterv CustomIncludes begin %> <% ' CustomerInterv CustomIncludes end '------------------------------- '=============================== ' Save Page and File Name available into variables '------------------------------- sFileName = "CustomerInterv.asp" '=============================== '=============================== ' CustomerInterv PageSecurity begin CheckSecurity(1) ' CustomerInterv PageSecurity end '=============================== '=============================== ' CustomerInterv Open Event start ' CustomerInterv Open Event end '=============================== '=============================== ' CustomerInterv OpenAnyPage Event start ' CustomerInterv OpenAnyPage Event end '=============================== '=============================== ' Save the name of the form and type of action into the variables '------------------------------- sAction = GetParam("FormAction") sForm = GetParam("FormName") '=============================== ' CustomerInterv Show begin '=============================== ' Page execution '------------------------------- 'Initialize error variables '------------------------------- scustint1Err = "" '------------------------------- ' Select the FormAction '------------------------------- Select Case sForm Case "custint1" custint1Action(sAction) end select '=============================== '=============================== ' HTML Page layout '------------------------------- %> EB Agenda
<% EBMenu_Show %>
<% Search_Show %>
<% custint_Show %> <% custint1_Show %>
<% ' CustomerInterv Show end ' CustomerInterv Close Event start ' CustomerInterv Close Event end '------------------------------- ' Destroy connection object '------------------------------- cn.close Set cn = nothing '=============================== '******************************************************************************** '=============================== ' Display Search Form '------------------------------- Sub Search_Show() Dim sFormTitle: sFormTitle = "Search" Dim action_page: action_page = "CustomerInterv.asp" '------------------------------- ' Search Open Event start ' Search Open Event end '------------------------------- '------------------------------- ' Set variables with search parameters '------------------------------- flds_Customer = GetParam("s_Customer") '------------------------------- ' Search Show begin '------------------------------- '------------------------------- ' Search Show Event start ' Search Show Event end '------------------------------- %>
<%=sFormTitle%>
Customer :
<% '------------------------------- ' Search Show end '------------------------------- '------------------------------- ' Search Close Event start ' Search Close Event end '------------------------------- end sub '=============================== '=============================== ' Display Grid Form '------------------------------- Sub custint_Show() '------------------------------- ' Initialize variables '------------------------------- Dim rs Dim sWhere : sWhere = "" Dim sOrder : sOrder = "" Dim sSQL : sSQL = "" Dim sFormTitle: sFormTitle = "Customers' list" Dim HasParam : HasParam = false Dim iSort : iSort = "" Dim iSorted : iSorted = "" Dim sDirection : sDirection = "" Dim form_sorting : form_sorting = "" Dim sSortParams : sSortParams = "" Dim form_action : form_action = "" Dim iRecordsPerPage : iRecordsPerPage = 200 Dim iCounter : iCounter = 0 Dim iPage : iPage = 0 Dim bEof : bEof = False Dim sActionFileName : sActionFileName = "CustomerInterv.asp" Dim transit_params : transit_params = "s_Customer=" & ToURL(GetParam("s_Customer")) & "&" Dim form_params : form_params = "s_Customer=" & ToURL(GetParam("s_Customer")) & "&" '------------------------------- ' Build ORDER BY statement '------------------------------- sOrder = " order by c.Customer Asc" iSort = GetParam("Formcustint_Sorting") iSorted = GetParam("Formcustint_Sorted") sDirection = "" if IsEmpty(iSort) then form_sorting = "" else if iSort = iSorted then form_sorting = "" sDirection = " DESC" sSortParams = "Formcustint_Sorting=" & iSort & "&Formcustint_Sorted=" & iSort & "&" else form_sorting = iSort sDirection = " ASC" sSortParams = "Formcustint_Sorting=" & iSort & "&Formcustint_Sorted=" & "&" end if if iSort = 1 then sOrder = " order by c.Customer" & sDirection end if '------------------------------- ' HTML column headers '------------------------------- %> <% '------------------------------- ' Build WHERE statement '------------------------------- ps_Customer = GetParam("s_Customer") if not isEmpty(ps_Customer) then HasParam = true sWhere = sWhere & "c.Customer like '%" & replace(ps_Customer, "'", "''") & "%'" end if if HasParam then sWhere = " WHERE (" & sWhere & ")" end if '------------------------------- ' Build base SQL statement '------------------------------- sSQL = "select c.Customer as c_Customer, " & _ "c.id as c_id " & _ " from custint c " '------------------------------- '------------------------------- ' custint Open Event start ' custint Open Event end '------------------------------- '------------------------------- ' Assemble full SQL statement '------------------------------- sSQL = sSQL & sWhere & sOrder '------------------------------- '------------------------------- ' Process the link to the record page '------------------------------- form_action = sActionFileName '------------------------------- '------------------------------- ' Open the recordset '------------------------------- openrs rs, sSQL '------------------------------- '------------------------------- ' Process empty recordset '------------------------------- if rs.eof then %> <% end if '------------------------------- '------------------------------- 'Initialize page counter and records per page '------------------------------- iRecordsPerPage = 200 iCounter = 0 '------------------------------- ' Process page scroller '------------------------------- iPage = GetParam("Formcustint_Page") if IsEmpty(iPage) then iPage = 1 else iPage = CLng(iPage) while not rs.eof and iCounter < (iPage-1)*iRecordsPerPage rs.movenext iCounter = iCounter + 1 wend iCounter = 0 '------------------------------- '------------------------------- ' Display grid based on recordset '------------------------------- while not rs.EOF and iCounter < iRecordsPerPage '------------------------------- ' Create field variables based on database fields '------------------------------- fldCustomer_URLLink = "CustomerInterv.asp" fldCustomer_id = GetValue(rs, "c_id") fldCustomer = GetValue(rs, "c_Customer") fldid = GetValue(rs, "c_id") '------------------------------- ' custint Show begin '------------------------------- '------------------------------- ' custint Show Event start ' custint Show Event end '------------------------------- '------------------------------- ' Process the HTML controls '------------------------------- %> <% '------------------------------- ' custint Show end '------------------------------- '------------------------------- ' Move to the next record and increase record counter '------------------------------- rs.MoveNext iCounter = iCounter + 1 wend '------------------------------- '------------------------------- ' Process the bottom on the Grid. The insert link and record navigator. '------------------------------- %>
<%=sFormTitle%>
Customer
Aucuns enregistrements
<%=fldCustomer%> 
Insert       <% '------------------------------- ' custint Navigation begin '------------------------------- bEof = rs.eof if not(rs.EOF and iPage=1) then if iPage = 1 then %> Previous <% else %> Previous <% end if response.write " [ " & iPage & " ] " if bEof then %> Next <% else %> Next <% end if end if '------------------------------- ' custint Navigation end '------------------------------- '------------------------------- ' Finish form processing '------------------------------- set rs = nothing %>
<% '------------------------------- ' custint Close Event start ' custint Close Event end '------------------------------- end sub '=============================== '=============================== ' Action of the Record Form '------------------------------- Sub custint1Action(sAction) '------------------------------- ' Initialize variables '------------------------------- Dim bExecSQL: bExecSQL = true Dim sActionFileName : sActionFileName = "" Dim sWhere : sWhere = "" Dim bErr : bErr = False Dim pPKid : pPKid = "" Dim fldCustomer : fldCustomer = "" '------------------------------- '------------------------------- ' custint1 Action begin '------------------------------- sActionFileName = "CustomerInterv.asp" '------------------------------- ' CANCEL action '------------------------------- if sAction = "cancel" then '------------------------------- ' custint1 BeforeCancel Event start ' custint1 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 '------------------------------- fldCustomer = GetParam("Customer") '------------------------------- ' Validate fields '------------------------------- if sAction = "insert" or sAction = "update" then if IsEmpty(fldCustomer) then scustint1Err = scustint1Err & "La valeur dans le domaine Customer : est exigée.
" end if '------------------------------- ' custint1 Check Event start ' custint1 Check Event end '------------------------------- If len(scustint1Err) > 0 then exit sub end if end if '------------------------------- '------------------------------- ' Create SQL statement '------------------------------- select case sAction case "insert" '------------------------------- ' custint1 Insert Event start ' custint1 Insert Event end '------------------------------- sSQL = "insert into custint (" & _ "Customer)" & _ " values (" & _ ToSQL(fldCustomer, "Text") & _ ")" case "update" '------------------------------- ' custint1 Update Event start ' custint1 Update Event end '------------------------------- sSQL = "update custint set " & _ "Customer=" & ToSQL(fldCustomer, "Text") sSQL = sSQL & " where " & sWhere case "delete" '------------------------------- ' custint1 Delete Event start ' custint1 Delete Event end '------------------------------- sSQL = "delete from custint where " & sWhere end select '------------------------------- '------------------------------- ' custint1 BeforeExecute Event start ' custint1 BeforeExecute Event end '------------------------------- '------------------------------- ' Execute SQL statement '------------------------------- if len(scustint1Err) > 0 then Exit Sub on error resume next if bExecSQL then cn.execute sSQL end if scustint1Err = ProcessError on error goto 0 if len(scustint1Err) > 0 then Exit Sub cn.Close Set cn = Nothing response.redirect sActionFileName '------------------------------- ' custint1 Action end '------------------------------- end sub '=============================== '=============================== ' Display Record Form '------------------------------- Sub custint1_Show() '------------------------------- ' custint1 Show begin '------------------------------- sWhere = "" Dim sFormTitle: sFormTitle = "Insert / Modifiy" bPK = true %> <% if not (scustint1Err = "") then %> <% end if %> <% '------------------------------- ' Load primary key and form parameters '------------------------------- if scustint1Err = "" then fldid = GetParam("id") pid = GetParam("id") else fldid = GetParam("id") fldCustomer = GetParam("Customer") 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 '------------------------------- '------------------------------- ' custint1 Open Event start ' custint1 Open Event end '------------------------------- '------------------------------- ' Build SQL statement and open recordset '------------------------------- sSQL = "select * from custint where " & sWhere openrs rs, sSQL bIsUpdateMode = (bPK and not(sAction = "insert" and sForm = "custint1") 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 scustint1Err = "" then fldCustomer = GetValue(rs, "Customer") end if '------------------------------- ' custint1 ShowEdit Event start ' custint1 ShowEdit Event end '------------------------------- else if scustint1Err = "" then fldid = ToHTML(GetParam("id")) end if '------------------------------- ' custint1 ShowInsert Event start ' custint1 ShowInsert Event end '------------------------------- end if '------------------------------- ' custint1 Show Event start ' custint1 Show Event end '------------------------------- '------------------------------- ' Show form fields '------------------------------- %>
<%=sFormTitle%>
<%= scustint1Err %>
Customer :
<% if not bIsUpdateMode then %> <% end if %> <% if bIsUpdateMode then %> <% end if %>
<% '------------------------------- ' custint1 Close Event start ' custint1 Close Event end '------------------------------- Set rs = Nothing '------------------------------- ' custint1 Show end '------------------------------- End Sub '=============================== %>