Hello All,
I have created a class Extension to override a methd and then I want to call that class extension in a graph extension that I am overriding an action of the graph.
Here is my Graph Ext:
using System.Collections;
using PX.Data;
using PX.Objects.EP;
namespace MyProject
{
public class MyTimeCardMaintExt : PXGraphExtension<TimeCardMaint>
{
public static bool IsActive() => true;
public MyEmployeeCostEngineExt MyEmployeeCostEngine;
public delegate IEnumerable ReleaseDelegate(PXAdapter adapter);
[PXOverride]
[PXButton]
public virtual IEnumerable Release(PXAdapter adapter, ReleaseDelegate baseMethod)
{
// Do some stuff
return baseMethod?.Invoke(adapter);
}
}
}
and here is my Class Ext:
using System;
using PX.Data;
using PX.Objects.EP;
namespace MyProject
{
public class MyEmployeeCostEngineExt : EmployeeCostEngine
{
public MyEmployeeCostEngineExt(PXGraph graph) : base(graph) { }
public static bool IsActive() => true;
public decimal? OvertimeMultiplier { get; set; }
//**************************************** Methods Override ****************************************//
public delegate decimal GetOvertimeMultiplierDelegate(string earningTypeID, Rate employeeRate);
[PXOverride]
public virtual decimal GetOvertimeMultiplier(string earningTypeID, Rate employeeRate, GetOvertimeMultiplierDelegate baseMethod)
{
// Do some stuff
return baseMethod?.Invoke(earningTypeID, employeeRate);
}
}
}My problem is that the class extension “MyEmployeeCostEngineExt” is not called. If I want to for the class initialization as follow in my Graph Ext, the Base is null.
public MyTimeCardMaintExt()
{
MyEmployeeCostEngine = new MyEmployeeCostEngineExt(Base);
}Any idea why the class Extension is not called and what I can do about it?