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.
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.
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.
We used this code to save data to the Module Settings:
VB:
Dim
objModules As New DotNetNuke.Entities.Modules.ModuleControllerC#:
DotNetNuke.Entities.Modules.ModuleController
objModules = new DotNetNuke.Entities.Modules.ModuleController();We retrieve the data using this code:
VB:
txtClosingDate.Text = CType(Settings("surveyclosingdate"), Date).ToShortDateString
C#:
txtClosingDate.Text = Convert.ToDateTime(Settings["surveyclosingdate"]).ToShortDateString();
To implement Personalization this code is used:
VB:
DotNetNuke.Services.Personalization.Personalization.SetProfile(ModuleId.ToString, "Voted", True)
C#:
DotNetNuke.Services.Personalization.Personalization.SetProfile(ModuleId.ToString(), "Voted", true);
We retrieve the Personalization setting using this code:
VB:
' 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
C#:
// Check if the user has voted
before
if (!(DotNetNuke.Services.Personalization.Personalization.GetProfile(ModuleId.ToString(),
"Voted") ==
null))
{
return ((bool)(DotNetNuke.Services.Personalization.Personalization.GetProfile(ModuleId.ToString(),
"Voted")));
}
else
{
return
false;
}
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.
DotNetNukeŽ is a registered trademark of Perpetual Motion Interactive Systems Inc.