en-USnl-NL
Goal:
Up 'till now we have just defined the tables that contain the information about the entities in your application.
We now want to make this information work. There must be a form that enables a member to sign in on an activity.

Table definition:
One thing that has to be done is to define a new table in the DatabaseBuilder called "ActivityPlan".
This table will contain the SQL tablefields that store the member information, the activity information and some things more.
We'll come back on this later. For now, create a dropdownlist on the Activity table as the first tablefield. See lesson 9 for more information.


Again, the DatabaseBuilder will add an extra fieldname in the list; you only have to put in the "YCActivities" fieldname. (The link to the Activities table, remember?)

At first the officer must be able to PLAN an activity. This means that he must put in a subscriptionperiod, a start date and end date for the actual activity, the cost and maybe a maximum number of participants. It might also be possible that the activity is restricted to individuals above a certain age, due to safety measures. And there has to be a counter for the reached number of participants on any given time.
Because this information has to be valid for ALL activities, it has to be present in ALL the records, regardless if it's being used or not.
So always design your table with this in mind.

How do we get this information into our database?

It is obvious that that the new activity fiels for the planning have to come in the ActivityTable. So we have to extent this table with the required SQL tablefields.

Execution:
Open your DatabaseBuilder and open the Activity Tab.
Now insert the new fields in the fieldname column "D" directly under the "YCOfficers" fieldname. Remember, the fieldnames have to be uninterrupted.
Insert these fields below the YCOfficers field:
FieldName:                FieldType:
SubscriptionPeriod        Int
StartDate                    VarChar(10)
EndDate                      VarChar(10)
Cost                            Money
MinAge                        Int
MaxParticipants           Int
CountParticipants        Int


Take care for the correct fieldtypes for the date fields; these are "VarChar(10)" types.
The date function is in the Extentions: "_DTE" or "_DTX".
Tick the extention "_DTE" to create a date field in the Start en End date.
Now you will get the DNN calendar icon next to these datefields.
Switch on the "_GRD" extention in the new fields to show these fields in the viewgrid, exept for the descriptionfield.
   



Re-create your Activities module; don't forget to delete the existing one alltogether with the code.


Now connect the ActivityOfficers with the Activities.by clicking the "Edit" button and selecting the activityofficer in the dropdownlist.


Observe that the names of the activityofficers show in the "YCOfficers" column.

Now imagine that you are activityofficerBert Stonefinger, and you have planned a new Paragliding event in august; from 16th untill 22th.
You would have calculated the cost per participant; lets say $950,00 all inclusive.
Then there are just 8 paragliders, so the maximum number of participants woule be 8.
Due to safety regulations the minimum age of any participant must be at least 18 years.

Now Bert can setup his event:
     

The event will show in the gridview:


Members of the society can select any of the events to join as long as the maximum number of participants is not reached.
Test your application toroughly. Make sure that you also test as if you were an anonimus visitor on the site that wants to join an event.

You're done with this lesson.

Continue on: ActivityPlan: Part 1
Continue on: ActivityPlan: Part 2


---->> Lesson 14: Extended Modal Popup