<% ' ' Filename: AgendaPeriods.asp ' Generated with CodeCharge 2.0.5 ' ASP 2.0.ccp build 01/22/2002 ' '------------------------------- ' AgendaPeriods CustomIncludes begin %> <% ' AgendaPeriods CustomIncludes end '------------------------------- '=============================== ' Save Page and File Name available into variables '------------------------------- sFileName = "AgendaPeriods.asp" '=============================== '=============================== ' AgendaPeriods PageSecurity begin CheckSecurity(1) ' AgendaPeriods PageSecurity end '=============================== '=============================== ' AgendaPeriods Open Event start ' AgendaPeriods Open Event end '=============================== '=============================== ' AgendaPeriods OpenAnyPage Event start ' AgendaPeriods OpenAnyPage Event end '=============================== '=============================== ' Save the name of the form and type of action into the variables '------------------------------- sAction = GetParam("FormAction") sForm = GetParam("FormName") '=============================== ' AgendaPeriods Show begin '=============================== ' Page execution '------------------------------- 'Initialize error variables '------------------------------- stimeagenda1Err = "" '------------------------------- ' Select the FormAction '------------------------------- Select Case sForm Case "timeagenda1" timeagenda1Action(sAction) end select '=============================== '=============================== ' HTML Page layout '------------------------------- %> EB Agenda
<% EBMenu_Show %>
<% timeagenda_Show %> <% timeagenda1_Show %>
<% ' AgendaPeriods Show end ' AgendaPeriods Close Event start ' AgendaPeriods Close Event end '------------------------------- ' Destroy connection object '------------------------------- cn.close Set cn = nothing '=============================== '******************************************************************************** '=============================== ' Display Grid Form '------------------------------- Sub timeagenda_Show() '------------------------------- ' Initialize variables '------------------------------- Dim rs Dim sWhere : sWhere = "" Dim sOrder : sOrder = "" Dim sSQL : sSQL = "" Dim sFormTitle: sFormTitle = "Periods" 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 = 20 Dim iCounter : iCounter = 0 Dim iPage : iPage = 0 Dim bEof : bEof = False Dim sActionFileName : sActionFileName = "AgendaPeriods.asp" Dim transit_params : transit_params = "" Dim form_params : form_params = "" '------------------------------- ' Build ORDER BY statement '------------------------------- sOrder = " order by t.id Asc" iSort = GetParam("Formtimeagenda_Sorting") iSorted = GetParam("Formtimeagenda_Sorted") sDirection = "" if IsEmpty(iSort) then form_sorting = "" else if iSort = iSorted then form_sorting = "" sDirection = " DESC" sSortParams = "Formtimeagenda_Sorting=" & iSort & "&Formtimeagenda_Sorted=" & iSort & "&" else form_sorting = iSort sDirection = " ASC" sSortParams = "Formtimeagenda_Sorting=" & iSort & "&Formtimeagenda_Sorted=" & "&" end if if iSort = 1 then sOrder = " order by t.id" & sDirection if iSort = 2 then sOrder = " order by t.Period" & sDirection end if '------------------------------- ' HTML column headers '------------------------------- %> <% '------------------------------- ' Build base SQL statement '------------------------------- sSQL = "select t.Period as t_Period, " & _ "t.id as t_id " & _ " from timeagenda t " '------------------------------- '------------------------------- ' timeagenda Open Event start ' timeagenda 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 = 20 iCounter = 0 '------------------------------- ' Process page scroller '------------------------------- iPage = GetParam("Formtimeagenda_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 '------------------------------- fldid_URLLink = "AgendaPeriods.asp" fldid_id = GetValue(rs, "t_id") fldid = GetValue(rs, "t_id") fldPeriod = GetValue(rs, "t_Period") '------------------------------- ' timeagenda Show begin '------------------------------- '------------------------------- ' timeagenda Show Event start ' timeagenda Show Event end '------------------------------- '------------------------------- ' Process the HTML controls '------------------------------- %> <% '------------------------------- ' timeagenda 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%>
id Period
Aucuns enregistrements
<%=fldid%>  <%=ToHTML(fldPeriod)%> 
Insert       <% '------------------------------- ' timeagenda 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 '------------------------------- ' timeagenda Navigation end '------------------------------- '------------------------------- ' Finish form processing '------------------------------- set rs = nothing %>
<% '------------------------------- ' timeagenda Close Event start ' timeagenda Close Event end '------------------------------- end sub '=============================== '=============================== ' Action of the Record Form '------------------------------- Sub timeagenda1Action(sAction) '------------------------------- ' Initialize variables '------------------------------- Dim bExecSQL: bExecSQL = true Dim sActionFileName : sActionFileName = "" Dim sWhere : sWhere = "" Dim bErr : bErr = False Dim pPKid : pPKid = "" Dim fldPeriod : fldPeriod = "" '------------------------------- '------------------------------- ' timeagenda1 Action begin '------------------------------- sActionFileName = "AgendaPeriods.asp" '------------------------------- ' CANCEL action '------------------------------- if sAction = "cancel" then '------------------------------- ' timeagenda1 BeforeCancel Event start ' timeagenda1 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 '------------------------------- fldPeriod = GetParam("Period") '------------------------------- ' Validate fields '------------------------------- if sAction = "insert" or sAction = "update" then if IsEmpty(fldPeriod) then stimeagenda1Err = stimeagenda1Err & "La valeur dans le domaine Period : est exigée.
" end if '------------------------------- ' timeagenda1 Check Event start ' timeagenda1 Check Event end '------------------------------- If len(stimeagenda1Err) > 0 then exit sub end if end if '------------------------------- '------------------------------- ' Create SQL statement '------------------------------- select case sAction case "insert" '------------------------------- ' timeagenda1 Insert Event start ' timeagenda1 Insert Event end '------------------------------- sSQL = "insert into timeagenda (" & _ "Period)" & _ " values (" & _ ToSQL(fldPeriod, "Text") & _ ")" case "update" '------------------------------- ' timeagenda1 Update Event start ' timeagenda1 Update Event end '------------------------------- sSQL = "update timeagenda set " & _ "Period=" & ToSQL(fldPeriod, "Text") sSQL = sSQL & " where " & sWhere case "delete" '------------------------------- ' timeagenda1 Delete Event start ' timeagenda1 Delete Event end '------------------------------- sSQL = "delete from timeagenda where " & sWhere end select '------------------------------- '------------------------------- ' timeagenda1 BeforeExecute Event start ' timeagenda1 BeforeExecute Event end '------------------------------- '------------------------------- ' Execute SQL statement '------------------------------- if len(stimeagenda1Err) > 0 then Exit Sub on error resume next if bExecSQL then cn.execute sSQL end if stimeagenda1Err = ProcessError on error goto 0 if len(stimeagenda1Err) > 0 then Exit Sub cn.Close Set cn = Nothing response.redirect sActionFileName '------------------------------- ' timeagenda1 Action end '------------------------------- end sub '=============================== '=============================== ' Display Record Form '------------------------------- Sub timeagenda1_Show() '------------------------------- ' timeagenda1 Show begin '------------------------------- sWhere = "" Dim sFormTitle: sFormTitle = "Modify Period" bPK = true %> <% if not (stimeagenda1Err = "") then %> <% end if %> <% '------------------------------- ' Load primary key and form parameters '------------------------------- if stimeagenda1Err = "" then fldid = GetParam("id") pid = GetParam("id") else fldid = GetParam("id") fldPeriod = GetParam("Period") 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 '------------------------------- '------------------------------- ' timeagenda1 Open Event start ' timeagenda1 Open Event end '------------------------------- '------------------------------- ' Build SQL statement and open recordset '------------------------------- sSQL = "select * from timeagenda where " & sWhere openrs rs, sSQL bIsUpdateMode = (bPK and not(sAction = "insert" and sForm = "timeagenda1") 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 stimeagenda1Err = "" then fldPeriod = GetValue(rs, "Period") end if '------------------------------- ' timeagenda1 ShowEdit Event start ' timeagenda1 ShowEdit Event end '------------------------------- else if stimeagenda1Err = "" then fldid = ToHTML(GetParam("id")) end if '------------------------------- ' timeagenda1 ShowInsert Event start ' timeagenda1 ShowInsert Event end '------------------------------- end if '------------------------------- ' timeagenda1 Show Event start ' timeagenda1 Show Event end '------------------------------- '------------------------------- ' Show form fields '------------------------------- %>
<%=sFormTitle%>
<%= stimeagenda1Err %>
Period :
<% if not bIsUpdateMode then %> <% end if %> <% if bIsUpdateMode then %> <% end if %>
<% '------------------------------- ' timeagenda1 Close Event start ' timeagenda1 Close Event end '------------------------------- Set rs = Nothing '------------------------------- ' timeagenda1 Show end '------------------------------- End Sub '=============================== %>