コード例 #1
0
        public AccountController(IUserStore<IdentityUser, Guid> userStore, IUnitOfWork unitOfWork)
        {
            _userManager = new UserManager<IdentityUser, Guid>(userStore);
            _pictureService = new PictureService(unitOfWork);
            _userService = new UserService(unitOfWork, _pictureService);

        }
コード例 #2
0
 public ProductCustomizerPlugin(IPictureService pictureService, 
     ISettingService settingService, IWebHelper webHelper)
 {
     this._pictureService = pictureService;
     this._settingService = settingService;
     this._webHelper = webHelper;
 }
コード例 #3
0
ファイル: BlogController.cs プロジェクト: vic0626/nas-merk
        public BlogController(IBlogService blogService, 
            IWorkContext workContext,
            IStoreContext storeContext,
            IPictureService pictureService, 
            ILocalizationService localizationService,
            IDateTimeHelper dateTimeHelper,
            IWorkflowMessageService workflowMessageService, 
            IWebHelper webHelper,
            ICacheManager cacheManager, 
            ICustomerActivityService customerActivityService,
            IStoreMappingService storeMappingService,
            MediaSettings mediaSettings,
            BlogSettings blogSettings,
            LocalizationSettings localizationSettings, 
            CustomerSettings customerSettings,
            CaptchaSettings captchaSettings)
        {
            this._blogService = blogService;
            this._workContext = workContext;
            this._storeContext = storeContext;
            this._pictureService = pictureService;
            this._localizationService = localizationService;
            this._dateTimeHelper = dateTimeHelper;
            this._workflowMessageService = workflowMessageService;
            this._webHelper = webHelper;
            this._cacheManager = cacheManager;
            this._customerActivityService = customerActivityService;
            this._storeMappingService = storeMappingService;

            this._mediaSettings = mediaSettings;
            this._blogSettings = blogSettings;
            this._localizationSettings = localizationSettings;
            this._customerSettings = customerSettings;
            this._captchaSettings = captchaSettings;
        }
コード例 #4
0
 public DessertViewModelManager(IHttpHelper httpHelper, IPictureService pictureService, IDessertService dessertService)
 {
     _httpHelper = httpHelper;
     _pictureService = pictureService;
     _dessertService = dessertService;
     HomePageModelMapper.Init();
 }
コード例 #5
0
 public ReviewService(IReviewRepository reviewRepository, IPictureService pictureService, IPictureRepository pictureRepository, IReviewLinkRepository reviewLinkRepository)
 {
     this.ReviewRepository = reviewRepository;
     this.PictureService = pictureService;
     this.PictureRepository = pictureRepository;
     this.ReviewLinkRepository = reviewLinkRepository;
 }
コード例 #6
0
 public ZelectroBlogLastPostsPlugin(IPictureService pictureService,
     ISettingService settingService, IWebHelper webHelper)
 {
     this._pictureService = pictureService;
     this._settingService = settingService;
     this._webHelper = webHelper;
 }
コード例 #7
0
 public FroogleService(IScheduleTaskService scheduleTaskService,
     IGoogleService googleService,
     IProductService productService,
     ICategoryService categoryService,
     IManufacturerService manufacturerService,
     IPictureService pictureService,
     ICurrencyService currencyService,
     IWebHelper webHelper,
     ISettingService settingService,
     IWorkContext workContext,
     IMeasureService measureService,
     MeasureSettings measureSettings,
     StoreInformationSettings storeInformationSettings,
     FroogleSettings froogleSettings,
     CurrencySettings currencySettings,
     GoogleProductObjectContext objectContext)
 {
     this._scheduleTaskService = scheduleTaskService;
     this._googleService = googleService;
     this._productService = productService;
     this._categoryService = categoryService;
     this._manufacturerService = manufacturerService;
     this._pictureService = pictureService;
     this._currencyService = currencyService;
     this._webHelper = webHelper;
     this._settingService = settingService;
     this._workContext = workContext;
     this._measureService = measureService;
     this._measureSettings = measureSettings;
     this._storeInformationSettings = storeInformationSettings;
     this._froogleSettings = froogleSettings;
     this._currencySettings = currencySettings;
     this._objectContext = objectContext;
 }
コード例 #8
0
ファイル: NivoSliderPlugin.cs プロジェクト: nvolpe/raver
 public NivoSliderPlugin(IPictureService pictureService,
     ISettingService settingService, IWebHelper webHelper)
 {
     this._pictureService = pictureService;
     this._settingService = settingService;
     this._webHelper = webHelper;
 }
コード例 #9
0
 public MiscFacebookShopController(IAclService aclService,
     ICacheManager cacheManager,
     CatalogSettings catalogSettings,
     ICategoryService categoryService,
     ICurrencyService currencyService,
     ILocalizationService localizationService,
     IPermissionService permissionService,
     IPictureService pictureService,
     IPriceCalculationService priceCalculationService,
     IPriceFormatter priceFormatter,
     IProductService productService,
     IStoreContext storeContext,
     IStoreMappingService storeMappingService,
     ITaxService taxService,
     IWorkContext workContext)
 {
     this._aclService = aclService;
     this._cacheManager = cacheManager;
     this._catalogSettings = catalogSettings;
     this._categoryService = categoryService;
     this._currencyService = currencyService;
     this._localizationService = localizationService;
     this._permissionService = permissionService;
     this._pictureService = pictureService;
     this._priceCalculationService = priceCalculationService;
     this._priceFormatter = priceFormatter;
     this._productService = productService;
     this._storeContext = storeContext;
     this._storeMappingService = storeMappingService;
     this._taxService = taxService;
     this._workContext = workContext;
 }
コード例 #10
0
ファイル: ExportManager.cs プロジェクト: mandocaesar/Mesinku
        public ExportManager(ICategoryService categoryService,
            IManufacturerService manufacturerService,
            IProductService productService,
			IProductAttributeService productAttributeService,
            IProductTemplateService productTemplateService,
            IPictureService pictureService,
            INewsLetterSubscriptionService newsLetterSubscriptionService,
            ILanguageService languageService,
			MediaSettings mediaSettings,
			ICommonServices services,
            IStoreMappingService storeMappingService)
        {
            _categoryService = categoryService;
            _manufacturerService = manufacturerService;
            _productService = productService;
			_productAttributeService = productAttributeService;
			_productTemplateService = productTemplateService;
            _pictureService = pictureService;
            _newsLetterSubscriptionService = newsLetterSubscriptionService;
            _languageService = languageService;
			_mediaSettings = mediaSettings;
			_services = services;
            _storeMappingService = storeMappingService;

			Logger = NullLogger.Instance;
        }
コード例 #11
0
 public ManufacturerController(ICategoryService categoryService, IManufacturerService manufacturerService,
     IManufacturerTemplateService manufacturerTemplateService, IProductService productService,
     ICustomerService customerService, IStoreService storeService,
     IStoreMappingService storeMappingService,
     IUrlRecordService urlRecordService, IPictureService pictureService,
     ILanguageService languageService, ILocalizationService localizationService,
     ILocalizedEntityService localizedEntityService, IExportManager exportManager,
     ICustomerActivityService customerActivityService, IAclService aclService, 
     IPermissionService permissionService,
     AdminAreaSettings adminAreaSettings, CatalogSettings catalogSettings)
 {
     this._categoryService = categoryService;
     this._manufacturerTemplateService = manufacturerTemplateService;
     this._manufacturerService = manufacturerService;
     this._productService = productService;
     this._customerService = customerService;
     this._storeService = storeService;
     this._storeMappingService = storeMappingService;
     this._urlRecordService = urlRecordService;
     this._pictureService = pictureService;
     this._languageService = languageService;
     this._localizationService = localizationService;
     this._localizedEntityService = localizedEntityService;
     this._exportManager = exportManager;
     this._customerActivityService = customerActivityService;
     this._aclService = aclService;
     this._permissionService = permissionService;
     this._adminAreaSettings = adminAreaSettings;
     this._catalogSettings = catalogSettings;
 }
コード例 #12
0
 public SettingController(ISettingService settingService,
     ICountryService countryService, IStateProvinceService stateProvinceService,
     IAddressService addressService, ITaxCategoryService taxCategoryService,
     ICurrencyService currencyService, IPictureService pictureService, 
     ILocalizationService localizationService, IDateTimeHelper dateTimeHelper,
     IOrderService orderService, IEncryptionService encryptionService,
     IThemeProvider themeProvider, ICustomerService customerService, 
     ICustomerActivityService customerActivityService, IPermissionService permissionService,
     IWebHelper webHelper, IFulltextService fulltextService, 
     IMaintenanceService maintenanceService, IStoreService storeService,
     IWorkContext workContext, IGenericAttributeService genericAttributeService)
 {
     this._settingService = settingService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._addressService = addressService;
     this._taxCategoryService = taxCategoryService;
     this._currencyService = currencyService;
     this._pictureService = pictureService;
     this._localizationService = localizationService;
     this._dateTimeHelper = dateTimeHelper;
     this._orderService = orderService;
     this._encryptionService = encryptionService;
     this._themeProvider = themeProvider;
     this._customerService = customerService;
     this._customerActivityService = customerActivityService;
     this._permissionService = permissionService;
     this._webHelper = webHelper;
     this._fulltextService = fulltextService;
     this._maintenanceService = maintenanceService;
     this._storeService = storeService;
     this._workContext = workContext;
     this._genericAttributeService = genericAttributeService;
 }
コード例 #13
0
 public PromoController(
     IPromoUtilities promoUtilities,
     IPriceFormatter priceFormatter,
     IWorkContext workContext,
     PromoSettings promoSettings,
     IProductMappingService productMappingService,
     IProductPromoMappingService productPromoMappingService,
     IPromoDetailService promoDetailService,
     IStoreService storeService,
     IStoreContext storeContext,
     IAttributeValueService attributeValueService,
     ICurrencyService currencyService,
     IPromoPictureService promoPictureService,
     IPictureService pictureService,
     IProductService productService,
     ILocalizationService localizationService)
 {
     this._promoUtilities = promoUtilities;
     this._priceFormatter = priceFormatter;
     this._workContext = workContext;
     this._productMappingService = productMappingService;
     this._productPromoMappingService = productPromoMappingService;
     this._promoDetailService = promoDetailService;
     this._promoSettings = promoSettings;
     this._storeService = storeService;
     this._storeContext = storeContext;
     this._attributeValueService = attributeValueService;
     this._currencyService = currencyService;
     this._promoPictureService = promoPictureService;
     this._pictureService = pictureService;
     this._productService = productService;
     this._localizationService = localizationService;
 }
コード例 #14
0
ファイル: ProductController.cs プロジェクト: pquic/qCommerce
 public ProductController(IProductService productService, 
     IProductTemplateService productTemplateService,
     ICategoryService categoryService, IManufacturerService manufacturerService,
     IWorkContext workContext, ILanguageService languageService, 
     ILocalizationService localizationService, ILocalizedEntityService localizedEntityService,
     ISpecificationAttributeService specificationAttributeService, IPictureService pictureService,
     ITaxCategoryService taxCategoryService, IProductTagService productTagService,
     ICopyProductService copyProductService, IPdfService pdfService,
     IExportManager exportManager, IImportManager importManager,
     ICustomerActivityService customerActivityService,
     IPermissionService permissionService, AdminAreaSettings adminAreaSettings)
 {
     this._productService = productService;
     this._productTemplateService = productTemplateService;
     this._categoryService = categoryService;
     this._manufacturerService = manufacturerService;
     this._workContext = workContext;
     this._languageService = languageService;
     this._localizationService = localizationService;
     this._localizedEntityService = localizedEntityService;
     this._specificationAttributeService = specificationAttributeService;
     this._pictureService = pictureService;
     this._taxCategoryService = taxCategoryService;
     this._productTagService = productTagService;
     this._copyProductService = copyProductService;
     this._pdfService = pdfService;
     this._exportManager = exportManager;
     this._importManager = importManager;
     this._customerActivityService = customerActivityService;
     this._permissionService = permissionService;
     this._adminAreaSettings = adminAreaSettings;
 }
コード例 #15
0
 public DiyGroupController(IPermissionService permissionService,
     IDiyService branchService, 
     ILanguageService languageService, 
     ILocalizationService localizationService, 
     IStoreMappingService storeMappingService, 
     ILocalizedEntityService localizedEntityService, 
     IStoreService storeService,
     IPictureService pictureService, 
     IUrlRecordService urlRecordService, 
     ICustomerActivityService customerActivityService, 
     IWorkContext workContext,
     ICacheManager cacheManager, 
     DiySettings diySettings, 
     IWebHelper webHelper)
 {
     _permissionService = permissionService;
     _diyService = branchService;
     _languageService = languageService;
     _localizationService = localizationService;
     _storeMappingService = storeMappingService;
     _localizedEntityService = localizedEntityService;
     _storeService = storeService;
     _pictureService = pictureService;
     _urlRecordService = urlRecordService;
     _customerActivityService = customerActivityService;
     _workContext = workContext;
     _cacheManager = cacheManager;
     _diySettings = diySettings;
     _webHelper = webHelper;
 }
コード例 #16
0
        public ManageController(
            IUnitOfWorkAsync unitOfWorkAsync,
            ISettingService settingService,
            ICategoryService categoryService,
            IItemService itemService,
            IPictureService pictureService,
            IItemPictureService itemPictureService,
            IOrderService orderService,
            ICustomFieldService customFieldService,
            ICustomFieldCategoryService customFieldCategoryService,
            ICustomFieldItemService customFieldItemService,
            ISettingDictionaryService settingDictionaryService,
            IItemStatService itemStatService,
            DataCacheService dataCacheService,
            SqlDbService sqlDbService)
        {
            _settingService = settingService;
            _settingDictionaryService = settingDictionaryService;

            _categoryService = categoryService;
            _itemService = itemService;
            _pictureService = pictureService;
            _itemPictureService = itemPictureService;
            _orderService = orderService;            
            
            _customFieldService = customFieldService;
            _customFieldCategoryService = customFieldCategoryService;
            _customFieldItemService = customFieldItemService;
            _itemStatService = itemStatService;

            _dataCacheService = dataCacheService;
            _sqlDbService = sqlDbService;

            _unitOfWorkAsync = unitOfWorkAsync;
        }
コード例 #17
0
 public WidgetsNivoSliderController(IPictureService pictureService, 
     NivoSliderSettings nivoSliderSettings, ISettingService settingService)
 {
     this._pictureService = pictureService;
     this._nivoSliderSettings = nivoSliderSettings;
     this._settingService = settingService;
 }
コード例 #18
0
ファイル: ImportManager.cs プロジェクト: mandocaesar/Mesinku
        public ImportManager(
			IProductService productService, 
			ICategoryService categoryService,
            IManufacturerService manufacturerService, 
			IPictureService pictureService,
            IUrlRecordService urlRecordService,
			SeoSettings seoSettings,
			IEventPublisher eventPublisher,
			IRepository<Product> rsProduct,
			IRepository<ProductCategory> rsProductCategory,
			IRepository<ProductManufacturer> rsProductManufacturer,
            IRepository<Picture> rsPicture,
			IRepository<ProductPicture> rsProductPicture,
            IRepository<UrlRecord> rsUrlRecord,
            ILanguageService languageService,
            ILocalizedEntityService localizedEntityService,
            IStoreMappingService storeMappingService)
        {
            this._productService = productService;
            this._categoryService = categoryService;
            this._manufacturerService = manufacturerService;
            this._pictureService = pictureService;
            this._urlRecordService = urlRecordService;
            this._seoSettings = seoSettings;
            this._eventPublisher = eventPublisher;
            this._rsProduct = rsProduct;
            this._rsProductCategory = rsProductCategory;
            this._rsProductManufacturer = rsProductManufacturer;
            this._rsProductPicture = rsProductPicture;
            this._rsUrlRecord = rsUrlRecord;
            this._rsPicture = rsPicture;
            this._languageService = languageService;
            this._localizedEntityService = localizedEntityService;
            this._storeMappingService = storeMappingService;
        }
コード例 #19
0
        public NewsController(INewsService newsService, 
            IWorkContext workContext, IPictureService pictureService, ILocalizationService localizationService,
            ICustomerContentService customerContentService, IDateTimeHelper dateTimeHelper,
            IWorkflowMessageService workflowMessageService, IWebHelper webHelper,
            ICacheManager cacheManager, ICustomerActivityService customerActivityService,
            MediaSettings mediaSettings, NewsSettings newsSettings,
            LocalizationSettings localizationSettings, CustomerSettings customerSettings,
            StoreInformationSettings storeInformationSettings, CaptchaSettings captchaSettings)
        {
            this._newsService = newsService;
            this._workContext = workContext;
            this._pictureService = pictureService;
            this._localizationService = localizationService;
            this._customerContentService = customerContentService;
            this._dateTimeHelper = dateTimeHelper;
            this._workflowMessageService = workflowMessageService;
            this._webHelper = webHelper;
            this._cacheManager = cacheManager;
            this._customerActivityService = customerActivityService;

            this._mediaSettings = mediaSettings;
            this._newsSettings = newsSettings;
            this._localizationSettings = localizationSettings;
            this._customerSettings = customerSettings;
            this._storeInformationSettings = storeInformationSettings;
            this._captchaSettings = captchaSettings;
        }
コード例 #20
0
        public static IList<CategoryView> PrepareCategoryViewModels(this IList<Category> categories, 
            IPictureService pictureService, SystemSetting sysSetting, int? pictureSize = null)
        {
            IList<CategoryView> results = new List<CategoryView>();

            foreach (var item in categories)
            {
                CategoryView view = new CategoryView
                {
                    Id = item.Id,
                    Name = item.Name
                };

                // Prepare the picture model
                if (pictureSize.HasValue && pictureService != null && sysSetting != null)
                {
                    //picture
                    var picture = pictureService.GetPicturesByProductId(item.Id, 1).FirstOrDefault();
                    int imageSize = pictureSize > 0 ? pictureSize.Value : sysSetting.DefaultThumbPicSize;

                    // PictureModel
                    PictureModel pictureModel = new PictureModel
                    {
                        ImageUrl = pictureService.GetPictureUrl(picture, imageSize),
                        FullSizeImageUrl = pictureService.GetPictureUrl(picture),
                        Title = string.Format("Show detail for {0}", item.Name),
                        AlternateText = string.Format("Image of {0}", item.Name)
                    };
                    view.PictureModel = pictureModel;
                }
                results.Add(view);
            }
            return results;
        }
コード例 #21
0
 public CopyProductService(IProductService productService,
     IProductAttributeService productAttributeService,
     ILanguageService languageService,
     ILocalizedEntityService localizedEntityService, 
     IPictureService pictureService,
     ICategoryService categoryService, 
     IManufacturerService manufacturerService,
     ISpecificationAttributeService specificationAttributeService,
     IDownloadService downloadService,
     IProductAttributeParser productAttributeParser,
     IUrlRecordService urlRecordService, 
     IStoreMappingService storeMappingService)
 {
     this._productService = productService;
     this._productAttributeService = productAttributeService;
     this._languageService = languageService;
     this._localizedEntityService = localizedEntityService;
     this._pictureService = pictureService;
     this._categoryService = categoryService;
     this._manufacturerService = manufacturerService;
     this._specificationAttributeService = specificationAttributeService;
     this._downloadService = downloadService;
     this._productAttributeParser = productAttributeParser;
     this._urlRecordService = urlRecordService;
     this._storeMappingService = storeMappingService;
 }
コード例 #22
0
 public CategoryController(ICategoryService categoryService, ICategoryTemplateService categoryTemplateService,
     IManufacturerService manufacturerService, IProductService productService, 
     ICustomerService customerService,
     IUrlRecordService urlRecordService, IPictureService pictureService, ILanguageService languageService,
     ILocalizationService localizationService, ILocalizedEntityService localizedEntityService,
     IDiscountService discountService, IPermissionService permissionService,
     IAclService aclService,
     IExportManager exportManager, IWorkContext workContext,
     ICustomerActivityService customerActivityService, AdminAreaSettings adminAreaSettings,
     CatalogSettings catalogSettings)
 {
     this._categoryService = categoryService;
     this._categoryTemplateService = categoryTemplateService;
     this._manufacturerService = manufacturerService;
     this._productService = productService;
     this._customerService = customerService;
     this._urlRecordService = urlRecordService;
     this._pictureService = pictureService;
     this._languageService = languageService;
     this._localizationService = localizationService;
     this._localizedEntityService = localizedEntityService;
     this._discountService = discountService;
     this._permissionService = permissionService;
     this._aclService = aclService;
     this._exportManager = exportManager;
     this._workContext = workContext;
     this._customerActivityService = customerActivityService;
     this._adminAreaSettings = adminAreaSettings;
     this._catalogSettings = catalogSettings;
 }
コード例 #23
0
 public CollectibleExportService(IProductService productService, 
     ICategoryService categoryService,
     IManufacturerService manufacturerService,
     IPictureService pictureService,
     IUrlRecordService urlRecordService,
     IStoreContext storeContext,
     INewsLetterSubscriptionService newsLetterSubscriptionService,
     ICountryService countryService,   //not used
     IStateProvinceService stateProvinceService,
     IConsignorService consignorService,
     IAuthenticationService authenticationService,
     ILogger logger,
     IRepository<AUCountryLotRecord> countrylotRepo,
     IRepository<AUStateProvinceLotRecord> stateprovincelotRepo
     )
 {
     this._productService = productService;
     this._categoryService = categoryService;
     this._manufacturerService = manufacturerService;
     this._pictureService = pictureService;
     this._urlRecordService = urlRecordService;
     this._storeContext = storeContext;
     this._newsLetterSubscriptionService = newsLetterSubscriptionService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._consignorService = consignorService;
     this._authenticationService = authenticationService;
     this._logger = logger;                          //NJM: AUConsignor
     this._countrylotRepo = countrylotRepo;
     this._stateprovincelotRepo = stateprovincelotRepo;
 }
コード例 #24
0
ファイル: PdfService.cs プロジェクト: priceLiu/MulitNop
 public PdfService(ILocalizationService localizationService, IOrderService orderService,
     IPaymentService paymentService,
     IDateTimeHelper dateTimeHelper, IPriceFormatter priceFormatter,
     ICurrencyService currencyService, IMeasureService measureService,
     IPictureService pictureService, IProductService productService, 
     IProductAttributeParser productAttributeParser, IWebHelper webHelper, 
     CatalogSettings catalogSettings, CurrencySettings currencySettings,
     MeasureSettings measureSettings, PdfSettings pdfSettings, TaxSettings taxSettings,
     StoreInformationSettings storeInformationSettings, AddressSettings addressSettings)
 {
     this._localizationService = localizationService;
     this._orderService = orderService;
     this._paymentService = paymentService;
     this._dateTimeHelper = dateTimeHelper;
     this._priceFormatter = priceFormatter;
     this._currencyService = currencyService;
     this._measureService = measureService;
     this._pictureService = pictureService;
     this._productService = productService;
     this._productAttributeParser = productAttributeParser;
     this._webHelper = webHelper;
     this._currencySettings = currencySettings;
     this._catalogSettings = catalogSettings;
     this._measureSettings = measureSettings;
     this._pdfSettings = pdfSettings;
     this._taxSettings = taxSettings;
     this._storeInformationSettings = storeInformationSettings;
     this._addressSettings = addressSettings;
 }
コード例 #25
0
 public FroogleService(IGoogleService googleService,
     IProductService productService,
     ICategoryService categoryService,
     IManufacturerService manufacturerService,
     IPictureService pictureService,
     ICurrencyService currencyService,
     ISettingService settingService,
     IWorkContext workContext,
     IMeasureService measureService,
     MeasureSettings measureSettings,
     FroogleSettings froogleSettings,
     CurrencySettings currencySettings,
     GoogleProductObjectContext objectContext)
 {
     this._googleService = googleService;
     this._productService = productService;
     this._categoryService = categoryService;
     this._manufacturerService = manufacturerService;
     this._pictureService = pictureService;
     this._currencyService = currencyService;
     this._settingService = settingService;
     this._workContext = workContext;
     this._measureService = measureService;
     this._measureSettings = measureSettings;
     this._froogleSettings = froogleSettings;
     this._currencySettings = currencySettings;
     this._objectContext = objectContext;
 }
コード例 #26
0
 public VendorController(ICustomerService customerService, 
     ILocalizationService localizationService,
     IVendorService vendorService, 
     IPermissionService permissionService,
     IUrlRecordService urlRecordService,
     ILanguageService languageService,
     ILocalizedEntityService localizedEntityService,
     VendorSettings vendorSettings,
     IPictureService pictureService,
     IProductService productService,
     IWorkContext workContext,
     IGenericAttributeService genericAttributeService,
     IWorkflowMessageService workflowMessageService)
 {
     this._customerService = customerService;
     this._localizationService = localizationService;
     this._vendorService = vendorService;
     this._permissionService = permissionService;
     this._urlRecordService = urlRecordService;
     this._languageService = languageService;
     this._localizedEntityService = localizedEntityService;
     this._vendorSettings = vendorSettings;
     this._pictureService = pictureService;
     this._productService = productService;
     this._workContext = workContext;
     this._workflowMessageService = workflowMessageService;
     this._genericAttributeService = genericAttributeService;
 }
コード例 #27
0
        public ListingController(
           IUnitOfWorkAsync unitOfWorkAsync,
           ISettingService settingService,
           ICategoryService categoryService,
           IListingService listingService,
           IPictureService pictureService,
           IListingPictureService ListingPictureservice,
           IOrderService orderService,
           ICustomFieldService customFieldService,
           ICustomFieldCategoryService customFieldCategoryService,
           ICustomFieldListingService customFieldListingService,
           ISettingDictionaryService settingDictionaryService,
           IListingStatService ListingStatservice,
           IEmailTemplateService emailTemplateService,
           DataCacheService dataCacheService,
           SqlDbService sqlDbService)
        {
            _settingService = settingService;
            _settingDictionaryService = settingDictionaryService;

            _categoryService = categoryService;
            _listingService = listingService;
            _pictureService = pictureService;
            _ListingPictureservice = ListingPictureservice;
            _orderService = orderService;
            _customFieldService = customFieldService;
            _customFieldCategoryService = customFieldCategoryService;
            _customFieldListingService = customFieldListingService;
            _ListingStatservice = ListingStatservice;
            _emailTemplateService = emailTemplateService;
            _dataCacheService = dataCacheService;
            _sqlDbService = sqlDbService;

            _unitOfWorkAsync = unitOfWorkAsync;
        }
コード例 #28
0
 public mobSocialApiController(IPermissionService permissionService,
     IWorkContext workContext, AdminAreaSettings adminAreaSettings, ILocalizationService localizationService,
     IPictureService pictureService, IMobSocialService socialNetworkService, ICustomerService customerService,
     ICustomerAlbumPictureService customerAlbumPictureService, mobSocialSettings mobSocialSettings, MediaSettings mediaSettings, CustomerSettings customerSettings, 
     ForumSettings forumSettings, RewardPointsSettings rewardPointsSettings, OrderSettings orderSettings,
      IStoreContext storeContext, IWebHelper webHelper, IUrlRecordService urlRecordService, IRepository<UrlRecord> urlRecordRepository,
     ICustomerVideoAlbumService customerVideoAlbumService, CustomerProfileViewService customerProfileViewService)
 {
     _permissionService = permissionService;
     _workContext = workContext;
     _adminAreaSettings = adminAreaSettings;
     _localizationService = localizationService;
     _pictureService = pictureService;
     _socialNetworkService = socialNetworkService;
     _customerService = customerService;
     _customerAlbumPictureService = customerAlbumPictureService;
     _mobSocialSettings = mobSocialSettings;
     _mediaSettings = mediaSettings;
     _customerSettings = customerSettings;
     _forumSettings = forumSettings;
     _rewardPointsSettings = rewardPointsSettings;
     _orderSettings = orderSettings;
     _storeContext = storeContext;
     _webHelper = webHelper;
     _urlRecordService = urlRecordService;
     _urlRecordRepository = urlRecordRepository;
     _customerVideoAlbumService = customerVideoAlbumService;
     _customerProfileViewService = customerProfileViewService;
 }
コード例 #29
0
 public ValuesController(IUserService userSvc, IAlbumService albumSvc, IPostService postSvc, IPictureService pictureSvc)
 {
     _userSvc = userSvc;
     _albumSvc = albumSvc;
     _postSvc = postSvc;
     _pictureSvc = pictureSvc;
 }
コード例 #30
0
 public VkCommunityPlugin(IPictureService pictureService,
     ISettingService settingService, IWebHelper webHelper)
 {
     this._pictureService = pictureService;
     this._settingService = settingService;
     this._webHelper = webHelper;
 }
コード例 #31
0
 public AffiliateEbayController(IWorkContext workContext, IStoreContext storeContext, IStoreService storeService, ISettingService settingService, ILocalizationService localizationService,
                                ICategoryService categoryService, IProductService productService, IPictureService pictureService, IAffiliateEbayService affiliateEbayService, ICacheManager cacheManager,
                                IRepository <CategoryMapping> categoryMappingRecord, IProductMappingService productMappingService, ISpecificationAttributeService specificationAttributeService)
 {
     this._localizationService           = localizationService;
     this._settingService                = settingService;
     this._storeContext                  = storeContext;
     this._storeService                  = storeService;
     this._workContext                   = workContext;
     this._categoryService               = categoryService;
     this._productService                = productService;
     this._pictureService                = pictureService;
     this._affiliateEbayService          = affiliateEbayService;
     this._categoryMappingRecord         = categoryMappingRecord;
     this._cacheManager                  = cacheManager;
     this._productMappingService         = productMappingService;
     this._specificationAttributeService = specificationAttributeService;
 }
コード例 #32
0
 public PictureController(IPictureService pictureService)
 {
     this._pictureService = pictureService;
 }
コード例 #33
0
 public CustomerModelFactory(AddressSettings addressSettings,
                             CaptchaSettings captchaSettings,
                             CatalogSettings catalogSettings,
                             CommonSettings commonSettings,
                             CustomerSettings customerSettings,
                             DateTimeSettings dateTimeSettings,
                             ExternalAuthenticationSettings externalAuthenticationSettings,
                             ForumSettings forumSettings,
                             GdprSettings gdprSettings,
                             IAddressModelFactory addressModelFactory,
                             ICountryService countryService,
                             ICustomerAttributeParser customerAttributeParser,
                             ICustomerAttributeService customerAttributeService,
                             IDateTimeHelper dateTimeHelper,
                             IDownloadService downloadService,
                             IExternalAuthenticationService externalAuthenticationService,
                             IGdprService gdprService,
                             IGenericAttributeService genericAttributeService,
                             ILocalizationService localizationService,
                             INewsLetterSubscriptionService newsLetterSubscriptionService,
                             IOrderService orderService,
                             IPictureService pictureService,
                             IReturnRequestService returnRequestService,
                             IStateProvinceService stateProvinceService,
                             IStoreContext storeContext,
                             IStoreMappingService storeMappingService,
                             IUrlRecordService urlRecordService,
                             IWorkContext workContext,
                             MediaSettings mediaSettings,
                             OrderSettings orderSettings,
                             RewardPointsSettings rewardPointsSettings,
                             SecuritySettings securitySettings,
                             TaxSettings taxSettings,
                             VendorSettings vendorSettings)
 {
     this._addressSettings  = addressSettings;
     this._captchaSettings  = captchaSettings;
     this._catalogSettings  = catalogSettings;
     this._commonSettings   = commonSettings;
     this._customerSettings = customerSettings;
     this._dateTimeSettings = dateTimeSettings;
     this._externalAuthenticationSettings = externalAuthenticationSettings;
     this._forumSettings                 = forumSettings;
     this._gdprSettings                  = gdprSettings;
     this._addressModelFactory           = addressModelFactory;
     this._countryService                = countryService;
     this._customerAttributeParser       = customerAttributeParser;
     this._customerAttributeService      = customerAttributeService;
     this._dateTimeHelper                = dateTimeHelper;
     this._downloadService               = downloadService;
     this._externalAuthenticationService = externalAuthenticationService;
     this._gdprService                   = gdprService;
     this._genericAttributeService       = genericAttributeService;
     this._localizationService           = localizationService;
     this._newsLetterSubscriptionService = newsLetterSubscriptionService;
     this._orderService                  = orderService;
     this._pictureService                = pictureService;
     this._returnRequestService          = returnRequestService;
     this._stateProvinceService          = stateProvinceService;
     this._storeContext                  = storeContext;
     this._storeMappingService           = storeMappingService;
     this._urlRecordService              = urlRecordService;
     this._workContext                   = workContext;
     this._mediaSettings                 = mediaSettings;
     this._orderSettings                 = orderSettings;
     this._rewardPointsSettings          = rewardPointsSettings;
     this._securitySettings              = securitySettings;
     this._taxSettings                   = taxSettings;
     this._vendorSettings                = vendorSettings;
 }
コード例 #34
0
        public static IEnumerable <ProductOverviewModel> PrepareProductOverviewModels(this Controller controller,
                                                                                      IWorkContext workContext,
                                                                                      IStoreContext storeContext,
                                                                                      ICategoryService categoryService,
                                                                                      IProductService productService,
                                                                                      ISpecificationAttributeService specificationAttributeService,
                                                                                      IPriceCalculationService priceCalculationService,
                                                                                      IPriceFormatter priceFormatter,
                                                                                      IPermissionService permissionService,
                                                                                      ILocalizationService localizationService,
                                                                                      ITaxService taxService,
                                                                                      ICurrencyService currencyService,
                                                                                      IPictureService pictureService,
                                                                                      IWebHelper webHelper,
                                                                                      ICacheManager cacheManager,
                                                                                      CatalogSettings catalogSettings,
                                                                                      MediaSettings mediaSettings,
                                                                                      IEnumerable <Product> products,
                                                                                      bool preparePriceModel                 = true, bool preparePictureModel = true,
                                                                                      int?productThumbPictureSize            = null, bool prepareSpecificationAttributes = false,
                                                                                      bool forceRedirectionAfterAddingToCart = false)
        {
            if (products == null)
            {
                throw new ArgumentNullException("products");
            }

            var models = new List <ProductOverviewModel>();

            foreach (var product in products)
            {
                var model = new ProductOverviewModel
                {
                    Id               = product.Id,
                    Name             = product.GetLocalized(x => x.Name),
                    ShortDescription = product.GetLocalized(x => x.ShortDescription),
                    FullDescription  = product.GetLocalized(x => x.FullDescription),
                    SeName           = product.GetSeName(),
                };
                //price
                if (preparePriceModel)
                {
                    #region Prepare product price

                    var priceModel = new ProductOverviewModel.ProductPriceModel
                    {
                        ForceRedirectionAfterAddingToCart = forceRedirectionAfterAddingToCart
                    };

                    switch (product.ProductType)
                    {
                    case ProductType.GroupedProduct:
                    {
                        #region Grouped product

                        var associatedProducts = productService.GetAssociatedProducts(product.Id, storeContext.CurrentStore.Id);

                        switch (associatedProducts.Count)
                        {
                        case 0:
                        {
                            //no associated products
                            //priceModel.DisableBuyButton = true;
                            //priceModel.DisableWishlistButton = true;
                            //compare products
                            priceModel.DisableAddToCompareListButton = !catalogSettings.CompareProductsEnabled;
                            //priceModel.AvailableForPreOrder = false;
                        }
                        break;

                        default:
                        {
                            //we have at least one associated product
                            //priceModel.DisableBuyButton = true;
                            //priceModel.DisableWishlistButton = true;
                            //compare products
                            priceModel.DisableAddToCompareListButton = !catalogSettings.CompareProductsEnabled;
                            //priceModel.AvailableForPreOrder = false;

                            if (permissionService.Authorize(StandardPermissionProvider.DisplayPrices))
                            {
                                //find a minimum possible price
                                decimal?minPossiblePrice = null;
                                Product minPriceProduct  = null;
                                foreach (var associatedProduct in associatedProducts)
                                {
                                    //calculate for the maximum quantity (in case if we have tier prices)
                                    var tmpPrice = priceCalculationService.GetFinalPrice(associatedProduct,
                                                                                         workContext.CurrentCustomer, decimal.Zero, true, int.MaxValue);
                                    if (!minPossiblePrice.HasValue || tmpPrice < minPossiblePrice.Value)
                                    {
                                        minPriceProduct  = associatedProduct;
                                        minPossiblePrice = tmpPrice;
                                    }
                                }
                                if (minPriceProduct != null && !minPriceProduct.CustomerEntersPrice)
                                {
                                    if (minPriceProduct.CallForPrice)
                                    {
                                        priceModel.OldPrice = null;
                                        priceModel.Price    = localizationService.GetResource("Products.CallForPrice");
                                    }
                                    else if (minPossiblePrice.HasValue)
                                    {
                                        //calculate prices
                                        decimal taxRate;
                                        decimal finalPriceBase = taxService.GetProductPrice(minPriceProduct, minPossiblePrice.Value, out taxRate);
                                        decimal finalPrice     = currencyService.ConvertFromPrimaryStoreCurrency(finalPriceBase, workContext.WorkingCurrency);

                                        priceModel.OldPrice   = null;
                                        priceModel.Price      = String.Format(localizationService.GetResource("Products.PriceRangeFrom"), priceFormatter.FormatPrice(finalPrice));
                                        priceModel.PriceValue = finalPrice;
                                    }
                                    else
                                    {
                                        //Actually it's not possible (we presume that minimalPrice always has a value)
                                        //We never should get here
                                        Debug.WriteLine("Cannot calculate minPrice for product #{0}", product.Id);
                                    }
                                }
                            }
                            else
                            {
                                //hide prices
                                priceModel.OldPrice = null;
                                priceModel.Price    = null;
                            }
                        }
                        break;
                        }

                        #endregion
                    }
                    break;

                    case ProductType.SimpleProduct:
                    default:
                    {
                        #region Simple product

                        //add to cart button
                        priceModel.DisableBuyButton = product.DisableBuyButton ||
                                                      !permissionService.Authorize(StandardPermissionProvider.EnableShoppingCart) ||
                                                      !permissionService.Authorize(StandardPermissionProvider.DisplayPrices);

                        //add to wishlist button
                        priceModel.DisableWishlistButton = product.DisableWishlistButton ||
                                                           !permissionService.Authorize(StandardPermissionProvider.EnableWishlist) ||
                                                           !permissionService.Authorize(StandardPermissionProvider.DisplayPrices);
                        //compare products
                        priceModel.DisableAddToCompareListButton = !catalogSettings.CompareProductsEnabled;

                        //rental
                        priceModel.IsRental = product.IsRental;

                        //pre-order
                        if (product.AvailableForPreOrder)
                        {
                            priceModel.AvailableForPreOrder = !product.PreOrderAvailabilityStartDateTimeUtc.HasValue ||
                                                              product.PreOrderAvailabilityStartDateTimeUtc.Value >= DateTime.UtcNow;
                            priceModel.PreOrderAvailabilityStartDateTimeUtc = product.PreOrderAvailabilityStartDateTimeUtc;
                        }

                        //prices
                        if (permissionService.Authorize(StandardPermissionProvider.DisplayPrices))
                        {
                            if (!product.CustomerEntersPrice)
                            {
                                if (product.CallForPrice)
                                {
                                    //call for price
                                    priceModel.OldPrice = null;
                                    priceModel.Price    = localizationService.GetResource("Products.CallForPrice");
                                }
                                else
                                {
                                    //prices

                                    //calculate for the maximum quantity (in case if we have tier prices)
                                    decimal minPossiblePrice = priceCalculationService.GetFinalPrice(product,
                                                                                                     workContext.CurrentCustomer, decimal.Zero, true, int.MaxValue);

                                    decimal taxRate;
                                    decimal oldPriceBase   = taxService.GetProductPrice(product, product.OldPrice, out taxRate);
                                    decimal finalPriceBase = taxService.GetProductPrice(product, minPossiblePrice, out taxRate);

                                    decimal oldPrice   = currencyService.ConvertFromPrimaryStoreCurrency(oldPriceBase, workContext.WorkingCurrency);
                                    decimal finalPrice = currencyService.ConvertFromPrimaryStoreCurrency(finalPriceBase, workContext.WorkingCurrency);

                                    //do we have tier prices configured?
                                    var tierPrices = new List <TierPrice>();
                                    if (product.HasTierPrices)
                                    {
                                        tierPrices.AddRange(product.TierPrices
                                                            .OrderBy(tp => tp.Quantity)
                                                            .ToList()
                                                            .FilterByStore(storeContext.CurrentStore.Id)
                                                            .FilterForCustomer(workContext.CurrentCustomer)
                                                            .RemoveDuplicatedQuantities());
                                    }
                                    //When there is just one tier (with  qty 1),
                                    //there are no actual savings in the list.
                                    bool displayFromMessage = tierPrices.Count > 0 &&
                                                              !(tierPrices.Count == 1 && tierPrices[0].Quantity <= 1);
                                    if (displayFromMessage)
                                    {
                                        priceModel.OldPrice   = null;
                                        priceModel.Price      = String.Format(localizationService.GetResource("Products.PriceRangeFrom"), priceFormatter.FormatPrice(finalPrice));
                                        priceModel.PriceValue = finalPrice;
                                    }
                                    else
                                    {
                                        if (finalPriceBase != oldPriceBase && oldPriceBase != decimal.Zero)
                                        {
                                            priceModel.OldPrice   = priceFormatter.FormatPrice(oldPrice);
                                            priceModel.Price      = priceFormatter.FormatPrice(finalPrice);
                                            priceModel.PriceValue = finalPrice;
                                        }
                                        else
                                        {
                                            priceModel.OldPrice   = null;
                                            priceModel.Price      = priceFormatter.FormatPrice(finalPrice);
                                            priceModel.PriceValue = finalPrice;
                                        }
                                    }
                                    if (product.IsRental)
                                    {
                                        //rental product
                                        priceModel.OldPrice = priceFormatter.FormatRentalProductPeriod(product, priceModel.OldPrice);
                                        priceModel.Price    = priceFormatter.FormatRentalProductPeriod(product, priceModel.Price);
                                    }


                                    //property for German market
                                    //we display tax/shipping info only with "shipping enabled" for this product
                                    //we also ensure this it's not free shipping
                                    priceModel.DisplayTaxShippingInfo = catalogSettings.DisplayTaxShippingInfoProductBoxes &&
                                                                        product.IsShipEnabled &&
                                                                        !product.IsFreeShipping;
                                }
                            }
                        }
                        else
                        {
                            //hide prices
                            priceModel.OldPrice = null;
                            priceModel.Price    = null;
                        }

                        #endregion
                    }
                    break;
                    }

                    model.ProductPrice = priceModel;

                    #endregion
                }

                //picture
                if (preparePictureModel)
                {
                    #region Prepare product picture

                    //If a size has been set in the view, we use it in priority
                    int pictureSize = productThumbPictureSize.HasValue ? productThumbPictureSize.Value : mediaSettings.ProductThumbPictureSize;
                    //prepare picture model
                    var defaultProductPictureCacheKey = string.Format(ModelCacheEventConsumer.PRODUCT_DEFAULTPICTURE_MODEL_KEY, product.Id, pictureSize, true, workContext.WorkingLanguage.Id, webHelper.IsCurrentConnectionSecured(), storeContext.CurrentStore.Id);
                    model.DefaultPictureModel = cacheManager.Get(defaultProductPictureCacheKey, () =>
                    {
                        var picture      = pictureService.GetPicturesByProductId(product.Id, 1).FirstOrDefault();
                        var pictureModel = new PictureModel
                        {
                            ImageUrl         = pictureService.GetPictureUrl(picture, pictureSize),
                            FullSizeImageUrl = pictureService.GetPictureUrl(picture)
                        };
                        //"title" attribute
                        pictureModel.Title = (picture != null && !string.IsNullOrEmpty(picture.TitleAttribute)) ?
                                             picture.TitleAttribute :
                                             string.Format(localizationService.GetResource("Media.Product.ImageLinkTitleFormat"), model.Name);
                        //"alt" attribute
                        pictureModel.AlternateText = (picture != null && !string.IsNullOrEmpty(picture.AltAttribute)) ?
                                                     picture.AltAttribute :
                                                     string.Format(localizationService.GetResource("Media.Product.ImageAlternateTextFormat"), model.Name);

                        return(pictureModel);
                    });

                    #endregion
                }

                //specs
                if (prepareSpecificationAttributes)
                {
                    model.SpecificationAttributeModels = PrepareProductSpecificationModel(controller, workContext,
                                                                                          specificationAttributeService, cacheManager, product);
                }

                //reviews
                model.ReviewOverviewModel = new ProductReviewOverviewModel
                {
                    ProductId            = product.Id,
                    RatingSum            = product.ApprovedRatingSum,
                    TotalReviews         = product.ApprovedTotalReviews,
                    AllowCustomerReviews = product.AllowCustomerReviews
                };

                models.Add(model);
            }
            return(models);
        }
コード例 #35
0
        public CustomerWebService(
            IOpenAuthenticationService openAuthenticationService,
            ICustomerAttributeParser customerAttributeParser,
            ICustomerAttributeService customerAttributeService,
            ILocalizationService localizationService,
            IDateTimeHelper dateTimeHelper,
            INewsLetterSubscriptionService newsLetterSubscriptionService,
            IWorkContext workContext,
            IStoreContext storeContext,
            ICountryService countryService,
            IStateProvinceService stateProvinceService,
            IGenericAttributeService genericAttributeService,
            IWorkflowMessageService workflowMessageService,
            IReturnRequestService returnRequestService,
            IStoreMappingService storeMappingService,
            IAddressWebService addressWebService,
            IOrderService orderService,
            IDownloadService downloadService,
            IPictureService pictureService,

            CustomerSettings customerSettings,
            DateTimeSettings dateTimeSettings,
            TaxSettings taxSettings,
            ForumSettings forumSettings,
            ExternalAuthenticationSettings externalAuthenticationSettings,
            SecuritySettings securitySettings,
            CaptchaSettings captchaSettings,
            RewardPointsSettings rewardPointsSettings,
            OrderSettings orderSettings,
            MediaSettings mediaSettings
            )
        {
            this._openAuthenticationService     = openAuthenticationService;
            this._customerAttributeParser       = customerAttributeParser;
            this._customerAttributeService      = customerAttributeService;
            this._localizationService           = localizationService;
            this._dateTimeHelper                = dateTimeHelper;
            this._newsLetterSubscriptionService = newsLetterSubscriptionService;
            this._workContext             = workContext;
            this._storeContext            = storeContext;
            this._countryService          = countryService;
            this._stateProvinceService    = stateProvinceService;
            this._genericAttributeService = genericAttributeService;
            this._workflowMessageService  = workflowMessageService;
            this._returnRequestService    = returnRequestService;
            this._storeMappingService     = storeMappingService;
            this._addressWebService       = addressWebService;
            this._orderService            = orderService;
            this._downloadService         = downloadService;
            this._pictureService          = pictureService;

            this._customerSettings = customerSettings;
            this._dateTimeSettings = dateTimeSettings;
            this._taxSettings      = taxSettings;
            this._forumSettings    = forumSettings;
            this._externalAuthenticationSettings = externalAuthenticationSettings;
            this._securitySettings     = securitySettings;
            this._captchaSettings      = captchaSettings;
            this._rewardPointsSettings = rewardPointsSettings;
            this._orderSettings        = orderSettings;
            this._mediaSettings        = mediaSettings;
        }
コード例 #36
0
 public ImageController(IPictureService pictureService)
 {
     this.PictureService = pictureService;
 }
コード例 #37
0
        public new void SetUp()
        {
            _pictureService                = MockRepository.GenerateMock <IPictureService>();
            _authenticationService         = MockRepository.GenerateMock <IAuthenticationService>();
            _localizationService           = MockRepository.GenerateMock <ILocalizationService>();
            _workContext                   = MockRepository.GenerateMock <IWorkContext>();
            _vendorService                 = MockRepository.GenerateMock <IVendorService>();
            _productTemplateService        = MockRepository.GenerateMock <IProductTemplateService>();
            _dateRangeService              = MockRepository.GenerateMock <IDateRangeService>();
            _genericAttributeService       = MockRepository.GenerateMock <IGenericAttributeService>();
            _storeService                  = MockRepository.GenerateMock <IStoreService>();
            _productAttributeService       = MockRepository.GenerateMock <IProductAttributeService>();
            _taxCategoryService            = MockRepository.GenerateMock <ITaxCategoryService>();
            _measureService                = MockRepository.GenerateMock <IMeasureService>();
            _catalogSettings               = new CatalogSettings();
            _specificationAttributeService = MockRepository.GenerateMock <ISpecificationAttributeService>();
            _orderSettings                 = new OrderSettings();
            _categoryService               = MockRepository.GenerateMock <ICategoryService>();
            _manufacturerService           = MockRepository.GenerateMock <IManufacturerService>();
            _customerService               = MockRepository.GenerateMock <ICustomerService>();
            _newsLetterSubscriptionService = MockRepository.GenerateMock <INewsLetterSubscriptionService>();
            _productEditorSettings         = new ProductEditorSettings();
            _customerAttributeFormatter    = MockRepository.GenerateMock <ICustomerAttributeFormatter>();

            var httpContextAccessor = MockRepository.GenerateMock <IHttpContextAccessor>();
            var nopEngine           = MockRepository.GenerateMock <NopEngine>();
            var serviceProvider     = MockRepository.GenerateMock <IServiceProvider>();
            var urlRecordService    = MockRepository.GenerateMock <IUrlRecordService>();
            var picture             = new Picture
            {
                Id          = 1,
                SeoFilename = "picture"
            };

            _genericAttributeService.Expect(p => p.GetAttributesForEntity(1, "Customer"))
            .Return(new List <GenericAttribute>
            {
                new GenericAttribute
                {
                    EntityId = 1,
                    Key      = "manufacturer-advanced-mode",
                    KeyGroup = "Customer",
                    StoreId  = 0,
                    Value    = "true"
                }
            });
            _authenticationService.Expect(p => p.GetAuthenticatedCustomer()).Return(GetTestCustomer());
            _pictureService.Expect(p => p.GetPictureById(1)).Return(picture);
            _pictureService.Expect(p => p.GetThumbLocalPath(picture)).Return(@"c:\temp\picture.png");
            _pictureService.Expect(p => p.GetPicturesByProductId(1, 3)).Return(new List <Picture> {
                picture
            });
            _productTemplateService.Expect(p => p.GetAllProductTemplates()).Return(new List <ProductTemplate> {
                new ProductTemplate {
                    Id = 1
                }
            });
            _dateRangeService.Expect(d => d.GetAllDeliveryDates()).Return(new List <DeliveryDate> {
                new DeliveryDate {
                    Id = 1
                }
            });
            _dateRangeService.Expect(d => d.GetAllProductAvailabilityRanges()).Return(new List <ProductAvailabilityRange> {
                new ProductAvailabilityRange {
                    Id = 1
                }
            });
            _taxCategoryService.Expect(t => t.GetAllTaxCategories()).Return(new List <TaxCategory> {
                new TaxCategory()
            });
            _vendorService.Expect(v => v.GetAllVendors(showHidden: true)).Return(new PagedList <Vendor>(new List <Vendor> {
                new Vendor {
                    Id = 1
                }
            }, 0, 10));
            _measureService.Expect(m => m.GetAllMeasureWeights()).Return(new List <MeasureWeight> {
                new MeasureWeight()
            });
            _categoryService.Expect(c => c.GetProductCategoriesByProductId(1, true)).Return(new List <ProductCategory>());
            _manufacturerService.Expect(m => m.GetProductManufacturersByProductId(1, true)).Return(new List <ProductManufacturer>());

            nopEngine.Expect(x => x.ServiceProvider).Return(serviceProvider);
            serviceProvider.Expect(x => x.GetRequiredService(typeof(IGenericAttributeService))).Return(_genericAttributeService);
            serviceProvider.Expect(x => x.GetRequiredService(typeof(IUrlRecordService))).Return(urlRecordService);
            serviceProvider.Expect(x => x.GetRequiredService(typeof(ILocalizationService))).Return(_localizationService);
            serviceProvider.Expect(x => x.GetRequiredService(typeof(IWorkContext))).Return(_workContext);
            serviceProvider.Expect(x => x.GetRequiredService(typeof(IHttpContextAccessor))).Return(httpContextAccessor);

            EngineContext.Replace(nopEngine);
            _exportManager = new ExportManager(_categoryService, _manufacturerService, _customerService, _productAttributeService, _pictureService, _newsLetterSubscriptionService, _storeService, _workContext, _productEditorSettings, _vendorService, _productTemplateService, _dateRangeService, _taxCategoryService, _measureService, _catalogSettings, _genericAttributeService, _customerAttributeFormatter, _orderSettings, _specificationAttributeService);
        }
コード例 #38
0
 public CategoryImageViewComponent(
     SpecificationAttributesSettings specificationAttributesSettings,
     ICustomerService customerService,
     ILanguageService languageService,
     ISettingService settingService,
     IStoreService storeService,
     IWorkContext workContext,
     ILocalizationService localizationService,
     IGenericAttributeService genericAttributeService,
     IVendorService vendorService,
     IProductService productService,
     IStoreContext storeContext,
     ISpecificationAttributeService specificationAttributeService,
     IWebHelper webHelper,
     IPriceFormatter priceFormatter,
     ICurrencyService currencyService,
     CatalogSettings catalogSettings,
     ICategoryService categoryService,
     ICacheManager cacheManager,
     MediaSettings mediaSettings,
     IPriceCalculationService priceCalculationService,
     IPermissionService permissionService,
     ITaxService taxService,
     IPictureService pictureService,
     IMeasureService measureService,
     IUrlRecordService urlRecordService,
     IProductModelFactory productModelFactory,
     IOrderService orderService,
     OrderSettings orderSettings,
     IOrderProcessingService orderProcessingService,
     IProductAttributeParser productAttributeParser,
     ILogger logger,
     ShoppingCartSettings shoppingCartSettings,
     IShoppingCartModelFactory shoppingCartModelFactory)
 {
     _specificationAttributesSettings = specificationAttributesSettings;
     _customerService               = customerService;
     _languageService               = languageService;
     _settingService                = settingService;
     _storeService                  = storeService;
     _localizationService           = localizationService;
     _workContext                   = workContext;
     _genericAttributeService       = genericAttributeService;
     _vendorService                 = vendorService;
     _productService                = productService;
     _storeContext                  = storeContext;
     _specificationAttributeService = specificationAttributeService;
     _webHelper               = webHelper;
     _priceFormatter          = priceFormatter;
     _currencyService         = currencyService;
     _catalogSettings         = catalogSettings;
     _categoryService         = categoryService;
     _cacheManager            = cacheManager;
     _mediaSettings           = mediaSettings;
     _priceCalculationService = priceCalculationService;
     _permissionService       = permissionService;
     _taxService              = taxService;
     _pictureService          = pictureService;
     _measureService          = measureService;
     _urlRecordService        = urlRecordService;
     _productModelFactory     = productModelFactory;
     _orderSettings           = orderSettings;
     _orderProcessingService  = orderProcessingService;
     _orderService            = orderService;
     _productAttributeParser  = productAttributeParser;
     _logger = logger;
     this._shoppingCartSettings     = shoppingCartSettings;
     this._shoppingCartModelFactory = shoppingCartModelFactory;
 }
コード例 #39
0
 public UploadPictureCommand(IUserSessionService userSessionService, IUserService userService, IPictureService pictureService, IAlbumService albumService)
 {
     this.userSessionService = userSessionService;
     this.userService        = userService;
     this.pictureService     = pictureService;
     this.albumService       = albumService;
 }
コード例 #40
0
 public CommonModelFactory(ICategoryService categoryService,
                           IProductService productService,
                           IManufacturerService manufacturerService,
                           ITopicService topicService,
                           ILanguageService languageService,
                           ICurrencyService currencyService,
                           ILocalizationService localizationService,
                           IWorkContext workContext,
                           IStoreContext storeContext,
                           ISitemapGenerator sitemapGenerator,
                           IThemeContext themeContext,
                           IThemeProvider themeProvider,
                           IForumService forumService,
                           IGenericAttributeService genericAttributeService,
                           IWebHelper webHelper,
                           IPermissionService permissionService,
                           IStaticCacheManager cacheManager,
                           IPageHeadBuilder pageHeadBuilder,
                           IPictureService pictureService,
                           IHostingEnvironment hostingEnvironment,
                           IUrlHelperFactory urlHelperFactory,
                           IActionContextAccessor actionContextAccessor,
                           CatalogSettings catalogSettings,
                           StoreInformationSettings storeInformationSettings,
                           CommonSettings commonSettings,
                           BlogSettings blogSettings,
                           NewsSettings newsSettings,
                           ForumSettings forumSettings,
                           LocalizationSettings localizationSettings,
                           CaptchaSettings captchaSettings,
                           VendorSettings vendorSettings,
                           IProductTagService productTagService,
                           DisplayDefaultFooterItemSettings displayDefaultFooterItemSettings)
 {
     this._categoryService         = categoryService;
     this._productService          = productService;
     this._manufacturerService     = manufacturerService;
     this._topicService            = topicService;
     this._languageService         = languageService;
     this._currencyService         = currencyService;
     this._localizationService     = localizationService;
     this._workContext             = workContext;
     this._storeContext            = storeContext;
     this._sitemapGenerator        = sitemapGenerator;
     this._themeContext            = themeContext;
     this._themeProvider           = themeProvider;
     this._forumservice            = forumService;
     this._genericAttributeService = genericAttributeService;
     this._webHelper                        = webHelper;
     this._permissionService                = permissionService;
     this._cacheManager                     = cacheManager;
     this._pageHeadBuilder                  = pageHeadBuilder;
     this._pictureService                   = pictureService;
     this._hostingEnvironment               = hostingEnvironment;
     this._urlHelperFactory                 = urlHelperFactory;
     this._actionContextAccessor            = actionContextAccessor;
     this._catalogSettings                  = catalogSettings;
     this._storeInformationSettings         = storeInformationSettings;
     this._commonSettings                   = commonSettings;
     this._blogSettings                     = blogSettings;
     this._newsSettings                     = newsSettings;
     this._forumSettings                    = forumSettings;
     this._localizationSettings             = localizationSettings;
     this._captchaSettings                  = captchaSettings;
     this._vendorSettings                   = vendorSettings;
     this._productTagService                = productTagService;
     this._displayDefaultFooterItemSettings = displayDefaultFooterItemSettings;
 }
コード例 #41
0
 public UploadPictureCommand(IPictureService pictureService, IAlbumService albumService)
 {
     this.pictureService = pictureService;
     this.albumService   = albumService;
 }
        public new void SetUp()
        {
            #region Test data

            //color (dropdownlist)
            pa1 = new ProductAttribute
            {
                Id   = 1,
                Name = "Color",
            };
            pva1_1 = new ProductVariantAttribute
            {
                Id                   = 11,
                ProductId            = 1,
                TextPrompt           = "Select color:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.DropdownList,
                DisplayOrder         = 1,
                ProductAttribute     = pa1,
                ProductAttributeId   = pa1.Id
            };
            pvav1_1 = new ProductVariantAttributeValue
            {
                Id                        = 11,
                Name                      = "Green",
                DisplayOrder              = 1,
                ProductVariantAttribute   = pva1_1,
                ProductVariantAttributeId = pva1_1.Id
            };
            pvav1_2 = new ProductVariantAttributeValue
            {
                Id                        = 12,
                Name                      = "Red",
                DisplayOrder              = 2,
                ProductVariantAttribute   = pva1_1,
                ProductVariantAttributeId = pva1_1.Id
            };
            pva1_1.ProductVariantAttributeValues.Add(pvav1_1);
            pva1_1.ProductVariantAttributeValues.Add(pvav1_2);

            //custom option (checkboxes)
            pa2 = new ProductAttribute
            {
                Id   = 2,
                Name = "Some custom option",
            };
            pva2_1 = new ProductVariantAttribute
            {
                Id                   = 21,
                ProductId            = 1,
                TextPrompt           = "Select at least one option:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.Checkboxes,
                DisplayOrder         = 2,
                ProductAttribute     = pa2,
                ProductAttributeId   = pa2.Id
            };
            pvav2_1 = new ProductVariantAttributeValue
            {
                Id                        = 21,
                Name                      = "Option 1",
                DisplayOrder              = 1,
                ProductVariantAttribute   = pva2_1,
                ProductVariantAttributeId = pva2_1.Id
            };
            pvav2_2 = new ProductVariantAttributeValue
            {
                Id                        = 22,
                Name                      = "Option 2",
                DisplayOrder              = 2,
                ProductVariantAttribute   = pva2_1,
                ProductVariantAttributeId = pva2_1.Id
            };
            pva2_1.ProductVariantAttributeValues.Add(pvav2_1);
            pva2_1.ProductVariantAttributeValues.Add(pvav2_2);

            //custom text
            pa3 = new ProductAttribute
            {
                Id   = 3,
                Name = "Custom text",
            };
            pva3_1 = new ProductVariantAttribute
            {
                Id                   = 31,
                ProductId            = 1,
                TextPrompt           = "Enter custom text:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.TextBox,
                DisplayOrder         = 1,
                ProductAttribute     = pa1,
                ProductAttributeId   = pa3.Id
            };


            #endregion

            _productAttributeRepo = MockRepository.GenerateMock <IRepository <ProductAttribute> >();
            _productAttributeRepo.Expect(x => x.Table).Return(new List <ProductAttribute>()
            {
                pa1, pa2, pa3
            }.AsQueryable());
            _productAttributeRepo.Expect(x => x.GetById(pa1.Id)).Return(pa1);
            _productAttributeRepo.Expect(x => x.GetById(pa2.Id)).Return(pa2);
            _productAttributeRepo.Expect(x => x.GetById(pa3.Id)).Return(pa3);

            _productVariantAttributeRepo = MockRepository.GenerateMock <IRepository <ProductVariantAttribute> >();
            _productVariantAttributeRepo.Expect(x => x.Table).Return(new List <ProductVariantAttribute>()
            {
                pva1_1, pva2_1, pva3_1
            }.AsQueryable());
            _productVariantAttributeRepo.Expect(x => x.GetById(pva1_1.Id)).Return(pva1_1);
            _productVariantAttributeRepo.Expect(x => x.GetById(pva2_1.Id)).Return(pva2_1);
            _productVariantAttributeRepo.Expect(x => x.GetById(pva3_1.Id)).Return(pva3_1);

            _productVariantAttributeCombinationRepo = MockRepository.GenerateMock <IRepository <ProductVariantAttributeCombination> >();
            _productVariantAttributeCombinationRepo.Expect(x => x.Table).Return(new List <ProductVariantAttributeCombination>().AsQueryable());

            _productVariantAttributeValueRepo = MockRepository.GenerateMock <IRepository <ProductVariantAttributeValue> >();
            _productVariantAttributeValueRepo.Expect(x => x.Table).Return(new List <ProductVariantAttributeValue>()
            {
                pvav1_1, pvav1_2, pvav2_1, pvav2_2
            }.AsQueryable());
            _productVariantAttributeValueRepo.Expect(x => x.GetById(pvav1_1.Id)).Return(pvav1_1);
            _productVariantAttributeValueRepo.Expect(x => x.GetById(pvav1_2.Id)).Return(pvav1_2);
            _productVariantAttributeValueRepo.Expect(x => x.GetById(pvav2_1.Id)).Return(pvav2_1);
            _productVariantAttributeValueRepo.Expect(x => x.GetById(pvav2_2.Id)).Return(pvav2_2);

            _productBundleItemAttributeFilter = MockRepository.GenerateMock <IRepository <ProductBundleItemAttributeFilter> >();

            _eventPublisher = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            _pictureService = MockRepository.GenerateMock <IPictureService>();

            var cacheManager = new NullCache();

            _productAttributeService = new ProductAttributeService(cacheManager,
                                                                   _productAttributeRepo,
                                                                   _productVariantAttributeRepo,
                                                                   _productVariantAttributeCombinationRepo,
                                                                   _productVariantAttributeValueRepo,
                                                                   _productBundleItemAttributeFilter,
                                                                   _eventPublisher,
                                                                   _pictureService);

            _productAttributeParser = new ProductAttributeParser(_productAttributeService);



            var workingLanguage = new Language();
            _workContext = MockRepository.GenerateMock <IWorkContext>();
            _workContext.Expect(x => x.WorkingLanguage).Return(workingLanguage);
            _currencyService     = MockRepository.GenerateMock <ICurrencyService>();
            _localizationService = MockRepository.GenerateMock <ILocalizationService>();
            _localizationService.Expect(x => x.GetResource("GiftCardAttribute.For.Virtual")).Return("For: {0} <{1}>");
            _localizationService.Expect(x => x.GetResource("GiftCardAttribute.From.Virtual")).Return("From: {0} <{1}>");
            _localizationService.Expect(x => x.GetResource("GiftCardAttribute.For.Physical")).Return("For: {0}");
            _localizationService.Expect(x => x.GetResource("GiftCardAttribute.From.Physical")).Return("From: {0}");
            _taxService              = MockRepository.GenerateMock <ITaxService>();
            _priceFormatter          = MockRepository.GenerateMock <IPriceFormatter>();
            _downloadService         = MockRepository.GenerateMock <IDownloadService>();
            _webHelper               = MockRepository.GenerateMock <IWebHelper>();
            _priceCalculationService = MockRepository.GenerateMock <IPriceCalculationService>();
            _shoppingCartSettings    = MockRepository.GenerateMock <ShoppingCartSettings>();

            _productAttributeFormatter = new ProductAttributeFormatter(_workContext,
                                                                       _productAttributeService,
                                                                       _productAttributeParser,
                                                                       _priceCalculationService,
                                                                       _currencyService,
                                                                       _localizationService,
                                                                       _taxService,
                                                                       _priceFormatter,
                                                                       _downloadService,
                                                                       _webHelper,
                                                                       _shoppingCartSettings);
        }
コード例 #43
0
        public CategoryApiService(IMongoDBContext mongoDBContext, ICategoryService categoryService, IUrlRecordService urlRecordService, IPictureService pictureService,
                                  ICustomerActivityService customerActivityService, ILocalizationService localizationService)
        {
            _mongoDBContext          = mongoDBContext;
            _categoryService         = categoryService;
            _urlRecordService        = urlRecordService;
            _pictureService          = pictureService;
            _customerActivityService = customerActivityService;
            _localizationService     = localizationService;

            _category = _mongoDBContext.Database().GetCollection <CategoryDto>(typeof(Core.Domain.Catalog.Category).Name);
        }
コード例 #44
0
 public ProfilesController(IUserService userService, UserManager <User> userManager, IPictureService pictureService, IMemoryCache memoryCache)
 {
     this.userService    = userService;
     this.userManager    = userManager;
     this.pictureService = pictureService;
     this.memoryCache    = memoryCache;
 }
コード例 #45
0
 public CommonModelFactory(BlogSettings blogSettings,
                           CaptchaSettings captchaSettings,
                           CatalogSettings catalogSettings,
                           CommonSettings commonSettings,
                           CustomerSettings customerSettings,
                           DisplayDefaultFooterItemSettings displayDefaultFooterItemSettings,
                           ForumSettings forumSettings,
                           IActionContextAccessor actionContextAccessor,
                           IBlogService blogService,
                           ICategoryService categoryService,
                           ICurrencyService currencyService,
                           ICustomerService customerService,
                           IForumService forumService,
                           IGenericAttributeService genericAttributeService,
                           IHttpContextAccessor httpContextAccessor,
                           ILanguageService languageService,
                           ILocalizationService localizationService,
                           IManufacturerService manufacturerService,
                           INewsService newsService,
                           INopFileProvider fileProvider,
                           INopHtmlHelper nopHtmlHelper,
                           IPermissionService permissionService,
                           IPictureService pictureService,
                           IProductService productService,
                           IProductTagService productTagService,
                           IShoppingCartService shoppingCartService,
                           ISitemapGenerator sitemapGenerator,
                           IStaticCacheManager staticCacheManager,
                           IStoreContext storeContext,
                           IThemeContext themeContext,
                           IThemeProvider themeProvider,
                           ITopicService topicService,
                           IUrlHelperFactory urlHelperFactory,
                           IUrlRecordService urlRecordService,
                           IWebHelper webHelper,
                           IWorkContext workContext,
                           LocalizationSettings localizationSettings,
                           MediaSettings mediaSettings,
                           NewsSettings newsSettings,
                           SitemapSettings sitemapSettings,
                           SitemapXmlSettings sitemapXmlSettings,
                           StoreInformationSettings storeInformationSettings,
                           VendorSettings vendorSettings)
 {
     _blogSettings     = blogSettings;
     _captchaSettings  = captchaSettings;
     _catalogSettings  = catalogSettings;
     _commonSettings   = commonSettings;
     _customerSettings = customerSettings;
     _displayDefaultFooterItemSettings = displayDefaultFooterItemSettings;
     _forumSettings           = forumSettings;
     _actionContextAccessor   = actionContextAccessor;
     _blogService             = blogService;
     _categoryService         = categoryService;
     _currencyService         = currencyService;
     _customerService         = customerService;
     _forumService            = forumService;
     _genericAttributeService = genericAttributeService;
     _httpContextAccessor     = httpContextAccessor;
     _languageService         = languageService;
     _localizationService     = localizationService;
     _manufacturerService     = manufacturerService;
     _newsService             = newsService;
     _fileProvider            = fileProvider;
     _nopHtmlHelper           = nopHtmlHelper;
     _permissionService       = permissionService;
     _pictureService          = pictureService;
     _productService          = productService;
     _productTagService       = productTagService;
     _shoppingCartService     = shoppingCartService;
     _sitemapGenerator        = sitemapGenerator;
     _staticCacheManager      = staticCacheManager;
     _storeContext            = storeContext;
     _themeContext            = themeContext;
     _themeProvider           = themeProvider;
     _topicService            = topicService;
     _urlHelperFactory        = urlHelperFactory;
     _urlRecordService        = urlRecordService;
     _webHelper                = webHelper;
     _workContext              = workContext;
     _mediaSettings            = mediaSettings;
     _localizationSettings     = localizationSettings;
     _newsSettings             = newsSettings;
     _sitemapSettings          = sitemapSettings;
     _sitemapXmlSettings       = sitemapXmlSettings;
     _storeInformationSettings = storeInformationSettings;
     _vendorSettings           = vendorSettings;
 }
コード例 #46
0
        internal static void Import(КоммерческаяИнформация source,
                                    ICategoryService categoryService,
                                    ISpecificationAttributeService specificationAttributeService,
                                    IManufacturerService manufacturerService,
                                    IProductService productService,
                                    IUrlRecordService urlRecordService,
                                    IPictureService pictureService,
                                    List <Category> categories,
                                    Dictionary <string, int> categoryMappings,
                                    List <SpecificationAttribute> attributes,
                                    Dictionary <string, int> attributesMappings,
                                    List <Manufacturer> manufacturers,
                                    Dictionary <string, int> manufacturersMappings,
                                    string mappingsFile,
                                    string logFile,
                                    ImportCatalogSettings importSettings)

        {
            logFile.Log("Начало импорта товаров");
            var stats = new[] { 0, 0 };

            var mappings = File.Exists(mappingsFile)
                ? JsonConvert.DeserializeObject <Dictionary <string, int> >(File.ReadAllText(mappingsFile))
                : new Dictionary <string, int>();

            foreach (var prod in source.Каталог.Товары)
            {
                try
                {
                    var product = mappings.ContainsKey(prod.Ид)
                        ? productService.GetProductById(mappings[prod.Ид])
                        : null;

                    var deleted = prod.Статус == "Удален";
                    if (product == null)
                    {
                        product = new Product
                        {
                            CreatedOnUtc        = DateTime.Now,
                            UpdatedOnUtc        = DateTime.Now,
                            ProductType         = ProductType.SimpleProduct,
                            ProductTemplateId   = 1,
                            VisibleIndividually = true,
                            Name                 = prod.Наименование,
                            Sku                  = prod.Артикул,
                            ShortDescription     = prod.Описание,
                            FullDescription      = prod.Описание,
                            AllowCustomerReviews = true,
                            Deleted              = deleted,
                            Published            = !deleted,
                            OrderMinimumQuantity = 1,
                            OrderMaximumQuantity = 10000
                        };
                        productService.InsertProduct(product);
                        var seName = product.ValidateSeName(null, product.Name, true);
                        urlRecordService.SaveSlug(product, seName, 0);
                        //logFile.Log($"Новый товар {product.Name} ({product.Id}): {prod.Ид}");
                        stats[0]++;
                    }
                    else
                    {
                        if (!importSettings.UpdateExisting)
                        {
                            //logFile.Log($"Пропущен товар {product.Name} ({product.Id}): {prod.Ид}");
                            stats[1]++;
                            continue;
                        }
                        product.UpdatedOnUtc = DateTime.Now;
                        product.Deleted      = deleted;
                        product.Published    = !deleted;
                        productService.UpdateProduct(product);
                        //logFile.Log($"Обновлен товар {product.Name} ({product.Id}): {prod.Ид}");
                        stats[1]++;
                    }
                    mappings[prod.Ид] = product.Id;

                    if (importSettings.OverwriteManufacturers)
                    {
                        foreach (var manufacturer in product.ProductManufacturers.ToList())
                        {
                            manufacturerService.DeleteProductManufacturer(manufacturer);
                        }
                    }
                    if (prod.Изготовитель != null && manufacturersMappings.ContainsKey(prod.Изготовитель.Ид))
                    {
                        var manufacturerId = manufacturersMappings[prod.Изготовитель.Ид];
                        var manufacturer   = product.ProductManufacturers.FirstOrDefault(m => m.ManufacturerId == manufacturerId);
                        if (manufacturer == null)
                        {
                            manufacturer = new ProductManufacturer
                            {
                                ProductId      = product.Id,
                                ManufacturerId = manufacturerId
                            };
                            manufacturerService.InsertProductManufacturer(manufacturer);
                            product.ProductManufacturers.Add(manufacturer);
                        }
                    }

                    if (importSettings.OverwriteCategories)
                    {
                        foreach (var category in product.ProductCategories.ToList())
                        {
                            categoryService.DeleteProductCategory(category);
                        }
                    }
                    if (prod.Группы != null && categoryMappings.ContainsKey(prod.Группы.Ид))
                    {
                        var categoryId = categoryMappings[prod.Группы.Ид];
                        var category   = product.ProductCategories.FirstOrDefault(c => c.CategoryId == categoryId);
                        if (category == null)
                        {
                            category = new ProductCategory
                            {
                                ProductId  = product.Id,
                                CategoryId = categoryId
                            };
                            categoryService.InsertProductCategory(category);
                            product.ProductCategories.Add(category);
                        }
                    }

                    if (importSettings.ImportSpecificationAttributes && prod.ЗначенияСвойств != null)
                    {
                        foreach (var attr in prod.ЗначенияСвойств)
                        {
                            if (attributesMappings.ContainsKey(attr.Ид))
                            {
                                var emptyOptionKey = $"{attr.Ид}.";
                                if (attributesMappings.ContainsKey(emptyOptionKey))
                                {
                                    var option = product.ProductSpecificationAttributes
                                                 .FirstOrDefault(a => a.SpecificationAttributeOptionId == attributesMappings[emptyOptionKey]);
                                    if (option == null)
                                    {
                                        option = new ProductSpecificationAttribute
                                        {
                                            ProductId         = product.Id,
                                            ShowOnProductPage = true,
                                            AllowFiltering    = false,
                                            SpecificationAttributeOptionId = attributesMappings[emptyOptionKey],
                                            AttributeType = SpecificationAttributeType.CustomText,
                                            CustomValue   = attr.Значение
                                        };
                                        specificationAttributeService.InsertProductSpecificationAttribute(option);
                                        product.ProductSpecificationAttributes.Add(option);
                                    }
                                    else if (option.CustomValue != attr.Значение)
                                    {
                                        option.CustomValue = attr.Значение;
                                        specificationAttributeService.UpdateProductSpecificationAttribute(option);
                                    }
                                }
                                else
                                {
                                    var optionKey = $"{attr.Ид}.{attr.Значение}";

                                    var option = product.ProductSpecificationAttributes
                                                 .FirstOrDefault(o => o.SpecificationAttributeOptionId == attributesMappings[optionKey]);
                                    if (option == null)
                                    {
                                        var attribute = attributes.FirstOrDefault(a => a.Id == attributesMappings[attr.Ид]);
                                        var optionIds = attribute.SpecificationAttributeOptions.Select(o => o.Id);
                                        var options   = product.ProductSpecificationAttributes
                                                        .Where(a => optionIds.Contains(a.SpecificationAttributeOptionId)).ToList();
                                        if (options != null && options.Count > 0)
                                        {
                                            foreach (var opt in options)
                                            {
                                                product.ProductSpecificationAttributes.Remove(opt);
                                                specificationAttributeService.DeleteProductSpecificationAttribute(opt);
                                            }
                                        }

                                        option = new ProductSpecificationAttribute
                                        {
                                            ProductId         = product.Id,
                                            ShowOnProductPage = true,
                                            AllowFiltering    = true,
                                            SpecificationAttributeOptionId = attributesMappings[optionKey],
                                            AttributeType = SpecificationAttributeType.Option
                                        };
                                        specificationAttributeService.InsertProductSpecificationAttribute(option);
                                        product.ProductSpecificationAttributes.Add(option);
                                    }
                                }
                            }
                        }
                    }

                    if (!string.IsNullOrEmpty(prod.Картинка))
                    {
                        // todo: compare with existing images
                        var picturePath = HttpContext.Current.Request.MapPath($"~/Content/{prod.Картинка}");
                        var picture     = LoadPicture(pictureService, picturePath, product.Name);
                        if (picture != null)
                        {
                            product.ProductPictures.Add(new ProductPicture
                            {
                                DisplayOrder = 1,
                                PictureId    = picture.Id,
                                ProductId    = product.Id
                            });
                        }
                    }

                    File.WriteAllText(mappingsFile, JsonConvert.SerializeObject(mappings, Formatting.Indented), Encoding.UTF8);
                }
                catch (Exception ex)
                {
                    logFile.Log($"Ошибка при обработке товара {prod.Ид} ({prod.Наименование}): {ex}");
                }
            }

            logFile.Log($"Импорт товаров завершен. Добавлено: {stats[0]}. Обновлено: {stats[1]}.");
        }
コード例 #47
0
 public RegionalContentController(IRegionalContentService regionalContentService, ILanguageService languageService,
                                  ILocalizedEntityService localizedEntityService, ILocalizationService localizationService,
                                  IPermissionService permissionService, ISiteService siteService, IPictureService pictureService,
                                  ISiteMappingService siteMappingService)
 {
     this._pictureService         = pictureService;
     this._regionalContentService = regionalContentService;
     this._languageService        = languageService;
     this._localizedEntityService = localizedEntityService;
     this._localizationService    = localizationService;
     this._permissionService      = permissionService;
     this._siteService            = siteService;
     this._siteMappingService     = siteMappingService;
 }
コード例 #48
0
        public static Size GetPictureSize(this IPictureService pictureService, Picture picture)
        {
            var pictureBinary = pictureService.LoadPictureBinary(picture);

            return(pictureService.GetPictureSize(pictureBinary));
        }
コード例 #49
0
ファイル: PictureController.cs プロジェクト: zcuriel/HEB
 public PictureController(IPictureService pictureService,
                          ICategoryService categoryService) : base()
 {
     _pictureService  = pictureService;
     _categoryService = categoryService;
 }
コード例 #50
0
 public GetShoppingCartHandler(
     ICacheManager cacheManager,
     IPaymentService paymentService,
     IProductService productService,
     IPictureService pictureService,
     IProductAttributeParser productAttributeParser,
     ILocalizationService localizationService,
     ICheckoutAttributeFormatter checkoutAttributeFormatter,
     ICurrencyService currencyService,
     IDiscountService discountService,
     IShoppingCartService shoppingCartService,
     ICheckoutAttributeService checkoutAttributeService,
     IPermissionService permissionService,
     ITaxService taxService,
     IPriceFormatter priceFormatter,
     ICheckoutAttributeParser checkoutAttributeParser,
     IDownloadService downloadService,
     ICountryService countryService,
     IWarehouseService warehouseService,
     IProductAttributeFormatter productAttributeFormatter,
     IPriceCalculationService priceCalculationService,
     IDateTimeHelper dateTimeHelper,
     IVendorService vendorService,
     IMediator mediator,
     MediaSettings mediaSettings,
     OrderSettings orderSettings,
     ShoppingCartSettings shoppingCartSettings,
     CatalogSettings catalogSettings,
     ShippingSettings shippingSettings,
     CommonSettings commonSettings)
 {
     _cacheManager               = cacheManager;
     _paymentService             = paymentService;
     _productService             = productService;
     _pictureService             = pictureService;
     _productAttributeParser     = productAttributeParser;
     _localizationService        = localizationService;
     _checkoutAttributeFormatter = checkoutAttributeFormatter;
     _currencyService            = currencyService;
     _discountService            = discountService;
     _shoppingCartService        = shoppingCartService;
     _checkoutAttributeService   = checkoutAttributeService;
     _permissionService          = permissionService;
     _taxService                = taxService;
     _priceFormatter            = priceFormatter;
     _checkoutAttributeParser   = checkoutAttributeParser;
     _downloadService           = downloadService;
     _countryService            = countryService;
     _warehouseService          = warehouseService;
     _productAttributeFormatter = productAttributeFormatter;
     _priceCalculationService   = priceCalculationService;
     _dateTimeHelper            = dateTimeHelper;
     _vendorService             = vendorService;
     _mediator             = mediator;
     _mediaSettings        = mediaSettings;
     _orderSettings        = orderSettings;
     _shoppingCartSettings = shoppingCartSettings;
     _catalogSettings      = catalogSettings;
     _shippingSettings     = shippingSettings;
     _commonSettings       = commonSettings;
 }
コード例 #51
0
 public ArtistsController(IPictureService pictureService, IArtistService artistService)
 {
     _pictureService = pictureService;
     _artistService  = artistService;
 }
コード例 #52
0
        public static IEnumerable <ItemOverviewModel> PrepareItemOverviewModels(this Controller controller,
                                                                                IWorkContext workContext,
                                                                                ICategoryService categoryService,
                                                                                IItemService itemService,
                                                                                ILocalizationService localizationService,
                                                                                IPictureService pictureService,
                                                                                IEnumerable <Item> items,
                                                                                bool preparePriceModel   = true, bool preparePictureModel = true,
                                                                                int?itemThumbPictureSize = null,
                                                                                bool forceRedirectionAfterAddingToCart = false)
        {
            if (items == null)
            {
                throw new ArgumentNullException("items");
            }

            var models = new List <ItemOverviewModel>();

            foreach (var item in items)
            {
                var model = new ItemOverviewModel
                {
                    Id               = item.Id,
                    Name             = item.Name,
                    ShortDescription = item.ShortDescription,
                    FullDescription  = item.FullDescription,
                    ItemType         = item.ItemType,
                };

                // цена
                if (preparePriceModel)
                {
                    var priceModel = new ItemOverviewModel.ItemPriceModel
                    {
                        ForceRedirectionAfterAddingToCart = forceRedirectionAfterAddingToCart
                    };

                    switch (item.ItemType)
                    {
                    case ItemType.AuctionItem:
                    {
                        #region тип товара аукцион
                        // не отображать кнопку добавить в корзину
                        priceModel.DisableBuyButton = true;
                        // отобразить кнопку избранное
                        priceModel.DisableWishlistButton = false;

                        priceModel.BidStep = item.BidStep.ToString();
                        priceModel.Price   = item.InitialPrice.ToString();
                        priceModel.Bids    = item.Bids.ToList();

                        #endregion
                    }
                    break;

                    case ItemType.ShopItem:
                    {
                        #region тип товара магазин

                        // добавить в корзину
                        priceModel.DisableBuyButton = false;
                        // добавить в избранное
                        priceModel.DisableWishlistButton = false;

                        priceModel.Price = item.InitialPrice.ToString();

                        #endregion
                    }
                    break;
                    }

                    model.ItemPrice = priceModel;
                }
                // изображение
                if (preparePictureModel)
                {
                    int pictureSize = itemThumbPictureSize ?? 415;

                    var picture      = pictureService.GetPicturesByItemId(item.Id, 1).FirstOrDefault();
                    var pictureModel = new PictureModel
                    {
                        ImageUrl       = pictureService.GetPictureUrl(picture, pictureSize),
                        FullSizeImgUrl = pictureService.GetPictureUrl(picture)
                    };
                    // "title" attribute
                    pictureModel.Title = (picture != null && !string.IsNullOrEmpty(picture.TitleAttribute))
                        ? picture.TitleAttribute
                        : string.Format(localizationService.GetResource("Media.Product.ImageLinkTitleFormat"),
                                        model.Name);

                    // "alt" attribute
                    pictureModel.AlternateText = (picture != null && !string.IsNullOrEmpty(picture.AltAttribute))
                        ? picture.AltAttribute
                        : string.Format(localizationService.GetResource("Media.Product.ImageAlternateTextFormat"),
                                        model.Name);

                    model.DefaultPictureModel = pictureModel;
                }
                model.AuctionStartDate = item.AuctionStartDate;
                model.AuctionEndDate   = item.AuctionEndDate;


                models.Add(model);
            }
            return(models);
        }
コード例 #53
0
 public HomesController(IHomeService homes, IUserService users, UserManager <User> userManager, IPictureService pictureService, IHomeReviewsService homeReviews)
 {
     this.homes          = homes;
     this.users          = users;
     this.userManager    = userManager;
     this.pictureService = pictureService;
     this.homeReviews    = homeReviews;
 }
コード例 #54
0
        public CustomShoppingCartController(
            CaptchaSettings captchaSettings,
            CustomerSettings customerSettings,
            ICheckoutAttributeParser checkoutAttributeParser,
            ICheckoutAttributeService checkoutAttributeService,
            ICurrencyService currencyService,
            ICustomerActivityService customerActivityService,
            ICustomerService customerService,
            IDiscountService discountService,
            IDownloadService downloadService,
            IGenericAttributeService genericAttributeService,
            IGiftCardService giftCardService,
            ILocalizationService localizationService,
            INopFileProvider fileProvider,
            INotificationService notificationService,
            IPermissionService permissionService,
            IPictureService pictureService,
            IPriceFormatter priceFormatter,
            IProductAttributeParser productAttributeParser,
            IProductAttributeService productAttributeService,
            IProductService productService,
            IShippingService shippingService,
            IShoppingCartModelFactory shoppingCartModelFactory,
            IShoppingCartService shoppingCartService,
            IStaticCacheManager staticCacheManager,
            IStoreContext storeContext,
            ITaxService taxService,
            IUrlRecordService urlRecordService,
            IWebHelper webHelper,
            IWorkContext workContext,
            IWorkflowMessageService workflowMessageService,
            MediaSettings mediaSettings,
            OrderSettings orderSettings,
            ShoppingCartSettings shoppingCartSettings,
            ShippingSettings shippingSettings,
            // custom
            IAttributeUtilities attributeUtilities,
            IRepository <CustomerShopMapping> customerShopMappingRepository,
            IBackendStockService backendStockService,
            IProductAbcDescriptionService productAbcDescriptionService,
            IWidgetPluginManager widgetPluginManager
            ) : base(captchaSettings, customerSettings, checkoutAttributeParser, checkoutAttributeService,
                     currencyService, customerActivityService, customerService, discountService,
                     downloadService, genericAttributeService, giftCardService, localizationService,
                     fileProvider, notificationService, permissionService, pictureService,
                     priceFormatter, productAttributeParser, productAttributeService, productService,
                     shippingService, shoppingCartModelFactory, shoppingCartService, staticCacheManager,
                     storeContext, taxService, urlRecordService, webHelper,
                     workContext, workflowMessageService, mediaSettings, orderSettings,
                     shoppingCartSettings, shippingSettings)
        {
            _customerActivityService = customerActivityService;
            _localizationService     = localizationService;
            _productAttributeParser  = productAttributeParser;
            _productAttributeService = productAttributeService;
            _productService          = productService;
            _shoppingCartService     = shoppingCartService;
            _shoppingCartSettings    = shoppingCartSettings;
            _storeContext            = storeContext;
            _urlRecordService        = urlRecordService;
            _workContext             = workContext;

            _attributeUtilities            = attributeUtilities;
            _customerShopMappingRepository = customerShopMappingRepository;
            _backendStockService           = backendStockService;
            _productAbcDescriptionService  = productAbcDescriptionService;
            _widgetPluginManager           = widgetPluginManager;
        }
コード例 #55
0
 public ProductController(IProductService productService, IPictureService pictureService)
 {
     _productService = productService;
     _pictureService = pictureService;
 }
コード例 #56
0
 public CreatePictureCommandHandler(IPictureService pictureService, MainDbContext dbContext)
 {
     _pictureService = pictureService;
     _dbContext      = dbContext;
 }
コード例 #57
0
 public CustomerViewModelService(
     IExternalAuthenticationService externalAuthenticationService,
     ICustomerAttributeParser customerAttributeParser,
     ICustomerAttributeService customerAttributeService,
     ILocalizationService localizationService,
     IDateTimeHelper dateTimeHelper,
     INewsLetterSubscriptionService newsLetterSubscriptionService,
     IWorkContext workContext,
     IStoreContext storeContext,
     ICountryService countryService,
     IStateProvinceService stateProvinceService,
     IGenericAttributeService genericAttributeService,
     IWorkflowMessageService workflowMessageService,
     IReturnRequestService returnRequestService,
     IStoreMappingService storeMappingService,
     IAddressViewModelService addressViewModelService,
     IOrderService orderService,
     IDownloadService downloadService,
     IPictureService pictureService,
     IProductService productService,
     IAuctionService auctionService,
     INewsletterCategoryService newsletterCategoryService,
     IServiceProvider serviceProvider,
     CustomerSettings customerSettings,
     DateTimeSettings dateTimeSettings,
     TaxSettings taxSettings,
     ForumSettings forumSettings,
     ExternalAuthenticationSettings externalAuthenticationSettings,
     SecuritySettings securitySettings,
     CaptchaSettings captchaSettings,
     RewardPointsSettings rewardPointsSettings,
     OrderSettings orderSettings,
     MediaSettings mediaSettings,
     VendorSettings vendorSettings
     )
 {
     _externalAuthenticationService = externalAuthenticationService;
     _customerAttributeParser       = customerAttributeParser;
     _customerAttributeService      = customerAttributeService;
     _localizationService           = localizationService;
     _dateTimeHelper = dateTimeHelper;
     _newsLetterSubscriptionService = newsLetterSubscriptionService;
     _workContext                    = workContext;
     _storeContext                   = storeContext;
     _countryService                 = countryService;
     _stateProvinceService           = stateProvinceService;
     _genericAttributeService        = genericAttributeService;
     _workflowMessageService         = workflowMessageService;
     _returnRequestService           = returnRequestService;
     _storeMappingService            = storeMappingService;
     _addressViewModelService        = addressViewModelService;
     _orderService                   = orderService;
     _downloadService                = downloadService;
     _pictureService                 = pictureService;
     _productService                 = productService;
     _auctionService                 = auctionService;
     _newsletterCategoryService      = newsletterCategoryService;
     _serviceProvider                = serviceProvider;
     _customerSettings               = customerSettings;
     _dateTimeSettings               = dateTimeSettings;
     _taxSettings                    = taxSettings;
     _forumSettings                  = forumSettings;
     _externalAuthenticationSettings = externalAuthenticationSettings;
     _securitySettings               = securitySettings;
     _captchaSettings                = captchaSettings;
     _rewardPointsSettings           = rewardPointsSettings;
     _orderSettings                  = orderSettings;
     _mediaSettings                  = mediaSettings;
     _vendorSettings                 = vendorSettings;
 }
コード例 #58
0
 public PictureController(IPictureService pictureService, MediaSettings mediaSettings)
 {
     _pictureService = pictureService;
     _mediaSettings  = mediaSettings;
 }
コード例 #59
0
ファイル: ByerService.cs プロジェクト: mukhaw/DOTNET
 public ByerService(IByerDAL byerDAL, IPictureService pictureService)
 {
     this.ByerDAL        = byerDAL;
     this.PictureService = pictureService;
 }
コード例 #60
0
 public PictureController(it_projektasContext context, IPictureService pictureService, IHttpContextAccessor httpContextAccessor)
 {
     _context             = context;
     _pictureService      = pictureService;
     _httpContextAccessor = httpContextAccessor;
 }