[CustomEcommerceEvents]
public partial class CMSModuleLoader : CMSModuleLoaderBase
{
///
public CMSModuleLoader()
: base("CMSModuleLoader")
{
}
///
///
private class CustomEcommerceEventsAttribute : CMSLoaderAttribute
{
///
public override void Init()
{
// Assigns custom handlers to events
EcommerceEvents.NewOrderCreated.Execute += NewOrderCreated;
EcommerceEvents.OrderPaid.Execute += OrderPaid;
}
private void NewOrderCreated(object sender, NewOrderCreatedEventArgs e)
{
// Add custom actions here
EventLogProvider.LogEvent(EventType.INFORMATION, "Proddoc", "varintcolor", eventDescription: "SMS");
if (ValidationHelper.GetString(MembershipContext.AuthenticatedUser.GetValue("UserPhone"), "") != "")
{
string[] number = null;
number[1] = "+98" + MembershipContext.AuthenticatedUser.GetValue("UserPhone").ToString();
EventLogProvider.LogEvent(EventType.INFORMATION, "Proddoc", "varintcolor", eventDescription: number[1]);
Myclass.sendSms(number, string.Format("کاربر گرامی {0} {1}، پرداخت شما با موفقیت انجام شد.", MembershipContext.AuthenticatedUser.FirstName, MembershipContext.AuthenticatedUser.LastName), "+985000171");
EventLogProvider.LogEvent(EventType.INFORMATION, "Proddoc", "varintcolor", eventDescription: "sms2");
}
}
private void OrderPaid(object sender, OrderPaidEventArgs e)
{
EventLogProvider.LogEvent(EventType.INFORMATION, "Proddoc", "varintcolor", eventDescription: "SMS");
if (ValidationHelper.GetString(MembershipContext.AuthenticatedUser.GetValue("UserPhone"), "") != "")
{
string[] number = null;
number[1] = "+98" + MembershipContext.AuthenticatedUser.GetValue("UserPhone").ToString();
EventLogProvider.LogEvent(EventType.INFORMATION, "Proddoc", "varintcolor", eventDescription: number[1]);
Myclass.sendSms(number, string.Format("کاربر گرامی {0} {1}، پرداخت شما با موفقیت انجام شد.", MembershipContext.AuthenticatedUser.FirstName, MembershipContext.AuthenticatedUser.LastName), "+985000171");
EventLogProvider.LogEvent(EventType.INFORMATION, "Proddoc", "varintcolor", eventDescription: "sms2");
}
}
}
i have error:
Message: Object reference not set to an instance of an object.
Exception type: System.NullReferenceException
Stack Trace:
at CMSModuleLoader.CustomEcommerceEventsAttribute.OrderPaid(Object sender, OrderPaidEventArgs e)
at CMS.Base.AbstractHandler.CallEventHandler[TArgs](EventHandler1 h, TArgs e)
at CMS.Base.AbstractHandler.Raise[TArgs](String partName, List
1 list, TArgs e, Boolean important)
at CMS.Base.SimpleHandler2.RaiseExecute(TArgs e)
at CMS.Base.SimpleHandler
2.RaiseExecute(TArgs e)
at CMS.Base.SimpleHandler`2.StartEvent(TArgs e)
at CMS.Ecommerce.OrderInfoProvider.SetOrderInfoInternal(OrderInfo orderObj)
at CMS.FormControls.UIForm.SaveDataInternal()
Message: Object reference not set to an instance of an object.
plese help me