示例#1
0
        public static NBrightInfo ProcessEventProvider(EventActions eventaction, NBrightInfo nbrightInfo, String eventinfo)
        {
            var rtnInfo = nbrightInfo;
            var pluginData = new PluginData(nbrightInfo.PortalId);
            var provList = pluginData.GetEventsProviders();

            foreach (var d in provList)
            {
                var prov = d.Value;
                ObjectHandle handle = null;
                var cachekey = prov.PortalId + "*" + prov.GetXmlProperty("genxml/textbox/assembly") + "*" + prov.GetXmlProperty("genxml/textbox/namespaceclass");
                handle = (ObjectHandle)Utils.GetCache(cachekey);
                if (handle == null) handle = Activator.CreateInstance(prov.GetXmlProperty("genxml/textbox/assembly"), prov.GetXmlProperty("genxml/textbox/namespaceclass"));
                if (handle != null)
                {
                    var eventprov = (EventInterface) handle.Unwrap();
                    if (eventprov != null)
                    {
                        if (eventaction == EventActions.ValidateCartBefore)
                        {
                            rtnInfo = eventprov.ValidateCartBefore(nbrightInfo);
                        }
                        else if (eventaction == EventActions.ValidateCartAfter)
                        {
                            rtnInfo = eventprov.ValidateCartAfter(nbrightInfo);
                        }
                        else if (eventaction == EventActions.ValidateCartItemBefore)
                        {
                            rtnInfo = eventprov.ValidateCartItemBefore(nbrightInfo);
                        }
                        else if (eventaction == EventActions.ValidateCartItemAfter)
                        {
                            rtnInfo = eventprov.ValidateCartItemAfter(nbrightInfo);
                        }
                        else if (eventaction == EventActions.AfterCartSave)
                        {
                            rtnInfo = eventprov.AfterCartSave(nbrightInfo);
                        }
                        else if (eventaction == EventActions.AfterCategorySave)
                        {
                            rtnInfo = eventprov.AfterCategorySave(nbrightInfo);
                        }
                        else if (eventaction == EventActions.AfterProductSave)
                        {
                            rtnInfo = eventprov.AfterProductSave(nbrightInfo);
                        }
                        else if (eventaction == EventActions.AfterSavePurchaseData)
                        {
                            rtnInfo = eventprov.AfterSavePurchaseData(nbrightInfo);
                        }
                        else if (eventaction == EventActions.BeforeOrderStatusChange)
                        {
                            rtnInfo = eventprov.BeforeOrderStatusChange(nbrightInfo);
                        }
                        else if (eventaction == EventActions.AfterOrderStatusChange)
                        {
                            rtnInfo = eventprov.AfterOrderStatusChange(nbrightInfo);
                        }
                        else if (eventaction == EventActions.BeforePaymentOK)
                        {
                            rtnInfo = eventprov.BeforePaymentOK(nbrightInfo);
                        }
                        else if (eventaction == EventActions.AfterPaymentOK)
                        {
                            rtnInfo = eventprov.AfterPaymentOK(nbrightInfo);
                        }
                        else if (eventaction == EventActions.BeforePaymentFail)
                        {
                            rtnInfo = eventprov.BeforePaymentFail(nbrightInfo);
                        }
                        else if (eventaction == EventActions.AfterPaymentFail)
                        {
                            rtnInfo = eventprov.AfterPaymentFail(nbrightInfo);
                        }
                        else if (eventaction == EventActions.BeforeSendEmail)
                        {
                            rtnInfo = eventprov.BeforeSendEmail(nbrightInfo,eventinfo);
                        }
                        else if (eventaction == EventActions.AfterSendEmail)
                        {
                            rtnInfo = eventprov.AfterSendEmail(nbrightInfo,eventinfo);
                        }

                    }
                }
            }
            return rtnInfo;
        }