Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...Creating Visitor Traker in DNNCreating Visitor Traker in DNN
Previous
 
Next
New Post
7/15/2011 12:02 AM
 
Hi
I am  working on creating a module to Track the Visitor to My Site I just Start with the database  for this module and I want to see if I'm on the right trake or not
f not exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}Elnajjar_VisitorsTrackingSystem]') and OBJECTPROPERTY(id, N'IsTable') = 1)
    BEGIN
        CREATE TABLE {databaseOwner}[{objectQualifier}Elnajjar_VisitorsTrackingSystem]
        (
            [ModuleID] [int] NOT NULL,
            [ItemID] [int] NOT NULL IDENTITY(1, 1),
            [Content] [ntext] NOT NULL,
            [CreatedByUser] [int] NOT NULL,
            [CreatedDate] [datetime] NOT NULL,
            [SessionId] [ntext] NOT NULL,
            [UrlPath] [ntext] NOT NULL,
            [PageView] [int] NOT NULL
        )
 
        ALTER TABLE {databaseOwner}[{objectQualifier}Elnajjar_VisitorsTrackingSystem] ADD CONSTRAINT [PK_{objectQualifier}Elnajjar_VisitorsTrackingSystem] PRIMARY KEY CLUSTERED  ([ItemID])
        CREATE NONCLUSTERED INDEX [IX_{objectQualifier}Elnajjar_VisitorsTrackingSystem] ON {databaseOwner}[{objectQualifier}Elnajjar_VisitorsTrackingSystem] ([ModuleID])
 
        ALTER TABLE {databaseOwner}[{objectQualifier}Elnajjar_VisitorsTrackingSystem] WITH NOCHECK ADD CONSTRAINT [FK_{objectQualifier}Elnajjar_VisitorsTrackingSystem_{objectQualifier}Modules] FOREIGN KEY ([ModuleID]) REFERENCES {databaseOwner}[{objectQualifier}Modules] ([ModuleID]) ON DELETE CASCADE NOT FOR REPLICATION
    END
GO
 
 
/** Drop Existing Stored Procedures **/
 
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}Elnajjar_GetVisitorsTrackingSystems]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}Elnajjar_GetVisitorsTrackingSystems
GO
 
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}Elnajjar_GetVisitorsTrackingSystem]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}Elnajjar_GetVisitorsTrackingSystem
GO
 
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}Elnajjar_AddVisitorsTrackingSystem]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}Elnajjar_AddVisitorsTrackingSystem
GO
 
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}Elnajjar_UpdateVisitorsTrackingSystem]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}Elnajjar_UpdateVisitorsTrackingSystem
GO
 
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}Elnajjar_DeleteVisitorsTrackingSystem]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
    drop procedure {databaseOwner}{objectQualifier}Elnajjar_DeleteVisitorsTrackingSystem
GO
 
/** Create Stored Procedures **/
 
 
create procedure {databaseOwner}{objectQualifier}Elnajjar_GetVisitorsTrackingSystems
 
    @ModuleId int
 
as
 
select ModuleId,
       ItemId,
       Content,
       CreatedByUser,
       SessionId,
       UrlPath,
       PageView,
       {objectQualifier}Elnajjar_VisitorsTrackingSystem.CreatedDate,
       'CreatedByUserName' = {objectQualifier}Users.FirstName + ' ' + {objectQualifier}Users.LastName
from {objectQualifier}Elnajjar_VisitorsTrackingSystem
inner join {objectQualifier}Users on {objectQualifier}Elnajjar_VisitorsTrackingSystem.CreatedByUser = {objectQualifier}Users.UserId
where  ModuleId = @ModuleId
GO
 
create procedure {databaseOwner}{objectQualifier}Elnajjar_GetVisitorsTrackingSystem
 
    @ModuleId int,
        @ItemId int
 
as
 
select ModuleId,
       ItemId,
       Content,
       CreatedByUser,
       SessionId,
       UrlPath,
       PageView,
       {objectQualifier}Elnajjar_VisitorsTrackingSystem.CreatedDate,
       'CreatedByUserName' = {objectQualifier}Users.FirstName + ' ' + {objectQualifier}Users.LastName
from {objectQualifier}Elnajjar_VisitorsTrackingSystem
inner join {objectQualifier}Users on {objectQualifier}Elnajjar_VisitorsTrackingSystem.CreatedByUser = {objectQualifier}Users.UserId
where  ModuleId = @ModuleId
and ItemId = @ItemId
GO
 
 
create procedure {databaseOwner}{objectQualifier}Elnajjar_AddVisitorsTrackingSystem
 
    @ModuleId       int,
    @Content        ntext,
    @UserID         int,
    @SessionId      ntext,
    @UrlPath       ntext,
    @PageView       ntext
 
as
 
insert into {objectQualifier}Elnajjar_VisitorsTrackingSystem (
    ModuleId,
    Content,
    CreatedByUser,
    CreatedDate,
    SessionId,
    UrlPath,
    PageView
     
)
values (
    @ModuleId,
    @Content,
    @UserID,
    @SessionId,
    @UrlPath,
    @PageView,
    getdate()
)
 
GO
 
create procedure {databaseOwner}{objectQualifier}Elnajjar_UpdateVisitorsTrackingSystem
 
    @ModuleId       int,
    @ItemId         int,
    @Content        ntext,
    @UserID         int,
    @SessionId      ntext,
    @UrlPath       ntext,
    @PageView       ntext
 
as
 
update {objectQualifier}Elnajjar_VisitorsTrackingSystem
set    Content       = @Content,
       CreatedByUser = @UserID,
       CreatedDate   = getdate()
       SessionId    =  @SessionId,
        UrlPath    =   @UrlPath,
        PageView   = @PageView
where  ModuleId = @ModuleId
and    ItemId = @ItemId
 
GO
 
create procedure {databaseOwner}{objectQualifier}Elnajjar_DeleteVisitorsTrackingSystem
 
    @ModuleId       int,
        @ItemId         int
 
as
 
delete
from   {objectQualifier}Elnajjar_VisitorsTrackingSystem
where  ModuleId = @ModuleId
and    ItemId = @ItemId
 
GO
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...Creating Visitor Traker in DNNCreating Visitor Traker in DNN


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out