Monday, December 18, 2017  
You are here:  Products * DNN KickStart * DNN KickStart Case * Case source code Register  Login


DNN KickStart Case code
Below are the samples of the generated code by DNN KickStart.
The full generated code is available on this site as download, and can be used as a module in your site.

Note: Always create a backup of your site before starting development or implementation of new modules!

Due to restrictions of the webpage width, the lines are wrapped; this is not the case in the generated code.

You are able to collapse and expand the sections for easier reading.

On this page the following code samples are shown:

  • ActiveMembersController.vb
  • ActiveMembersInfo.vb
  • DataProvider.vb
  • SqlDataProvider.vb


Imports System

Imports System.Configuration

Imports System.Data

 

Namespace myComany.Modules.ActiveMembers

 

    Public Class ActiveMembersInfo

        ' local property declarations

        Private _ModuleID As Integer

        Private _MyModule as Int32

        Private _Name as String

        Private _Address as String

        Private _Street as String

        Private _Town as String

        Private _Active as Boolean

        Private _Entrance as DateTime

 

 

        ' initialization

        Public Sub New()

        End Sub

 

        ' public properties

        Public Property ModuleID() As Integer

            Get

                Return _ModuleID

            End Get

            Set(ByVal Value As Integer)

                _ModuleID = Value

            End Set

        End Property

 

 

Public Property MyModule() As Int32

 Get

   Return _MyModule

 End Get

 Set(ByVal Value As Int32)

   _MyModule = Value

 End Set

 End Property

 

 

 

Public Property Name() As String

 Get

   Return _Name

 End Get

 Set(ByVal Value As String)

   _Name = Value

 End Set

 End Property

 

 

 

Public Property Address() As String

 Get

   Return _Address

 End Get

 Set(ByVal Value As String)

   _Address = Value

 End Set

 End Property

 

 

 

Public Property Street() As String

 Get

   Return _Street

 End Get

 Set(ByVal Value As String)

   _Street = Value

 End Set

 End Property

 

 

 

Public Property Town() As String

 Get

   Return _Town

 End Get

 Set(ByVal Value As String)

   _Town = Value

 End Set

 End Property

 

 

 

Public Property Active() As Boolean

 Get

   Return _Active

 End Get

 Set(ByVal Value As Boolean)

   _Active = Value

 End Set

 End Property

 

 

 

Public Property Entrance() As DateTime

 Get

   Return _Entrance

 End Get

 Set(ByVal Value As DateTime)

   _Entrance = Value

 End Set

 End Property

 

 

 

 

 

    End Class

 

End Namespace

 

 

Imports System

Imports System.Configuration

Imports System.Data

Imports System.XML

Imports System.Web

Imports System.Collections.Generic

Imports DotNetNuke

Imports DotNetNuke.Services.Search

Imports DotNetNuke.Common.Utilities.XmlUtils

Imports DotNetNuke.Common.Utilities

 

 

Namespace myComany.Modules.ActiveMembers

 

    Public Class ActiveMembersController

 

 

#Region "Public Methods"

 

        Public Function GetActiveMemberss(ByVal ModuleID As Integer) As List(Of ActiveMembersInfo)

 

            Return CBO.FillCollection(Of ActiveMembersInfo)(DataProvider.Instance().GetActiveMemberss(ModuleID))

 

        End Function

 

        Public Function GetActiveMembers(ByVal ModuleID As Integer, ByVal ItemId As Integer) As ActiveMembersInfo

 

            Return CType(CBO.FillObject(DataProvider.Instance().GetActiveMembers(ModuleID,ItemId), GetType(ActiveMembersInfo)), ActiveMembersInfo)

 

        End Function

 

        Public Sub AddActiveMembers(ByVal objActiveMembers As ActiveMembersInfo)

 

 

       DataProvider.Instance().AddActiveMembers(objActiveMembers.ModuleID, objActiveMembers.Name , objActiveMembers.Address , objActiveMembers.Street , objActiveMembers.Town , objActiveMembers.Active , objActiveMembers.Entrance )

 

 

        End Sub

 

        Public Sub UpdateActiveMembers(ByVal objActiveMembers As ActiveMembersInfo)

 

                DataProvider.Instance().UpdateActiveMembers(objActiveMembers.ModuleID, objActiveMembers.MyModule , objActiveMembers.Name , objActiveMembers.Address , objActiveMembers.Street , objActiveMembers.Town , objActiveMembers.Active , objActiveMembers.Entrance )

 

 

        End Sub

 

        Public Sub DeleteActiveMembers(ByVal ModuleID As Integer, ByVal ItemId As Integer)

 

            DataProvider.Instance().DeleteActiveMembers(ModuleID,ItemId)

 

        End Sub

 

#End Region

 

#Region "Optional Interfaces"

 

 

 

 

 

 

#End Region

 

    End Class

End Namespace

 

Imports System

Imports DotNetNuke

Imports System.Data

 

Namespace myComany.Modules.ActiveMembers

 

Public MustInherit Class DataProvider

 

' Provider constants - eliminates need for Reflection later

   Private Const mDataProviderType As String = "data"

   Private Const mDataNameSpace As String = "myComany.Modules.ActiveMembers"

   Private Const mDataAssemblyName As String = ""

 

#Region "Shared/Static Methods"

 

'singleton reference to the instantiated object

Private Shared objProvider As DataProvider = Nothing

 

' constructor

Shared Sub New()

   CreateProvider()

End Sub

 

' dynamically create provider

Private Shared Sub CreateProvider()

   If objProvider Is Nothing Then

       objProvider = CType(Framework.Reflection.CreateObject("data", "myComany.Modules.ActiveMembers", ""), DataProvider)

   End If

End Sub

 

' return the provider

Public Shared Shadows Function Instance() As DataProvider

   Return objProvider

End Function

 

#End Region

 

#Region "Abstract methods"

 

Public MustOverride Function GetActiveMemberss(ByVal ModuleID As Integer) As IDataReader

Public MustOverride Function GetActiveMembers(ByVal ModuleID As Integer, ByVal MyModule as Integer) As IDataReader

Public MustOverride Sub AddActiveMembers(ByVal ModuleID As Integer, ByVal Name as String, ByVal Address as String, ByVal Street as String, ByVal Town as String, ByVal Active as Boolean, ByVal Entrance as DateTime)

Public MustOverride Sub UpdateActiveMembers(ByVal ModuleID As Integer, ByVal MyModule as Int32, ByVal Name as String, ByVal Address as String, ByVal Street as String, ByVal Town as String, ByVal Active as Boolean, ByVal Entrance as DateTime)

Public MustOverride Sub DeleteActiveMembers(ByVal ModuleID As Integer, ByVal MyModule as Integer)

 

#End Region

 

  End Class

 

End Namespace

 

Imports System

Imports System.Data

Imports System.Data.SqlClient

Imports Microsoft.ApplicationBlocks.Data

Imports DotNetNuke

 

Namespace myComany.Modules.ActiveMembers

 

    Public Class SqlDataProvider

 

        Inherits DataProvider

 

#Region "Private Members"

 

        Private Const ProviderType As String = "data"

        Private Const ModuleQualifier As String = "myComany_"

 

        Private _providerConfiguration As Framework.Providers.ProviderConfiguration = Framework.Providers.ProviderConfiguration.GetProviderConfiguration(ProviderType)

        Private _connectionString As String

        Private _providerPath As String

        Private _objectQualifier As String

        Private _databaseOwner As String

 

#End Region

 

#Region "Constructors"

 

        Public Sub New()

 

            ' Read the configuration specific information for this provider

            Dim objProvider As Framework.Providers.Provider = CType(_providerConfiguration.Providers(_providerConfiguration.DefaultProvider), Framework.Providers.Provider)

 

            ' Read the attributes for this provider

            If objProvider.Attributes("connectionStringName") <> "" AndAlso _

            System.Configuration.ConfigurationManager.AppSettings(objProvider.Attributes("connectionStringName")) <> "" Then

                _connectionString = System.Configuration.ConfigurationManager.AppSettings(objProvider.Attributes("connectionStringName"))

            Else

                _connectionString = objProvider.Attributes("connectionString")

            End If

 

            _providerPath = objProvider.Attributes("providerPath")

 

            _objectQualifier = objProvider.Attributes("objectQualifier")

            If _objectQualifier <> "" And _objectQualifier.EndsWith("_") = False Then

                _objectQualifier += "_"

            End If

 

            _databaseOwner = objProvider.Attributes("databaseOwner")

            If _databaseOwner <> "" And _databaseOwner.EndsWith(".") = False Then

                _databaseOwner += "."

            End If

 

        End Sub

 

#End Region

 

#Region "Properties"

 

        Public ReadOnly Property ConnectionString() As String

            Get

                Return _connectionString

            End Get

        End Property

 

        Public ReadOnly Property ProviderPath() As String

            Get

                Return _providerPath

            End Get

        End Property

 

        Public ReadOnly Property ObjectQualifier() As String

            Get

                Return _objectQualifier

            End Get

        End Property

 

        Public ReadOnly Property DatabaseOwner() As String

            Get

                Return _databaseOwner

            End Get

        End Property

 

#End Region

 

#Region "Private Methods"

 

        Private Function GetFullyQualifiedName(ByVal name As String) As String

            Return DatabaseOwner & ObjectQualifier & ModuleQualifier & name

        End Function

 

        Private Function GetNull(ByVal Field As Object) As Object

            Return DotNetNuke.Common.Utilities.Null.GetNull(Field, DBNull.Value)

        End Function

 

#End Region

 

#Region "Public Methods"

 

        Public Overrides Function GetActiveMemberss(ByVal ModuleID As Integer) As IDataReader

            Return CType(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetActiveMemberss"), ModuleID), IDataReader)

        End Function

 

        Public Overrides Function GetActiveMembers(ByVal ModuleID As Integer, ByVal MyModule as Integer) As IDataReader

            Return CType(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("GetActiveMembers"), ModuleID, MyModule), IDataReader)

        End Function

 

        Public Overrides Sub AddActiveMembers(ByVal ModuleID As Integer, ByVal Name as String, ByVal Address as String, ByVal Street as String, ByVal Town as String, ByVal Active as Boolean, ByVal Entrance as DateTime)

            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("AddActiveMembers"), ModuleID, Name , Address , Street , Town , Active , Entrance )

        End Sub

 

        Public Overrides Sub UpdateActiveMembers(ByVal ModuleID As Integer, ByVal MyModule as Int32, ByVal Name as String, ByVal Address as String, ByVal Street as String, ByVal Town as String, ByVal Active as Boolean, ByVal Entrance as DateTime)

            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("UpdateActiveMembers"), ModuleID, MyModule , Name , Address , Street , Town , Active , Entrance )

        End Sub

 

        Public Overrides Sub DeleteActiveMembers(ByVal ModuleID As Integer, ByVal MyModule as Integer)

            SqlHelper.ExecuteNonQuery(ConnectionString, GetFullyQualifiedName("DeleteActiveMembers"), ModuleID, MyModule)

        End Sub

 

#End Region

 

    End Class

 

End Namespace

 


 
Home  |  Company  |  Products  |  Contact  |  Downloads  |  Knowledge base
Copyright (c) 2017 FRENT IT   |  Privacy Statement  |  Terms Of Use