Open Nop solution. Add a new DLL project. Right click on that project in solution explorer and add a reference to the business logic DLL project.
Right click on the NopCommerceStore project in solution explorer and add a reference to the new DLL project.
Open up EventContext.cs in the business logic DLL and see which event you want to use.
In the new DLL add a static class with a static function to handle the event. Example:
public static class FleetObserverLiteNopCommercePlugin
{
/// <summary>
/// OrderPlaced event handler
/// </summary>
/// <remarks>Needs to be threadsafe</remarks>
public static void OrderPaidHandler(object sender, OrderEventArgs e)
{
.... do stuff
}
Attach the event in global.asax:
void Application_BeginRequest(object sender, EventArgs e)
{
NopConfig.Init();
if (!InstallerHelper.ConnectionStringIsSet())
{
InstallerHelper.RedirectToInstallationPage();
}
EventContext.Current.OrderPaid += FleetObserverLiteNopCommercePlugin.OrderPaidHandler;
}
Test.