コード例 #1
0
        public void Uninitialize(
            CatalogKeyEventBroadcaster catalogKeyEventBroadcaster,
            ICatalogEvents catalogEvents,
            IContentEvents contentEvents)
        {
            catalogKeyEventBroadcaster.PriceUpdated -= OnPriceUpdated;

            catalogEvents.AssociationUpdating -= OnAssociationUpdated;

            contentEvents.CreatedContent   -= OnCreatedContent;
            contentEvents.DeletedContent   -= OnDeletedContent;
            contentEvents.DeletingContent  -= OnDeletingContent;
            contentEvents.MovedContent     -= OnMovedContent;
            contentEvents.PublishedContent -= OnPublishedContent;
        }
コード例 #2
0
        /// <summary>
        /// Initializes this instance.
        ///
        /// </summary>
        /// <param name="context">The context.</param>
        /// <remarks>
        /// Gets called as part of the EPiServer Framework initialization sequence. Note that it will be called
        ///             only once per AppDomain, unless the method throws an exception. If an exception is thrown, the initialization
        ///             method will be called repeadetly for each request reaching the site until the method succeeds.
        ///
        /// </remarks>
        public void Initialize(InitializationEngine context)
        {
            CatalogContentClientConventions instance = context.Locate.Advanced.GetInstance <B2BCatalogContentClientConventions>();

            try
            {
                instance.ApplyConventions(SearchClient.Instance.Conventions);
            }
            catch (Exception ex)
            {
                if (Log.IsErrorEnabled())
                {
                    Log.Error("Could not apply catalog content conventions.", ex);
                }
            }
            _broadcaster = context.Locate.Advanced.GetInstance <CatalogKeyEventBroadcaster>();
            _listener    = context.Locate.Advanced.GetInstance <CatalogContentEventListener>();
            _listener.AddEvent();
            _broadcaster.InventoryUpdated += _listener.InventoryUpdated;
            _broadcaster.PriceUpdated     += _listener.PriceUpdated;
        }
        public void Initialize(InitializationEngine context)
        {
            // routing fund.
            //CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes,, false);

            // routing adv.
            CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, () =>
            {
                // the scheduled job still have troubles
                var contentLoader = ServiceLocator.Current.GetInstance <IContentLoader>();

                // If epi-Find-error in exercise, it's the "catalog start"
                var startPage = new ContentReference(9);

                //var startPage = contentLoader.Get<PageData>(ContentReference.StartPage);
                if (startPage == null)                    // should maybe check for the "setting-prop"
                {
                    return(ContentReference.WasteBasket); //.StartPage;
                }

                //var homePage = startPage as StartPage;

                //return homePage != null ? homePage.Settings.catalogStartPageLink : ContentReference.StartPage;

                // if Find issues
                return(startPage);
            }
                                                           , false);

            #region Partial Routing Simplified... Conceptually
            //CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, () =>
            //{
            //    var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
            //    var startPage = contentLoader.Get<StartPage>(ContentReference.StartPage);
            //    return startPage.Settings.catalogStartPageLink;
            //}
            //, false);
            #endregion

            #region Events CMS & ECF

            // Nice for Entry Pricing and Inventory updates
            CatalogKeyEventBroadcaster e =
                ServiceLocator.Current.GetInstance <CatalogKeyEventBroadcaster>();

            e.PriceUpdated     += e_PriceUpdated;
            e.InventoryUpdated += e_InventoryUpdated;

            Event.Get(CatalogEventBroadcaster.CommerceProductUpdated).Raised += EB;


            // this is the old one for Orders
            //OrderContext.Current.OrderGroupUpdated += Current_OrderGroupUpdated;

            // Good stuff for Orders ...\Infrastructure\CartAndCheckout\NewOrderEvents.cs
            //IOrderRepositoryCallback orc =
            //    ServiceLocator.Current.GetInstance<IOrderRepositoryCallback>();

            IContentEvents e2 = ServiceLocator.Current.GetInstance <IContentEvents>(); // ...the way to go
            e2.RequestedApproval += E2_RequestedApproval;
            e2.PublishedContent  += E2_PublishedContent;

            #endregion

            // new in 10.1.0
            SetPromotionExclusions(context);
        }
        //OLD, not done will go away

        public MyPriceService(IChangeNotificationManager changeManager
                              , ISynchronizedObjectInstanceCache objectInstanceCache
                              , CatalogKeyEventBroadcaster broadcaster, EntryIdentityResolver entryIdentityResolver, IApplicationContext appContext)
            : base(changeManager, objectInstanceCache, broadcaster, appContext, entryIdentityResolver)
        {
        }
コード例 #5
0
 public MyPriceService(ICatalogSystem catalogSystem, IChangeNotificationManager changeManager, ISynchronizedObjectInstanceCache objectInstanceCache, CatalogKeyEventBroadcaster broadcaster, IApplicationContext applicationContext)
 {
     _marketService      = ServiceLocator.Current.GetInstance <IMarketService>();
     _referenceConverter = ServiceLocator.Current.GetInstance <ReferenceConverter>();
 }
コード例 #6
0
 public MyPriceService(ICatalogSystem catalogSystem, IChangeNotificationManager changeManager, ISynchronizedObjectInstanceCache objectInstanceCache, CatalogKeyEventBroadcaster broadcaster, IApplicationContext applicationContext)
 {
     _marketService = ServiceLocator.Current.GetInstance<IMarketService>();
     _referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
 }