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

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesExportModule by PortalID (Need PortalID from ModuleID)ExportModule by PortalID (Need PortalID from ModuleID)
Previous
 
Next
New Post
5/14/2010 5:21 PM
 
Hi,

  I am writing a set of modules that will have data stored by PortalID and not ModuleID for all its tables.  While this should not be an issue, apprently an oversite occurrs in the ExportModule in IPortable.  The ExportModule receives only one parameter (ModuleID), and I need PortalID.  this.PortalID is not avaiable within this function, so I am asking for the C# code to get it?  Anyone know how?

public string ExportModule(int ModuleID)

{

string strXML = "";

List<EntityTypeInfo> colEntityTypes = GetEntityTypes(/* here is where I need PortalID */);

 
New Post
5/15/2010 12:52 PM
 
If the export is being called within the context of the current portal, you should be able to obtain PortalID as follows:

int PortalID = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings.PortalId;

If there is no portal context, you can use the following:

DotNetNuke.Entities.Modules.ModuleController mc = new DotNetNuke.Entities.Modules.ModuleController();
DotNetNuke.Entities.Modules.ModuleInfo mi = mc.GetModule(ModuleID);
int PortalID = -1;
if (mi != null) {
      PortalID = mi.PortalID;
}

Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
5/16/2010 12:14 PM
 
Bill,
  It looks like option one does not work in import/export in the controller class, and it looks like option two might work, but now I am hung up on something else.  My module is working perfectly for view and edit using C# MVP (Module/View/Presenter) method into and out of the controller class; however, when I click Export, and enter the Root & filename values it dies on:

AssemblyVersion: 5.4.1
PortalID: 0
PortalName: My Website
UserID: 1
UserName: qhhost
ActiveTabID: 40
ActiveTabName: Home
RawURL: /dotnetnuke/Home/tabid/40/ctl/ExportModule/moduleid/387/Default.aspx
AbsoluteURL: /DotNetNuke/Default.aspx
AbsoluteURLReferrer: http://localhost/dotnetnuke/Home/tabid/40/ctl/ExportModule/moduleid/387/Default.aspx
UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; iOpus-I-M; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
DefaultDataProvider: DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider
ExceptionGUID: bd25fc9a-d470-48a3-bccd-bb2dc56eff2e
InnerException: Could not load type 'QHWeb.Modules.EntityType.EntityTypeController'.
FileName:
FileLineNumber: 0
FileColumnNumber: 0
Method: System.Web.Compilation.BuildManager.GetType
StackTrace:
Message: System.Web.HttpException: Could not load type 'QHWeb.Modules.EntityType.EntityTypeController'. at System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) at DotNetNuke.Framework.Reflection.CreateType(String TypeName, String CacheKey, Boolean UseCache, Boolean IgnoreErrors)
Source:
Server Name: Z60M


Again, the controller class works for eveything else, so I am baffelled.  Iportable is [checked] in the module definition. Code is included below.  Any ideas?

using System.Xml;

using System.Collections.Generic;

using System;

using DotNetNuke.Data;

using DotNetNuke.Framework;

using DotNetNuke.Common;

using DotNetNuke.Common.Utilities;

using DotNetNuke.ComponentModel;

using DotNetNuke.Entities.Modules;

using DotNetNuke.Entities.Users;

namespace QHWeb.Modules.EntityType.Controllers

{

public class EntityTypeController : IPortable, IEntityTypeController
.
.
.

public string ExportModule(int ModuleID)

{

 

DotNetNuke.Entities.Modules.ModuleController mc = new DotNetNuke.Entities.Modules.ModuleController();

DotNetNuke.Entities.Modules.ModuleInfo mi = mc.GetModule(ModuleID);

int PortalID = -1;

if (mi != null) {

PortalID = mi.PortalID;

}

//int PortalID = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings.PortalId;

string strXML = "";

List<EntityTypeInfo> colEntityTypes = GetEntityTypes(PortalID);

if (colEntityTypes.Count != 0)

{

strXML += "<EntityTypes>";

foreach (EntityTypeInfo EntityTypeInfo in colEntityTypes)

{

.
.
.
strXML += "</EntityType>";

}

strXML += "</EntityTypes>";

}

return strXML;

}

public void ImportModule(int ModuleID, string content, string version, int userId)

{

DotNetNuke.Entities.Modules.ModuleController mc = new DotNetNuke.Entities.Modules.ModuleController();

DotNetNuke.Entities.Modules.ModuleInfo mi = mc.GetModule(ModuleID);

int PortalID = -1;

if (mi != null)

{

PortalID = mi.PortalID;

}

XmlNode xmlEntityTypes = Globals.GetContent(content, "EntityTypes");

foreach (XmlNode xmlEntityType in xmlEntityTypes.SelectNodes("EntityType"))

{

EntityTypeInfo EntityTypeInfo = new EntityTypeInfo();

EntityTypeInfo.PortalID = PortalID;

.
.
.
AddEntityType(EntityTypeInfo);

}

}

 
New Post
5/30/2010 3:30 PM
 
Registered as 'QHWeb.Modules.EntityType.EntityTypeController', but should be registered as 'QHWeb.Modules.EntityType.Controllers.EntityTypeController'
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesExportModule by PortalID (Need PortalID from ModuleID)ExportModule by PortalID (Need PortalID from ModuleID)


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