#include WCONNECT.H
DEFINE CLASS Participant as rbPage
PageTitle = "Enter Attendee Information"
oEventData = .NULL.
Payments_ID = [NEW]
FUNCTION Page
This.Content = [<p align = "center"><br><br><b>IMPORTANT MESSAGE:</b><br><br>Please fill out all 5 pages of registration.<br>]+;
[Page 5 says "Done!"<br><br>] +;
[<a href="/Participant.Signup.fox?SessionID=_71P0SACUM">Continue Registration</a></p><br><br><br>]
This.Merge("TemplatePage.htm")
EndFunc
Function Signup
LOCAL lcEvents_id, lcParticipants_ID
STORE [] TO lcEvents_id, lcParticipants_ID
lcEvents_id = SessionVars.Globals.Get("Events_ID","ERROR")
lcParticipants_ID = Request.QueryString("Participants_ID")
IF EMPTY(lcParticipants_ID)
lcParticipants_ID = [NEW]
ENDIF
IF lcEvents_id = "ERROR"
Response.Redirect("/ChooseEvent.Page.fox?SessionID=_71P0SACUM")
Return
ENDIF
This.Payments_ID = SessionVars.Globals.Get("Payments_ID", "NEW")
IF This.Payments_ID = [ORDERISPROCESSED]
SessionVars.Globals.Set("Payments_ID","NEW")
ENDIF
This.oEventData = This.DataObject("Events","Events_ID",lcEvents_ID)
This.oData = This.DataObject("Participants","Participants_id",lcParticipants_ID)
IF lcParticipants_ID = [NEW]
This.oData.events_id = lcEvents_ID
ENDIF
This.Content = This.MergeToString("Participant.htm")
This.Merge("TemplatePage.htm")
ENDFUNC
FUNCTION Submit
LOCAL lcPaymentsID, lcEvents_ID
lcPaymentsID = SessionVars.Globals.Get("Payments_ID","NEW")
This.oData = This.ReadForm("Participants","Participants_id")
lcEvents_ID = Request.Form("Events_ID")
SessionVars.Globals.Set("Events_ID",lcEvents_ID)
IF EMPTY(lcPaymentsID) OR lcPaymentsID == [NEW]
If not Used("Payments")
USE (Site.DataPath+"Payments") IN 0 SHARED
EndIf
SELECT Payments
APPEND BLANK
SessionVars.Globals.Set("Payments_ID", Payments.Payments_ID)
ENDIF
This.oData.Payments_ID = SessionVars.Globals.Get("Payments_ID", "ERROR")
This.ValidateDuplicateParticipants()
This.GetCurrentPriceID(lcEvents_ID)
IF This.Validate() AND This.Save("Participants","Participants_id",This.oData)
Response.Redirect("ParticipantSummary.Page.fox?SessionID=_71P0SACUM")
ELSE
lcEvents_id = SessionVars.Globals.Get("Events_ID","ERROR")
This.oEventData = This.DataObject("Events","Events_ID",lcEvents_ID)
This.Content = This.MergeToString("Participant.htm")
This.Merge("TemplatePage.htm")
ENDIF
ENDFUNC
HIDDEN Function GetCurrentPriceID(tcEvents_ID)
LOCAL lcEvents_ID
LOCAL loData, loEventData
loEventData = This.DataObject("Events","Events_ID",tcEvents_ID)
SELECT * from (Site.Datapath+"EventsPriceSchedule") WHERE Events_ID = tcEvents_ID AND end_dt >= DATE() INTO CURSOR qResult
SELECT qResult
GO Top
STORE amount TO this.oData.amount
STORE eventpriceschedule_id TO this.oData.eventpriceschedule_id
USE IN (SELECT('qResults'))
ENDFUNC
FUNCTION Validate()
This.ErrorMessage = []
This.AddConditionalError(EMPTY(This.oData.First), "First Name must not be empty")
This.AddConditionalError(EMPTY(This.oData.Last), "Last Name must not be empty")
This.AddConditionalError(EMPTY(This.oData.Email), "Email must not be empty")
This.AddConditionalError(EMPTY(This.oData.HomePhone+This.oData.WorkPhone+This.oData.CellPhone+This.oData.Fax), "Please fill in at least one phone #")
RETURN EMPTY(This.ErrorMessage)
ENDFUNC
FUNCTION ValidateDuplicateParticipants()
This.OpenAndSelect("Participants")
IF NOT EMPTY(This.oData.First) AND NOT EMPTY(This.oData.Last)
LOCATE FOR ;
Payments_ID = This.oData.Payments_ID AND ;
ALLTRIM(First) == ALLTRIM(This.oData.First) AND ;
ALLTRIM(Last) == ALLTRIM(This.oData.Last) AND ;
events_id == This.oData.events_id
IF FOUND()
This.oData.Participants_ID = Participants_ID
ENDIF
ENDIF
ENDFUNC
ENDDEFINE
csCodeParser v0.9 stats: 122 lines in 0.00 seconds.