File: D:/HostingSpaces/TDijk1/erp-apps.eu/wwwroot/App_Code/ERPApps/ERPSystemCustomizationModule.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CMS.SettingsProvider;
using CMS.Base;
using CMS.Membership;
using CMS.DataEngine;
/// <summary>
/// Extends UserInfo with attributes of custom VendorInfo
/// </summary>
[ERPSystemCustomizationModuleLoader]
public partial class CMSModuleLoader
{
private class ERPSystemCustomizationModuleLoaderAttribute : CMSLoaderAttribute
{
/// <summary>
/// Initializes the module
/// </summary>
public override void Init()
{
UserInfo.TYPEINFO.OnLoadRelatedData += new ObjectTypeInfo.ObjectLoadRelatedDataEventHandler(TYPEINFO_OnLoadRelatedData);
ClassHelper.OnGetCustomClass += GetCustomClass;
}
object TYPEINFO_OnLoadRelatedData(BaseInfo infoObj)
{
if ( infoObj is UserInfo )
{
// extend UserInfo with custom attributes in VendorInfo
return new VendorInfo(infoObj as UserInfo);
}
return null;
}
private static void GetCustomClass(object sender, ClassEventArgs e)
{
if (e.Object == null)
{
switch (e.ClassName.ToLower())
{
case "erp.buckaroopaymentgateway.buckaroopaymentgatewayprovider":
e.Object = new ERP.BuckarooPaymentGateway.BuckarooPaymentGatewayProvider();
break;
}
}
}
}
}