public AdjustInventoryActivity(ICatalogRepository catalogRepository, IInventoryRepository inventoryRepository, ICustomerSessionService customerService, ICacheRepository cacheRepository) { _catalogRepository = catalogRepository; _inventoryRepository = inventoryRepository; _cacheRepository = cacheRepository; _customerSessionService = customerService; }
public ImportService(IImportRepository importRepository, IAssetService blobProvider, ICatalogRepository catalogRepository, IOrderRepository orderRepository, IAppConfigRepository appConfigRepository, IRepositoryFactory<IAppConfigRepository> appConfigRepositoryFactory) { _orderRepository = orderRepository; _catalogRepository = catalogRepository; _importJobRepository = importRepository; _appConfigRepository = appConfigRepository; _appConfigRepositoryFactory = appConfigRepositoryFactory; _assetProvider = blobProvider; _entityImporters = new List<IEntityImporter> { new ItemImporter() { Name = "Product"}, new ItemImporter() { Name = "Sku"}, new ItemImporter() { Name = "Bundle"}, new ItemImporter() { Name = "DynamicKit"}, new ItemImporter() { Name = "Package"}, new PriceImporter(_catalogRepository), new AssociationImporter(_catalogRepository), new RelationImporter(_catalogRepository), new CategoryImporter(), new LocalizationImporter(), new TaxValueImporter(), new ItemAssetImporter(), new TaxCategoryImporter(), new JurisdictionImporter(), new JurisdictionGroupImporter(), new SeoImporter() }; _importResults = new Dictionary<string, ImportResult>(); }
public CatalogController( ICatalogRepository repository, ITaskRepository taskRepository, ICatalogView catalogView, INewCatalogView newCatalogView, INewSupplyView newSupplyView, INewHardwareView newHardwareView, IEditSupplyView editSupplyView, IEditHardwareView editHardwareView, INewHardwareSupplyView newHardwareSupplyView, IEditHardwareSupplyView editHardwareSupplyView, IImportHardwareView importHardwareView, ILoadingView loadingView) { this.catalogView = catalogView; this.newCatalogView = newCatalogView; this.newSupplyView = newSupplyView; this.newHardwareView = newHardwareView; this.editSupplyView = editSupplyView; this.editHardwareView = editHardwareView; this.newHardwareSupplyView = newHardwareSupplyView; this.editHardwareSupplyView = editHardwareSupplyView; this.importHardwareView = importHardwareView; this.loadingView = loadingView; this.repository = repository; this.taskRepository = taskRepository; }
public SkyDriveAuthorizationService(ILiveLogin liveLogin, ICatalogRepository catalogRepository, CatalogModel catalog) { _liveLogin = liveLogin; _catalog = catalog; _catalogRepository = catalogRepository; }
/// <summary> /// Creates a CatalogService based on the passed-in repository /// </summary> /// <param name="repository">An ICatalogRepository</param> public CatalogService(ICatalogRepository repository, IOrderService orderService) { _repository = repository; _orderService = orderService; if (_repository == null) throw new InvalidOperationException("Repository cannot be null"); }
public CatalogService( ICatalogRepository catalogRepository ) { if ( catalogRepository == null ) throw new ArgumentNullException( "catalogRepository" ); _catalogRepository = catalogRepository; }
public void Startup() { _orderRepository = new TestOrderRepository(); _catalogRepository = new TestCatalogRepository(); _addressValidation = new TestAddressValidator(); _shippingRepository = new TestShippingRepository(); _shippingService = new SimpleShippingService(_shippingRepository); _taxRepository = new TestTaxRepository(); _taxService = new RegionalSalesTaxService(_taxRepository); _orderService = new OrderService(_orderRepository,_catalogRepository,_shippingRepository,_shippingService); _personalizationRepository = new TestPersonalizationRepository(); _personalizationService = new PersonalizationService(_personalizationRepository,_orderRepository, _orderService,_catalogRepository); _catalogService = new CatalogService(_catalogRepository,_orderService); _paymentService = new FakePaymentService(); _incentiveRepository = new TestIncentiveRepository(); _incentiveService = new IncentiveService(_incentiveRepository); //this service throws the sent mailers into a collection //and does not use SMTP _mailerService = new TestMailerService(); _inventoryRepository = new TestInventoryRepository(); _inventoryService = new InventoryService(_inventoryRepository,_catalogService); _mailerRepository = new TestMailerRepository(); _pipeline=new DefaultPipeline( _addressValidation,_paymentService, _orderService,_mailerService, _inventoryService ); }
public ProjectController( IProjectView projectView, INewProjectView newProjectView, IProjectRepository projectRepository, IDealRepository dealRepository, INewProjectSupplyView newProjectSupplyView, INewProjectHardwareView newProjectHardwareView, IEditProjectSupplyView editProjectSupplyView, IEditProjectHardwareView editProjectHardwareView, INewProjectFrameView newProjectFrameView, IEditProjectHardwareSupplyView editProjectHardwareSupplyView, ILoadingView loadingView, ICatalogRepository catalogRepository, ITaskRepository taskRepository) { this.projectView = projectView; this.newProjectView = newProjectView; this.projectRepository = projectRepository; this.dealRepository = dealRepository; this.newProjectSupplyView = newProjectSupplyView; this.newProjectHardwareView = newProjectHardwareView; this.editProjectHardwareView = editProjectHardwareView; this.editProjectSupplyView = editProjectSupplyView; this.newProjectFrameView = newProjectFrameView; this.editProjectHardwareSupplyView = editProjectHardwareSupplyView; this.loadingView = loadingView; this.catalogRepository = catalogRepository; this.taskRepository = taskRepository; }
public PriceImporter(ICatalogRepository catalogRepository) { _catalogRepository = catalogRepository; Name = ImportEntityType.Price.ToString(); InitializeSystemProperties(); var catalogs = _catalogRepository.Catalogs.ToList(); catalogs.ForEach(cat => SystemProperties.First(prop => prop.Name == "CatalogId").EnumValues.Add(cat.Name)); }
public OrderService(IOrderRepository rep, ICatalogRepository catalog, IShippingRepository shippingRepository, IShippingService shippingService) { _orderRepository = rep; _catalogRepository = catalog; _shippingRepository = shippingRepository; _shippingService = shippingService; }
//Creates a Catalog Service based on the passed in repository public CatalogService(ICatalogRepository repository) { _repository = repository; if (repository == null) { throw new InvalidOperationException("Repository cannot be null"); } }
public TaskService( IEventBroker eventBroker, ITaskRepository repository, ICatalogRepository catalogRepository) { this.repository = repository; this.catalogRepository = catalogRepository; this.eventBroker = eventBroker; }
public AllCatalogsSearchPageViewModel(INotificationsService notificationsService, ICatalogReaderFactory catalogReaderFactory, ICatalogRepository catalogRepository, INavigationService navigationService) { Items = new ObservableCollection<CatalogItemModel>(); _notificationsService = notificationsService; _catalogReaderFactory = catalogReaderFactory; _catalogRepository = catalogRepository; _navigationService = navigationService; }
public SkyDriveService( ILiveLogin liveLogin, BookTool bookTool, ICatalogRepository catalogRepository) { _liveLogin = liveLogin; _bookTool = bookTool; _catalogRepository = catalogRepository; }
public CatalogSearchPageViewModel( INotificationsService notificationsService, ICatalogRepository catalogRepository, ICatalogReaderFactory catalogReaderFactory, INavigationService navigationService, CatalogController catalogController) : base(catalogReaderFactory, catalogRepository, notificationsService, navigationService, catalogController) { }
public ShippingOptionPackagesStepViewModel( IViewModelsFactory<IShippingOptionAddShippingPackageViewModel> addPackageVmFactory, IRepositoryFactory<IShippingRepository> repositoryFactory, IOrderEntityFactory entityFactory, ShippingOption item, ICatalogRepository catalogRepository) : base(addPackageVmFactory, repositoryFactory, entityFactory, catalogRepository, item) { }
public FeatureController(ILectuerRepository lectuerRepository, ICatalogRepository catalogRepository, ISubtypeRepository subtypeRepository, IDynastyRepository dynastyRepository, IFeatureRepository featureRepository) { this.lectuerRepository = lectuerRepository; this.catalogRepository = catalogRepository; this.subtypeRepository = subtypeRepository; this.dynastyRepository = dynastyRepository; this.featureRepository = featureRepository; }
public void Startup() { _cartRepository = new TestShoppingCartRepository(); _catalogRepository = new TestCatalogRepository(); _userRepository = new TestUserRepository(); cartService = new ShoppingCartService(_cartRepository); catalogService = new CatalogService(_catalogRepository); userService = new UserService(_userRepository); }
public override string Import(string catalogId, string propertySetId, ImportItem[] systemValues, ImportItem[] customValues, IRepository repository) { var _error = string.Empty; _repository = (ICatalogRepository)repository; var action = GetAction(systemValues.First(x => x.Name == "Action").Value); var itemId = systemValues.First(y => y.Name == "ItemId").Value; var itemAssetId = systemValues.First(y => y.Name == "AssetId").Value; var assetType = systemValues.First(y => y.Name == "AssetType").Value; var originalItem = _repository.Items.Where(x => x.ItemId == itemId || x.Code == itemId).Expand(it => it.ItemAssets).FirstOrDefault(); if (originalItem != null) { switch (action) { case ImportAction.Insert: if (originalItem.ItemAssets.All(x => x.AssetId != itemAssetId)) { var addItem = InitializeItem(null, systemValues); addItem.AssetType = !string.IsNullOrEmpty(assetType) ? addItem.AssetType : imageTypes.Any(x => x.Equals(Path.GetExtension(addItem.AssetId).Replace(".", string.Empty))) ? imageType : Path.GetExtension(addItem.AssetId).Replace(".", string.Empty); originalItem.ItemAssets.Add(addItem); _repository.Update(originalItem); } break; case ImportAction.Update: if (originalItem.ItemAssets.Any(x => x.AssetId == itemAssetId)) { var asset = originalItem.ItemAssets.FirstOrDefault(x => x.AssetId == itemAssetId); if (asset != null) { InitializeItem(asset, systemValues); _repository.Update(originalItem); } } break; case ImportAction.Delete: if (originalItem.ItemAssets.Any(x => x.AssetId == itemAssetId)) { var assetD = originalItem.ItemAssets.FirstOrDefault(x => x.AssetId == itemAssetId); originalItem.ItemAssets.Remove(assetD); _repository.Update(originalItem); } break; } } return _error; }
public AddCatalogPageViewModel(IWebDataGateway dataGateway, INotificationsService notificationsService, IErrorHandler errorHandler, INavigationService navigationService, ICatalogRepository catalogRepository) { _dataGateway = dataGateway; _notificationsService = notificationsService; _errorHandler = errorHandler; _navigationService = navigationService; _catalogRepository = catalogRepository; CatalogUrl = HTTP_PREFIX; }
public AssociationImporter(ICatalogRepository catalogRepository) { _repository = catalogRepository; Name = ImportEntityType.Association.ToString(); InitializeSystemProperties(); _repository.Catalogs.ToList().ForEach(cat => { SystemProperties.First(prop => prop.Name == "SourceCatalogId").EnumValues.Add(cat.Name); SystemProperties.First(prop => prop.Name == "TargetCatalogId").EnumValues.Add(cat.Name); }); }
public PersonalizationService( IPersonalizationRepository pRepo, IOrderRepository orderRepository, IOrderService orderService, ICatalogRepository catalogRepository ) { _pRepo = pRepo; _orderRepository = orderRepository; _orderService = orderService; _catalogRepository = catalogRepository; }
public CatalogPageViewModel( ICatalogReaderFactory catalogReaderFactory, ICatalogRepository catalogRepository, INotificationsService notificationsService, INavigationService navigationService, CatalogController catalogController, ICatalogAuthorizationFactory catalogAuthorizationFactory) : base(catalogReaderFactory, catalogRepository, notificationsService, navigationService, catalogController) { _navigationService = navigationService; _catalogController = catalogController; _catalogAuthorizationFactory = catalogAuthorizationFactory; }
public NavigationController( IEventBroker eventBroker, ICatalogRepository catalogRepository, IDealRepository dealRepository, IProjectRepository projectRepository, INavigationView navigationView) { this.eventBroker = eventBroker; this.catalogRepository = catalogRepository; this.dealRepository = dealRepository; this.projectRepository = projectRepository; this.navigationView = navigationView; }
public ProjectService( IEventBroker eventBroker, ICatalogRepository catalogRepository, ITaskRepository taskRepository, IDealRepository dealRepository, IProjectRepository projectRepository) { this.dealRepository = dealRepository; this.catalogRepository = catalogRepository; this.taskRepository = taskRepository; this.projectRepository = projectRepository; this.eventBroker = eventBroker; }
public MockImportService(IImportRepository importJobRepository) { _importJobRepository = importJobRepository; _catalogRepository = null; _entityImporters = new List<IEntityImporter>(); _entityImporters.Add(new ItemImporter()); _entityImporters.Add(new PriceImporter()); _entityImporters.Add(new AssociationImporter()); _entityImporters.Add(new CategoryImporter()); _importResults = new Dictionary<string, ImportResult>(); }
protected CatalogPageViewModelBase( ICatalogReaderFactory catalogReaderFactory, ICatalogRepository catalogRepository, INotificationsService notificationsService, INavigationService navigationService, CatalogController catalogController) { FolderItems = new ObservableCollection<CatalogItemModel>(); CatalogReaderFactory = catalogReaderFactory; CatalogRepository = catalogRepository; NotificationsService = notificationsService; _navigationService = navigationService; _catalogController = catalogController; }
public SkyDriveCatalogReader( CatalogModel catalog, ILiveLogin liveLogin, IStorageStateSaver storageStateSaver, DownloadController downloadController, ICatalogRepository catalogRepository) { _catalog = catalog; _liveLogin = liveLogin; _storageStateSaver = storageStateSaver; _downloadController = downloadController; _catalogRepository = catalogRepository; CatalogId = catalog.Id; }
public HomeController(IWebcastRepository webcastRepository, IFeatureRepository featureRepository, ICatalogRepository catalogRepository, ILectuerRepository lectuerRepository, ISubtypeRepository subtypeRepository, IDynastyRepository dynastyRepository,IAtkRepository atkRepository) //IFictionRepository fictionRepository { this.webcastRepository = webcastRepository; this.featureRepository = featureRepository; this.catalogRepository = catalogRepository; this.lectuerRepository = lectuerRepository; this.subtypeRepository = subtypeRepository; this.dynastyRepository = dynastyRepository; //this.fictionRepository = fictionRepository; this.atkRepository = atkRepository; }
public override string Import(string catalogId, string propertySetId, ImportItem[] systemValues, ImportItem[] customValues, IRepository repository) { var _error = string.Empty; _repository = (ICatalogRepository)repository; var action = GetAction(systemValues.First(x => x.Name == "Action").Value); switch (action) { case ImportAction.Insert: var addItem = InitializeItem(null, systemValues); _repository.Add(addItem); break; case ImportAction.InsertAndReplace: var itemR = systemValues.FirstOrDefault(y => y.Name == "TaxCategoryId"); if (itemR != null) { var originalItem = _repository.TaxCategories.Where(x => x.TaxCategoryId == itemR.Value).SingleOrDefault(); if (originalItem != null) _repository.Remove(originalItem); } var replaceItem = InitializeItem(null, systemValues); _repository.Add(replaceItem); break; case ImportAction.Update: var itemU = systemValues.FirstOrDefault(y => y.Name == "TaxCategoryId"); if (itemU != null) { var origItem = _repository.TaxCategories.Where(x => x.TaxCategoryId == itemU.Value).SingleOrDefault(); if (origItem != null) { InitializeItem(origItem, systemValues); _repository.Update(origItem); } } break; case ImportAction.Delete: var itemD = systemValues.FirstOrDefault(y => y.Name == "TaxCategoryId"); if (itemD != null) { var deleteItem = _repository.TaxCategories.Where(x => x.TaxCategoryId == itemD.Value).SingleOrDefault(); if (deleteItem != null) _repository.Remove(deleteItem); } break; } return _error; }
public ShippingOptionViewModel( IViewModelsFactory <IShippingOptionAddShippingPackageViewModel> addPackageVmFactory, IRepositoryFactory <IShippingRepository> repositoryFactory, IOrderEntityFactory entityFactory, IHomeSettingsViewModel parent, INavigationManager navManager, ShippingOption item, ICatalogRepository catalogRepository) : base(entityFactory, item, false) { ViewTitle = new ViewTitleBase { SubTitle = "SETTINGS".Localize(null, LocalizationScope.DefaultCategory), Title = "Shipping Option" }; _repositoryFactory = repositoryFactory; _navManager = navManager; _parent = parent; _addPackageVmFactory = addPackageVmFactory; _catalogRepository = catalogRepository; OpenItemCommand = new DelegateCommand(() => _navManager.Navigate(NavigationData)); CommandInit(); }
protected virtual IQueryable <CategoryEntity> BuildQuery(ICatalogRepository repository, CategorySearchCriteria criteria) { var query = repository.Categories; if (!string.IsNullOrEmpty(criteria.Keyword)) { query = query.Where(x => x.Name.Contains(criteria.Keyword)); } if (!criteria.CatalogIds.IsNullOrEmpty()) { query = query.Where(x => criteria.CatalogIds.Contains(x.CatalogId)); } if (!string.IsNullOrEmpty(criteria.CategoryId) && !criteria.SearchOnlyInRoot) { query = query.Where(x => x.ParentCategoryId == criteria.CategoryId); } if (criteria.SearchOnlyInRoot) { query = query.Where(x => x.ParentCategoryId == null); } return(query); }
public OrderRepository( IOrderManager orderManager, ICartManager cartManager, ICatalogRepository catalogRepository, IAccountManager accountManager, ICartModelBuilder cartModelBuilder, IOrderModelBuilder orderModelBuilder, IEntityMapper entityMapper, IStorefrontContext storefrontContext, IVisitorContext visitorContext) : base( cartManager, catalogRepository, accountManager, cartModelBuilder, entityMapper, storefrontContext, visitorContext) { this.orderManager = orderManager; this.orderModelBuilder = orderModelBuilder; }
public OrderConfirmationNotificationHandlerImpl(IEventLogRepository eventLogRepository, IUserProfileLogic userProfileLogic, IUserPushNotificationDeviceRepository userPushNotificationDeviceRepository, IMessageTemplateLogic messageTemplateLogic, ICustomerRepository customerRepository, IUserMessagingPreferenceRepository userMessagingPreferenceRepository, Func <Channel, IMessageProvider> messageProviderFactory, IDsrLogic dsrLogic, ICatalogRepository catalogRepository, IOrderLogic orderLogic, IPriceLogic priceLogic) : base(userProfileLogic, userPushNotificationDeviceRepository, customerRepository, userMessagingPreferenceRepository, messageProviderFactory, eventLogRepository, dsrLogic) { _priceLogic = priceLogic; _catRepo = catalogRepository; this.eventLogRepository = eventLogRepository; this.userProfileLogic = userProfileLogic; this.userPushNotificationDeviceRepository = userPushNotificationDeviceRepository; this.customerRepository = customerRepository; this.userMessagingPreferenceRepository = userMessagingPreferenceRepository; _messageTemplateLogic = messageTemplateLogic; this.messageProviderFactory = messageProviderFactory; this._orderLogic = orderLogic; }
/// <summary> /// Gets a value indicating whether the specified catalog already exists. /// </summary> /// <param name="catalog">The catalog.</param> /// <returns><c>true</c> if the catalog exists. Otherwise <c>false.</c></returns> public async Task <bool> CatalogExists(Catalog catalog) { CatalogContract contract = await this.mapper.MapNewAsync <Catalog, CatalogContract>(catalog); if (string.IsNullOrWhiteSpace(contract.Name) && contract.ID == Guid.Empty) { return(false); } using (IDbContextScope scope = this.dataContextScopeFactory.CreateDbContextScope(this.connectionStrings.DataStorageDB, false)) { ICatalogRepository catalogRepository = scope.GetRepository <ICatalogRepository>(); if (!string.IsNullOrWhiteSpace(contract.Name)) { CatalogContract catalogResult = (await catalogRepository.FindAsync(contract, 0, 1)).FirstOrDefault(); return(!(catalogResult is null || (contract.ID != Guid.Empty && contract.ID == catalogResult.ID))); } return((await catalogRepository.GetAsync(contract.ID)) != null); } }
/// <summary> /// Gets the catalog by the initial instance set. /// </summary> /// <param name="catalog">The initial catalog set.</param> /// <returns>The instance of <see cref="Catalog"/> type.</returns> public async Task <Catalog> GetCatalog(Catalog catalog) { CatalogContract catalogContract = null; CatalogContract parentCatalogContract = null; using (IDbContextScope scope = this.dataContextScopeFactory.CreateDbContextScope(this.connectionStrings.DataStorageDB, false)) { ICatalogRepository catalogRepository = scope.GetRepository <ICatalogRepository>(); catalogContract = await catalogRepository.GetAsync(catalog.ID); if ((catalogContract?.ParentID).HasValue) { parentCatalogContract = await catalogRepository.GetAsync(catalogContract.ParentID.Value); } } catalog = await this.mapper.MapAsync(catalogContract, catalog); catalog.Parent = await this.mapper.MapAsync(parentCatalogContract, catalog.Parent); return(catalog); }
public CatalogRepositoryTests() { var logger = new Mock <ILogger>(); var builder = new WebHostBuilder() .UseEnvironment("UnitTesting") .UseStartup <Startup>(); var server = new TestServer(builder); _context = server.Host.Services.GetService(typeof(CatalogContext)) as CatalogContext; _repository = new CatalogRepository(_context, logger.Object); _catalogBrands = TestCatalog.CreateBrands(); _catalogTypes = TestCatalog.CreateTypes(); _catalogResponse = TestCatalog.CreateItems(); _context.AddRange(_catalogBrands); _context.AddRange(_catalogTypes); _context.AddRange(_catalogResponse.ItemsOnPage); _context.SaveChanges(); }
public static string BuildCategoryOutline(ICatalogRepository repository, string catalogId, Item item) { var retVal = new List <String>(); // TODO: remove this call to improve performance, methods that call this should know what type of catalog it is var catalog = repository.Catalogs.Single(c => c.CatalogId == catalogId); if (catalog is Catalog) { // TODO: item should already have relations defined, make sure to use those instead of loading new var categoryRelations = repository.CategoryItemRelations.Expand(x => x.Category) .Where(c => c.ItemId == item.ItemId && c.CatalogId == catalogId).ToArray(); if (categoryRelations.Any()) { retVal.AddRange( categoryRelations.Select( categoryRelation => BuildCategoryOutline(repository, catalogId, categoryRelation.Category))); } } else if (catalog is VirtualCatalog) { // TODO: item should already have relations defined, make sure to use those instead of loading new var linkedCategories = repository.CategoryItemRelations .Where(ci => ci.ItemId == item.ItemId) .SelectMany(c => c.Category.LinkedCategories) .Where(lc => lc.CatalogId == catalogId).ToArray(); if (linkedCategories.Any()) { retVal.AddRange( linkedCategories.Select(cat => BuildCategoryOutline(repository, cat.CatalogId, cat))); } } return(String.Join(";", retVal.ToArray())); }
public FakeSarchProvider(ICatalogRepository repository) { _repository = repository; }
public SubCategoriesController(ICatalogRepository <SubCategory> subcategoryobj) { _subcategoryobj = subcategoryobj; }
public CatalogService(ICatalogRepository catalogRepository, IProductRepository productRepository) { _catalogRepository = catalogRepository; _productRepository = productRepository; }
public void Setup() { _catalogRepository = new MockCatalogRepository(); _catalogRepository.Add(SetTenant()); }
// GET api/values public CategoriesController(ICatalogRepository catalogRepo, ILogger <CategoriesController> logger) { _catalogRepo = catalogRepo; _logger = logger; }
public GetAllCommodityCategoriesHandler(ICatalogRepository repository, IMapper mapper) { _repository = repository; _mapper = mapper; }
public override string Import(string containerId, string propertySetId, ImportItem[] systemValues, ImportItem[] customValues, IRepository repository) { var _error = string.Empty; _repository = (ICatalogRepository)repository; var action = GetAction(systemValues.First(x => x.Name == "Action").Value); var taxCategory = systemValues.SingleOrDefault(x => x.Name == "TaxCategory") != null?systemValues.Single(x => x.Name == "TaxCategory").Value : null; var categoryId = systemValues.SingleOrDefault(x => x.Name == "CategoryId") != null?systemValues.Single(x => x.Name == "CategoryId").Value : null; var itemCode = systemValues.SingleOrDefault(x => x.Name == "Code") != null?systemValues.Single(x => x.Name == "Code").Value : null; var availability = systemValues.SingleOrDefault(x => x.Name == "AvailabilityRule") != null?systemValues.Single(x => x.Name == "AvailabilityRule").Value : null; if (availability != null) { var number = (int)((AvailabilityRule)Enum.Parse(typeof(AvailabilityRule), availability)); systemValues.SingleOrDefault(x => x.Name == "AvailabilityRule").Value = number.ToString(); } switch (action) { case ImportAction.Insert: if (_repository.Items.Where(item => item.CatalogId == containerId && item.Code == itemCode).FirstOrDefault() != null) { _error = string.Format("Item with the code {0} already exist", itemCode); } else { var addItem = SetupItem(null, containerId, propertySetId, systemValues, customValues, _repository, taxCategory); _repository.Add(addItem); _error = SetupCategoryRelation(categoryId, containerId, _repository, addItem); } break; case ImportAction.InsertAndReplace: if (itemCode != null) { var originalItem = _repository.Items.Where(i => i.CatalogId == containerId && i.Code == itemCode).Expand(x => x.CategoryItemRelations).FirstOrDefault(); if (originalItem != null) { originalItem = SetupItem(originalItem, containerId, propertySetId, systemValues, customValues, _repository, taxCategory); _repository.Update(originalItem); if (originalItem.CategoryItemRelations.All(rel => rel.CategoryId != categoryId)) { _error = SetupCategoryRelation(categoryId, containerId, _repository, originalItem); } } else { var newItem = SetupItem(null, containerId, propertySetId, systemValues, customValues, _repository, taxCategory); _repository.Add(newItem); _error = SetupCategoryRelation(categoryId, containerId, _repository, newItem); } } break; case ImportAction.Update: if (itemCode != null) { var origItem = _repository.Items.FirstOrDefault(i => i.CatalogId == containerId && i.Code == itemCode); if (origItem != null) { SetupItem(origItem, containerId, propertySetId, systemValues, customValues, _repository, taxCategory); _repository.Update(origItem); } } break; case ImportAction.Delete: if (itemCode != null) { var deleteItem = _repository.Items.Where(i => i.CatalogId == containerId && i.Code == itemCode).SingleOrDefault(); if (deleteItem != null) { _repository.Remove(deleteItem); } } break; } return(_error); }
/// <summary> /// Processes the specified arguments. /// </summary> /// <param name="args">The arguments.</param> public override void Process(Commerce.Pipelines.ServicePipelineArgs args) { Assert.ArgumentNotNull(args, "args"); Assert.ArgumentNotNull(args.Request, "args.request"); Assert.ArgumentCondition(args.Request is GetProductPricesRequest, "args.Request", "args.Request is GetProductPricesRequest"); Assert.ArgumentCondition(args.Result is Sitecore.Commerce.Services.Prices.GetProductPricesResult, "args.Result", "args.Result is GetProductPricesResult"); GetProductPricesRequest request = (GetProductPricesRequest)args.Request; Sitecore.Commerce.Services.Prices.GetProductPricesResult result = (Sitecore.Commerce.Services.Prices.GetProductPricesResult)args.Result; Assert.ArgumentNotNull(request.ProductCatalogName, "request.ProductCatalogName"); Assert.ArgumentNotNull(request.ProductId, "request.ProductId"); Assert.ArgumentNotNull(request.PriceTypeIds, "request.PriceTypeIds"); ICatalogRepository catalogRepository = ContextTypeLoader.CreateInstance <ICatalogRepository>(); bool isList = request.PriceTypeIds.FirstOrDefault(x => x.Equals(PriceTypes.List, StringComparison.OrdinalIgnoreCase)) != null; bool isAdjusted = request.PriceTypeIds.FirstOrDefault(x => x.Equals(PriceTypes.Adjusted, StringComparison.OrdinalIgnoreCase)) != null; try { var product = catalogRepository.GetProductReadOnly(request.ProductCatalogName, request.ProductId); ExtendedCommercePrice extendedPrice = this.EntityFactory.Create <ExtendedCommercePrice>("Price"); // BasePrice is a List price and ListPrice is Adjusted price if (isList) { if (product.HasProperty("BasePrice") && product["BasePrice"] != null) { extendedPrice.Amount = (product["BasePrice"] as decimal?).Value; } else { // No base price is defined, the List price is set to the actual ListPrice define in the catalog extendedPrice.Amount = product.ListPrice; } } if (isAdjusted && !product.IsListPriceNull()) { extendedPrice.ListPrice = product.ListPrice; } result.Prices.Add(request.ProductId, extendedPrice); if (request.IncludeVariantPrices && product is ProductFamily) { foreach (Variant variant in ((ProductFamily)product).Variants) { ExtendedCommercePrice variantExtendedPrice = this.EntityFactory.Create <ExtendedCommercePrice>("Price"); bool hasBasePrice = product.HasProperty("BasePrice"); if (hasBasePrice && variant["BasePriceVariant"] != null) { variantExtendedPrice.Amount = (variant["BasePriceVariant"] as decimal?).Value; } if (!variant.IsListPriceNull()) { variantExtendedPrice.ListPrice = variant.ListPrice; if (!hasBasePrice) { variantExtendedPrice.Amount = variant.ListPrice; } } result.Prices.Add(variant.VariantId.Trim(), variantExtendedPrice); } } } catch (EntityDoesNotExistException e) { result.Success = false; result.SystemMessages.Add(new SystemMessage { Message = e.Message }); } }
public override void Delete(ICatalogRepository repository, InteractionRequest <Confirmation> commonConfirmRequest, InteractionRequest <Notification> errorNotifyRequest, Action onSuccess) { var countBuffer = new List <string>(); // count: categories in Catalog int itemCount = repository.Categories.Where(x => x.CatalogId == InnerItem.CatalogId).Count(); if (itemCount > 0) { countBuffer.Add(string.Format("contains {0} category(ies)".Localize(), itemCount)); } // count: items in Catalog itemCount = repository.Items.Where(x => x.CatalogId == InnerItem.CatalogId).Count(); if (itemCount > 0) { countBuffer.Add(string.Format("has {0} item(s)".Localize(), itemCount)); } var content = string.Empty; var warnings = countBuffer.Select(x => "\n\t- " + x).ToArray(); if (warnings.Length > 0) { content = string.Format("ATTENTION: This Catalog {0}.\n\n".Localize(), string.Join("", warnings)); } content += string.Format("Are you sure you want to delete Catalog '{0}'?".Localize(), DisplayName); var item = LoadItem(InnerItem.CatalogId, repository); var itemVM = _catalogDeleteVmFactory.GetViewModelInstance( new KeyValuePair <string, object>("item", item), new KeyValuePair <string, object>("contentText", content)); var confirmation = new ConditionalConfirmation(itemVM.Validate) { Content = itemVM, Title = "Delete confirmation".Localize(null, LocalizationScope.DefaultCategory) }; commonConfirmRequest.Raise(confirmation, async(x) => { if (x.Confirmed) { await Task.Run(() => { repository.Remove(item); // report status var id = Guid.NewGuid().ToString(); var statusUpdate = new StatusMessage { ShortText = string.Format("A Catalog '{0}' deletion in progress".Localize(), DisplayName), StatusMessageId = id }; EventSystem.Publish(statusUpdate); try { repository.UnitOfWork.Commit(); statusUpdate = new StatusMessage { ShortText = string.Format("A Catalog '{0}' deleted successfully".Localize(), DisplayName), StatusMessageId = id, State = StatusMessageState.Success }; EventSystem.Publish(statusUpdate); } catch (Exception e) { statusUpdate = new StatusMessage { ShortText = string.Format("Failed to delete Catalog '{0}'".Localize(), DisplayName), Details = e.ToString(), StatusMessageId = id, State = StatusMessageState.Error }; EventSystem.Publish(statusUpdate); } }); onSuccess(); } }); }
public _ProductsController(ICatalogRepository catalogRepo) { _catalogRepo = catalogRepo; }
public CatalogService(ICatalogRepository catalogRepository) { _catalogRepository = catalogRepository; }
protected OpdsAuthorizationServiceBase(ICatalogRepository catalogRepository, CatalogModel catalogModel) { _catalogRepository = catalogRepository; _catalogModel = catalogModel; }
private Item SetupItem(Item item, string containerId, string propertySetId, ImportItem[] systemValues, IEnumerable <ImportItem> customValues, ICatalogRepository repository, string taxCategory) { var retVal = (Item)InitializeItem(item, systemValues); retVal.CatalogId = containerId; var propSet = repository.PropertySets.Expand("PropertySetProperties/Property/PropertyValues").Where(x => x.PropertySetId == propertySetId).First(); var resProps = InitializeProperties(propSet.PropertySetProperties.ToArray(), customValues, retVal.ItemId); retVal.ItemPropertyValues.Add(resProps); retVal.PropertySetId = propSet.PropertySetId; if (!string.IsNullOrEmpty(taxCategory)) { var cat = repository.TaxCategories.Where(x => x.TaxCategoryId == taxCategory || x.Name == taxCategory).FirstOrDefault(); retVal.TaxCategory = cat != null ? cat.TaxCategoryId : null; } if (!string.IsNullOrEmpty(systemValues.First(x => x.Name == "ItemAsset").Value)) { var itemAsset = new ItemAsset { AssetType = "image", ItemId = retVal.ItemId, AssetId = systemValues.First(x => x.Name == "ItemAsset").Value, GroupName = "primaryimage" }; retVal.ItemAssets.Add(itemAsset); } if (!string.IsNullOrEmpty(systemValues.First(x => x.Name == "EditorialReview").Value)) { var editorial = new CatalogEntityFactory().CreateEntity <EditorialReview>(); editorial.ReviewState = (int)ReviewState.Active; editorial.Content = systemValues.First(x => x.Name == "EditorialReview").Value; editorial.ItemId = retVal.ItemId; retVal.EditorialReviews.Add(editorial); } return(retVal); }
private static string SetupCategoryRelation(string categoryId, string catalogId, ICatalogRepository repository, Item item) { var retVal = string.Empty; if (categoryId != null) { var category = repository.Categories.Where( cat => cat.CatalogId == catalogId && (cat.CategoryId == categoryId || cat.Code == categoryId)) .FirstOrDefault(); if (category != null) { var relation = new CatalogEntityFactory().CreateEntity <CategoryItemRelation>(); relation.CatalogId = catalogId; relation.ItemId = item.ItemId; relation.CategoryId = category.CategoryId; repository.Add(relation); } else { retVal = string.Format(noCategoryError, categoryId, item.Code); } } return(retVal); }
public CalculateTaxActivity(ICatalogRepository catalogRepository, ITaxRepository taxRepository, ICacheRepository cacheRepository) { _catalogRepository = catalogRepository; _taxRepository = taxRepository; _cacheRepository = cacheRepository; }
public ImportJobViewModelNew( NavigationManager navManager, ICatalogEntityFactory entityFactory, ICatalogRepository catalogRepository, IImportRepository importRepository, ImportJob item, WizardViewModelBare parentVM, IColumnMappingEditViewModel mappingEditVM, IColumnMappingViewModel columnMappingVM, IImportService importService, IPickAssetViewModel pickAssetVM, bool isSingleDialogEditing) { _entityFactory = entityFactory; InnerItem = _originalItem = item; _parentViewModel = parentVM; IsSingleDialogEditing = isSingleDialogEditing; _itemRepository = importRepository; _mappingEditVM = mappingEditVM; _columnMappingVM = columnMappingVM; _pickAssetVM = pickAssetVM; _importService = importService; _catalogRepository = catalogRepository; ViewTitle = new ViewTitleBase() { Title = "Import job", SubTitle = DisplayName.ToUpper() }; if (isSingleDialogEditing) { _originalItem = InnerItem; OpenItemCommand = new DelegateCommand(() => { NavigationData = new NavigationItem(InnerItem.ImportJobId, NavigationNames.HomeName, NavigationNames.MenuName, this); navManager.Navigate(NavigationData); }); CancelCommand = new DelegateCommand <object>(OnCancelCommand); SaveChangesCommand = new DelegateCommand <object>((x) => OnSaveChangesCommand(), (x) => { return(IsModified); }); MinimizeCommand = new DelegateCommand(() => MinimizableViewRequestedEvent(this, null)); } else { InitializePropertiesForViewing(); } FilePickCommand = new DelegateCommand(RaiseFilePickInteractionRequest); CreateMappingCommand = new DelegateCommand(RaiseCreateMappingInteractionRequest); CancelConfirmRequest = new InteractionRequest <Confirmation>(); CommonConfirmRequest = new InteractionRequest <Confirmation>(); CommonConfirmRequest2 = new InteractionRequest <Confirmation>(); UpdateImporterCommand = new DelegateCommand <EntityImporterBase>((x) => OnImporterChangesCommand(x)); UpdatePropertySetCommand = new DelegateCommand <PropertySet>((x) => OnPropertySetChangesCommand(x)); CatalogChangedCommand = new DelegateCommand <CatalogBase>((x) => OnCatalogChangesCommand(x)); ItemEditCommand = new DelegateCommand <MappingItem>((x) => RaiseItemEditInteractionRequest(x), x => x != null); ItemClearCommand = new DelegateCommand <MappingItem>((x) => RaiseItemClearInteractionRequest(x), x => x != null); }
public CatalogController(ICatalogRepository catalogRepository, IOptionsSnapshot <AppSettings> settings) { _catalogRepository = catalogRepository; _settings = settings; //string externalBaseUrl = _settings.Value.ExternalBaseUrl; }
public CatalogService(ICatalogRepository repository, AspPostgreSQLContext context, IMapper mapper) { _repository = repository; _context = context; _mapper = mapper; }
public PolicyController(ICatalogRepository policyRepository) { _policyRepository = policyRepository; }
public CategoriesController(ILogger <CategoriesController> logger, ICatalogRepository repository) { _logger = logger; _repository = repository; }
public AppController(IConfigurationRoot config, ICatalogRepository repository) { _config = config; _repository = repository; }
/// <summary> /// Processes the specified arguments. /// </summary> /// <param name="args">The arguments.</param> public override void Process(Commerce.Pipelines.ServicePipelineArgs args) { Assert.ArgumentNotNull(args, "args"); Assert.ArgumentNotNull(args.Request, "args.request"); Assert.ArgumentCondition(args.Request is GetProductPricesRequest, "args.Request", "args.Request is GetProductPricesRequest"); Assert.ArgumentCondition(args.Result is GetProductPricesResult, "args.Result", "args.Result is GetProductPricesResult"); GetProductPricesRequest request = (GetProductPricesRequest)args.Request; GetProductPricesResult result = (GetProductPricesResult)args.Result; Assert.ArgumentNotNull(request.ProductCatalogName, "request.ProductCatalogName"); Assert.ArgumentNotNull(request.ProductId, "request.ProductId"); Assert.ArgumentNotNull(request.PriceTypeIds, "request.PriceTypeIds"); ICatalogRepository catalogRepository = CommerceTypeLoader.CreateInstance <ICatalogRepository>(); bool isList = Array.FindIndex(request.PriceTypeIds as string[], t => t.IndexOf("List", StringComparison.OrdinalIgnoreCase) >= 0) > -1; bool isAdjusted = Array.FindIndex(request.PriceTypeIds as string[], t => t.IndexOf("Adjusted", StringComparison.OrdinalIgnoreCase) >= 0) > -1; try { var product = catalogRepository.GetProductReadOnly(request.ProductCatalogName, request.ProductId); Dictionary <string, Price> prices = new Dictionary <string, Price>(); // BasePrice is a List price and ListPrice is Adjusted price if (isList) { if (product.HasProperty("BasePrice") && product["BasePrice"] != null) { prices.Add("List", new Price { PriceType = "List", Amount = (product["BasePrice"] as decimal?).Value }); } else { // No base price is defined, the List price is set to the actual ListPrice define in the catalog prices.Add("List", new Price { PriceType = "List", Amount = product.ListPrice }); } } if (isAdjusted && !product.IsListPriceNull()) { prices.Add("Adjusted", new Price { PriceType = "Adjusted", Amount = product.ListPrice }); } result.Prices.Add(request.ProductId, prices); if (request.IncludeVariantPrices && product is ProductFamily) { foreach (Variant variant in ((ProductFamily)product).Variants) { Dictionary <string, Price> variantPrices = new Dictionary <string, Price>(); if (isList && product.HasProperty("BasePrice") && variant["BasePriceVariant"] != null) { variantPrices.Add("List", new Price { PriceType = "List", Amount = (variant["BasePriceVariant"] as decimal?).Value }); } if (isAdjusted && !variant.IsListPriceNull()) { variantPrices.Add("Adjusted", new Price { PriceType = "Adjusted", Amount = variant.ListPrice }); } result.Prices.Add(variant.VariantId, variantPrices); } } } catch (CommerceServer.Core.EntityDoesNotExistException e) { result.Success = false; result.SystemMessages.Add(new SystemMessage { Message = e.Message }); } }