Nearly half of your module development can be spent creating database objects (tables and stored procedures) and data access methods. You can leverage the DotNetNuke framework and reduce or eliminate this task.
What Module Settings Will Do For You
Module Settings will allow you to easily store data that is specific to an instance of a module. A DotNetNuke module can be placed on multiple pages in a portal (even on the same page). Each time is a separate instance.
Module Settings is usually used to store the data for the Settings user control of a module, but it can be used on any of the module's user controls.
What Personalization Will Do For You
Personalization will store data that is specific to a single user. With the DotNetNuke Survey module, personalization is used to determine if an authenticated user has voted before. If they have they are only showed the results and not allowed to vote again.
Implementing Module Settings
In the Settings.ascx.vb file we used this code to save data to the Module Settings:
Dim
objModules As New DotNetNuke.Entities.Modules.ModuleController
objModules.UpdateModuleSetting(ModuleId, "surveyclosingdate", DotNetNuke.Common.Globals.DateToString(datClosingDate))
We retrieve the data using this code:
If CType(ModuleSettings("surveyclosingdate"), String) <> "" Then
txtClosingDate.Text = CType(ModuleSettings("surveyclosingdate"), Date).ToShortDateString
End If
Implementing Personalization
To implement Personalization in the Survey.ascx.vb file, this code is used:
DotNetNuke.Services.Personalization.Personalization.SetProfile(ModuleId.ToString, "Voted", True)
We retrieve the Personalization setting using this code:
' Check if the user has voted before
If Not DotNetNuke.Services.Personalization.Personalization.GetProfile(ModuleId.ToString, "Voted") Is Nothing Then
Return CType(DotNetNuke.Services.Personalization.Personalization.GetProfile(ModuleId.ToString, "Voted"), Boolean)
Else
Return False
End If
Leverage The DotNetNuke framework
Generally you will want to create tables and stored procedures and data access methods so that you can optimize performance. However, many situations may exist where minimal amounts of data are needed and development time can be reduced by leveraging the DotNetNuke framework.