public DiscountController(IDiscountService discountService, 
     ILocalizationService localizationService,
     ICurrencyService currencyService,
     ICategoryService categoryService,
     IProductService productService,
     IWebHelper webHelper, 
     IDateTimeHelper dateTimeHelper,
     ICustomerActivityService customerActivityService, 
     CurrencySettings currencySettings,
     IPermissionService permissionService,
     IWorkContext workContext,
     IManufacturerService manufacturerService,
     IStoreService storeService,
     IVendorService vendorService,
     IOrderService orderService,
     IPriceFormatter priceFormatter)
 {
     this._discountService = discountService;
     this._localizationService = localizationService;
     this._currencyService = currencyService;
     this._categoryService = categoryService;
     this._productService = productService;
     this._webHelper = webHelper;
     this._dateTimeHelper = dateTimeHelper;
     this._customerActivityService = customerActivityService;
     this._currencySettings = currencySettings;
     this._permissionService = permissionService;
     this._workContext = workContext;
     this._manufacturerService = manufacturerService;
     this._storeService = storeService;
     this._vendorService = vendorService;
     this._orderService = orderService;
     this._priceFormatter = priceFormatter;
 }
 public PromoOrderController(
     //IPromoUtilities promoUtilities,
     IPriceFormatter priceFormatter,
     IWorkContext workContext,
     PromoSettings promoSettings,
     IGenericAttributeService genericAttributeService,
     IOrderService orderService,
     IProductMappingService productMappingService,
     ILocalizationService localizationService,
     ICurrencyService currencyService,
     IPromoOrderService promoOrderService,
     IProductService productService)
 {
     //this._promoUtilities = promoUtilities;
     this._priceFormatter = priceFormatter;
     this._workContext = workContext;
     this._genericAttributeService = genericAttributeService;
     this._orderService = orderService;
     this._productMappingService = productMappingService;
     this._localizationService = localizationService;
     this._promoSettings = promoSettings;
     this._currencyService = currencyService;
     this._promoOrderService = promoOrderService;
     this._productService = productService;
 }
Example #3
0
        public CheckoutController(IWorkContext workContext,
            IShoppingCartService shoppingCartService, ILocalizationService localizationService,
            ITaxService taxService, ICurrencyService currencyService,
            IPriceFormatter priceFormatter, IOrderProcessingService orderProcessingService,
            ICustomerService customerService,  ICountryService countryService,
            IStateProvinceService stateProvinceService, IShippingService shippingService,
            IPaymentService paymentService, IOrderTotalCalculationService orderTotalCalculationService,
            ILogger logger, IOrderService orderService, IWebHelper webHelper,
            OrderSettings orderSettings, RewardPointsSettings rewardPointsSettings,
            PaymentSettings paymentSettings)
        {
            this._workContext = workContext;
            this._shoppingCartService = shoppingCartService;
            this._localizationService = localizationService;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._priceFormatter = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._customerService = customerService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._shippingService = shippingService;
            this._paymentService = paymentService;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._logger = logger;
            this._orderService = orderService;
            this._webHelper = webHelper;

            this._orderSettings = orderSettings;
            this._rewardPointsSettings = rewardPointsSettings;
            this._paymentSettings = paymentSettings;
        }
 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;
 }
Example #5
0
 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;
 }
        public ReturnRequestController(IOrderService orderService, 
            IWorkContext workContext, 
            IStoreContext storeContext,
            ICurrencyService currencyService, 
            IPriceFormatter priceFormatter,
            IOrderProcessingService orderProcessingService,
            ILocalizationService localizationService,
            ICustomerService customerService,
            IWorkflowMessageService workflowMessageService,
            IDateTimeHelper dateTimeHelper,
            LocalizationSettings localizationSettings,
            OrderSettings orderSettings)
        {
            this._orderService = orderService;
            this._workContext = workContext;
            this._storeContext = storeContext;
            this._currencyService = currencyService;
            this._priceFormatter = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._localizationService = localizationService;
            this._customerService = customerService;
            this._workflowMessageService = workflowMessageService;
            this._dateTimeHelper = dateTimeHelper;

            this._localizationSettings = localizationSettings;
            this._orderSettings = orderSettings;
        }
Example #7
0
        public OrderController(IOrderService orderService, IWorkContext workContext,
            ICurrencyService currencyService, IPriceFormatter priceFormatter,
            IOrderProcessingService orderProcessingService,
            IDateTimeHelper dateTimeHelper, IMeasureService measureService,
            IPaymentService paymentService, ILocalizationService localizationService,
            IPdfService pdfService, ICustomerService customerService,
            IWorkflowMessageService workflowMessageService, 
            LocalizationSettings localizationSettings,
            MeasureSettings measureSettings, CatalogSettings catalogSettings,
            OrderSettings orderSettings, TaxSettings taxSettings, PdfSettings pdfSettings)
        {
            this._orderService = orderService;
            this._workContext = workContext;
            this._currencyService = currencyService;
            this._priceFormatter = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._dateTimeHelper = dateTimeHelper;
            this._measureService = measureService;
            this._paymentService = paymentService;
            this._localizationService = localizationService;
            this._pdfService = pdfService;
            this._customerService = customerService;
            this._workflowMessageService = workflowMessageService;

            this._localizationSettings = localizationSettings;
            this._measureSettings = measureSettings;
            this._catalogSettings = catalogSettings;
            this._orderSettings = orderSettings;
            this._taxSettings = taxSettings;
            this._pdfSettings = pdfSettings;
        }
        public MessageTokenProvider(ILanguageService languageService,
            ILocalizationService localizationService, IDateTimeHelper dateTimeHelper,
            IEmailAccountService emailAccountService,
            IPriceFormatter priceFormatter, ICurrencyService currencyService,IWebHelper webHelper,
            IWorkContext workContext, IDownloadService downloadService,
            IOrderService orderService, IPaymentService paymentService,
            IProductAttributeParser productAttributeParser,
            MessageTemplatesSettings templatesSettings,
            EmailAccountSettings emailAccountSettings, CatalogSettings catalogSettings,
            TaxSettings taxSettings, IEventPublisher eventPublisher)
        {
            this._languageService = languageService;
            this._localizationService = localizationService;
            this._dateTimeHelper = dateTimeHelper;
            this._emailAccountService = emailAccountService;
            this._priceFormatter = priceFormatter;
            this._currencyService = currencyService;
            this._webHelper = webHelper;
            this._workContext = workContext;
            this._downloadService = downloadService;
            this._orderService = orderService;
            this._paymentService = paymentService;
            this._productAttributeParser = productAttributeParser;

            this._templatesSettings = templatesSettings;
            this._emailAccountSettings = emailAccountSettings;
            this._catalogSettings = catalogSettings;
            this._taxSettings = taxSettings;
            this._eventPublisher = eventPublisher;
        }
        public MessageTokenProvider(ILanguageService languageService,
            ILocalizationService localizationService, IDateTimeHelper dateTimeHelper,
            IEmailAccountService emailAccountService,
            IPriceFormatter priceFormatter, ICurrencyService currencyService,IWebHelper webHelper,
            IWorkContext workContext, IDownloadService downloadService,
            IOrderService orderService,
            StoreInformationSettings storeSettings, MessageTemplatesSettings templatesSettings,
            EmailAccountSettings emailAccountSettings, CatalogSettings catalogSettings,
            TaxSettings taxSettings)
        {
            this._languageService = languageService;
            this._localizationService = localizationService;
            this._dateTimeHelper = dateTimeHelper;
            this._emailAccountService = emailAccountService;
            this._priceFormatter = priceFormatter;
            this._currencyService = currencyService;
            this._webHelper = webHelper;
            this._workContext = workContext;
            this._downloadService = downloadService;
            this._orderService = orderService;

            this._storeSettings = storeSettings;
            this._templatesSettings = templatesSettings;
            this._emailAccountSettings = emailAccountSettings;
            this._catalogSettings = catalogSettings;
            this._taxSettings = taxSettings;
        }
        public OrderController(IOrderService orderService, 
            IShipmentService shipmentService, IWorkContext workContext,
            ICurrencyService currencyService, IPriceFormatter priceFormatter,
            IOrderProcessingService orderProcessingService, IDateTimeHelper dateTimeHelper,
            IPaymentService paymentService, ILocalizationService localizationService,
            IPdfService pdfService, IShippingService shippingService,
            ICountryService countryService, IProductAttributeParser productAttributeParser,
            IWebHelper webHelper,
            CatalogSettings catalogSettings, OrderSettings orderSettings,
            TaxSettings taxSettings, PdfSettings pdfSettings,
            ShippingSettings shippingSettings, AddressSettings addressSettings)
        {
            this._orderService = orderService;
            this._shipmentService = shipmentService;
            this._workContext = workContext;
            this._currencyService = currencyService;
            this._priceFormatter = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._dateTimeHelper = dateTimeHelper;
            this._paymentService = paymentService;
            this._localizationService = localizationService;
            this._pdfService = pdfService;
            this._shippingService = shippingService;
            this._countryService = countryService;
            this._productAttributeParser = productAttributeParser;
            this._webHelper = webHelper;

            this._catalogSettings = catalogSettings;
            this._orderSettings = orderSettings;
            this._taxSettings = taxSettings;
            this._pdfSettings = pdfSettings;
            this._shippingSettings = shippingSettings;
            this._addressSettings = addressSettings;
        }
        public CheckoutAttributeFormatter(IWorkContext workContext,
            ICheckoutAttributeService checkoutAttributeService,
            ICheckoutAttributeParser checkoutAttributeParser,
            ICurrencyService currencyService,
            ITaxService taxService,
            IPriceFormatter priceFormatter,
            IDownloadService downloadService,
            IWebHelper webHelper,
            PromoSettings promoSettings,
            IPromoUtilities qixolPromoUtilities,
            IAttributeValueService attributeValueService)
            : base(workContext, checkoutAttributeService, checkoutAttributeParser,
                    currencyService, taxService, priceFormatter,
                    downloadService, webHelper)
        {
            this._workContext = workContext;
            this._checkoutAttributeService = checkoutAttributeService;
            this._checkoutAttributeParser = checkoutAttributeParser;
            this._currencyService = currencyService;
            this._taxService = taxService;
            this._priceFormatter = priceFormatter;
            this._downloadService = downloadService;
            this._webHelper = webHelper;

            this._promoSettings = promoSettings;
            this._qixolPromoUtilities = qixolPromoUtilities;
            this._attributeValueService = attributeValueService;
        }
Example #12
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="sciRepository">Shopping cart repository</param>
 /// <param name="workContext">Work context</param>
 /// <param name="currencyService">Currency service</param>
 /// <param name="productService">Product settings</param>
 /// <param name="localizationService">Localization service</param>
 /// <param name="productAttributeParser">Product attribute parser</param>
 /// <param name="checkoutAttributeService">Checkout attribute service</param>
 /// <param name="checkoutAttributeParser">Checkout attribute parser</param>
 /// <param name="priceFormatter">Price formatter</param>
 /// <param name="customerService">Customer service</param>
 /// <param name="shoppingCartSettings">Shopping cart settings</param>
 /// <param name="eventPublisher">Event publisher</param>
 /// <param name="permissionService">Permission service</param>
 /// <param name="aclService">ACL service</param>
 public ShoppingCartService(IRepository<ShoppingCartItem> sciRepository,
     IWorkContext workContext, ICurrencyService currencyService,
     IProductService productService, ILocalizationService localizationService,
     IProductAttributeParser productAttributeParser,
     ICheckoutAttributeService checkoutAttributeService,
     ICheckoutAttributeParser checkoutAttributeParser,
     IPriceFormatter priceFormatter,
     ICustomerService customerService,
     ShoppingCartSettings shoppingCartSettings,
     IEventPublisher eventPublisher,
     IPermissionService permissionService, 
     IAclService aclService)
 {
     this._sciRepository = sciRepository;
     this._workContext = workContext;
     this._currencyService = currencyService;
     this._productService = productService;
     this._localizationService = localizationService;
     this._productAttributeParser = productAttributeParser;
     this._checkoutAttributeService = checkoutAttributeService;
     this._checkoutAttributeParser = checkoutAttributeParser;
     this._priceFormatter = priceFormatter;
     this._customerService = customerService;
     this._shoppingCartSettings = shoppingCartSettings;
     this._eventPublisher = eventPublisher;
     this._permissionService = permissionService;
     this._aclService = aclService;
 }
 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;
 }
Example #14
0
        public ProductController(
			ICommonServices services,
			IManufacturerService manufacturerService,
			IProductService productService,
			IProductAttributeService productAttributeService,
			IProductAttributeParser productAttributeParser,
			ITaxService taxService,
			ICurrencyService currencyService,
			IPictureService pictureService,
			IPriceCalculationService priceCalculationService, 
			IPriceFormatter priceFormatter,
			ICustomerContentService customerContentService, 
			ICustomerService customerService,
			IShoppingCartService shoppingCartService,
			IRecentlyViewedProductsService recentlyViewedProductsService, 
			IWorkflowMessageService workflowMessageService, 
			IProductTagService productTagService,
			IOrderReportService orderReportService,
			IBackInStockSubscriptionService backInStockSubscriptionService, 
			IAclService aclService,
			IStoreMappingService storeMappingService,
			MediaSettings mediaSettings, 
			CatalogSettings catalogSettings,
			ShoppingCartSettings shoppingCartSettings,
			LocalizationSettings localizationSettings, 
			CaptchaSettings captchaSettings,
			CatalogHelper helper,
            IDownloadService downloadService,
            ILocalizationService localizationService)
        {
            this._services = services;
            this._manufacturerService = manufacturerService;
            this._productService = productService;
            this._productAttributeService = productAttributeService;
            this._productAttributeParser = productAttributeParser;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._pictureService = pictureService;
            this._priceCalculationService = priceCalculationService;
            this._priceFormatter = priceFormatter;
            this._customerContentService = customerContentService;
            this._customerService = customerService;
            this._shoppingCartService = shoppingCartService;
            this._recentlyViewedProductsService = recentlyViewedProductsService;
            this._workflowMessageService = workflowMessageService;
            this._productTagService = productTagService;
            this._orderReportService = orderReportService;
            this._backInStockSubscriptionService = backInStockSubscriptionService;
            this._aclService = aclService;
            this._storeMappingService = storeMappingService;
            this._mediaSettings = mediaSettings;
            this._catalogSettings = catalogSettings;
            this._shoppingCartSettings = shoppingCartSettings;
            this._localizationSettings = localizationSettings;
            this._captchaSettings = captchaSettings;
            this._helper = helper;
            this._downloadService = downloadService;
            this._localizationService = localizationService;
        }
        public CheckoutController(IWorkContext workContext,
            IStoreContext storeContext,
            IStoreMappingService storeMappingService,
            IShoppingCartService shoppingCartService, 
            ILocalizationService localizationService, 
            ITaxService taxService, 
            ICurrencyService currencyService, 
            IPriceFormatter priceFormatter, 
            IOrderProcessingService orderProcessingService,
            ICustomerService customerService, 
            IGenericAttributeService genericAttributeService,
            ICountryService countryService,
            IStateProvinceService stateProvinceService,
            IShippingService shippingService, 
            IPaymentService paymentService,
            IPluginFinder pluginFinder,
            IOrderTotalCalculationService orderTotalCalculationService,
            ILogger logger,
            IOrderService orderService,
            IWebHelper webHelper,
            HttpContextBase httpContext,
            IMobileDeviceHelper mobileDeviceHelper,
            OrderSettings orderSettings, 
            RewardPointsSettings rewardPointsSettings,
            PaymentSettings paymentSettings,
            ShippingSettings shippingSettings,
            AddressSettings addressSettings)
        {
            this._workContext = workContext;
            this._storeContext = storeContext;
            this._storeMappingService = storeMappingService;
            this._shoppingCartService = shoppingCartService;
            this._localizationService = localizationService;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._priceFormatter = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._customerService = customerService;
            this._genericAttributeService = genericAttributeService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._shippingService = shippingService;
            this._paymentService = paymentService;
            this._pluginFinder = pluginFinder;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._logger = logger;
            this._orderService = orderService;
            this._webHelper = webHelper;
            this._httpContext = httpContext;
            this._mobileDeviceHelper = mobileDeviceHelper;

            this._orderSettings = orderSettings;
            this._rewardPointsSettings = rewardPointsSettings;
            this._paymentSettings = paymentSettings;
            this._shippingSettings = shippingSettings;
            this._addressSettings = addressSettings;
        }
Example #16
0
 public OrderController(IOrderService orderService, 
     IShipmentService shipmentService, 
     IWorkContext workContext,
     ICurrencyService currencyService,
     IPriceFormatter priceFormatter,
     IOrderProcessingService orderProcessingService, 
     IDateTimeHelper dateTimeHelper,
     IPaymentService paymentService, 
     ILocalizationService localizationService,
     IPdfService pdfService, 
     IShippingService shippingService,
     ICountryService countryService, 
     IProductAttributeParser productAttributeParser,
     IWebHelper webHelper,
     IDownloadService downloadService,
     IAddressAttributeFormatter addressAttributeFormatter,
     IStoreContext storeContext,
     IOrderTotalCalculationService orderTotalCalculationService,
     IRewardPointsService rewardPointsService,
     IGiftCardService giftCardService,
     CatalogSettings catalogSettings,
     OrderSettings orderSettings,
     TaxSettings taxSettings,
     ShippingSettings shippingSettings, 
     AddressSettings addressSettings,
     RewardPointsSettings rewardPointsSettings,
     PdfSettings pdfSettings)
 {
     this._orderService = orderService;
     this._shipmentService = shipmentService;
     this._workContext = workContext;
     this._currencyService = currencyService;
     this._priceFormatter = priceFormatter;
     this._orderProcessingService = orderProcessingService;
     this._dateTimeHelper = dateTimeHelper;
     this._paymentService = paymentService;
     this._localizationService = localizationService;
     this._pdfService = pdfService;
     this._shippingService = shippingService;
     this._countryService = countryService;
     this._productAttributeParser = productAttributeParser;
     this._webHelper = webHelper;
     this._downloadService = downloadService;
     this._addressAttributeFormatter = addressAttributeFormatter;
     this._storeContext = storeContext;
     this._rewardPointsService = rewardPointsService;
     this._giftCardService = giftCardService;
     this._orderTotalCalculationService = orderTotalCalculationService;
     this._catalogSettings = catalogSettings;
     this._orderSettings = orderSettings;
     this._taxSettings = taxSettings;
     this._shippingSettings = shippingSettings;
     this._addressSettings = addressSettings;
     this._rewardPointsSettings = rewardPointsSettings;
     this._pdfSettings = pdfSettings;
 }
 public ShoppingCartService(IRepository<ShoppingCartItem> sciRepository,
     IWorkContext workContext, IStoreContext storeContext,
     ICurrencyService currencyService,
     IProductService productService, ILocalizationService localizationService,
     IProductAttributeParser productAttributeParser,
     global::Nop.Services.Orders.ICheckoutAttributeService checkoutAttributeService,
     global::Nop.Services.Orders.ICheckoutAttributeParser checkoutAttributeParser,
     IPriceFormatter priceFormatter,
     ICustomerService customerService,
     ShoppingCartSettings shoppingCartSettings,
     IEventPublisher eventPublisher,
     IPermissionService permissionService,
     IAclService aclService,
     IStoreMappingService storeMappingService,
     IGenericAttributeService genericAttributeService,
     IProductAttributeService productAttributeService,
     PromoSettings promoSettings) :
     base( sciRepository,
         workContext,
         storeContext,
         currencyService,
         productService,
         localizationService,
         productAttributeParser,
         checkoutAttributeService,
         checkoutAttributeParser,
         priceFormatter,
         customerService,
         shoppingCartSettings,
         eventPublisher,
         permissionService,
         aclService,
         storeMappingService,
         genericAttributeService,
         productAttributeService)
 {
     this._sciRepository = sciRepository;
     this._workContext = workContext;
     this._storeContext = storeContext;
     this._currencyService = currencyService;
     this._productService = productService;
     this._localizationService = localizationService;
     this._productAttributeParser = productAttributeParser;
     this._checkoutAttributeService = checkoutAttributeService;
     this._checkoutAttributeParser = checkoutAttributeParser;
     this._priceFormatter = priceFormatter;
     this._customerService = customerService;
     this._shoppingCartSettings = shoppingCartSettings;
     this._eventPublisher = eventPublisher;
     this._permissionService = permissionService;
     this._aclService = aclService;
     this._storeMappingService = storeMappingService;
     this._genericAttributeService = genericAttributeService;
     this._productAttributeService = productAttributeService;
     this._promoSettings = promoSettings;
 }
 public PdfService(ILocalizationService localizationService,
     ILanguageService languageService,
     IWorkContext workContext,
     IOrderService orderService,
     IPaymentService paymentService,
     IDateTimeHelper dateTimeHelper,
     IPriceFormatter priceFormatter,
     ICurrencyService currencyService,
     IMeasureService measureService,
     IPictureService pictureService,
     IProductService productService,
     IProductAttributeParser productAttributeParser,
     IStoreService storeService,
     IStoreContext storeContext,
     ISettingService settingContext,
     IWebHelper webHelper,
     IAddressAttributeFormatter addressAttributeFormatter,
     CatalogSettings catalogSettings,
     CurrencySettings currencySettings,
     MeasureSettings measureSettings,
     PdfSettings pdfSettings,
     TaxSettings taxSettings,
     AddressSettings addressSettings,
     PromoSettings promoSettings,
     IPromoOrderService promoOrderService)
     : base(localizationService, languageService, workContext, orderService, paymentService, dateTimeHelper, priceFormatter,
                                             currencyService, measureService, pictureService, productService, productAttributeParser, storeService, storeContext,
                                             settingContext, webHelper, addressAttributeFormatter, catalogSettings, currencySettings, measureSettings,
                                             pdfSettings, taxSettings, addressSettings)
 {
     this._localizationService = localizationService;
     this._languageService = languageService;
     this._workContext = workContext;
     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._storeService = storeService;
     this._storeContext = storeContext;
     this._settingContext = settingContext;
     this._webHelper = webHelper;
     this._addressAttributeFormatter = addressAttributeFormatter;
     this._currencySettings = currencySettings;
     this._catalogSettings = catalogSettings;
     this._measureSettings = measureSettings;
     this._pdfSettings = pdfSettings;
     this._taxSettings = taxSettings;
     this._addressSettings = addressSettings;
     this._promoSettings = promoSettings;
     this._promoOrderService = promoOrderService;
 }
        public OrderController(IOrderService orderService, 
            IOrderReportService orderReportService, IOrderProcessingService orderProcessingService,
            IDateTimeHelper dateTimeHelper, IPriceFormatter priceFormatter, ILocalizationService localizationService,
            IWorkContext workContext, ICurrencyService currencyService,
            IEncryptionService encryptionService, IPaymentService paymentService,
            IMeasureService measureService, IPdfService pdfService,
            IAddressService addressService, ICountryService countryService,
            IStateProvinceService stateProvinceService, IProductService productService,
            IExportManager exportManager, IPermissionService permissionService,
            IWorkflowMessageService workflowMessageService,
            ICategoryService categoryService, IManufacturerService manufacturerService,
            IProductAttributeService productAttributeService, IProductAttributeParser productAttributeParser,
            IProductAttributeFormatter productAttributeFormatter, IShoppingCartService shoppingCartService,
            IGiftCardService giftCardService, IDownloadService downloadService,
            IShipmentService shipmentService, IStoreService storeService,
            CatalogSettings catalogSettings, CurrencySettings currencySettings, TaxSettings taxSettings,
            MeasureSettings measureSettings, PdfSettings pdfSettings, AddressSettings addressSettings)
        {
            this._orderService = orderService;
            this._orderReportService = orderReportService;
            this._orderProcessingService = orderProcessingService;
            this._dateTimeHelper = dateTimeHelper;
            this._priceFormatter = priceFormatter;
            this._localizationService = localizationService;
            this._workContext = workContext;
            this._currencyService = currencyService;
            this._encryptionService = encryptionService;
            this._paymentService = paymentService;
            this._measureService = measureService;
            this._pdfService = pdfService;
            this._addressService = addressService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._productService = productService;
            this._exportManager = exportManager;
            this._permissionService = permissionService;
            this._workflowMessageService = workflowMessageService;
            this._categoryService = categoryService;
            this._manufacturerService = manufacturerService;
            this._productAttributeService = productAttributeService;
            this._productAttributeParser = productAttributeParser;
            this._productAttributeFormatter = productAttributeFormatter;
            this._shoppingCartService = shoppingCartService;
            this._giftCardService = giftCardService;
            this._downloadService = downloadService;
            this._shipmentService = shipmentService;
            this._storeService = storeService;

            this._catalogSettings = catalogSettings;
            this._currencySettings = currencySettings;
            this._taxSettings = taxSettings;
            this._measureSettings = measureSettings;
            this._pdfSettings = pdfSettings;
            this._addressSettings = addressSettings;
        }
Example #20
0
        public ShoppingCartController(IProductService productService, IWorkContext workContext,
            IShoppingCartService shoppingCartService, IPictureService pictureService,
            ILocalizationService localizationService, IProductAttributeFormatter productAttributeFormatter,
            ITaxService taxService, ICurrencyService currencyService, 
            IPriceCalculationService priceCalculationService, IPriceFormatter priceFormatter,
            ICheckoutAttributeParser checkoutAttributeParser, ICheckoutAttributeFormatter checkoutAttributeFormatter, 
            IOrderProcessingService orderProcessingService,
            IDiscountService discountService,ICustomerService customerService, 
            IGiftCardService giftCardService, ICountryService countryService,
            IStateProvinceService stateProvinceService, IShippingService shippingService, 
            IOrderTotalCalculationService orderTotalCalculationService,
            ICheckoutAttributeService checkoutAttributeService, IPaymentService paymentService,
            IWorkflowMessageService workflowMessageService,
            IPermissionService permissionService, 
            IDownloadService downloadService,
            MediaSettings mediaSetting, ShoppingCartSettings shoppingCartSettings,
            CatalogSettings catalogSettings, OrderSettings orderSettings,
            ShippingSettings shippingSettings, TaxSettings taxSettings,
            CaptchaSettings captchaSettings)
        {
            this._productService = productService;
            this._workContext = workContext;
            this._shoppingCartService = shoppingCartService;
            this._pictureService = pictureService;
            this._localizationService = localizationService;
            this._productAttributeFormatter = productAttributeFormatter;
            this._taxService = taxService;
            this._currencyService = currencyService;
            this._priceCalculationService = priceCalculationService;
            this._priceFormatter = priceFormatter;
            this._checkoutAttributeParser = checkoutAttributeParser;
            this._checkoutAttributeFormatter = checkoutAttributeFormatter;
            this._orderProcessingService = orderProcessingService;
            this._discountService = discountService;
            this._customerService = customerService;
            this._giftCardService = giftCardService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._shippingService = shippingService;
            this._orderTotalCalculationService = orderTotalCalculationService;
            this._checkoutAttributeService = checkoutAttributeService;
            this._paymentService = paymentService;
            this._workflowMessageService = workflowMessageService;
            this._permissionService = permissionService;
            this._downloadService = downloadService;

            this._mediaSetting = mediaSetting;
            this._shoppingCartSettings = shoppingCartSettings;
            this._catalogSettings = catalogSettings;
            this._orderSettings = orderSettings;
            this._shippingSettings = shippingSettings;
            this._taxSettings = taxSettings;
            this._captchaSettings = captchaSettings;
        }
        public MessageTokenProvider(ILanguageService languageService,
            ILocalizationService localizationService,
            IDateTimeHelper dateTimeHelper,
            IPriceFormatter priceFormatter,
            ICurrencyService currencyService,
            IWorkContext workContext,
            IDownloadService downloadService,
            IOrderService orderService,
            IPaymentService paymentService,
            IStoreService storeService,
            IStoreContext storeContext,
            IProductAttributeParser productAttributeParser,
            IAddressAttributeFormatter addressAttributeFormatter,
            MessageTemplatesSettings templatesSettings,
            CatalogSettings catalogSettings,
            TaxSettings taxSettings,
            CurrencySettings currencySettings,
            ShippingSettings shippingSettings,
            IEventPublisher eventPublisher,
            PromoSettings promoSettings,
            IPromoOrderService promoOrderService
            )
            : base(languageService, localizationService,
            dateTimeHelper, priceFormatter, currencyService, workContext,
            downloadService, orderService, paymentService, storeService,
            storeContext, productAttributeParser,
            addressAttributeFormatter, templatesSettings, catalogSettings,
            taxSettings, currencySettings, shippingSettings, eventPublisher)
        {
            this._languageService = languageService;
            this._localizationService = localizationService;
            this._dateTimeHelper = dateTimeHelper;
            this._priceFormatter = priceFormatter;
            this._currencyService = currencyService;
            this._workContext = workContext;
            this._downloadService = downloadService;
            this._orderService = orderService;
            this._paymentService = paymentService;
            this._productAttributeParser = productAttributeParser;
            this._addressAttributeFormatter = addressAttributeFormatter;
            this._storeService = storeService;
            this._storeContext = storeContext;

            this._templatesSettings = templatesSettings;
            this._catalogSettings = catalogSettings;
            this._taxSettings = taxSettings;
            this._currencySettings = currencySettings;
            this._shippingSettings = shippingSettings;
            this._eventPublisher = eventPublisher;

            this._promoSettings = promoSettings;
            this._promoOrderService = promoOrderService;
        }
 public FloorPackController(FloorPackSettings floorPackSettings,
     ISettingService settingService,
     IProductService productService,
     IFloorPackService floorPackService,
     IPriceFormatter priceFormatter)
 {
     _floorPackSettings = floorPackSettings;
     _settingService = settingService;
     _productService = productService;
     _floorPackService = floorPackService;
     _priceFormatter = priceFormatter;
 }
 public ShoppingCartController(ICustomerService customerService,
     IDateTimeHelper dateTimeHelper, IPriceFormatter priceFormatter,
     ITaxService taxService, IPriceCalculationService priceCalculationService,
     IPermissionService permissionService)
 {
     this._customerService = customerService;
     this._dateTimeHelper = dateTimeHelper;
     this._priceFormatter = priceFormatter;
     this._taxService = taxService;
     this._priceCalculationService = priceCalculationService;
     this._permissionService = permissionService;
 }
        /// <summary>
        /// Format base price (PAngV)
        /// </summary>
        /// <param name="product">Product</param>
        /// <param name="productPrice">Product price (in primary currency). Pass null if you want to use a default produce price</param>
        /// <param name="localizationService">Localization service</param>
        /// <param name="measureService">Measure service</param>
        /// <param name="currencyService">Currency service</param>
        /// <param name="workContext">Work context</param>
        /// <param name="priceFormatter">Price formatter</param>
        /// <returns>Base price</returns>
        public static string FormatBasePrice(this Product product, decimal? productPrice, ILocalizationService localizationService,
            IMeasureService measureService, ICurrencyService currencyService,
            IWorkContext workContext, IPriceFormatter priceFormatter)
        {
            if (product == null)
                throw new ArgumentNullException("product");

            if (localizationService == null)
                throw new ArgumentNullException("localizationService");

            if (measureService == null)
                throw new ArgumentNullException("measureService");

            if (currencyService == null)
                throw new ArgumentNullException("currencyService");

            if (workContext == null)
                throw new ArgumentNullException("workContext");

            if (priceFormatter == null)
                throw new ArgumentNullException("priceFormatter");

            if (!product.BasepriceEnabled)
                return null;

            var productAmount = product.BasepriceAmount;
            //Amount in product cannot be 0
            if (productAmount == 0)
                return null;
            var referenceAmount = product.BasepriceBaseAmount;
            var productUnit = measureService.GetMeasureWeightById(product.BasepriceUnitId);
            //measure weight cannot be loaded
            if (productUnit == null)
                return null;
            var referenceUnit = measureService.GetMeasureWeightById(product.BasepriceBaseUnitId);
            //measure weight cannot be loaded
            if (referenceUnit == null)
                return null;

            productPrice = productPrice.HasValue ? productPrice.Value : product.Price;

            decimal basePrice = productPrice.Value /
                //do not round. otherwise, it can cause issues
                measureService.ConvertWeight(productAmount, productUnit, referenceUnit, false) *
                referenceAmount;
            decimal basePriceInCurrentCurrency = currencyService.ConvertFromPrimaryStoreCurrency(basePrice, workContext.WorkingCurrency);
            string basePriceStr = priceFormatter.FormatPrice(basePriceInCurrentCurrency, true, false);

            var result = string.Format(localizationService.GetResource("Products.BasePrice"),
                basePriceStr, referenceAmount.ToString("G29"), referenceUnit.Name);
            return result;
        }
        //private readonly TaxSettings _taxSettings;
        //private readonly AddressSettings _addressSettings;

        #endregion

        #region Ctor

        public PhilatelicPdfService(
            ILocalizationService localizationService,
            ILanguageService languageService,
            IWorkContext workContext,
            //IOrderService orderService,
            //IPaymentService paymentService,
            //IDateTimeHelper dateTimeHelper,
            IPriceFormatter priceFormatter,
            ICurrencyService currencyService,
            IMeasureService measureService,
            IPictureService pictureService,
            IProductService productService, 
            //IProductAttributeParser productAttributeParser,
            //IStoreService storeService,
            //IStoreContext storeContext,
            //ISettingService settingContext,
            IWebHelper webHelper,
            //IAddressAttributeFormatter addressAttributeFormatter,
            //CatalogSettings catalogSettings, 
            CurrencySettings currencySettings,
            MeasureSettings measureSettings,
            PdfSettings pdfSettings
            //TaxSettings taxSettings,
            //AddressSettings addressSettings
            )
        {
            this._localizationService = localizationService;
            //this._languageService = languageService;
            this._workContext = workContext;
            //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._storeService = storeService;
            //this._storeContext = storeContext;
            //this._settingContext = settingContext;
            this._webHelper = webHelper;
            //this._addressAttributeFormatter = addressAttributeFormatter;
            this._currencySettings = currencySettings;
            //this._catalogSettings = catalogSettings;
            this._measureSettings = measureSettings;
            this._pdfSettings = pdfSettings;
            //this._taxSettings = taxSettings;
            //this._addressSettings = addressSettings;
        }
 public CheckoutAttributeFormatter(IWorkContext workContext,
     ICheckoutAttributeService checkoutAttributeService,
     ICheckoutAttributeParser checkoutAttributeParser,
     ICurrencyService currencyService,
     ITaxService taxService,
     IPriceFormatter priceFormatter)
 {
     this._workContext = workContext;
     this._checkoutAttributeService = checkoutAttributeService;
     this._checkoutAttributeParser = checkoutAttributeParser;
     this._currencyService = currencyService;
     this._taxService = taxService;
     this._priceFormatter = priceFormatter;
 }
        public new void SetUp()
        {
            var cacheManager = new NopNullCache();

            _workContext = null;

            _currencySettings = new CurrencySettings();
            var currency1 = new Currency
            {
                Id = 1,
                Name = "Euro",
                CurrencyCode = "EUR",
                DisplayLocale =  "",
                CustomFormatting = "€0.00",
                DisplayOrder = 1,
                Published = true,
                CreatedOnUtc = DateTime.UtcNow,
                UpdatedOnUtc= DateTime.UtcNow
            };
            var currency2 = new Currency
            {
                Id = 1,
                Name = "US Dollar",
                CurrencyCode = "USD",
                DisplayLocale = "en-US",
                CustomFormatting = "",
                DisplayOrder = 2,
                Published = true,
                CreatedOnUtc = DateTime.UtcNow,
                UpdatedOnUtc= DateTime.UtcNow
            };            
            _currencyRepo = MockRepository.GenerateMock<IRepository<Currency>>();
            _currencyRepo.Expect(x => x.Table).Return(new List<Currency>() { currency1, currency2 }.AsQueryable());

            _storeMappingService = MockRepository.GenerateMock<IStoreMappingService>();

            var pluginFinder = new PluginFinder();
            _currencyService = new CurrencyService(cacheManager, _currencyRepo, _storeMappingService,
                _currencySettings, pluginFinder, null);

            _taxSettings = new TaxSettings();

            _localizationService = MockRepository.GenerateMock<ILocalizationService>();
            _localizationService.Expect(x => x.GetResource("Products.InclTaxSuffix", 1, false)).Return("{0} incl tax");
            _localizationService.Expect(x => x.GetResource("Products.ExclTaxSuffix", 1, false)).Return("{0} excl tax");
            
            _priceFormatter = new PriceFormatter(_workContext, _currencyService,_localizationService, 
                _taxSettings, _currencySettings);
        }
        public CatalogController(
			ICommonServices services,
			ICategoryService categoryService,
            IManufacturerService manufacturerService, 
			IProductService productService,
            ICategoryTemplateService categoryTemplateService,
            IManufacturerTemplateService manufacturerTemplateService,
			ICurrencyService currencyService,
			IOrderReportService orderReportService,
			IProductTagService productTagService,
			IRecentlyViewedProductsService recentlyViewedProductsService,
            IPictureService pictureService,
            IPriceFormatter priceFormatter,
            ISpecificationAttributeService specificationAttributeService,
			ICompareProductsService compareProductsService,
			IGenericAttributeService genericAttributeService,
			IAclService aclService,
			IStoreMappingService storeMappingService,
            MediaSettings mediaSettings, 
			CatalogSettings catalogSettings,
			IFilterService filterService,
 			CatalogHelper helper)
        {
            this._services = services;
            this._categoryService = categoryService;
            this._manufacturerService = manufacturerService;
            this._productService = productService;
            this._categoryTemplateService = categoryTemplateService;
            this._manufacturerTemplateService = manufacturerTemplateService;
            this._currencyService = currencyService;
            this._orderReportService = orderReportService;
            this._productTagService = productTagService;
            this._recentlyViewedProductsService = recentlyViewedProductsService;
            this._compareProductsService = compareProductsService;
            this._pictureService = pictureService;
            this._priceFormatter = priceFormatter;
            this._specificationAttributeService = specificationAttributeService;
            this._genericAttributeService = genericAttributeService;
            this._aclService = aclService;
            this._storeMappingService = storeMappingService;
            this._filterService = filterService;
            this._mediaSettings = mediaSettings;
            this._catalogSettings = catalogSettings;

            this._helper = helper;

            T = NullLocalizer.Instance;
        }
Example #29
0
 public AffiliateController(ILocalizationService localizationService,
     IWorkContext workContext, IDateTimeHelper dateTimeHelper, IWebHelper webHelper,
     ICountryService countryService, IStateProvinceService stateProvinceService,
     IPriceFormatter priceFormatter, IAffiliateService affiliateService,
     IPermissionService permissionService)
 {
     this._localizationService = localizationService;
     this._workContext = workContext;
     this._dateTimeHelper = dateTimeHelper;
     this._webHelper = webHelper;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._priceFormatter = priceFormatter;
     this._affiliateService = affiliateService;
     this._permissionService = permissionService;
 }
 public ProductAttributeFormatter(IWorkContext workContext,
     IProductAttributeService productAttributeService,
     IProductAttributeParser productAttributeParser,
     ICurrencyService currencyService,
     ILocalizationService localizationService,
     ITaxService taxService,
     IPriceFormatter priceFormatter)
 {
     this._workContext = workContext;
     this._productAttributeService = productAttributeService;
     this._productAttributeParser = productAttributeParser;
     this._currencyService = currencyService;
     this._localizationService = localizationService;
     this._taxService = taxService;
     this._priceFormatter = priceFormatter;
 }
Example #31
0
 public BackInStockSubscriptionController(CatalogSettings catalogSettings,
                                          CustomerSettings customerSettings,
                                          IBackInStockSubscriptionService backInStockSubscriptionService,
                                          ILocalizationService localizationService,
                                          IProductService productService,
                                          IStoreContext storeContext,
                                          IPriceFormatter priceFormatter,
                                          IPictureService pictureService,
                                          IUrlRecordService urlRecordService,
                                          ICategoryService categoryService,
                                          IWorkContext workContext)
 {
     this._categoryService  = categoryService;
     this._catalogSettings  = catalogSettings;
     this._customerSettings = customerSettings;
     this._backInStockSubscriptionService = backInStockSubscriptionService;
     this._localizationService            = localizationService;
     this._productService   = productService;
     this._pictureService   = pictureService;
     this._priceFormatter   = priceFormatter;
     this._storeContext     = storeContext;
     this._urlRecordService = urlRecordService;
     this._workContext      = workContext;
 }
Example #32
0
 public AffiliateModelFactory(IAddressModelFactory addressModelFactory,
                              IAddressService addressService,
                              IAffiliateService affiliateService,
                              IBaseAdminModelFactory baseAdminModelFactory,
                              ICountryService countryService,
                              ICustomerService customerService,
                              IDateTimeHelper dateTimeHelper,
                              ILocalizationService localizationService,
                              IOrderService orderService,
                              IPriceFormatter priceFormatter,
                              IStateProvinceService stateProvinceService)
 {
     _addressModelFactory   = addressModelFactory;
     _addressService        = addressService;
     _affiliateService      = affiliateService;
     _baseAdminModelFactory = baseAdminModelFactory;
     _countryService        = countryService;
     _customerService       = customerService;
     _dateTimeHelper        = dateTimeHelper;
     _localizationService   = localizationService;
     _orderService          = orderService;
     _priceFormatter        = priceFormatter;
     _stateProvinceService  = stateProvinceService;
 }
Example #33
0
 public ReportModelFactory(IBaseAdminModelFactory baseAdminModelFactory,
                           ICountryService countryService,
                           ICustomerReportService customerReportService,
                           ICustomerService customerService,
                           IDateTimeHelper dateTimeHelper,
                           ILocalizationService localizationService,
                           IOrderReportService orderReportService,
                           IPriceFormatter priceFormatter,
                           IProductAttributeFormatter productAttributeFormatter,
                           IProductService productService,
                           IWorkContext workContext)
 {
     _baseAdminModelFactory     = baseAdminModelFactory;
     _countryService            = countryService;
     _customerReportService     = customerReportService;
     _customerService           = customerService;
     _dateTimeHelper            = dateTimeHelper;
     _localizationService       = localizationService;
     _orderReportService        = orderReportService;
     _priceFormatter            = priceFormatter;
     _productAttributeFormatter = productAttributeFormatter;
     _productService            = productService;
     _workContext = workContext;
 }
Example #34
0
        public ReturnRequestController(
            IOrderService orderService,
            IWorkContext workContext, IStoreContext storeContext,
            ICurrencyService currencyService, IPriceFormatter priceFormatter,
            IOrderProcessingService orderProcessingService,
            ILocalizationService localizationService,
            ICustomerService customerService,
            IWorkflowMessageService workflowMessageService,
            LocalizationSettings localizationSettings,
            OrderSettings orderSettings)
        {
            this._orderService           = orderService;
            this._workContext            = workContext;
            this._storeContext           = storeContext;
            this._currencyService        = currencyService;
            this._priceFormatter         = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._localizationService    = localizationService;
            this._customerService        = customerService;
            this._workflowMessageService = workflowMessageService;

            this._localizationSettings = localizationSettings;
            this._orderSettings        = orderSettings;
        }
Example #35
0
 public ReturnRequestModelFactory(IReturnRequestService returnRequestService,
                                  IOrderService orderService,
                                  IWorkContext workContext,
                                  IStoreContext storeContext,
                                  ICurrencyService currencyService,
                                  IPriceFormatter priceFormatter,
                                  ILocalizationService localizationService,
                                  IDateTimeHelper dateTimeHelper,
                                  IDownloadService downloadService,
                                  OrderSettings orderSettings,
                                  IStaticCacheManager cacheManager)
 {
     this._returnRequestService = returnRequestService;
     this._orderService         = orderService;
     this._workContext          = workContext;
     this._storeContext         = storeContext;
     this._currencyService      = currencyService;
     this._priceFormatter       = priceFormatter;
     this._localizationService  = localizationService;
     this._dateTimeHelper       = dateTimeHelper;
     this._downloadService      = downloadService;
     this._orderSettings        = orderSettings;
     this._cacheManager         = cacheManager;
 }
Example #36
0
 public DiscountController(IDiscountService discountService,
                           ILocalizationService localizationService,
                           ICurrencyService currencyService,
                           ICategoryService categoryService,
                           IProductService productService,
                           IWebHelper webHelper,
                           IDateTimeHelper dateTimeHelper,
                           ICustomerActivityService customerActivityService,
                           CurrencySettings currencySettings,
                           IPermissionService permissionService,
                           IWorkContext workContext,
                           IManufacturerService manufacturerService,
                           IStoreService storeService,
                           IVendorService vendorService,
                           IOrderService orderService,
                           IPriceFormatter priceFormatter,
                           ICacheManager cacheManager)
 {
     this._discountService         = discountService;
     this._localizationService     = localizationService;
     this._currencyService         = currencyService;
     this._categoryService         = categoryService;
     this._productService          = productService;
     this._webHelper               = webHelper;
     this._dateTimeHelper          = dateTimeHelper;
     this._customerActivityService = customerActivityService;
     this._currencySettings        = currencySettings;
     this._permissionService       = permissionService;
     this._workContext             = workContext;
     this._manufacturerService     = manufacturerService;
     this._storeService            = storeService;
     this._vendorService           = vendorService;
     this._orderService            = orderService;
     this._priceFormatter          = priceFormatter;
     this._cacheManager            = cacheManager;
 }
 public ProductAttributeFormatter(IWorkContext workContext,
                                  IProductAttributeService productAttributeService,
                                  IProductAttributeParser productAttributeParser,
                                  ICurrencyService currencyService,
                                  ILocalizationService localizationService,
                                  ITaxService taxService,
                                  IPriceFormatter priceFormatter,
                                  IDownloadService downloadService,
                                  IWebHelper webHelper,
                                  IPriceCalculationService priceCalculationService,
                                  ShoppingCartSettings shoppingCartSettings)
 {
     this._workContext             = workContext;
     this._productAttributeService = productAttributeService;
     this._productAttributeParser  = productAttributeParser;
     this._currencyService         = currencyService;
     this._localizationService     = localizationService;
     this._taxService              = taxService;
     this._priceFormatter          = priceFormatter;
     this._downloadService         = downloadService;
     this._webHelper               = webHelper;
     this._priceCalculationService = priceCalculationService;
     this._shoppingCartSettings    = shoppingCartSettings;
 }
Example #38
0
 public ReturnRequestViewModelService(IReturnRequestService returnRequestService,
                                      IOrderService orderService,
                                      IProductService productService,
                                      IWorkContext workContext,
                                      IStoreContext storeContext,
                                      ICurrencyService currencyService,
                                      IPriceFormatter priceFormatter,
                                      ILocalizationService localizationService,
                                      IDateTimeHelper dateTimeHelper,
                                      ICacheManager cacheManager,
                                      ICountryService countryService,
                                      IStoreMappingService storeMappingService,
                                      IAddressViewModelService addressViewModelService,
                                      IWorkflowMessageService workflowMessageService,
                                      IServiceProvider serviceProvider,
                                      OrderSettings orderSettings,
                                      LocalizationSettings localizationSettings)
 {
     _returnRequestService    = returnRequestService;
     _orderService            = orderService;
     _productService          = productService;
     _workContext             = workContext;
     _storeContext            = storeContext;
     _currencyService         = currencyService;
     _priceFormatter          = priceFormatter;
     _localizationService     = localizationService;
     _dateTimeHelper          = dateTimeHelper;
     _cacheManager            = cacheManager;
     _countryService          = countryService;
     _storeMappingService     = storeMappingService;
     _addressViewModelService = addressViewModelService;
     _workflowMessageService  = workflowMessageService;
     _serviceProvider         = serviceProvider;
     _orderSettings           = orderSettings;
     _localizationSettings    = localizationSettings;
 }
Example #39
0
        public static SponsorPublicModel ToPublicModel(this Sponsor Sponsor, IWorkContext _workContext,
                                                       ICustomerService _customerService, IPictureService _pictureService, ISponsorService _sponsorService, IPriceFormatter _priceFormatter, MediaSettings _mediaSettings)
        {
            var customer = _customerService.GetCustomerById(Sponsor.CustomerId);

            if (customer == null)
            {
                return(null);
            }

            //get sponsor data
            var sponsorData = _sponsorService.GetSponsorData(Sponsor.BattleId, Sponsor.BattleType, Sponsor.CustomerId);

            var model = new SponsorPublicModel
            {
                SponsorshipStatus     = Sponsor.SponsorshipStatus,
                SponsorshipStatusName = Sponsor.SponsorshipStatus.ToString(),
                CustomerId            = Sponsor.CustomerId,
                SeName                 = customer.GetSeName(_workContext.WorkingLanguage.Id),
                SponsorName            = customer.GetFullName(),
                SponsorProfileImageUrl =
                    _pictureService.GetPictureUrl(
                        customer.GetAttribute <int>(SystemCustomerAttributeNames.AvatarPictureId),
                        _mediaSettings.AvatarPictureSize, false),
                SponsorshipAmount          = Sponsor.SponsorshipAmount,
                SponsorshipAmountFormatted =
                    _priceFormatter.FormatPrice(Sponsor.SponsorshipAmount, true, _workContext.WorkingCurrency),
                SponsorData     = sponsorData.ToModel(_pictureService),
                SponsorshipType = Sponsor.SponsorshipType
            };


            return(model);
        }
        public new void SetUp()
        {
            _workContext = null;

            _store = new Store {
                Id = 1
            };
            _storeContext = MockRepository.GenerateMock <IStoreContext>();
            _storeContext.Expect(x => x.CurrentStore).Return(_store);

            var pluginFinder = new PluginFinder();

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings      = new CatalogSettings();

            var cacheManager = new NopNullCache();

            _productService = MockRepository.GenerateMock <IProductService>();

            //price calculation service
            _discountService     = MockRepository.GenerateMock <IDiscountService>();
            _categoryService     = MockRepository.GenerateMock <ICategoryService>();
            _manufacturerService = MockRepository.GenerateMock <IManufacturerService>();

            _productAttributeParser = MockRepository.GenerateMock <IProductAttributeParser>();
            _priceCalcService       = new PriceCalculationService(_workContext, _storeContext,
                                                                  _discountService, _categoryService, _manufacturerService,
                                                                  _productAttributeParser, _productService,
                                                                  cacheManager, _shoppingCartSettings, _catalogSettings);

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

            _localizationService = MockRepository.GenerateMock <ILocalizationService>();

            //shipping
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List <string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
            _shippingMethodRepository = MockRepository.GenerateMock <IRepository <ShippingMethod> >();
            _deliveryDateRepository   = MockRepository.GenerateMock <IRepository <DeliveryDate> >();
            _warehouseRepository      = MockRepository.GenerateMock <IRepository <Warehouse> >();
            _logger          = new NullLogger();
            _shippingService = new ShippingService(_shippingMethodRepository,
                                                   _deliveryDateRepository,
                                                   _warehouseRepository,
                                                   _logger,
                                                   _productService,
                                                   _productAttributeParser,
                                                   _checkoutAttributeParser,
                                                   _genericAttributeService,
                                                   _localizationService,
                                                   _addressService,
                                                   _shippingSettings,
                                                   pluginFinder,
                                                   _storeContext,
                                                   _eventPublisher,
                                                   _shoppingCartSettings,
                                                   cacheManager);
            _shipmentService = MockRepository.GenerateMock <IShipmentService>();


            _paymentService          = MockRepository.GenerateMock <IPaymentService>();
            _checkoutAttributeParser = MockRepository.GenerateMock <ICheckoutAttributeParser>();
            _giftCardService         = MockRepository.GenerateMock <IGiftCardService>();
            _genericAttributeService = MockRepository.GenerateMock <IGenericAttributeService>();

            _geoLookupService = MockRepository.GenerateMock <IGeoLookupService>();
            _countryService   = MockRepository.GenerateMock <ICountryService>();
            _customerSettings = new CustomerSettings();
            _addressSettings  = new AddressSettings();

            //tax
            _taxSettings = new TaxSettings();
            _taxSettings.ShippingIsTaxable = true;
            _taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
            _taxSettings.DefaultTaxAddressId = 10;
            _addressService = MockRepository.GenerateMock <IAddressService>();
            _addressService.Expect(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Return(new Address {
                Id = _taxSettings.DefaultTaxAddressId
            });
            _taxService = new TaxService(_addressService, _workContext, _taxSettings,
                                         pluginFinder, _geoLookupService, _countryService, _customerSettings, _addressSettings);

            _rewardPointService   = MockRepository.GenerateMock <IRewardPointService>();
            _rewardPointsSettings = new RewardPointsSettings();

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                                                                      _priceCalcService, _taxService, _shippingService, _paymentService,
                                                                      _checkoutAttributeParser, _discountService, _giftCardService,
                                                                      _genericAttributeService, _rewardPointService,
                                                                      _taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);

            _orderService               = MockRepository.GenerateMock <IOrderService>();
            _webHelper                  = MockRepository.GenerateMock <IWebHelper>();
            _languageService            = MockRepository.GenerateMock <ILanguageService>();
            _priceFormatter             = MockRepository.GenerateMock <IPriceFormatter>();
            _productAttributeFormatter  = MockRepository.GenerateMock <IProductAttributeFormatter>();
            _shoppingCartService        = MockRepository.GenerateMock <IShoppingCartService>();
            _checkoutAttributeFormatter = MockRepository.GenerateMock <ICheckoutAttributeFormatter>();
            _customerService            = MockRepository.GenerateMock <ICustomerService>();
            _encryptionService          = MockRepository.GenerateMock <IEncryptionService>();
            _workflowMessageService     = MockRepository.GenerateMock <IWorkflowMessageService>();
            _customerActivityService    = MockRepository.GenerateMock <ICustomerActivityService>();
            _currencyService            = MockRepository.GenerateMock <ICurrencyService>();
            _affiliateService           = MockRepository.GenerateMock <IAffiliateService>();
            _vendorService              = MockRepository.GenerateMock <IVendorService>();
            _pdfService                 = MockRepository.GenerateMock <IPdfService>();

            _paymentSettings = new PaymentSettings
            {
                ActivePaymentMethodSystemNames = new List <string>
                {
                    "Payments.TestMethod"
                }
            };
            _orderSettings = new OrderSettings();

            _localizationSettings = new LocalizationSettings();

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

            _rewardPointService = MockRepository.GenerateMock <IRewardPointService>();
            _currencySettings   = new CurrencySettings();

            _orderProcessingService = new OrderProcessingService(_orderService, _webHelper,
                                                                 _localizationService, _languageService,
                                                                 _productService, _paymentService, _logger,
                                                                 _orderTotalCalcService, _priceCalcService, _priceFormatter,
                                                                 _productAttributeParser, _productAttributeFormatter,
                                                                 _giftCardService, _shoppingCartService, _checkoutAttributeFormatter,
                                                                 _shippingService, _shipmentService, _taxService,
                                                                 _customerService, _discountService,
                                                                 _encryptionService, _workContext,
                                                                 _workflowMessageService, _vendorService,
                                                                 _customerActivityService, _currencyService, _affiliateService,
                                                                 _eventPublisher, _pdfService, _rewardPointService,
                                                                 _shippingSettings, _paymentSettings, _rewardPointsSettings,
                                                                 _orderSettings, _taxSettings, _localizationSettings,
                                                                 _currencySettings);
        }
Example #41
0
        public new void SetUp()
        {
            _workContext = new Mock <IWorkContext>();
            _workContext.Setup(w => w.WorkingCurrency).Returns(new Currency {
                RoundingType = RoundingType.Rounding001
            });

            _currencySettings = new CurrencySettings();
            var currency1 = new Currency
            {
                Id               = 1,
                Name             = "Euro",
                CurrencyCode     = "EUR",
                DisplayLocale    = "",
                CustomFormatting = "€0.00",
                DisplayOrder     = 1,
                Published        = true,
                CreatedOnUtc     = DateTime.UtcNow,
                UpdatedOnUtc     = DateTime.UtcNow
            };
            var currency2 = new Currency
            {
                Id               = 1,
                Name             = "US Dollar",
                CurrencyCode     = "USD",
                DisplayLocale    = "en-US",
                CustomFormatting = "",
                DisplayOrder     = 2,
                Published        = true,
                CreatedOnUtc     = DateTime.UtcNow,
                UpdatedOnUtc     = DateTime.UtcNow
            };

            _currencyRepo = new Mock <IRepository <Currency> >();
            _currencyRepo.Setup(x => x.Table).Returns(new List <Currency> {
                currency1, currency2
            }.AsQueryable());

            _storeMappingService = new Mock <IStoreMappingService>();
            _measureService      = new Mock <IMeasureService>();

            _eventPublisher = new Mock <IEventPublisher>();
            _eventPublisher.Setup(x => x.Publish(It.IsAny <object>()));

            var pluginService = new FakePluginService();

            _exchangeRatePluginManager = new ExchangeRatePluginManager(_currencySettings, new Mock <ICustomerService>().Object, pluginService);
            _currencyService           = new CurrencyService(_currencySettings,
                                                             new FakeCacheKeyService(),
                                                             null,
                                                             _exchangeRatePluginManager,
                                                             _currencyRepo.Object,
                                                             _storeMappingService.Object);

            _taxSettings = new TaxSettings();

            _localizationService = new Mock <ILocalizationService>();
            _localizationService.Setup(x => x.GetResource("Products.InclTaxSuffix", 1, false, string.Empty, false)).Returns("{0} incl tax");
            _localizationService.Setup(x => x.GetResource("Products.ExclTaxSuffix", 1, false, string.Empty, false)).Returns("{0} excl tax");

            _priceFormatter = new PriceFormatter(_currencySettings, _currencyService, _localizationService.Object,
                                                 _measureService.Object, _workContext.Object, _taxSettings);

            var nopEngine = new Mock <NopEngine>();

            nopEngine.Setup(x => x.ServiceProvider).Returns(new TestServiceProvider());
            EngineContext.Replace(nopEngine.Object);
        }
Example #42
0
        public static PhieuGuiHangModel ToModel(this PhieuGuiHang nvfrom, ILocalizationService localizationService, IPriceFormatter priceFormatter, List <HangHoa> hanghoas = null, bool isChiTiet = false)
        {
            var nvto = new PhieuGuiHangModel();

            nvto.Id      = nvfrom.Id;
            nvto.MaPhieu = nvfrom.MaPhieu;
            //van phong gui
            nvto.VanPhongGui.Id          = nvfrom.VanPhongGuiId;
            nvto.VanPhongGui.TenVanPhong = nvfrom.VanPhongGui.TenVanPhong;
            //van phong nhan
            nvto.VanPhongNhan.Id          = nvfrom.VanPhongNhanId;
            nvto.VanPhongNhan.TenVanPhong = nvfrom.VanPhongNhan.TenVanPhong;
            //nguoi gui
            nvto.NguoiGui.Id          = nvfrom.NguoiGuiId;
            nvto.NguoiGui.HoTen       = nvfrom.NguoiGui.HoTen;
            nvto.NguoiGui.SoDienThoai = nvfrom.NguoiGui.DienThoai;
            nvto.NguoiGui.DiaChi      = nvfrom.NguoiGui.DiaChiLienHe;
            //nguoi nhan
            nvto.NguoiNhan.Id          = nvfrom.NguoiNhanId;
            nvto.NguoiNhan.HoTen       = nvfrom.NguoiNhan.HoTen;
            nvto.NguoiNhan.SoDienThoai = nvfrom.NguoiNhan.DienThoai;
            nvto.NguoiNhan.DiaChi      = nvfrom.NguoiNhan.DiaChiLienHe;

            nvto.NguoiKiemTraHangId = nvfrom.NguoiKiemTraHangId;
            if (nvfrom.NguoiKiemTraHang != null)
            {
                nvto.TenNguoiKiemTraHang = nvfrom.NguoiKiemTraHang.HoVaTen;
            }
            else
            {
                nvto.TenNguoiKiemTraHang = nvfrom.nguoitao.HoVaTen;
            }

            nvto.TinhTrangVanChuyen = nvfrom.TinhTrangVanChuyen.ToCVEnumText(localizationService);
            nvto.DaThuCuoc          = nvfrom.DaThuCuoc;
            if (nvto.DaThuCuoc)
            {
                nvto.ThanhToan = "Đã thanh toán";
            }
            else
            {
                nvto.ThanhToan = "Chưa thanh toán";
            }
            nvto.NgayNhan = nvfrom.NgayUpdate;
            if (nvfrom.NhanVienThuTien != null)
            {
                nvto.NgayThanhToan     = nvfrom.NgayThanhToan;
                nvto.NhanVienThuTienId = nvfrom.NhanVienThuTienId;
            }
            nvto.NgayTao = nvfrom.NgayTao;
            if (nvfrom.XeXuatBen != null)
            {
                nvto.NgayDi       = nvfrom.XeXuatBen.NgayDi;
                nvto.TenXeXuatBen = string.Format("{0}-{1}-{2}-{3} ({4})", nvfrom.XeXuatBen.NguonVeInfo.ThoiGianDi.ToString("HH:mm"),
                                                  nvfrom.XeXuatBen.NguonVeInfo.ThoiGianDen.ToString("HH:mm"), nvfrom.XeXuatBen.NgayDi.ToString("dd/MM/yyyy"),
                                                  nvfrom.XeXuatBen.xevanchuyen.TenXe, nvfrom.XeXuatBen.xevanchuyen.BienSo);
                if (isChiTiet)
                {
                    nvto.XeXuatBen = nvfrom.XeXuatBen;
                }
            }
            else
            {
                nvto.NgayDi = nvfrom.NgayTao;
            }
            nvto.XeXuatBenId         = nvfrom.XeXuatBenId;
            nvto.GhiChu              = nvfrom.GhiChu;
            nvto.TenNguoiKiemTraHang = nvfrom.NguoiKiemTraHang.ThongTin();
            if (hanghoas != null)
            {
                nvto.HangHoaInfo = "";
                nvto.SoLuongHang = hanghoas.Count();
                if (nvto.SoLuongHang == 1)
                {
                    nvto.HangHoa = hanghoas.First().ToModel(localizationService, priceFormatter);
                }
                //var items = _hanghoaService.GetAllHangHoaByPhieuGuiHangId(nvfrom.Id);
                decimal tonggiatrihanghoa = 0;
                decimal tongcuocphi       = 0;
                decimal tongcannang       = 0;
                decimal tongsoluong       = 0;
                foreach (var _item in hanghoas)
                {
                    if (string.IsNullOrEmpty(nvto.HangHoaInfo))
                    {
                        nvto.HangHoaInfo = _item.TenHangHoa;
                    }
                    else
                    {
                        nvto.HangHoaInfo = nvto.HangHoaInfo + "," + _item.TenHangHoa;
                    }

                    var _model = _item.ToModel(localizationService, priceFormatter);
                    tonggiatrihanghoa = tonggiatrihanghoa + _item.GiaTri * _item.SoLuong;
                    tongcuocphi       = tongcuocphi + _item.GiaCuoc;
                    tongcannang       = tongcannang + _item.CanNang;
                    tongsoluong       = tongsoluong + _item.SoLuong;
                    if (isChiTiet)
                    {
                        nvto.ListHangHoaInPhieuGui.Add(_model);
                    }
                }
                nvto.TotalPackage      = string.Format("{0} {1}", tongsoluong, "Kiện");
                nvto.TongGiaTriHangHoa = tonggiatrihanghoa.ToTien(priceFormatter);
                nvto.TongCuocPhi       = tongcuocphi.ToTien(priceFormatter);
                nvto.TongCanNang       = tongcannang.ToSoNguyen();
            }

            return(nvto);
        }
Example #43
0
        public static PhieuGuiHangModel.HangHoaModel ToModel(this HangHoa nvfrom, ILocalizationService localizationService, IPriceFormatter priceFormatter)
        {
            var nvto = new PhieuGuiHangModel.HangHoaModel();

            nvto.Id            = nvfrom.Id;
            nvto.TenHangHoa    = nvfrom.TenHangHoa;
            nvto.LoaiHangHoaId = nvfrom.LoaiHangHoaId;
            nvto.CanNang       = nvfrom.CanNang;
            nvto.LoaiHangHoa   = nvfrom.LoaiHangHoa.ToCVEnumText(localizationService);
            nvto.GiaTri        = nvfrom.GiaTri;
            nvto.GiaCuoc       = nvfrom.GiaCuoc;
            nvto.GhiChu        = nvfrom.GhiChu;
            nvto.SoLuong       = nvfrom.SoLuong;
            nvto.CanNangText   = string.Format("{0} {1}", nvfrom.CanNang, "kg");
            nvto.GiaTriText    = nvfrom.GiaTri.ToTien(priceFormatter);
            nvto.GiaCuocText   = nvfrom.GiaCuoc.ToTien(priceFormatter);
            return(nvto);
        }
Example #44
0
        public MVPController(ICategoryService categoryService,
                             IManufacturerService manufacturerService,
                             IProductService productService,
                             IVendorService vendorService,
                             IProductTemplateService productTemplateService,
                             IProductAttributeService productAttributeService,
                             IWorkContext workContext,
                             IStoreContext storeContext,
                             ITaxService taxService,
                             ICurrencyService currencyService,
                             IPictureService pictureService,
                             ILocalizationService localizationService,
                             IMeasureService measureService,
                             IPriceCalculationService priceCalculationService,
                             IPriceFormatter priceFormatter,
                             IWebHelper webHelper,
                             ISpecificationAttributeService specificationAttributeService,
                             IDateTimeHelper dateTimeHelper,
                             IRecentlyViewedProductsService recentlyViewedProductsService,
                             ICompareProductsService compareProductsService,
                             IWorkflowMessageService workflowMessageService,
                             IProductTagService productTagService,
                             IOrderReportService orderReportService,
                             IAclService aclService,
                             IStoreMappingService storeMappingService,
                             IPermissionService permissionService,
                             IDownloadService downloadService,
                             ICustomerActivityService customerActivityService,
                             IProductAttributeParser productAttributeParser,
                             IShippingService shippingService,
                             IEventPublisher eventPublisher,
                             MediaSettings mediaSettings,
                             CatalogSettings catalogSettings,
                             VendorSettings vendorSettings,
                             ShoppingCartSettings shoppingCartSettings,
                             LocalizationSettings localizationSettings,
                             CustomerSettings customerSettings,
                             CaptchaSettings captchaSettings,
                             SeoSettings seoSettings,
                             ICacheManager cacheManager,
                             IStoreService storeService,
                             ISettingService settingService,
                             IProductReportService productReportService,
                             IMVPService mvpService

                             )
        {
            this._categoryService         = categoryService;
            this._manufacturerService     = manufacturerService;
            this._productService          = productService;
            this._vendorService           = vendorService;
            this._productTemplateService  = productTemplateService;
            this._productAttributeService = productAttributeService;
            this._workContext             = workContext;
            this._storeContext            = storeContext;
            this._taxService              = taxService;
            this._currencyService         = currencyService;
            this._pictureService          = pictureService;
            this._localizationService     = localizationService;
            this._measureService          = measureService;
            this._priceCalculationService = priceCalculationService;
            this._priceFormatter          = priceFormatter;
            this._webHelper = webHelper;
            this._specificationAttributeService = specificationAttributeService;
            this._dateTimeHelper = dateTimeHelper;
            this._recentlyViewedProductsService = recentlyViewedProductsService;
            this._compareProductsService        = compareProductsService;
            this._workflowMessageService        = workflowMessageService;
            this._productTagService             = productTagService;
            this._orderReportService            = orderReportService;
            this._aclService              = aclService;
            this._storeMappingService     = storeMappingService;
            this._permissionService       = permissionService;
            this._downloadService         = downloadService;
            this._customerActivityService = customerActivityService;
            this._productAttributeParser  = productAttributeParser;
            this._shippingService         = shippingService;
            this._eventPublisher          = eventPublisher;
            this._mediaSettings           = mediaSettings;
            this._catalogSettings         = catalogSettings;
            this._vendorSettings          = vendorSettings;
            this._shoppingCartSettings    = shoppingCartSettings;
            this._localizationSettings    = localizationSettings;
            this._customerSettings        = customerSettings;
            this._captchaSettings         = captchaSettings;
            this._seoSettings             = seoSettings;
            this._cacheManager            = cacheManager;
            this._storeService            = storeService;
            this._settingService          = settingService;
            this._productReportService    = productReportService;
            this._mvpService              = mvpService;
        }
Example #45
0
        public CommonController(ICategoryService categoryService,
                                INhaXeService nhaxeService,
                                IPriceFormatter priceFormatter,
                                IXeInfoService xeinfoService,
                                IHanhTrinhService hanhtrinhService,
                                IPictureService pictureService,
                                IBenXeService benxeService,
                                IProductService productService,
                                IManufacturerService manufacturerService,
                                ITopicService topicService,
                                ILanguageService languageService,
                                ICurrencyService currencyService,
                                ILocalizationService localizationService,
                                IWorkContext workContext,
                                IStoreContext storeContext,
                                IQueuedEmailService queuedEmailService,
                                IEmailAccountService emailAccountService,
                                ISitemapGenerator sitemapGenerator,
                                IThemeContext themeContext,
                                IThemeProvider themeProvider,
                                IForumService forumService,
                                IGenericAttributeService genericAttributeService,
                                IWebHelper webHelper,
                                IPermissionService permissionService,
                                ICacheManager cacheManager,
                                ICustomerActivityService customerActivityService,
                                CustomerSettings customerSettings,
                                TaxSettings taxSettings,
                                CatalogSettings catalogSettings,
                                StoreInformationSettings storeInformationSettings,
                                EmailAccountSettings emailAccountSettings,
                                CommonSettings commonSettings,
                                BlogSettings blogSettings,
                                NewsSettings newsSettings,
                                ForumSettings forumSettings,
                                LocalizationSettings localizationSettings,
                                CaptchaSettings captchaSettings)
        {
            this._priceFormatter          = priceFormatter;
            this._xeinfoService           = xeinfoService;
            this._hanhtrinhService        = hanhtrinhService;
            this._nhaxeService            = nhaxeService;
            this._pictureService          = pictureService;
            this._benxeService            = benxeService;
            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._queuedEmailService      = queuedEmailService;
            this._emailAccountService     = emailAccountService;
            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._customerActivityService = customerActivityService;

            this._customerSettings         = customerSettings;
            this._taxSettings              = taxSettings;
            this._catalogSettings          = catalogSettings;
            this._storeInformationSettings = storeInformationSettings;
            this._emailAccountSettings     = emailAccountSettings;
            this._commonSettings           = commonSettings;
            this._blogSettings             = blogSettings;
            this._newsSettings             = newsSettings;
            this._forumSettings            = forumSettings;
            this._localizationSettings     = localizationSettings;
            this._captchaSettings          = captchaSettings;
        }
Example #46
0
        public static PhieuVanChuyenModel ToModel(this PhieuVanChuyen nvfrom, ILocalizationService localizationService, IPriceFormatter priceFormatter, bool isNhatKy)
        {
            var nvto = new PhieuVanChuyenModel();

            nvto.Id                     = nvfrom.Id;
            nvto.NhaXeId                = nvfrom.NhaXeId;
            nvto.SoLenh                 = nvfrom.SoLenh;
            nvto.VanPhongId             = nvfrom.VanPhongId;
            nvto.KhuVucDenId            = nvfrom.KhuVucDenId;
            nvto.TrangThai              = nvfrom.TrangThai;
            nvto.TrangThaiText          = nvto.TrangThai.ToCVEnumText(localizationService);
            nvto.NgayTao                = nvfrom.NgayTao;
            nvto.TenVanPhong            = nvfrom.vanphong != null ? nvfrom.vanphong.TenVanPhong : "";
            nvto.MaVanPhong             = nvfrom.vanphong != null ? nvfrom.vanphong.Ma : "";
            nvto.LoaiPhieuVanChuyen     = nvfrom.LoaiPhieuVanChuyen;
            nvto.LoaiPhieuVanChuyenText = nvfrom.LoaiPhieuVanChuyen.ToCVEnumText(localizationService);
            // vidu: HP->HD
            nvto.TenChang = gettenchang(nvfrom);
            //tong tien di kem=tong tien da thanh toan
            if (nvfrom.phieuchuyenphats != null)
            {
                nvto.TongCuocDiKem = nvfrom.phieuchuyenphats.Sum(c => c.TongCuocDaThanhToan);
            }

            //nhat ky van chuyen
            foreach (var nk in nvfrom.nhatkyvanchuyens)
            {
                var nvkcmodel = new PhieuVanChuyenModel.PhieuVanChuyenLogModel();
                nvkcmodel.ChuyenDiId = nk.ChuyenDiId;
                if (nk.chuyendi != null)
                {
                    nvkcmodel.BienSo     = nk.chuyendi.xevanchuyen != null ? nk.chuyendi.xevanchuyen.BienSo : "";
                    nvkcmodel.LaiXe      = nk.chuyendi.ThongTinLaiPhuXe(0, true);
                    nvkcmodel.NgayDi     = nk.chuyendi.NgayDi;
                    nvkcmodel.NgayDiText = nk.chuyendi.NgayDi.ToString("HH:mm");
                }
                nvkcmodel.HanhTrinhId      = nk.HanhTrinhId;
                nvkcmodel.hanhtrinhText    = nk.hanhtrinh != null ? nk.hanhtrinh.MoTa : "";
                nvkcmodel.Id               = nk.Id;
                nvkcmodel.KhuVucId         = nk.KhuVucId;
                nvkcmodel.khuvucText       = nk.khuvuc != null ? nk.khuvuc.TenKhuVuc : "";
                nvkcmodel.PhieuVanChuyenId = nk.PhieuVanChuyenId;
                nvkcmodel.TongCuoc         = nk.TongCuoc;
                nvkcmodel.TuyenId          = nk.TuyenId.GetValueOrDefault(0);
                nvkcmodel.tuyenText        = nk.tuyen != null ? nk.tuyen.TenTuyen : "";
                nvkcmodel.VanPhongGuiId    = nk.VanPhongGuiId;
                nvkcmodel.vanphongguiText  = nk.vanphonggui != null ? nk.vanphonggui.TenVanPhong : "";
                nvkcmodel.VanPhongNhanId   = nk.VanPhongNhanId;
                nvkcmodel.vanphongnhanText = nk.vanphongnhan != null ? nk.vanphongnhan.TenVanPhong : "";
                nvkcmodel.NguoiGiaoId      = nk.NguoiGiaoId;
                nvkcmodel.NguoiGiaoText    = nk.NguoiGiao != null ? nk.NguoiGiao.HoVaTen : "";
                nvkcmodel.NguoiNhanId      = nk.NguoiNhanId;
                nvkcmodel.NguoiNhanText    = nk.NguoiNhan != null ? nk.NguoiNhan.HoVaTen : "";
                nvkcmodel.NgayTao          = nk.NgayTao;
                nvkcmodel.GhiChu           = nk.GhiChu;
                nvto.nhatkyvanchuyens.Add(nvkcmodel);
            }
            if (isNhatKy && nvto.nhatkyvanchuyens.Count > 0)
            {
                nvto.NhatKyVanChuyenHienTai = nvto.nhatkyvanchuyens.Last();
            }
            return(nvto);
        }
        public void TestInitialize()
        {
            //color choosing via DropDownList
            ca1 = new CheckoutAttribute {
                Id                   = "1",
                Name                 = "Color",
                TextPrompt           = "Select color:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.DropdownList,
                DisplayOrder         = 1,
            };
            cav1_1 = new CheckoutAttributeValue {
                Id           = "11",
                Name         = "Green",
                DisplayOrder = 1,
                //CheckoutAttribute = ca1,
                CheckoutAttributeId = ca1.Id,
            };
            cav1_2 = new CheckoutAttributeValue {
                Id           = "12",
                Name         = "Red",
                DisplayOrder = 2,
                //CheckoutAttribute = ca1,
                CheckoutAttributeId = ca1.Id,
            };
            ca1.CheckoutAttributeValues.Add(cav1_1);
            ca1.CheckoutAttributeValues.Add(cav1_2);

            //choosing via CheckBox'es
            ca2 = new CheckoutAttribute {
                Id                   = "2",
                Name                 = "Custom option",
                TextPrompt           = "Select custom option:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.Checkboxes,
                DisplayOrder         = 2,
                //CheckoutAttributeValues
            };

            cav2_1 = new CheckoutAttributeValue {
                Id           = "21",
                Name         = "Option 1",
                DisplayOrder = 1,
                //CheckoutAttribute = ca2,
                CheckoutAttributeId = ca2.Id,
            };
            cav2_2 = new CheckoutAttributeValue {
                Id           = "22",
                Name         = "Option 2",
                DisplayOrder = 2,
                //CheckoutAttribute = ca2,
                CheckoutAttributeId = ca2.Id,
            };
            ca2.CheckoutAttributeValues.Add(cav2_1);
            ca2.CheckoutAttributeValues.Add(cav2_2);

            //via MultiTextBoxes
            ca3 = new CheckoutAttribute {
                Id                   = "3",
                Name                 = "Custom text",
                TextPrompt           = "Enter custom text:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.MultilineTextbox,
                DisplayOrder         = 3,
            };



            var tempCheckoutAttributeRepo = new Mock <IRepository <CheckoutAttribute> >();
            {
                var IMongoCollection = new Mock <IMongoCollection <CheckoutAttribute> >().Object;
                IMongoCollection.InsertOne(ca1);
                IMongoCollection.InsertOne(ca2);
                IMongoCollection.InsertOne(ca3);
                tempCheckoutAttributeRepo.Setup(x => x.Table).Returns(IMongoCollection.AsQueryable());
                tempCheckoutAttributeRepo.Setup(x => x.GetByIdAsync(ca1.Id)).ReturnsAsync(ca1);
                tempCheckoutAttributeRepo.Setup(x => x.GetByIdAsync(ca2.Id)).ReturnsAsync(ca2);
                tempCheckoutAttributeRepo.Setup(x => x.GetByIdAsync(ca3.Id)).ReturnsAsync(ca3);
                _checkoutAttributeRepo = tempCheckoutAttributeRepo.Object;
            }

            var cacheManager = new TestMemoryCacheManager(new Mock <IMemoryCache>().Object);

            _storeMappingService = new Mock <IStoreMappingService>().Object;



            var tempEventPublisher = new Mock <IMediator>();

            {
                //tempEventPublisher.Setup(x => x.PublishAsync(It.IsAny<object>()));
                _eventPublisher = tempEventPublisher.Object;
            }


            _checkoutAttributeService = new CheckoutAttributeService(cacheManager, _checkoutAttributeRepo,
                                                                     _storeMappingService, _eventPublisher, null, null);

            _checkoutAttributeParser = new CheckoutAttributeParser(_checkoutAttributeService);



            var workingLanguage = new Language();
            var tempWorkContext = new Mock <IWorkContext>();

            {
                tempWorkContext.Setup(x => x.WorkingLanguage).Returns(workingLanguage);
                _workContext = tempWorkContext.Object;
            }
            _currencyService = new Mock <ICurrencyService>().Object;
            _taxService      = new Mock <ITaxService>().Object;
            _priceFormatter  = new Mock <IPriceFormatter>().Object;
            _downloadService = new Mock <IDownloadService>().Object;
            _webHelper       = new Mock <IWebHelper>().Object;

            _checkoutAttributeFormatter = new CheckoutAttributeFormatter(_workContext,
                                                                         _checkoutAttributeService,
                                                                         _checkoutAttributeParser,
                                                                         _currencyService,
                                                                         _taxService,
                                                                         _priceFormatter,
                                                                         _downloadService,
                                                                         _webHelper);
        }
Example #48
0
 public void SetFormatter(IPriceFormatter formatter)
 {
     _currentFormatter = formatter;
 }
Example #49
0
 public GetGiftVoucherTokensCommandHandler(IPriceFormatter priceFormatter)
 {
     _priceFormatter = priceFormatter;
 }
        public ProductController(
            ICommonServices services,
            IManufacturerService manufacturerService,
            IProductService productService,
            IProductAttributeService productAttributeService,
            IProductAttributeParser productAttributeParser,
            ITaxService taxService,
            ICurrencyService currencyService,
            IPictureService pictureService,
            IPriceCalculationService priceCalculationService,
            IPriceFormatter priceFormatter,
            ICustomerContentService customerContentService,
            ICustomerService customerService,
            IShoppingCartService shoppingCartService,
            IRecentlyViewedProductsService recentlyViewedProductsService,
            IProductTagService productTagService,
            IOrderReportService orderReportService,
            IBackInStockSubscriptionService backInStockSubscriptionService,
            IAclService aclService,
            IStoreMappingService storeMappingService,
            MediaSettings mediaSettings,
            SeoSettings seoSettings,
            CatalogSettings catalogSettings,
            ShoppingCartSettings shoppingCartSettings,
            LocalizationSettings localizationSettings,
            CaptchaSettings captchaSettings,
            CatalogHelper helper,
            IDownloadService downloadService,
            ILocalizationService localizationService,
            IBreadcrumb breadcrumb,
            Lazy <PrivacySettings> privacySettings,
            Lazy <TaxSettings> taxSettings,
            IRepository <Category> categoryRepository,
            ICategoryService categoryService

            )
        {
            _services                       = services;
            _manufacturerService            = manufacturerService;
            _productService                 = productService;
            _productAttributeService        = productAttributeService;
            _productAttributeParser         = productAttributeParser;
            _taxService                     = taxService;
            _currencyService                = currencyService;
            _pictureService                 = pictureService;
            _priceCalculationService        = priceCalculationService;
            _priceFormatter                 = priceFormatter;
            _customerContentService         = customerContentService;
            _customerService                = customerService;
            _shoppingCartService            = shoppingCartService;
            _recentlyViewedProductsService  = recentlyViewedProductsService;
            _productTagService              = productTagService;
            _orderReportService             = orderReportService;
            _backInStockSubscriptionService = backInStockSubscriptionService;
            _aclService                     = aclService;
            _storeMappingService            = storeMappingService;
            _mediaSettings                  = mediaSettings;
            _seoSettings                    = seoSettings;
            _catalogSettings                = catalogSettings;
            _shoppingCartSettings           = shoppingCartSettings;
            _localizationSettings           = localizationSettings;
            _captchaSettings                = captchaSettings;
            _helper              = helper;
            _downloadService     = downloadService;
            _localizationService = localizationService;
            _breadcrumb          = breadcrumb;
            _privacySettings     = privacySettings;
            _taxSettings         = taxSettings;
            _categoryRepository  = categoryRepository;
            _categoryService     = categoryService;
        }
 public SelectedShippingPointController(IShippingPointService shippingPointService, ICountryService countryService, IPriceFormatter priceFormatter)
 {
     _shippingPointService = shippingPointService;
     _countryService       = countryService;
     _priceFormatter       = priceFormatter;
 }
 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;
 }
Example #53
0
        /// <summary>
        /// Format base price (PAngV)
        /// </summary>
        /// <param name="product">Product</param>
        /// <param name="productPrice">Product price (in primary currency). Pass null if you want to use a default produce price</param>
        /// <param name="localizationService">Localization service</param>
        /// <param name="measureService">Measure service</param>
        /// <param name="currencyService">Currency service</param>
        /// <param name="workContext">Work context</param>
        /// <param name="priceFormatter">Price formatter</param>
        /// <returns>Base price</returns>
        public static string FormatBasePrice(this Product product, decimal?productPrice, ILocalizationService localizationService,
                                             IMeasureService measureService, ICurrencyService currencyService,
                                             IWorkContext workContext, IPriceFormatter priceFormatter)
        {
            if (product == null)
            {
                throw new ArgumentNullException("product");
            }

            if (localizationService == null)
            {
                throw new ArgumentNullException("localizationService");
            }

            if (measureService == null)
            {
                throw new ArgumentNullException("measureService");
            }

            if (currencyService == null)
            {
                throw new ArgumentNullException("currencyService");
            }

            if (workContext == null)
            {
                throw new ArgumentNullException("workContext");
            }

            if (priceFormatter == null)
            {
                throw new ArgumentNullException("priceFormatter");
            }

            if (!product.BasepriceEnabled)
            {
                return(null);
            }

            var productAmount = product.BasepriceAmount;

            //Amount in product cannot be 0
            if (productAmount == 0)
            {
                return(null);
            }
            var referenceAmount = product.BasepriceBaseAmount;
            var productUnit     = measureService.GetMeasureWeightById(product.BasepriceUnitId);

            //measure weight cannot be loaded
            if (productUnit == null)
            {
                return(null);
            }
            var referenceUnit = measureService.GetMeasureWeightById(product.BasepriceBaseUnitId);

            //measure weight cannot be loaded
            if (referenceUnit == null)
            {
                return(null);
            }

            productPrice = productPrice.HasValue ? productPrice.Value : product.Price;

            decimal basePrice = productPrice.Value /
                                //do not round. otherwise, it can cause issues
                                measureService.ConvertWeight(productAmount, productUnit, referenceUnit, false) *
                                referenceAmount;
            decimal basePriceInCurrentCurrency = currencyService.ConvertFromPrimaryStoreCurrency(basePrice, workContext.WorkingCurrency);
            string  basePriceStr = priceFormatter.FormatPrice(basePriceInCurrentCurrency, true, false);

            var result = string.Format(localizationService.GetResource("Products.BasePrice"),
                                       basePriceStr, referenceAmount.ToString("G29"), referenceUnit.Name);

            return(result);
        }
 public OverriddenShoppingCartModelFactory(AddressSettings addressSettings,
                                           CaptchaSettings captchaSettings,
                                           CatalogSettings catalogSettings,
                                           CommonSettings commonSettings,
                                           CustomerSettings customerSettings,
                                           IAddressModelFactory addressModelFactory,
                                           ICheckoutAttributeFormatter checkoutAttributeFormatter,
                                           ICheckoutAttributeParser checkoutAttributeParser,
                                           ICheckoutAttributeService checkoutAttributeService,
                                           ICountryService countryService,
                                           ICurrencyService currencyService,
                                           ICustomerService customerService,
                                           IDiscountService discountService,
                                           IDownloadService downloadService,
                                           IGenericAttributeService genericAttributeService,
                                           IGiftCardService giftCardService,
                                           IHttpContextAccessor httpContextAccessor,
                                           ILocalizationService localizationService,
                                           IOrderProcessingService orderProcessingService,
                                           IOrderTotalCalculationService orderTotalCalculationService,
                                           IPaymentPluginManager paymentPluginManager,
                                           IPaymentService paymentService,
                                           IPermissionService permissionService,
                                           IPictureService pictureService,
                                           IPriceCalculationService priceCalculationService,
                                           IPriceFormatter priceFormatter,
                                           IProductAttributeFormatter productAttributeFormatter,
                                           IProductService productService,
                                           IShippingPluginManager shippingPluginManager,
                                           IShippingService shippingService,
                                           IShoppingCartService shoppingCartService,
                                           IStateProvinceService stateProvinceService,
                                           IStaticCacheManager cacheManager,
                                           IStoreContext storeContext,
                                           ITaxPluginManager taxPluginManager,
                                           ITaxService taxService,
                                           IUrlRecordService urlRecordService,
                                           IVendorService vendorService,
                                           IWebHelper webHelper,
                                           IWorkContext workContext,
                                           MediaSettings mediaSettings,
                                           OrderSettings orderSettings,
                                           RewardPointsSettings rewardPointsSettings,
                                           ShippingSettings shippingSettings,
                                           ShoppingCartSettings shoppingCartSettings,
                                           TaxSettings taxSettings,
                                           VendorSettings vendorSettings) : base(addressSettings,
                                                                                 captchaSettings,
                                                                                 catalogSettings,
                                                                                 commonSettings,
                                                                                 customerSettings,
                                                                                 addressModelFactory,
                                                                                 checkoutAttributeFormatter,
                                                                                 checkoutAttributeParser,
                                                                                 checkoutAttributeService,
                                                                                 countryService,
                                                                                 currencyService,
                                                                                 customerService,
                                                                                 discountService,
                                                                                 downloadService,
                                                                                 genericAttributeService,
                                                                                 giftCardService,
                                                                                 httpContextAccessor,
                                                                                 localizationService,
                                                                                 orderProcessingService,
                                                                                 orderTotalCalculationService,
                                                                                 paymentPluginManager,
                                                                                 paymentService,
                                                                                 permissionService,
                                                                                 pictureService,
                                                                                 priceCalculationService,
                                                                                 priceFormatter,
                                                                                 productAttributeFormatter,
                                                                                 productService,
                                                                                 shippingPluginManager,
                                                                                 shippingService,
                                                                                 shoppingCartService,
                                                                                 stateProvinceService,
                                                                                 cacheManager,
                                                                                 storeContext,
                                                                                 taxService,
                                                                                 urlRecordService,
                                                                                 vendorService,
                                                                                 webHelper,
                                                                                 workContext,
                                                                                 mediaSettings,
                                                                                 orderSettings,
                                                                                 rewardPointsSettings,
                                                                                 shippingSettings,
                                                                                 shoppingCartSettings,
                                                                                 taxSettings,
                                                                                 vendorSettings)
 {
     _countryService               = countryService;
     _currencyService              = currencyService;
     _genericAttributeService      = genericAttributeService;
     _giftCardService              = giftCardService;
     _httpContextAccessor          = httpContextAccessor;
     _orderTotalCalculationService = orderTotalCalculationService;
     _paymentService               = paymentService;
     _priceCalculationService      = priceCalculationService;
     _priceFormatter               = priceFormatter;
     _shippingPluginManager        = shippingPluginManager;
     _shoppingCartService          = shoppingCartService;
     _stateProvinceService         = stateProvinceService;
     _storeContext         = storeContext;
     _taxPluginManager     = taxPluginManager;
     _taxService           = taxService;
     _workContext          = workContext;
     _rewardPointsSettings = rewardPointsSettings;
     _shippingSettings     = shippingSettings;
     _taxSettings          = taxSettings;
 }
Example #55
0
            public virtual void LoadPriceRangeFilters(string priceRangeStr, IWebHelper webHelper, IPriceFormatter priceFormatter)
            {
                var priceRangeList = GetPriceRangeList(priceRangeStr);

                if (priceRangeList.Any())
                {
                    this.Enabled = true;

                    var selectedPriceRange = GetSelectedPriceRange(webHelper, priceRangeStr);

                    this.Items = priceRangeList.ToList().Select(x =>
                    {
                        //from&to
                        var item = new PriceRangeFilterItem();
                        if (x.From.HasValue)
                        {
                            item.From = priceFormatter.FormatPrice(x.From.Value, true, false);
                        }
                        if (x.To.HasValue)
                        {
                            item.To = priceFormatter.FormatPrice(x.To.Value, true, false);
                        }
                        string fromQuery = string.Empty;
                        if (x.From.HasValue)
                        {
                            fromQuery = x.From.Value.ToString(new CultureInfo("en-US"));
                        }
                        string toQuery = string.Empty;
                        if (x.To.HasValue)
                        {
                            toQuery = x.To.Value.ToString(new CultureInfo("en-US"));
                        }

                        //is selected?
                        if (selectedPriceRange != null &&
                            selectedPriceRange.From == x.From &&
                            selectedPriceRange.To == x.To)
                        {
                            item.Selected = true;
                        }

                        //filter URL
                        string url     = webHelper.ModifyQueryString(webHelper.GetThisPageUrl(true), QUERYSTRINGPARAM, $"{fromQuery}-{toQuery}");
                        url            = ExcludeQueryStringParams(url, webHelper);
                        item.FilterUrl = url;


                        return(item);
                    }).ToList();

                    if (selectedPriceRange != null)
                    {
                        //remove filter URL
                        string url = webHelper.ModifyQueryString(webHelper.GetThisPageUrl(true), QUERYSTRINGPARAM, null);
                        url = ExcludeQueryStringParams(url, webHelper);
                        this.RemoveFilterUrl = url;
                    }
                }
                else
                {
                    this.Enabled = false;
                }
            }
Example #56
0
        public static PhieuChuyenPhatModel ToModel(this PhieuChuyenPhat nvfrom, ILocalizationService localizationService, IPriceFormatter priceFormatter)
        {
            var nvto = new PhieuChuyenPhatModel();

            nvto.Id      = nvfrom.Id;
            nvto.NhaXeId = nvfrom.NhaXeId;
            nvto.MaPhieu = nvfrom.MaPhieu;
            //van phong gui
            nvto.VanPhongGuiId   = nvfrom.VanPhongGuiId;
            nvto.VanPhongGuiText = nvfrom.VanPhongGui != null ? nvfrom.VanPhongGui.TenVanPhong : "";
            //van phong nhan
            nvto.VanPhongNhanId   = nvfrom.VanPhongNhanId;
            nvto.VanPhongNhanText = nvfrom.VanPhongNhan != null ? nvfrom.VanPhongNhan.TenVanPhong : "";
            nvto.KhuVucText       = nvfrom.VanPhongNhan != null && nvfrom.VanPhongNhan.khuvuc != null ? nvfrom.VanPhongNhan.khuvuc.TenKhuVuc : "";
            //nguoi gui
            nvto.NguoiGuiId   = nvfrom.NguoiGuiId;
            nvto.NguoiGuiText = nvfrom.NguoiGui.toText();
            nvto.NguoiGui     = nvfrom.NguoiGui;
            //nguoi nhan
            nvto.NguoiNhanId   = nvfrom.NguoiNhanId;
            nvto.NguoiNhanText = nvfrom.NguoiNhan.toText();
            nvto.NguoiNhan     = nvfrom.NguoiNhan;

            nvto.NhanVienGiaoDichId  = nvfrom.NhanVienGiaoDichId;
            nvto.TenNhanvienGiaoDich = nvfrom.NVGiaoDich != null ? nvfrom.NVGiaoDich.HoVaTen : "";
            nvto.TrangThai           = nvfrom.TrangThai;
            nvto.TrangThaiText       = nvfrom.TrangThai.ToCVEnumText(localizationService);
            nvto.TenHang             = nvfrom.TenHang;
            nvto.CuocCapToc          = nvfrom.CuocCapToc;
            nvto.CuocGiaTri          = nvfrom.CuocGiaTri;
            nvto.CuocVuotTuyen       = nvfrom.CuocVuotTuyen;
            nvto.CuocPhi             = nvfrom.CuocPhi;
            nvto.CuocTanNoi          = nvfrom.CuocTanNoi;
            nvto.CuocNhanTanNoi      = nvfrom.CuocNhanTanNoi;
            nvto.TongCuocDaThanhToan = nvfrom.TongCuocDaThanhToan;
            nvto.PhieuVanChuyenId    = nvfrom.PhieuVanChuyenId.GetValueOrDefault(0);
            nvto.SoLenh = nvfrom.phieuvanchuyen != null ? nvfrom.phieuvanchuyen.SoLenh : "";

            nvto.NgayKetThuc           = nvfrom.NgayKetThuc;
            nvto.NgayTao               = nvfrom.NgayTao;
            nvto.NgayUpdate            = nvfrom.NgayUpdate;
            nvto.NgayNhanHang          = nvfrom.NgayNhanHang;
            nvto.GhiChu                = nvfrom.GhiChu;
            nvto.ToVanChuyenNhanId     = nvfrom.ToVanChuyenNhanId.GetValueOrDefault(0);
            nvto.TenToVanChuyenNhan    = nvfrom.tovanchuyennhan != null ? nvfrom.tovanchuyennhan.TenTo : "";
            nvto.NguoiVanChuyenNhanId  = nvfrom.NguoiVanChuyenNhanId.GetValueOrDefault(0);
            nvto.TenNguoiVanChuyenNhan = nvfrom.nguoivanchuyennhan != null ? nvfrom.nguoivanchuyennhan.HoVaTen : "";

            nvto.ToVanChuyenTraId     = nvfrom.ToVanChuyenTraId.GetValueOrDefault(0);
            nvto.TenToVanChuyenTra    = nvfrom.tovanchuyentra != null ? nvfrom.tovanchuyentra.TenTo : "";
            nvto.NguoiVanChuyenTraId  = nvfrom.NguoiVanChuyenTraId.GetValueOrDefault(0);
            nvto.TenNguoiVanChuyenTra = nvfrom.nguoivanchuyentra != null ? nvfrom.nguoivanchuyentra.HoVaTen : "";

            nvto.DaSMS        = nvfrom.DaSMS;
            nvto.TongTienCuoc = nvfrom.TongTienCuoc;
            nvto.LoaiPhieuId  = nvfrom.LoaiPhieuId;


            if (nvfrom.phieuvanchuyen != null)
            {
                if (nvfrom.phieuvanchuyen.LoaiPhieuVanChuyen == ENLoaiPhieuVanChuyen.VuotTuyen)
                {
                    nvto.isVuotTuyen = true;
                }
            }
            //nhat ky van chuyen
            foreach (var nk in nvfrom.nhatkyvanchuyens)
            {
                var nvkcmodel = new PhieuChuyenPhatModel.PhieuChuyenPhatVanChuyenModel();
                nvkcmodel.ChuyenDiId = nk.ChuyenDiId;
                if (nk.chuyendi != null)
                {
                    nvkcmodel.BienSo         = nk.chuyendi.xevanchuyen != null ? nk.chuyendi.xevanchuyen.BienSo : "";
                    nvkcmodel.LaiXe          = nk.chuyendi.ThongTinLaiPhuXe(0, true);
                    nvkcmodel.PhuXe          = nk.chuyendi.ThongTinLaiPhuXe(1, true);
                    nvkcmodel.NgayDi         = nk.chuyendi.NgayDi;
                    nvkcmodel.ThongTinChuyen = string.Format("{0};{1};{2};{3}", nvkcmodel.BienSo, nvkcmodel.LaiXe, nvkcmodel.PhuXe, nvkcmodel.NgayDi.ToString("HH:mm"));
                    if (nvto.ThongTinXe == null)
                    {
                        nvto.ThongTinXe = nvkcmodel.ThongTinChuyen;
                    }
                    else
                    {
                        nvto.ThongTinXe = string.Format("[{0}]\n[{1}]", nvto.ThongTinXe, nvkcmodel.ThongTinChuyen);
                    }
                }
                nvkcmodel.CuocVuotTuyen      = nk.CuocVuotTuyen;
                nvkcmodel.HanhTrinhId        = nk.HanhTrinhId;
                nvkcmodel.hanhtrinhText      = nk.hanhtrinh != null ? nk.hanhtrinh.MoTa : "";
                nvkcmodel.Id                 = nk.Id;
                nvkcmodel.KhuVucId           = nk.KhuVucId;
                nvkcmodel.khuvucText         = nk.khuvuc != null ? nk.khuvuc.TenKhuVuc : "";
                nvkcmodel.PhieuChuyenPhatId  = nk.PhieuChuyenPhatId;
                nvkcmodel.PhieuVanChuyenId   = nk.PhieuVanChuyenId;
                nvkcmodel.PhieuVanChuyenText = nk.phieuvanchuyen.SoLenh;
                nvkcmodel.TongCuoc           = nk.TongCuoc;
                nvkcmodel.TuyenId            = nk.TuyenId.GetValueOrDefault(0);
                nvkcmodel.tuyenText          = nk.tuyen != null ? nk.tuyen.TenTuyen : "";
                nvkcmodel.VanPhongGuiId      = nk.VanPhongGuiId;
                nvkcmodel.vanphongguiText    = nk.vanphonggui != null ? nk.vanphonggui.TenVanPhong : "";
                nvkcmodel.VanPhongNhanId     = nk.VanPhongNhanId;
                nvkcmodel.vanphongnhanText   = nk.vanphongnhan != null ? nk.vanphongnhan.TenVanPhong : "";
                nvto.nhatkyvanchuyens.Add(nvkcmodel);
            }
            //thong tin chuyen di

            return(nvto);
        }
        public void TestInitialize()
        {
            _productRepo = new MongoDBRepositoryTest <Product>();
            //dropdown list: adding 2 options "atributes" that can be selected via DropDownList
            pa1 = new ProductAttribute {
                Id   = "1",
                Name = "Color"
            };
            pam1_1 = new ProductAttributeMapping {
                Id                   = "11",
                ProductId            = "1",
                TextPrompt           = "Select color:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.DropdownList,
                DisplayOrder         = 1,
                ProductAttributeId   = pa1.Id
            };
            pav1_1 = new ProductAttributeValue {
                Id           = "11",
                Name         = "Green",
                DisplayOrder = 1,
                ProductAttributeMappingId = pam1_1.Id
            };
            pav1_2 = new ProductAttributeValue {
                Id           = "12",
                Name         = "Red",
                DisplayOrder = 2,
                ProductAttributeMappingId = pam1_1.Id
            };
            //adding colors (as product atributes)
            pam1_1.ProductAttributeValues.Add(pav1_1);
            pam1_1.ProductAttributeValues.Add(pav1_2);

            //checkboxes - adding 2 options that can be ticked via CheckBox'es
            pa2 = new ProductAttribute {
                Id   = "2",
                Name = "Some custom option",
            };
            pam2_1 = new ProductAttributeMapping {
                Id                   = "21",
                ProductId            = "1",
                TextPrompt           = "Select at least one option:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.Checkboxes,
                DisplayOrder         = 2,
                ProductAttributeId   = pa2.Id
            };
            pav2_1 = new ProductAttributeValue {
                Id           = "21",
                Name         = "Option 1",
                DisplayOrder = 1,
                ProductAttributeMappingId = pam2_1.Id
            };
            pav2_2 = new ProductAttributeValue {
                Id           = "22",
                Name         = "Option 2",
                DisplayOrder = 2,
                ProductAttributeMappingId = pam2_1.Id
            };
            pam2_1.ProductAttributeValues.Add(pav2_1);
            pam2_1.ProductAttributeValues.Add(pav2_2);

            //adds custom text (user can add its own text)
            pa3 = new ProductAttribute {
                Id   = "3",
                Name = "Custom text",
            };
            pam3_1 = new ProductAttributeMapping {
                Id                   = "31",
                ProductId            = "1",
                TextPrompt           = "Enter custom text:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.TextBox,
                DisplayOrder         = 1,
                ProductAttributeId   = pa3.Id
            };

            _product = new Product();
            _product.ProductAttributeMappings.Add(pam1_1);
            _product.ProductAttributeMappings.Add(pam2_1);
            _product.ProductAttributeMappings.Add(pam3_1);
            _productRepo.Insert(_product); //26 april

            var tempEventPublisher = new Mock <IMediator>();
            {
                //tempEventPublisher.Setup(x => x.Publish(It.IsAny<object>()));
                _eventPublisher = tempEventPublisher.Object;
            }

            var cacheManager = new TestMemoryCacheManager(new Mock <IMemoryCache>().Object, _eventPublisher);

            _productAttributeRepo = new Mock <IRepository <ProductAttribute> >().Object;

            _productAttributeService = new ProductAttributeService(cacheManager,
                                                                   _productAttributeRepo,
                                                                   _productRepo,
                                                                   _eventPublisher);
            _productAttributeParser  = new ProductAttributeParser();
            _priceCalculationService = new Mock <IPriceCalculationService>().Object;

            var tempWorkContext = new Mock <IWorkContext>();

            {
                var workingLanguage = new Language();
                tempWorkContext.Setup(x => x.WorkingLanguage).Returns(workingLanguage);
                _workContext = tempWorkContext.Object;
            }
            _currencyService = new Mock <ICurrencyService>().Object;
            var tempLocalizationService = new Mock <ILocalizationService>();

            {
                tempLocalizationService.Setup(x => x.GetResource("GiftCardAttribute.For.Virtual")).Returns("For: {0} <{1}>");
                tempLocalizationService.Setup(x => x.GetResource("GiftCardAttribute.From.Virtual")).Returns("From: {0} <{1}>");
                tempLocalizationService.Setup(x => x.GetResource("GiftCardAttribute.For.Physical")).Returns("For: {0}");
                tempLocalizationService.Setup(x => x.GetResource("GiftCardAttribute.From.Physical")).Returns("From: {0}");
                _localizationService = tempLocalizationService.Object;
            }

            _taxService           = new Mock <ITaxService>().Object;
            _priceFormatter       = new Mock <IPriceFormatter>().Object;
            _downloadService      = new Mock <IDownloadService>().Object;
            _webHelper            = new Mock <IWebHelper>().Object;
            _shoppingCartSettings = new Mock <ShoppingCartSettings>().Object;

            _productAttributeFormatter = new ProductAttributeFormatter(_workContext,
                                                                       _productAttributeService,
                                                                       _productAttributeParser,
                                                                       _currencyService,
                                                                       _localizationService,
                                                                       _taxService,
                                                                       _priceFormatter,
                                                                       _downloadService,
                                                                       _webHelper,
                                                                       _priceCalculationService,
                                                                       _shoppingCartSettings);
        }
        public new void SetUp()
        {
            #region Test data

            //color (dropdownlist)
            ca1 = new CheckoutAttribute
            {
                Id                   = 1,
                Name                 = "Color",
                TextPrompt           = "Select color:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.DropdownList,
                DisplayOrder         = 1,
            };
            cav1_1 = new CheckoutAttributeValue
            {
                Id                  = 11,
                Name                = "Green",
                DisplayOrder        = 1,
                CheckoutAttribute   = ca1,
                CheckoutAttributeId = ca1.Id,
            };
            cav1_2 = new CheckoutAttributeValue
            {
                Id                  = 12,
                Name                = "Red",
                DisplayOrder        = 2,
                CheckoutAttribute   = ca1,
                CheckoutAttributeId = ca1.Id,
            };
            ca1.CheckoutAttributeValues.Add(cav1_1);
            ca1.CheckoutAttributeValues.Add(cav1_2);

            //custom option (checkboxes)
            ca2 = new CheckoutAttribute
            {
                Id                   = 2,
                Name                 = "Custom option",
                TextPrompt           = "Select custom option:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.Checkboxes,
                DisplayOrder         = 2,
            };
            cav2_1 = new CheckoutAttributeValue
            {
                Id                  = 21,
                Name                = "Option 1",
                DisplayOrder        = 1,
                CheckoutAttribute   = ca2,
                CheckoutAttributeId = ca2.Id,
            };
            cav2_2 = new CheckoutAttributeValue
            {
                Id                  = 22,
                Name                = "Option 2",
                DisplayOrder        = 2,
                CheckoutAttribute   = ca2,
                CheckoutAttributeId = ca2.Id,
            };
            ca2.CheckoutAttributeValues.Add(cav2_1);
            ca2.CheckoutAttributeValues.Add(cav2_2);

            //custom text
            ca3 = new CheckoutAttribute
            {
                Id                   = 3,
                Name                 = "Custom text",
                TextPrompt           = "Enter custom text:",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.MultilineTextbox,
                DisplayOrder         = 3,
            };


            #endregion

            _checkoutAttributeRepo = MockRepository.GenerateMock <IRepository <CheckoutAttribute> >();
            _checkoutAttributeRepo.Expect(x => x.Table).Return(new List <CheckoutAttribute>()
            {
                ca1, ca2, ca3
            }.AsQueryable());
            _checkoutAttributeRepo.Expect(x => x.GetById(ca1.Id)).Return(ca1);
            _checkoutAttributeRepo.Expect(x => x.GetById(ca2.Id)).Return(ca2);
            _checkoutAttributeRepo.Expect(x => x.GetById(ca3.Id)).Return(ca3);

            _checkoutAttributeValueRepo = MockRepository.GenerateMock <IRepository <CheckoutAttributeValue> >();
            _checkoutAttributeValueRepo.Expect(x => x.Table).Return(new List <CheckoutAttributeValue>()
            {
                cav1_1, cav1_2, cav2_1, cav2_2
            }.AsQueryable());
            _checkoutAttributeValueRepo.Expect(x => x.GetById(cav1_1.Id)).Return(cav1_1);
            _checkoutAttributeValueRepo.Expect(x => x.GetById(cav1_2.Id)).Return(cav1_2);
            _checkoutAttributeValueRepo.Expect(x => x.GetById(cav2_1.Id)).Return(cav2_1);
            _checkoutAttributeValueRepo.Expect(x => x.GetById(cav2_2.Id)).Return(cav2_2);

            var cacheManager = new NopNullCache();

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

            _checkoutAttributeService = new CheckoutAttributeService(cacheManager,
                                                                     _checkoutAttributeRepo,
                                                                     _checkoutAttributeValueRepo,
                                                                     _eventPublisher);

            _checkoutAttributeParser = new CheckoutAttributeParser(_checkoutAttributeService);



            var workingLanguage = new Language();
            _workContext = MockRepository.GenerateMock <IWorkContext>();
            _workContext.Expect(x => x.WorkingLanguage).Return(workingLanguage);
            _currencyService = MockRepository.GenerateMock <ICurrencyService>();
            _taxService      = MockRepository.GenerateMock <ITaxService>();
            _priceFormatter  = MockRepository.GenerateMock <IPriceFormatter>();

            _checkoutAttributeFormatter = new CheckoutAttributeFormatter(_workContext,
                                                                         _checkoutAttributeService,
                                                                         _checkoutAttributeParser,
                                                                         _currencyService,
                                                                         _taxService,
                                                                         _priceFormatter);
        }
Example #59
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(),
                    ProductType      = product.ProductType,
                    MarkAsNew        = product.MarkAsNew &&
                                       (!product.MarkAsNewStartDateTimeUtc.HasValue || product.MarkAsNewStartDateTimeUtc.Value < DateTime.UtcNow) &&
                                       (!product.MarkAsNewEndDateTimeUtc.HasValue || product.MarkAsNewEndDateTimeUtc.Value > DateTime.UtcNow)
                };
                //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);

                        //add to cart button (ignore "DisableBuyButton" property for grouped products)
                        priceModel.DisableBuyButton = !permissionService.Authorize(StandardPermissionProvider.EnableShoppingCart) ||
                                                      !permissionService.Authorize(StandardPermissionProvider.DisplayPrices);

                        //add to wishlist button (ignore "DisableWishlistButton" property for grouped products)
                        priceModel.DisableWishlistButton = !permissionService.Authorize(StandardPermissionProvider.EnableWishlist) ||
                                                           !permissionService.Authorize(StandardPermissionProvider.DisplayPrices);

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

                        default:
                        {
                            //we have at least one associated product
                            //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 = controller.PrepareProductReviewOverviewModel(storeContext, catalogSettings, cacheManager, product);

                models.Add(model);
            }
            return(models);
        }
Example #60
0
        public VeXeKhachController(IStateProvinceService stateProvinceService,
                                   INhaXeService nhaxeService,
                                   ILocalizationService localizationService,
                                   IWorkContext workContext,
                                   IPictureService pictureService,
                                   ICustomerService customerService,
                                   IChonVeService chonveService,
                                   IDiaChiService diachiService,
                                   INhanVienService nhanvienService,
                                   IPermissionService permissionService,
                                   IDateTimeHelper dateTimeHelper,
                                   CustomerSettings customerSettings,
                                   DateTimeSettings dateTimeSettings,
                                   ICustomerRegistrationService customerRegistrationService,
                                   ICustomerActivityService customerActivityService,
                                   IGenericAttributeService genericAttributeService,
                                   IStoreService storeService,
                                   INewsLetterSubscriptionService newsLetterSubscriptionService,
                                   IXeInfoService xeinfoService,
                                   IHanhTrinhService hanhtrinhService,
                                   IPriceFormatter priceFormatter,
                                   IBenXeService benxeService,
                                   IVeXeService vexeService,
                                   AddressSettings addressSettings,
                                   IAddressAttributeFormatter addressAttributeFormatter,
                                   IAddressService addressService,
                                   ICountryService countryService,
                                   IAddressAttributeParser addressAttributeParser,
                                   IAddressAttributeService addressAttributeService,
                                   IPhoiVeService phoiveService,
                                   IOrderService orderService

                                   )
        {
            this._phoiveService                 = phoiveService;
            this._addressAttributeParser        = addressAttributeParser;
            this._addressAttributeService       = addressAttributeService;
            this._stateProvinceService          = stateProvinceService;
            this._nhaxeService                  = nhaxeService;
            this._localizationService           = localizationService;
            this._workContext                   = workContext;
            this._pictureService                = pictureService;
            this._customerService               = customerService;
            this._chonveService                 = chonveService;
            this._diachiService                 = diachiService;
            this._nhanvienService               = nhanvienService;
            this._permissionService             = permissionService;
            this._dateTimeHelper                = dateTimeHelper;
            this._customerSettings              = customerSettings;
            this._dateTimeSettings              = dateTimeSettings;
            this._customerRegistrationService   = customerRegistrationService;
            this._customerActivityService       = customerActivityService;
            this._genericAttributeService       = genericAttributeService;
            this._storeService                  = storeService;
            this._newsLetterSubscriptionService = newsLetterSubscriptionService;
            this._xeinfoService                 = xeinfoService;
            this._hanhtrinhService              = hanhtrinhService;
            this._priceFormatter                = priceFormatter;
            this._benxeService                  = benxeService;
            this._vexeService                   = vexeService;
            this._addressSettings               = addressSettings;
            this._addressAttributeFormatter     = addressAttributeFormatter;
            this._addressService                = addressService;
            this._countryService                = countryService;
            this._orderService                  = orderService;
        }