public ProductService(IContentLoader contentLoader,
                       IPromotionService promotionService,
                       IPricingService pricingService,
                       UrlResolver urlResolver,
                       LinksRepository linksRepository,
                       IRelationRepository relationRepository,
                       ICurrentMarket currentMarketService,
                       ICurrencyService currencyService,
                       AppContextFacade appContext,
                       ReferenceConverter referenceConverter,
                       LanguageService languageService,
                       FilterPublished filterPublished)
 {
     _contentLoader        = contentLoader;
     _promotionService     = promotionService;
     _pricingService       = pricingService;
     _urlResolver          = urlResolver;
     _linksRepository      = linksRepository;
     _relationRepository   = relationRepository;
     _preferredCulture     = ContentLanguage.PreferredCulture;
     _currentMarketService = currentMarketService;
     _currencyService      = currencyService;
     _appContext           = appContext;
     _referenceConverter   = referenceConverter;
     _languageService      = languageService;
     _filterPublished      = filterPublished;
 }
Esempio n. 2
0
 public ImporterBase(IContentRepository contentRepository, ReferenceConverter referenceConverter, IContentTypeRepository typeRepository, ILogger logger)
 {
     _contentRepository  = contentRepository;
     _referenceConverter = referenceConverter;
     _typeRepository     = typeRepository;
     _log = logger;
 }
 public AdminPageController(
     ReferenceConverter referenceConverter,
     IContentLoader contentLoader,
     AssetUrlResolver assetUrlReslver)
 {
     _referenceConverter = referenceConverter;
 }
        public InMemoryPriceDetailService(ReferenceConverter referenceConverter)
        {
            this._referenceConverter = referenceConverter;

            _contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
            _relationRepository = ServiceLocator.Current.GetInstance<IRelationRepository>();
        }
Esempio n. 5
0
 public CartService(
     IProductService productService,
     IPricingService pricingService,
     IOrderGroupFactory orderGroupFactory,
     CustomerContextFacade customerContext,
     IInventoryProcessor inventoryProcessor,
     IOrderRepository orderRepository,
     IPromotionEngine promotionEngine,
     IAddressBookService addressBookService,
     ICurrentMarket currentMarket,
     ICurrencyService currencyService,
     ReferenceConverter referenceConverter,
     IContentLoader contentLoader,
     IRelationRepository relationRepository,
     OrderValidationService orderValidationService)
 {
     _productService         = productService;
     _pricingService         = pricingService;
     _orderGroupFactory      = orderGroupFactory;
     _customerContext        = customerContext;
     _inventoryProcessor     = inventoryProcessor;
     _promotionEngine        = promotionEngine;
     _orderRepository        = orderRepository;
     _addressBookService     = addressBookService;
     _currentMarket          = currentMarket;
     _currencyService        = currencyService;
     _referenceConverter     = referenceConverter;
     _contentLoader          = contentLoader;
     _relationRepository     = relationRepository;
     _orderValidationService = orderValidationService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CatalogContentEventListener"/> class.
 /// </summary>
 /// <param name="referenceConverter">The reference converter.</param>
 /// <param name="recommendationRepository">The recommendation repository.</param>
 public CatalogContentEventListener(
     ReferenceConverter referenceConverter,
     IRecommendationRepository recommendationRepository)
 {
     this.referenceConverter       = referenceConverter;
     this.recommendationRepository = recommendationRepository;
 }
 public DefaultOmniumOrderFactory(
     IShippingCalculator shippingCalculator,
     IMarketService marketService,
     CultureResolver cultureResolver,
     ITaxUtility taxUtility,
     ReferenceConverter referenceConverter,
     IContentRepository contentRepository,
     IPaymentManagerFacade paymentManagerFacade,
     ILineItemCalculator lineItemCalculator,
     IOrderFormCalculator orderFormCalculator,
     IOrderGroupCalculator orderGroupCalculator,
     IShipmentManagerFacade shipmentManagerFacade,
     IPromotionEngine promotionEngine)
 {
     _shippingCalculator    = shippingCalculator;
     _marketService         = marketService;
     _cultureResolver       = cultureResolver;
     _taxUtility            = taxUtility;
     _referenceConverter    = referenceConverter;
     _contentRepository     = contentRepository;
     _paymentManagerFacade  = paymentManagerFacade;
     _lineItemCalculator    = lineItemCalculator;
     _orderFormCalculator   = orderFormCalculator;
     _orderGroupCalculator  = orderGroupCalculator;
     _shipmentManagerFacade = shipmentManagerFacade;
     _promotionEngine       = promotionEngine;
 }
Esempio n. 8
0
        public async Task <IApiResponseContextDto <TResponseDto> > Post <TRequestDto, TResponseDto>(TRequestDto dto)
            where TRequestDto : IApiRequestDto
        {
            _referenceConverter = new ReferenceConverter(typeof(IApiResponseContextDto <TResponseDto>));

            if (_configuration["ApiBaseUrl"] == null)
            {
                throw new Exception("FATAL: ApiBaseUrl CAN NOT BE NULL");
            }

            var httpClient = new HttpClient();

            httpClient.BaseAddress = new Uri(_configuration["ApiBaseUrl"]);

            var request = new ApiControllerRequestDto()
            {
                Request             = dto,
                ResponseType        = typeof(TResponseDto).FullName,
                AuthenticationToken = _applicationContextHandler.FetchContext()?.Token?.Value
            };

            var jsonToSend = JsonConvert.SerializeObject(request, Json.Serialization.Auto());

            var content  = new StringContent(jsonToSend, Encoding.UTF8, "application/json");
            var uri      = _configuration["ApiBaseUrl"] + "EndPoint/Request";
            var response = await httpClient.PostAsync(uri, content);

            var result = JsonConvert.DeserializeObject <ApiResponseContextDto <TResponseDto> >
                             (response.Content.ReadAsStringAsync().Result);

            return(result);
        }
        public void GetStandardValues_IReferenceServiceNullType_ReturnsExpected()
        {
            var converter = new ReferenceConverter(null);

            var component1 = new TestComponent();
            var component2 = new TestComponent();
            var component3 = new Component();

            var referenceService = new MockReferenceService();

            referenceService.AddReference("reference name 1", component1);
            referenceService.AddReference("reference name 2", component2);
            referenceService.AddReference("reference name 3", component3);

            int callCount = 0;
            var context   = new MockTypeDescriptorContext
            {
                GetServiceAction = (serviceType) =>
                {
                    callCount++;
                    Assert.Equal(typeof(IReferenceService), serviceType);
                    return(referenceService);
                }
            };

            TypeConverter.StandardValuesCollection values1 = converter.GetStandardValues(context);
            Assert.Equal(1, callCount);
            Assert.Equal(new object[] { null }, values1.Cast <object>());

            // Call again to test caching behavior.
            TypeConverter.StandardValuesCollection values2 = converter.GetStandardValues(context);
            Assert.Equal(2, callCount);
            Assert.NotSame(values1, values2);
        }
 public CommerceTrackingService(
     ServiceAccessor <IContentRouteHelper> contentRouteHelperAccessor,
     IContextModeResolver contextModeResolver,
     IProductService productService,
     TrackingDataFactory trackingDataFactory,
     ITrackingService trackingService,
     IContentLoader contentLoader,
     LanguageService languageService,
     HttpContextBase httpContextBase,
     LanguageResolver languageResolver,
     ILineItemCalculator lineItemCalculator,
     IRequestTrackingDataService requestTrackingDataService,
     ReferenceConverter referenceConverter,
     IRelationRepository relationRepository,
     ICurrentMarket currentMarket)
 {
     _contentRouteHelperAccessor = contentRouteHelperAccessor;
     _contextModeResolver        = contextModeResolver;
     _productService             = productService;
     _trackingDataFactory        = trackingDataFactory;
     _trackingService            = trackingService;
     _contentLoader              = contentLoader;
     _languageService            = languageService;
     _httpContextBase            = httpContextBase;
     _languageResolver           = languageResolver;
     _lineItemCalculator         = lineItemCalculator;
     _requestTrackingDataService = requestTrackingDataService;
     _referenceConverter         = referenceConverter;
     _relationRepository         = relationRepository;
     _currentMarket              = currentMarket;
 }
 public SannsynRecommendedProductsService(ITrackedRecommendationService trackedRecommendationService, IRecommendationService recommendationService, ReferenceConverter referenceConverter, IContentRepository contentRepository)
 {
     _trackedRecommendationService = trackedRecommendationService;
     _recommendationService        = recommendationService;
     _referenceConverter           = referenceConverter;
     _contentRepository            = contentRepository;
 }
        public void ConvertFrom()
        {
            ReferenceConverter converter     = new ReferenceConverter(typeof(ITestInterface));
            string             referenceName = "reference name";

            // no context
            Assert.IsNull(converter.ConvertFrom(null, null, referenceName), "#1");

            TestComponent component = new TestComponent();

            // context with IReferenceService
            TestReferenceService referenceService = new TestReferenceService();

            referenceService.AddReference(referenceName, component);
            TestTypeDescriptorContext context = new TestTypeDescriptorContext(referenceService);

            Assert.AreSame(component, converter.ConvertFrom(context, null, referenceName), "#2");

            // context with Component without IReferenceService
            Container container = new Container();

            container.Add(component, referenceName);
            context           = new TestTypeDescriptorContext();
            context.Container = container;
            Assert.AreSame(component, converter.ConvertFrom(context, null, referenceName), "#3");
        }
Esempio n. 13
0
        protected void PrimeCacheImpl()
        {
            ICatalogSystem       catalog            = ServiceLocator.Current.GetInstance <ICatalogSystem>();
            IContentRepository   repository         = ServiceLocator.Current.GetInstance <IContentRepository>();
            ReferenceConverter   referenceConverter = ServiceLocator.Current.GetInstance <ReferenceConverter>();
            CatalogContentLoader contentLoader      = ServiceLocator.Current.GetInstance <CatalogContentLoader>();

            // Get all catalogs
            CatalogDto catalogDto = catalog.GetCatalogDto();

            _log.Debug("Found {0} catalogs. Start iterating.", catalogDto.Catalog.Count);
            foreach (CatalogDto.CatalogRow catalogRow in catalogDto.Catalog)
            {
                _log.Debug("Loading all categories for catalog {0} ({1})", catalogRow.Name, catalogRow.CatalogId);
                // Get all Categories on first level
                CatalogNodes nodes = catalog.GetCatalogNodes(catalogRow.CatalogId,
                                                             new CatalogNodeResponseGroup(CatalogNodeResponseGroup.ResponseGroup.CatalogNodeInfo));
                _log.Debug("Loaded {0} categories using ICatalogSystem", nodes.CatalogNode.Count());
                // Get them as content too
                foreach (CatalogNode node in nodes.CatalogNode)
                {
                    ContentReference nodeReference = referenceConverter.GetContentLink(node.CatalogNodeId, CatalogContentType.CatalogNode, 0);
                    NodeContent      content       = repository.Get <EPiServer.Commerce.Catalog.ContentTypes.NodeContent>(nodeReference);
                    _log.Debug("Loded Category Content: {0}", content.Name);
                    WalkCategoryTree(content, repository, contentLoader, catalog, referenceConverter);
                }
            }
        }
        protected void GetEntry_Click(object sender, EventArgs e)
        {
            try
            {
                this.ResetPanels();

                _repo = ServiceLocator.Current.GetInstance <IContentRepository>();
                _referenceConverter = ServiceLocator.Current.GetInstance <ReferenceConverter>();

                var content = _repo.Get <CatalogContentBase>(_referenceConverter.GetContentLink(Code.Value));

                ErrorMessage.Text = (content is PackageContent).ToString();

                string code  = Code.Value;
                var    entry = CatalogContext.Current.GetCatalogEntry(
                    code, new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.Children));

                if (entry == null)
                {
                    throw new Exception(string.Format("No style or variant found with code {0}", code));
                }

                DisplayVariant(entry);
            }
            catch (Exception ex)
            {
                ErrorMessage.Text  = ex.Message;
                ErrorPanel.Visible = true;
            }
        }
        public void ConvertTo()
        {
            ReferenceConverter converter     = new ReferenceConverter(typeof(ITestInterface));
            string             referenceName = "reference name";

            Assert.AreEqual("(none)", (string)converter.ConvertTo(null, null, null, typeof(string)), "#1");

            TestComponent component = new TestComponent();

            // no context
            Assert.AreEqual(String.Empty, (string)converter.ConvertTo(null, null, component, typeof(string)), "#2");

            // context with IReferenceService
            TestReferenceService referenceService = new TestReferenceService();

            referenceService.AddReference(referenceName, component);
            TestTypeDescriptorContext context = new TestTypeDescriptorContext(referenceService);

            Assert.AreEqual(referenceName, (string)converter.ConvertTo(context, null, component, typeof(string)), "#3");

            // context with Component without IReferenceService
            Container container = new Container();

            container.Add(component, referenceName);
            context           = new TestTypeDescriptorContext();
            context.Container = container;
            Assert.AreEqual(referenceName, (string)converter.ConvertTo(context, null, component, typeof(string)), "#4");
        }
        public DefaultCartController(
            ICartService cartService,
            IOrderRepository orderRepository,
            ICommerceTrackingService recommendationService,
            CartViewModelFactory cartViewModelFactory,
            IContentLoader contentLoader,
            IContentRouteHelper contentRouteHelper,
            ReferenceConverter referenceConverter,
            IQuickOrderService quickOrderService,
            ICustomerService customerService,
            ShipmentViewModelFactory shipmentViewModelFactory,
            CheckoutService checkoutService,
            IOrderGroupCalculator orderGroupCalculator,
            CartItemViewModelFactory cartItemViewModelFactory,
            IProductService productService,
            LanguageResolver languageResolver)

        {
            _cartService              = cartService;
            _orderRepository          = orderRepository;
            _recommendationService    = recommendationService;
            _cartViewModelFactory     = cartViewModelFactory;
            _contentLoader            = contentLoader;
            _contentRouteHelper       = contentRouteHelper;
            _referenceConverter       = referenceConverter;
            _quickOrderService        = quickOrderService;
            _customerService          = customerService;
            _shipmentViewModelFactory = shipmentViewModelFactory;
            _checkoutService          = checkoutService;
            _orderGroupCalculator     = orderGroupCalculator;
            _cartItemViewModelFactory = cartItemViewModelFactory;
            _productService           = productService;
            _languageResolver         = languageResolver;
        }
Esempio n. 17
0
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            ArrayList arrayList = new ArrayList();
            StandardValuesCollection standardValues           = base.GetStandardValues(context);
            StandardValuesCollection standardValuesCollection = null;

            this.FillList(arrayList, standardValues);
            ReferenceConverter referenceConverter = null;

            referenceConverter       = new ReferenceConverter(typeof(IListSource));
            standardValuesCollection = referenceConverter.GetStandardValues(context);
            this.FillList(arrayList, standardValuesCollection);
            referenceConverter       = new ReferenceConverter(typeof(DataView));
            standardValuesCollection = referenceConverter.GetStandardValues(context);
            this.FillList(arrayList, standardValuesCollection);
            referenceConverter       = new ReferenceConverter(typeof(IDbDataAdapter));
            standardValuesCollection = referenceConverter.GetStandardValues(context);
            this.FillList(arrayList, standardValuesCollection);
            referenceConverter       = new ReferenceConverter(typeof(IDataReader));
            standardValuesCollection = referenceConverter.GetStandardValues(context);
            this.FillList(arrayList, standardValuesCollection);
            referenceConverter       = new ReferenceConverter(typeof(IDbCommand));
            standardValuesCollection = referenceConverter.GetStandardValues(context);
            this.FillList(arrayList, standardValuesCollection);
            arrayList.Add(null);
            return(new StandardValuesCollection(arrayList));
        }
        public InMemoryPriceDetailService(ReferenceConverter referenceConverter)
        {
            this._referenceConverter = referenceConverter;

            _contentLoader      = ServiceLocator.Current.GetInstance <IContentLoader>();
            _relationRepository = ServiceLocator.Current.GetInstance <IRelationRepository>();
        }
Esempio n. 19
0
 public CatalogContentGeneratorController(IContentRepository contentRepository, ReferenceConverter referenceConverter, IInventoryService inventoryService, IPriceDetailService priceDetailService)
 {
     _contentRepository  = contentRepository;
     _referenceConverter = referenceConverter;
     _inventoryService   = inventoryService;
     _priceDetailService = priceDetailService;
 }
        public void ConvertTo()
        {
            RemoteInvoke(() =>
            {
                CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;

                ReferenceConverter remoteConverter = new ReferenceConverter(typeof(ITestInterface));
                Assert.Equal("(none)", (string)remoteConverter.ConvertTo(null, null, null, typeof(string)));
            }).Dispose();

            ReferenceConverter converter     = new ReferenceConverter(typeof(ITestInterface));
            string             referenceName = "reference name";
            TestComponent      component     = new TestComponent();

            // no context
            Assert.Equal(String.Empty, (string)converter.ConvertTo(null, null, component, typeof(string)));

            // context with IReferenceService
            TestReferenceService referenceService = new TestReferenceService();

            referenceService.AddReference(referenceName, component);
            TestTypeDescriptorContext context = new TestTypeDescriptorContext(referenceService);

            Assert.Equal(referenceName, (string)converter.ConvertTo(context, null, component, typeof(string)));

            // context with Component without IReferenceService
            Container container = new Container();

            container.Add(component, referenceName);
            context           = new TestTypeDescriptorContext();
            context.Container = container;
            Assert.Equal(referenceName, (string)converter.ConvertTo(context, null, component, typeof(string)));
        }
Esempio n. 21
0
 public CommerceSearchService(ICurrentMarket currentMarket,
                              ICurrencyService currencyService,
                              LanguageResolver languageResolver,
                              IClient findClient,
                              IFacetRegistry facetRegistry,
                              IFindUIConfiguration findUIConfiguration,
                              ReferenceConverter referenceConverter,
                              IContentRepository contentRepository,
                              IPriceService priceService,
                              IPromotionService promotionService,
                              ICurrencyService currencyservice,
                              IContentLoader contentLoader
                              )
 {
     _currentMarket       = currentMarket;
     _currencyService     = currencyService;
     _languageResolver    = languageResolver;
     _findClient          = findClient;
     _facetRegistry       = facetRegistry;
     _findUIConfiguration = findUIConfiguration;
     //_findClient.Personalization().Refresh();
     _referenceConverter = referenceConverter;
     _contentRepository  = contentRepository;
     _priceService       = priceService;
     _promotionService   = promotionService;
     _currencyservice    = currencyservice;
     _contentLoader      = contentLoader;
 }
Esempio n. 22
0
 public ImportService(IContentRepository contentRepository, ReferenceConverter referenceConverter, IContentTypeRepository typeRepository, ILogger logger)
 {
     _contentRepository = contentRepository;
     _referenceConverter = referenceConverter;
     _typeRepository = typeRepository;
     _log = logger;
 }
        public virtual List <ProductListViewModel> GetSearchResults(string language)
        {
            IContentLoader     loader         = ServiceLocator.Current.GetInstance <IContentLoader>();
            ProductService     productService = ServiceLocator.Current.GetInstance <ProductService>();
            ReferenceConverter refConverter   = ServiceLocator.Current.GetInstance <ReferenceConverter>();

            SearchResults <FindProduct> results = GetResults(language);

            List <ProductListViewModel> searchResult = new List <ProductListViewModel>();

            foreach (SearchHit <FindProduct> searchHit in results.Hits)
            {
                ContentReference contentLink = refConverter.GetContentLink(searchHit.Document.Id, CatalogContentType.CatalogEntry, 0);

                // The content can be deleted from the db, but still exist in the index
                IContentData content = null;
                if (loader.TryGet(contentLink, out content))
                {
                    IProductListViewModelInitializer modelInitializer = content as IProductListViewModelInitializer;
                    if (modelInitializer != null)
                    {
                        searchResult.Add(productService.GetProductListViewModel(modelInitializer));
                    }
                }
            }

            return(searchResult);
        }
Esempio n. 24
0
 public PackageController(IsInEditModeAccessor isInEditModeAccessor, CatalogEntryViewModelFactory viewModelFactory, IRecommendationService recommendationService, ReferenceConverter referenceConverter)
 {
     _isInEditMode          = isInEditModeAccessor();
     _viewModelFactory      = viewModelFactory;
     _recommendationService = recommendationService;
     _referenceConverter    = referenceConverter;
 }
Esempio n. 25
0
        public Project(string name, Uri location)
            : base(name, location)
        {
            AssemblyLocation = GenerateAssemblyLocation();

            FReferenceConverter = new ReferenceConverter(location);
            FDocumentConverter  = new DocumentConverter(location);

            FReferences = new EditableIDList <IReference>("References");
            FReferences.Mapper.RegisterMapping <IConverter>(FReferenceConverter);
            Add(FReferences);

            FDocuments = new EditableIDList <IDocument>("Documents");
            FDocuments.Mapper.RegisterMapping <IConverter>(FDocumentConverter);
            Add(FDocuments);

            FReferences.Added += Reference_Added;
            FDocuments.Added  += Document_Added;

            References = FReferences;
            Documents  = FDocuments;

            FBackgroundWorker = new BackgroundWorker();
            FBackgroundWorker.WorkerReportsProgress      = false;
            FBackgroundWorker.WorkerSupportsCancellation = false;

            FBackgroundWorker.DoWork             += DoWorkCB;
            FBackgroundWorker.RunWorkerCompleted += RunWorkerCompletedCB;
        }
Esempio n. 26
0
 public ProductService(IContentLoader contentLoader,
                       IPromotionService promotionService,
                       UrlResolver urlResolver,
                       IRelationRepository relationRepository,
                       ICurrentMarket currentMarketService,
                       ICurrencyService currencyService,
                       ReferenceConverter referenceConverter,
                       LanguageService languageService,
                       FilterPublished filterPublished,
                       IStoreService storeService,
                       ICurrentMarket currentMarket)
 {
     _contentLoader        = contentLoader;
     _promotionService     = promotionService;
     _urlResolver          = urlResolver;
     _relationRepository   = relationRepository;
     _preferredCulture     = ContentLanguage.PreferredCulture;
     _currentMarketService = currentMarketService;
     _currencyService      = currencyService;
     _referenceConverter   = referenceConverter;
     _languageService      = languageService;
     _filterPublished      = filterPublished;
     _storeService         = storeService;
     _currentMarket        = currentMarket;
 }
Esempio n. 27
0
        public Project(string path)
            : base(path)
        {
            LocalPath = path;

            FReferenceConverter = new ReferenceConverter(path);
            FDocumentConverter  = new DocumentConverter(path);

            FReferences = new EditableIDList <IReference>("References");
            FReferences.RootingChanged += FReferences_RootingChanged;
            Add(FReferences);

            FDocuments = new EditableIDList <IDocument>("Documents");
            FDocuments.RootingChanged += FDocuments_RootingChanged;
            Add(FDocuments);

            FReferences.Added += Reference_Added;
            FDocuments.Added  += Document_Added;

            References = FReferences;
            Documents  = FDocuments;

            FBackgroundWorker = new BackgroundWorker();
            FBackgroundWorker.WorkerReportsProgress      = false;
            FBackgroundWorker.WorkerSupportsCancellation = false;

            FBackgroundWorker.DoWork             += DoWorkCB;
            FBackgroundWorker.RunWorkerCompleted += RunWorkerCompletedCB;
        }
Esempio n. 28
0
 public CartService(
     IPricingService pricingService,
     IOrderGroupFactory orderGroupFactory,
     ICurrentCustomerService customerContext,
     IPlacedPriceProcessor placedPriceProcessor,
     IInventoryProcessor inventoryProcessor,
     ILineItemValidator lineItemValidator,
     IOrderRepository orderRepository,
     IPromotionEngine promotionEngine,
     ICurrentMarket currentMarket,
     IContentLoader contentLoader,
     ReferenceConverter referenceConverter
     )
 {
     _pricingService       = pricingService;
     _orderGroupFactory    = orderGroupFactory;
     _customerContext      = customerContext;
     _placedPriceProcessor = placedPriceProcessor;
     _inventoryProcessor   = inventoryProcessor;
     _lineItemValidator    = lineItemValidator;
     _promotionEngine      = promotionEngine;
     _orderRepository      = orderRepository;
     _currentMarket        = currentMarket;
     _contentLoader        = contentLoader;
     _referenceConverter   = referenceConverter;
 }
Esempio n. 29
0
 public LineItemTaxCalculator(
     ReferenceConverter referenceConverter,
     IContentRepository contentRepository)
 {
     _referenceConverter = referenceConverter;
     _contentRepository  = contentRepository;
 }
Esempio n. 30
0
        public IEnumerable <ContentReference> AllCategories()
        {
            List <ContentReference> localList = new List <ContentReference>();
            List <int> nodeIds = new List <int>();

            CatalogEntryDto dto = CatalogContext.Current.GetCatalogEntriesDto("Fashion");

            CatalogRelationDto relDto = CatalogContext.Current.GetCatalogRelationDto(1, 0, 0, null,
                                                                                     new CatalogRelationResponseGroup(CatalogRelationResponseGroup.ResponseGroup.NodeEntry));


            foreach (CatalogRelationDto.NodeEntryRelationRow item in relDto.NodeEntryRelation)
            {
                if (!nodeIds.Contains(item.CatalogNodeId))
                {
                    nodeIds.Add(item.CatalogNodeId);
                }
            }

            ReferenceConverter refConv = ServiceLocator.Current.GetInstance <ReferenceConverter>();

            foreach (int item in nodeIds)
            {
                localList.Add(refConv.GetContentLink(item, CatalogContentType.CatalogNode, 0));
            }

            return(localList);
        }
Esempio n. 31
0
 public TestController(ITicketProvider ticketProvider, IContentLoader contentLoader, ReferenceConverter referenceConverter)
 {
     _ticketProvider     = ticketProvider;
     _client             = SearchClient.Instance;
     _contentLoader      = contentLoader;
     _referenceConverter = referenceConverter;
 }
Esempio n. 32
0
 public WishListController(
     IContentLoader contentLoader,
     ICartService cartService,
     IOrderRepository orderRepository,
     ICommerceTrackingService recommendationService,
     CartViewModelFactory cartViewModelFactory,
     IQuickOrderService quickOrderService,
     ReferenceConverter referenceConverter,
     ICustomerService customerService,
     IUrlResolver urlResolver,
     IRelationRepository relationRepository,
     LanguageResolver languageResolver,
     ICurrentMarket currentMarket,
     FilterPublished filterPublished,
     ISettingsService settingsService)
 {
     _contentLoader        = contentLoader;
     _cartService          = cartService;
     _orderRepository      = orderRepository;
     _trackingService      = recommendationService;
     _cartViewModelFactory = cartViewModelFactory;
     _quickOrderService    = quickOrderService;
     _referenceConverter   = referenceConverter;
     _customerService      = customerService;
     _urlResolver          = urlResolver;
     _relationRepository   = relationRepository;
     _languageResolver     = languageResolver;
     _currentMarket        = currentMarket;
     _filterPublished      = filterPublished;
     _settingsService      = settingsService;
 }
 public FindProductUiSearchProvider(LocalizationService localizationService, ICatalogSystem catalogSystem, ReferenceConverter referenceConverter, IContentLoader contentLoader)
 {
     _catalogSystem = catalogSystem;
     _localizationService = localizationService;
     _catalogContext = catalogSystem;
     _referenceConverter = referenceConverter;
     _contentLoader = contentLoader;
 }
Esempio n. 34
0
 public CatalogIndexer()
 {
     _priceService = ServiceLocator.Current.GetInstance<IPriceService>();
     _contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>(); 
     _promotionService = ServiceLocator.Current.GetInstance<IPromotionService>(); 
     _referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
     _assetUrlResolver = ServiceLocator.Current.GetInstance<AssetUrlResolver>();
     _relationRepository = ServiceLocator.Current.GetInstance<IRelationRepository>();
     _appContext = ServiceLocator.Current.GetInstance<AppContextFacade>();
     _log = LogManager.GetLogger(typeof(CatalogIndexer));
 }
Esempio n. 35
0
 public RelationContractResolver(DefaultContractResolver original, DocumentConvention documentConvention, IEnumerable<Type> rootTypes)
     : base(true)
 {
     _rootTypes = new HashSet<Type>();
     _referenceConverter = new ReferenceConverter(documentConvention);
     foreach (var rootType in rootTypes)
     {
         _rootTypes.Add(rootType);
     }
     DefaultMembersSearchFlags = original.DefaultMembersSearchFlags;
 }
Esempio n. 36
0
 public EntryImporter(IContentRepository contentRepository,
     ReferenceConverter referenceConverter, IContentTypeRepository typeRepository,
     ILogger logger, UrlResolver urlResolver,
     IWarehouseRepository warehouseRepository,
     IWarehouseInventoryService inventoryService,
     IPriceService priceService)
     : base(contentRepository, referenceConverter, typeRepository, logger)
 {
     _urlResolver = urlResolver;
     _warehouseRepository = warehouseRepository;
     _inventoryService = inventoryService;
     _priceService = priceService;
 }
Esempio n. 37
0
 public PromotionService(
     IPricingService pricingService, 
     IMarketService marketService, 
     IContentLoader contentLoader, 
     ReferenceConverter referenceConverter,
     ILineItemCalculator lineItemCalculator,
     IPromotionEngine promotionEngine)
 {
     _contentLoader = contentLoader;
     _marketService = marketService;
     _pricingService = pricingService;
     _referenceConverter = referenceConverter;
     _lineItemCalculator = lineItemCalculator;
     _promotionEngine = promotionEngine;
 }
Esempio n. 38
0
 public CartService(Func<string, CartHelper> cartHelper, 
     IContentLoader contentLoader, 
     ReferenceConverter referenceConverter, 
     UrlResolver urlResolver, 
     IProductService productService,
     IPricingService pricingService)
 {
     _cartHelper = cartHelper;
     _contentLoader = contentLoader;
     _referenceConverter = referenceConverter;
     _preferredCulture = ContentLanguage.PreferredCulture;
     _urlResolver = urlResolver;
     _productService = productService;
     _pricingService = pricingService;
 }
Esempio n. 39
0
 public PromotionService(
     IPricingService pricingService, 
     IMarketService marketService, 
     IContentLoader contentLoader, 
     ReferenceConverter referenceConverter, 
     PromotionHelperFacade promotionHelper,
     IPromotionEntryService promotionEntryService)
 {
     _contentLoader = contentLoader;
     _marketService = marketService;
     _pricingService = pricingService;
     _referenceConverter = referenceConverter;
     _promotionEntryService = promotionEntryService;
     _promotionHelper = promotionHelper;
 }
 public SearchDocumentController(IPriceService priceService,
     IPromotionService promotionService,
     IContentLoader contentLoader,
     ReferenceConverter referenceConverter,
     AssetUrlResolver assetUrlResolver,
     IRelationRepository relationRepository,
     AppContextFacade appContext)
 {
     _priceService = priceService;
     _promotionService = promotionService;
     _contentLoader = contentLoader;
     _referenceConverter = referenceConverter;
     _assetUrlResolver = assetUrlResolver;
     _relationRepository = relationRepository;
     _appContext = appContext;
 }
 public ShipmentViewModelFactory(
     IContentLoader contentLoader,
     ShippingManagerFacade shippingManagerFacade,
     LanguageService languageService,
     ReferenceConverter referenceConverter,
     IAddressBookService addressBookService,
     CartItemViewModelFactory cartItemViewModelFactory,
     Func<CultureInfo> preferredCulture,
     IRelationRepository relationRepository)
 {
     _contentLoader = contentLoader;
     _shippingManagerFacade = shippingManagerFacade;
     _languageService = languageService;
     _referenceConverter = referenceConverter;
     _addressBookService = addressBookService;
     _cartItemViewModelFactory = cartItemViewModelFactory;
     _relationRepository = relationRepository;
     _preferredCulture = preferredCulture();
 }
Esempio n. 42
0
 public CatalogIndexer(ICatalogSystem catalogSystem, 
     IPriceService priceService, 
     IInventoryService inventoryService, 
     MetaDataContext metaDataContext, 
     IContentLoader contentLoader,
     IPromotionService promotionService,
     ReferenceConverter referenceConverter,
     AssetUrlResolver assetUrlResolver,
     IRelationRepository relationRepository,
     AppContextFacade appContext,
     ILogger logger)
     : base(catalogSystem, priceService, inventoryService, metaDataContext)
 {
     _priceService = priceService;
     _contentLoader = contentLoader;
     _promotionService = promotionService;
     _referenceConverter = referenceConverter;
     _assetUrlResolver = assetUrlResolver;
     _relationRepository = relationRepository;
     _appContext = appContext;
     _log = logger;
 }
Esempio n. 43
0
 public ProductService(IContentLoader contentLoader,
     IPromotionService promotionService,
     IPricingService pricingService,
     UrlResolver urlResolver,
     LinksRepository linksRepository,
     IRelationRepository relationRepository,
     ICurrentMarket currentMarket,
     ICurrencyService currencyService,
     AppContextFacade appContext,
     ReferenceConverter referenceConverter)
 {
     _contentLoader = contentLoader;
     _promotionService = promotionService;
     _pricingService = pricingService;
     _urlResolver = urlResolver;
     _linksRepository = linksRepository;
     _relationRepository = relationRepository;
     _preferredCulture = ContentLanguage.PreferredCulture;
     _currentMarket = currentMarket;
     _currencyService = currencyService;
     _appContext = appContext;
     _referenceConverter = referenceConverter;
 }
Esempio n. 44
0
 public MyPriceService(ICatalogSystem catalogSystem, IChangeNotificationManager changeManager, ISynchronizedObjectInstanceCache objectInstanceCache, CatalogKeyEventBroadcaster broadcaster, IApplicationContext applicationContext)
 {
     _marketService = ServiceLocator.Current.GetInstance<IMarketService>();
     _referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();
 }
Esempio n. 45
0
 public NodeImporter(IContentRepository contentRepository, ReferenceConverter referenceConverter, IContentTypeRepository typeRepository, ILogger logger)
     : base(contentRepository, referenceConverter, typeRepository, logger)
 {
 }
        protected void GetEntry_Click(object sender, EventArgs e)
        {
            try
            {
                this.ResetPanels();

                _repo = ServiceLocator.Current.GetInstance<IContentRepository>();
                _referenceConverter = ServiceLocator.Current.GetInstance<ReferenceConverter>();

                var content = _repo.Get<CatalogContentBase>(_referenceConverter.GetContentLink(Code.Value));

                ErrorMessage.Text = (content is PackageContent).ToString();

                string code = Code.Value;
                var entry = CatalogContext.Current.GetCatalogEntry(
                    code, new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.Children));

                if (entry == null)
                    throw new Exception(string.Format("No style or variant found with code {0}", code));

                DisplayVariant(entry);

            }
            catch (Exception ex)
            {
                ErrorMessage.Text = ex.Message;
                ErrorPanel.Visible = true;
            }
        }
Esempio n. 47
0
        public void ConvertFrom()
        {
            ReferenceConverter converter = new ReferenceConverter(typeof(ITestInterface));
            string referenceName = "reference name";
            // no context
            Assert.Null(converter.ConvertFrom(null, null, referenceName));

            TestComponent component = new TestComponent();

            // context with IReferenceService
            TestReferenceService referenceService = new TestReferenceService();
            referenceService.AddReference(referenceName, component);
            TestTypeDescriptorContext context = new TestTypeDescriptorContext(referenceService);
            Assert.Same(component, converter.ConvertFrom(context, null, referenceName));

            // context with Component without IReferenceService
            Container container = new Container();
            container.Add(component, referenceName);
            context = new TestTypeDescriptorContext();
            context.Container = container;
            Assert.Same(component, converter.ConvertFrom(context, null, referenceName));
        }
 public CommerceAndStandardSitemapXmlGenerator(ISitemapRepository sitemapRepository, IContentRepository contentRepository, UrlResolver urlResolver, SiteDefinitionRepository siteDefinitionRepository, ILanguageBranchRepository languageBranchRepository, ReferenceConverter referenceConverter)
     : base(sitemapRepository, contentRepository, urlResolver, siteDefinitionRepository, languageBranchRepository, referenceConverter)
 {
 }
 public CommerceSitemapXmlGenerator(ISitemapRepository sitemapRepository, IContentRepository contentRepository, UrlResolver urlResolver, SiteDefinitionRepository siteDefinitionRepository, ILanguageBranchRepository languageBranchRepository, ReferenceConverter referenceConverter) : base(sitemapRepository, contentRepository, urlResolver, siteDefinitionRepository, languageBranchRepository)
 {
     if (referenceConverter == null) throw new ArgumentNullException("referenceConverter");
     _referenceConverter = referenceConverter;
 }
Esempio n. 50
0
        public void GetStandardValues()
        {
            ReferenceConverter converter = new ReferenceConverter(typeof(TestComponent));

            TestComponent component1 = new TestComponent();
            TestComponent component2 = new TestComponent();
            TestReferenceService referenceService = new TestReferenceService();
            referenceService.AddReference("reference name 1", component1);
            referenceService.AddReference("reference name 2", component2);
            ITypeDescriptorContext context = new TestTypeDescriptorContext(referenceService);

            TypeConverter.StandardValuesCollection values = converter.GetStandardValues(context);
            Assert.NotNull(values);
            // 2 components + 1 null value
            Assert.Equal(3, values.Count);
        }
Esempio n. 51
0
 public void CanConvertTo()
 {
     ReferenceConverter converter = new ReferenceConverter(typeof(ITestInterface));
     Assert.True(converter.CanConvertTo(new TestTypeDescriptorContext(), typeof(string)));
 }
Esempio n. 52
0
        public void ConvertTo()
        {
            ReferenceConverter converter = new ReferenceConverter(typeof(ITestInterface));
            string referenceName = "reference name";

            Assert.Equal("(none)", (string)converter.ConvertTo(null, null, null, typeof(string)));

            TestComponent component = new TestComponent();

            // no context
            Assert.Equal(String.Empty, (string)converter.ConvertTo(null, null, component, typeof(string)));

            // context with IReferenceService
            TestReferenceService referenceService = new TestReferenceService();
            referenceService.AddReference(referenceName, component);
            TestTypeDescriptorContext context = new TestTypeDescriptorContext(referenceService);
            Assert.Equal(referenceName, (string)converter.ConvertTo(context, null, component, typeof(string)));

            // context with Component without IReferenceService
            Container container = new Container();
            container.Add(component, referenceName);
            context = new TestTypeDescriptorContext();
            context.Container = container;
            Assert.Equal(referenceName, (string)converter.ConvertTo(context, null, component, typeof(string)));
        }
Esempio n. 53
0
 public CartService(IContentLoader contentLoader, ReferenceConverter referenceConverter)
 {
     _contentLoader = contentLoader;
     _referenceConverter = referenceConverter;
 }
Esempio n. 54
0
 public void CanConvertFrom()
 {
     ReferenceConverter converter = new ReferenceConverter(typeof(ITestInterface));
     // without context
     Assert.False(converter.CanConvertFrom(null, typeof(string)));
     // with context
     Assert.True(converter.CanConvertFrom(new TestTypeDescriptorContext(), typeof(string)));
 }
 public CatalogContentRouteRegistration(IContentLoader contentLoader, ReferenceConverter referenceConverter)
 {
     _contentLoader = contentLoader;
     _referenceConverter = referenceConverter;
 }
        protected void WalkCategoryTree(NodeContent node, 
            IContentRepository repository, 
            CatalogContentLoader contentLoader, 
            ICatalogSystem catalog,
            ReferenceConverter referenceConverter)
        {
            // ReSharper disable PossibleMultipleEnumeration
            // Get all products
            Stopwatch tmr = Stopwatch.StartNew();
            IEnumerable<EntryContentBase> entries = repository.GetChildren<EPiServer.Commerce.Catalog.ContentTypes.EntryContentBase>(node.ContentLink);
            _log.Debug("Loaded {0} entries in category {1} using IContentRepository in {2}ms",
                            entries.Count(),
                            node.Name,
                            tmr.ElapsedMilliseconds);

            // Load and cache Entry objects. Still a lot of code that uses this
            tmr = Stopwatch.StartNew();
            foreach (EntryContentBase entryAsContent in entries)
            {
                // Load full entry
                int entryId = referenceConverter.GetObjectId(entryAsContent.ContentLink);
                // Catalog Gadget uses info
                //catalog.GetCatalogEntry(entryId,
                //	new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryInfo));
                catalog.GetCatalogEntry(entryId,
                    new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull));
            }

            // Prime the catalog gadget
            // IEnumerable<IContent> children = repository.GetChildren<IContent>(node.ContentLink, new LanguageSelector("en"), 0, int.MaxValue);
            // _log.Debug("Loaded {0} children", children.Count());

            // .GetDescendents(node.ContentLink);

            tmr.Stop();
            _log.Debug("Loaded {0} entries in category {1} using ICatalogSystem in {2}ms",
                            entries.Count(),
                            node.Name,
                            tmr.ElapsedMilliseconds);

            // Get all products the way it is done in edit mode, but this does not seem to
            // use the cache.
            //int loadedEntries;
            //contentLoader.GetCatalogEntries(node.ContentLink, 0, int.MaxValue, out loadedEntries);
            //_log.Debug("Loaded {0} entries in category {1} using CatalogContentLoader", loadedEntries, node.Name);

            // Get child nodes the same way done by the UI
            IList<GetChildrenReferenceResult> catalogNodes = contentLoader.GetCatalogNodes(node.ContentLink);
            _log.Debug("Loaded {0} categories in category {1} using CatalogContentLoader", catalogNodes.Count, node.Name);
            foreach (GetChildrenReferenceResult catalogNode in catalogNodes)
            {
                NodeContent childNode = repository.Get<NodeContent>(catalogNode.ContentLink);
                WalkCategoryTree(childNode, repository, contentLoader, catalog, referenceConverter);
            }
            // ReSharper restore PossibleMultipleEnumeration
        }