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);
}
}