public AddressAttributeFormatter(IWorkContext workContext,
     IAddressAttributeService addressAttributeService,
     IAddressAttributeParser addressAttributeParser)
 {
     this._workContext = workContext;
     this._addressAttributeService = addressAttributeService;
     this._addressAttributeParser = addressAttributeParser;
 }
 public AddressAttributeController(IAddressAttributeService addressAttributeService,
     ILanguageService languageService, 
     ILocalizationService localizationService,
     IWorkContext workContext,
     IPermissionService permissionService)
 {
     this._addressAttributeService = addressAttributeService;
     this._languageService = languageService;
     this._localizationService = localizationService;
     this._workContext = workContext;
     this._permissionService = permissionService;
 }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="cacheManager">Cache manager</param>
 /// <param name="addressRepository">Address repository</param>
 /// <param name="countryService">Country service</param>
 /// <param name="stateProvinceService">State/province service</param>
 /// <param name="addressAttributeService">Address attribute service</param>
 /// <param name="eventPublisher">Event publisher</param>
 /// <param name="addressSettings">Address settings</param>
 public AddressService(ICacheManager cacheManager,
     IRepository<Address> addressRepository,
     ICountryService countryService, 
     IStateProvinceService stateProvinceService,
     IAddressAttributeService addressAttributeService,
     IEventPublisher eventPublisher, 
     AddressSettings addressSettings)
 {
     this._cacheManager = cacheManager;
     this._addressRepository = addressRepository;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._addressAttributeService = addressAttributeService;
     this._eventPublisher = eventPublisher;
     this._addressSettings = addressSettings;
 }
        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,
            IAddressAttributeParser addressAttributeParser,
            IAddressAttributeService addressAttributeService,
            IAddressAttributeFormatter addressAttributeFormatter,
            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._addressAttributeParser = addressAttributeParser;
            this._addressAttributeService = addressAttributeService;
            this._addressAttributeFormatter = addressAttributeFormatter;

            this._orderSettings = orderSettings;
            this._rewardPointsSettings = rewardPointsSettings;
            this._paymentSettings = paymentSettings;
            this._shippingSettings = shippingSettings;
            this._addressSettings = addressSettings;
        }
Beispiel #5
0
        public PaidRegistionController(
            IAddressModelFactory addressModelFactory,
            ICustomerModelFactory customerModelFactory,
            IAuthenticationService authenticationService,
            DateTimeSettings dateTimeSettings,
            TaxSettings taxSettings,
            ILocalizationService localizationService,
            IWorkContext workContext,
            IStoreContext storeContext,
            ICustomerService customerService,
            ICustomerAttributeParser customerAttributeParser,
            ICustomerAttributeService customerAttributeService,
            IGenericAttributeService genericAttributeService,
            ICustomerRegistrationService customerRegistrationService,
            ITaxService taxService,
            CustomerSettings customerSettings,
            AddressSettings addressSettings,
            ForumSettings forumSettings,
            IAddressService addressService,
            ICountryService countryService,
            IOrderService orderService,
            IPictureService pictureService,
            INewsLetterSubscriptionService newsLetterSubscriptionService,
            IShoppingCartService shoppingCartService,
            IOpenAuthenticationService openAuthenticationService,
            IWebHelper webHelper,
            ICustomerActivityService customerActivityService,
            IAddressAttributeParser addressAttributeParser,
            IAddressAttributeService addressAttributeService,
            IStoreService storeService,
            IEventPublisher eventPublisher,
            MediaSettings mediaSettings,
            IWorkflowMessageService workflowMessageService,
            LocalizationSettings localizationSettings,
            CaptchaSettings captchaSettings,
            StoreInformationSettings storeInformationSettings,
            IStateProvinceService stateProvinceService

            )
        {
            this._addressModelFactory         = addressModelFactory;
            this._customerModelFactory        = customerModelFactory;
            this._authenticationService       = authenticationService;
            this._dateTimeSettings            = dateTimeSettings;
            this._taxSettings                 = taxSettings;
            this._localizationService         = localizationService;
            this._workContext                 = workContext;
            this._storeContext                = storeContext;
            this._customerService             = customerService;
            this._customerAttributeParser     = customerAttributeParser;
            this._customerAttributeService    = customerAttributeService;
            this._genericAttributeService     = genericAttributeService;
            this._customerRegistrationService = customerRegistrationService;
            this._taxService       = taxService;
            this._customerSettings = customerSettings;
            this._addressSettings  = addressSettings;
            this._forumSettings    = forumSettings;
            this._addressService   = addressService;
            this._countryService   = countryService;
            this._orderService     = orderService;
            this._pictureService   = pictureService;
            this._newsLetterSubscriptionService = newsLetterSubscriptionService;
            this._shoppingCartService           = shoppingCartService;
            this._openAuthenticationService     = openAuthenticationService;
            this._webHelper = webHelper;
            this._customerActivityService  = customerActivityService;
            this._addressAttributeParser   = addressAttributeParser;
            this._addressAttributeService  = addressAttributeService;
            this._storeService             = storeService;
            this._eventPublisher           = eventPublisher;
            this._mediaSettings            = mediaSettings;
            this._workflowMessageService   = workflowMessageService;
            this._localizationSettings     = localizationSettings;
            this._captchaSettings          = captchaSettings;
            this._storeInformationSettings = storeInformationSettings;
            this._stateProvinceService     = stateProvinceService;



            this._mapper = new MapperConfiguration(cfg => { cfg.CreateMap <RegisterModel, PaaRegisterModel>(); })
                           .CreateMapper();
        }
 public AddressAttributeParser(IAddressAttributeService addressAttributeService,
                               ILocalizationService localizationService)
 {
     _addressAttributeService = addressAttributeService;
     _localizationService     = localizationService;
 }
        public OrderController(IOrderService orderService, 
            IOrderReportService orderReportService, 
            IOrderProcessingService orderProcessingService,
            IReturnRequestService returnRequestService,
            IPriceCalculationService priceCalculationService,
            ITaxService taxService,
            IDateTimeHelper dateTimeHelper,
            IPriceFormatter priceFormatter,
            IDiscountService discountService,
            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, 
            IShippingService shippingService,
            IStoreService storeService,
            IVendorService vendorService,
            IAddressAttributeParser addressAttributeParser,
            IAddressAttributeService addressAttributeService,
            IAddressAttributeFormatter addressAttributeFormatter,
            IAffiliateService affiliateService,
            IPictureService pictureService,
            ICustomerActivityService customerActivityService,
            ICacheManager cacheManager,
            OrderSettings orderSettings,
            CurrencySettings currencySettings, 
            TaxSettings taxSettings,
            MeasureSettings measureSettings,
            AddressSettings addressSettings,
            ShippingSettings shippingSettings)
		{
            this._orderService = orderService;
            this._orderReportService = orderReportService;
            this._orderProcessingService = orderProcessingService;
            this._returnRequestService = returnRequestService;
            this._priceCalculationService = priceCalculationService;
            this._taxService = taxService;
            this._dateTimeHelper = dateTimeHelper;
            this._priceFormatter = priceFormatter;
            this._discountService = discountService;
            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._shippingService = shippingService;
            this._storeService = storeService;
            this._vendorService = vendorService;
            this._addressAttributeParser = addressAttributeParser;
            this._addressAttributeService = addressAttributeService;
            this._addressAttributeFormatter = addressAttributeFormatter;
            this._affiliateService = affiliateService;
            this._pictureService = pictureService;
            this._customerActivityService = customerActivityService;
            this._cacheManager = cacheManager;
            this._orderSettings = orderSettings;
            this._currencySettings = currencySettings;
            this._taxSettings = taxSettings;
            this._measureSettings = measureSettings;
            this._addressSettings = addressSettings;
            this._shippingSettings = shippingSettings;
		}
 public AddressAttributeParser(IAddressAttributeService addressAttributeService,
     ILocalizationService localizationService)
 {
     this._addressAttributeService = addressAttributeService;
     this._localizationService = localizationService;
 }
Beispiel #9
0
 public AddressAttributeParser(IAddressAttributeService addressAttributeService, ILocalizationService localizationService, IUnitOfWork unitOfWork)
 {
     this._addressAttributeService = addressAttributeService;
     this._localizationService     = localizationService;
     //this._unitOfWork = unitOfWork;
 }
        //address
        /// <summary>
        /// Prepare address model
        /// </summary>
        /// <param name="model">Model</param>
        /// <param name="address">Address</param>
        /// <param name="excludeProperties">A value indicating whether to exclude properties</param>
        /// <param name="addressSettings">Address settings</param>
        /// <param name="localizationService">Localization service (used to prepare a select list)</param>
        /// <param name="stateProvinceService">State service (used to prepare a select list). null to don't prepare the list.</param>
        /// <param name="addressAttributeService">Address attribute service. null to don't prepare the list.</param>
        /// <param name="addressAttributeParser">Address attribute parser. null to don't prepare the list.</param>
        /// <param name="addressAttributeFormatter">Address attribute formatter. null to don't prepare the formatted custom attributes.</param>
        /// <param name="loadCountries">A function to load countries  (used to prepare a select list). null to don't prepare the list.</param>
        /// <param name="prePopulateWithCustomerFields">A value indicating whether to pre-populate an address with customer fields entered during registration. It's used only when "address" parameter is set to "null"</param>
        /// <param name="customer">Customer record which will be used to pre-populate address. Used only when "prePopulateWithCustomerFields" is "true".</param>
        /// <param name="overrideAttributesXml">When specified we do not use attributes of an address; if null, then already saved ones are used</param>
        public static void PrepareModel(this AddressModel model,
            Address address, bool excludeProperties,
            AddressSettings addressSettings,
            ILocalizationService localizationService = null,
            IStateProvinceService stateProvinceService = null,
            IAddressAttributeService addressAttributeService = null,
            IAddressAttributeParser addressAttributeParser = null,
            IAddressAttributeFormatter addressAttributeFormatter = null,
            Func<IList<Country>> loadCountries = null,
            bool prePopulateWithCustomerFields = false,
            Customer customer = null,
            string overrideAttributesXml = "")
        {
            if (model == null)
                throw new ArgumentNullException("model");

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

            if (!excludeProperties && address != null)
            {
                model.Id = address.Id;
                model.FirstName = address.FirstName;
                model.LastName = address.LastName;
                model.Email = address.Email;
                model.Company = address.Company;
                model.CountryId = address.CountryId;
                model.CountryName = address.Country != null
                    ? address.Country.GetLocalized(x => x.Name)
                    : null;
                model.StateProvinceId = address.StateProvinceId;
                model.StateProvinceName = address.StateProvince != null
                    ? address.StateProvince.GetLocalized(x => x.Name)
                    : null;
                model.City = address.City;
                model.Address1 = address.Address1;
                model.Address2 = address.Address2;
                model.ZipPostalCode = address.ZipPostalCode;
                model.PhoneNumber = address.PhoneNumber;
                model.FaxNumber = address.FaxNumber;
            }

            if (address == null && prePopulateWithCustomerFields)
            {
                if (customer == null)
                    throw new Exception("Customer cannot be null when prepopulating an address");
                model.Email = customer.Email;
                model.FirstName = customer.GetAttribute<string>(SystemCustomerAttributeNames.FirstName);
                model.LastName = customer.GetAttribute<string>(SystemCustomerAttributeNames.LastName);
                model.Company = customer.GetAttribute<string>(SystemCustomerAttributeNames.Company);
                model.Address1 = customer.GetAttribute<string>(SystemCustomerAttributeNames.StreetAddress);
                model.Address2 = customer.GetAttribute<string>(SystemCustomerAttributeNames.StreetAddress2);
                model.ZipPostalCode = customer.GetAttribute<string>(SystemCustomerAttributeNames.ZipPostalCode);
                model.City = customer.GetAttribute<string>(SystemCustomerAttributeNames.City);
                //ignore country and state for prepopulation. it can cause some issues when posting pack with errors, etc
                //model.CountryId = customer.GetAttribute<int>(SystemCustomerAttributeNames.CountryId);
                //model.StateProvinceId = customer.GetAttribute<int>(SystemCustomerAttributeNames.StateProvinceId);
                model.PhoneNumber = customer.GetAttribute<string>(SystemCustomerAttributeNames.Phone);
                model.FaxNumber = customer.GetAttribute<string>(SystemCustomerAttributeNames.Fax);
            }

            //countries and states
            if (addressSettings.CountryEnabled && loadCountries != null)
            {
                if (localizationService == null)
                    throw new ArgumentNullException("localizationService");

                model.AvailableCountries.Add(new SelectListItem { Text = localizationService.GetResource("Address.SelectCountry"), Value = "0" });
                foreach (var c in loadCountries())
                {
                    model.AvailableCountries.Add(new SelectListItem
                    {
                        Text = c.GetLocalized(x => x.Name),
                        Value = c.Id.ToString(),
                        Selected = c.Id == model.CountryId
                    });
                }

                if (addressSettings.StateProvinceEnabled)
                {
                    //states
                    if (stateProvinceService == null)
                        throw new ArgumentNullException("stateProvinceService");

                    var languageId = EngineContext.Current.Resolve<IWorkContext>().WorkingLanguage.Id;
                    var states = stateProvinceService
                        .GetStateProvincesByCountryId(model.CountryId.HasValue ? model.CountryId.Value : 0, languageId)
                        .ToList();
                    if (states.Count > 0)
                    {
                        model.AvailableStates.Add(new SelectListItem { Text = localizationService.GetResource("Address.SelectState"), Value = "0" });

                        foreach (var s in states)
                        {
                            model.AvailableStates.Add(new SelectListItem
                            {
                                Text = s.GetLocalized(x => x.Name),
                                Value = s.Id.ToString(),
                                Selected = (s.Id == model.StateProvinceId)
                            });
                        }
                    }
                    else
                    {
                        bool anyCountrySelected = model.AvailableCountries.Any(x => x.Selected);
                        model.AvailableStates.Add(new SelectListItem
                        {
                            Text = localizationService.GetResource(anyCountrySelected ? "Address.OtherNonUS" : "Address.SelectState"),
                            Value = "0"
                        });
                    }
                }
            }

            //form fields
            model.CompanyEnabled = addressSettings.CompanyEnabled;
            model.CompanyRequired = addressSettings.CompanyRequired;
            model.StreetAddressEnabled = addressSettings.StreetAddressEnabled;
            model.StreetAddressRequired = addressSettings.StreetAddressRequired;
            model.StreetAddress2Enabled = addressSettings.StreetAddress2Enabled;
            model.StreetAddress2Required = addressSettings.StreetAddress2Required;
            model.ZipPostalCodeEnabled = addressSettings.ZipPostalCodeEnabled;
            model.ZipPostalCodeRequired = addressSettings.ZipPostalCodeRequired;
            model.CityEnabled = addressSettings.CityEnabled;
            model.CityRequired = addressSettings.CityRequired;
            model.CountryEnabled = addressSettings.CountryEnabled;
            model.StateProvinceEnabled = addressSettings.StateProvinceEnabled;
            model.PhoneEnabled = addressSettings.PhoneEnabled;
            model.PhoneRequired = addressSettings.PhoneRequired;
            model.FaxEnabled = addressSettings.FaxEnabled;
            model.FaxRequired = addressSettings.FaxRequired;

            //customer attribute services
            if (addressAttributeService != null && addressAttributeParser != null)
            {
                PrepareCustomAddressAttributes(model, address, addressAttributeService, addressAttributeParser, overrideAttributesXml);
            }
            if (addressAttributeFormatter != null && address != null)
            {
                model.FormattedCustomAddressAttributes = addressAttributeFormatter.FormatAttributes(address.CustomAttributes);
            }
        }
        public static string ParseCustomAddressAttributes(this FormCollection form,
            IAddressAttributeParser addressAttributeParser,
            IAddressAttributeService addressAttributeService)
        {
            if (form == null)
                throw new ArgumentNullException("form");

            string attributesXml = "";
            var attributes = addressAttributeService.GetAllAddressAttributes();
            foreach (var attribute in attributes)
            {
                string controlId = string.Format("address_attribute_{0}", attribute.ID);
                switch (attribute.AttributeControlType)
                {
                    case AttributeControlType.DropdownList:
                    case AttributeControlType.RadioList:
                        {
                            var ctrlAttributes = form[controlId];
                            if (!String.IsNullOrEmpty(ctrlAttributes))
                            {
                                int selectedAttributeId = int.Parse(ctrlAttributes);
                                if (selectedAttributeId > 0)
                                    attributesXml = addressAttributeParser.AddAddressAttribute(attributesXml,
                                        attribute, selectedAttributeId.ToString());
                            }
                        }
                        break;
                    case AttributeControlType.Checkboxes:
                        {
                            var cblAttributes = form[controlId];
                            if (!String.IsNullOrEmpty(cblAttributes))
                            {
                                foreach (var item in cblAttributes.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                                {
                                    int selectedAttributeId = int.Parse(item);
                                    if (selectedAttributeId > 0)
                                        attributesXml = addressAttributeParser.AddAddressAttribute(attributesXml,
                                            attribute, selectedAttributeId.ToString());
                                }
                            }
                        }
                        break;
                    case AttributeControlType.ReadonlyCheckboxes:
                        {
                            //load read-only (already server-side selected) values
                            var attributeValues = addressAttributeService.GetAddressAttributeValues(attribute.ID);
                            foreach (var selectedAttributeId in attributeValues
                                .Where(v => v.IsPreSelected)
                                .Select(v => v.ID)
                                .ToList())
                            {
                                attributesXml = addressAttributeParser.AddAddressAttribute(attributesXml,
                                            attribute, selectedAttributeId.ToString());
                            }
                        }
                        break;
                    case AttributeControlType.TextBox:
                    case AttributeControlType.MultilineTextbox:
                        {
                            var ctrlAttributes = form[controlId];
                            if (!String.IsNullOrEmpty(ctrlAttributes))
                            {
                                string enteredText = ctrlAttributes.Trim();
                                attributesXml = addressAttributeParser.AddAddressAttribute(attributesXml,
                                    attribute, enteredText);
                            }
                        }
                        break;
                    case AttributeControlType.Datepicker:
                    case AttributeControlType.ColorSquares:
                    case AttributeControlType.FileUpload:
                    //not supported address attributes
                    default:
                        break;
                }
            }

            return attributesXml;
        }
Beispiel #12
0
 public ShipmentController(
     IShipmentViewModelService shipmentViewModelService,
     IOrderService orderService,
     IOrderProcessingService orderProcessingService,
     ILocalizationService localizationService,
     IWorkContext workContext,
     IMeasureService measureService,
     IPdfService pdfService,
     IProductService productService,
     IExportManager exportManager,
     IWorkflowMessageService workflowMessageService,
     ICategoryService categoryService,
     IManufacturerService manufacturerService,
     IProductAttributeService productAttributeService,
     IProductAttributeParser productAttributeParser,
     IProductAttributeFormatter productAttributeFormatter,
     IShoppingCartService shoppingCartService,
     IGiftCardService giftCardService,
     IDownloadService downloadService,
     IShipmentService shipmentService,
     IShippingService shippingService,
     IStoreService storeService,
     IVendorService vendorService,
     IAddressAttributeParser addressAttributeParser,
     IAddressAttributeService addressAttributeService,
     IAddressAttributeFormatter addressAttributeFormatter,
     IAffiliateService affiliateService,
     IPictureService pictureService,
     ITaxService taxService,
     IReturnRequestService returnRequestService,
     ICustomerService customerService,
     ICustomerActivityService customerActivityService,
     CurrencySettings currencySettings,
     TaxSettings taxSettings,
     MeasureSettings measureSettings,
     AddressSettings addressSettings,
     ShippingSettings shippingSettings,
     MediaSettings mediaSettings)
 {
     this._shipmentViewModelService = shipmentViewModelService;
     this._orderService             = orderService;
     this._orderProcessingService   = orderProcessingService;
     this._localizationService      = localizationService;
     this._workContext               = workContext;
     this._measureService            = measureService;
     this._pdfService                = pdfService;
     this._productService            = productService;
     this._exportManager             = exportManager;
     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._shippingService           = shippingService;
     this._storeService              = storeService;
     this._vendorService             = vendorService;
     this._addressAttributeParser    = addressAttributeParser;
     this._addressAttributeService   = addressAttributeService;
     this._addressAttributeFormatter = addressAttributeFormatter;
     this._affiliateService          = affiliateService;
     this._pictureService            = pictureService;
     this._taxService                = taxService;
     this._returnRequestService      = returnRequestService;
     this._customerActivityService   = customerActivityService;
     this._currencySettings          = currencySettings;
     this._taxSettings               = taxSettings;
     this._measureSettings           = measureSettings;
     this._addressSettings           = addressSettings;
     this._shippingSettings          = shippingSettings;
     this._customerService           = customerService;
     this._mediaSettings             = mediaSettings;
 }
        public static async Task PrepareCustomAddressAttributes(this AddressModel model,
                                                                Address address,
                                                                IAddressAttributeService addressAttributeService,
                                                                IAddressAttributeParser addressAttributeParser)
        {
            //this method is very similar to the same one in Grand.Web project
            if (addressAttributeService == null)
            {
                throw new ArgumentNullException("addressAttributeService");
            }

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

            var attributes = await addressAttributeService.GetAllAddressAttributes();

            foreach (var attribute in attributes)
            {
                var attributeModel = new AddressModel.AddressAttributeModel {
                    Id                   = attribute.Id,
                    Name                 = attribute.Name,
                    IsRequired           = attribute.IsRequired,
                    AttributeControlType = attribute.AttributeControlType,
                };

                if (attribute.ShouldHaveValues())
                {
                    //values
                    var attributeValues = attribute.AddressAttributeValues;
                    foreach (var attributeValue in attributeValues)
                    {
                        var attributeValueModel = new AddressModel.AddressAttributeValueModel {
                            Id            = attributeValue.Id,
                            Name          = attributeValue.Name,
                            IsPreSelected = attributeValue.IsPreSelected
                        };
                        attributeModel.Values.Add(attributeValueModel);
                    }
                }

                //set already selected attributes
                var selectedAddressAttributes = address != null ? address.Attributes : new List <CustomAttribute>();
                switch (attribute.AttributeControlType)
                {
                case AttributeControlType.DropdownList:
                case AttributeControlType.RadioList:
                case AttributeControlType.Checkboxes:
                {
                    if (selectedAddressAttributes.Any())
                    {
                        //clear default selection
                        foreach (var item in attributeModel.Values)
                        {
                            item.IsPreSelected = false;
                        }

                        //select new values
                        var selectedValues = await addressAttributeParser.ParseAddressAttributeValues(selectedAddressAttributes);

                        foreach (var attributeValue in selectedValues)
                        {
                            if (attributeModel.Id == attributeValue.AddressAttributeId)
                            {
                                foreach (var item in attributeModel.Values)
                                {
                                    if (attributeValue.Id == item.Id)
                                    {
                                        item.IsPreSelected = true;
                                    }
                                }
                            }
                        }
                    }
                }
                break;

                case AttributeControlType.ReadonlyCheckboxes:
                {
                    //do nothing
                    //values are already pre-set
                }
                break;

                case AttributeControlType.TextBox:
                case AttributeControlType.MultilineTextbox:
                {
                    if (selectedAddressAttributes.Any())
                    {
                        var enteredText = selectedAddressAttributes.Where(x => x.Key == attribute.Id).Select(x => x.Value).ToList();
                        if (enteredText.Count > 0)
                        {
                            attributeModel.DefaultValue = enteredText[0];
                        }
                    }
                }
                break;

                case AttributeControlType.ColorSquares:
                case AttributeControlType.Datepicker:
                case AttributeControlType.FileUpload:
                case AttributeControlType.ImageSquares:
                default:
                    //not supported attribute control types
                    break;
                }

                model.CustomAddressAttributes.Add(attributeModel);
            }
        }
        public static string ParseCustomAddressAttributes(this FormCollection form,
                                                          IAddressAttributeParser addressAttributeParser,
                                                          IAddressAttributeService addressAttributeService)
        {
            if (form == null)
            {
                throw new ArgumentNullException("form");
            }

            string attributesXml = "";
            var    attributes    = addressAttributeService.GetAllAddressAttributes();

            foreach (var attribute in attributes)
            {
                string controlId = string.Format("address_attribute_{0}", attribute.Id);
                switch (attribute.AttributeControlType)
                {
                case AttributeControlType.DropdownList:
                case AttributeControlType.RadioList:
                {
                    var ctrlAttributes = form[controlId];
                    if (!String.IsNullOrEmpty(ctrlAttributes))
                    {
                        int selectedAttributeId = int.Parse(ctrlAttributes);
                        if (selectedAttributeId > 0)
                        {
                            attributesXml = addressAttributeParser.AddAddressAttribute(attributesXml,
                                                                                       attribute, selectedAttributeId.ToString());
                        }
                    }
                }
                break;

                case AttributeControlType.Checkboxes:
                {
                    var cblAttributes = form[controlId];
                    if (!String.IsNullOrEmpty(cblAttributes))
                    {
                        foreach (var item in cblAttributes.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                        {
                            int selectedAttributeId = int.Parse(item);
                            if (selectedAttributeId > 0)
                            {
                                attributesXml = addressAttributeParser.AddAddressAttribute(attributesXml,
                                                                                           attribute, selectedAttributeId.ToString());
                            }
                        }
                    }
                }
                break;

                case AttributeControlType.ReadonlyCheckboxes:
                {
                    //load read-only (already server-side selected) values
                    var attributeValues = addressAttributeService.GetAddressAttributeValues(attribute.Id);
                    foreach (var selectedAttributeId in attributeValues
                             .Where(v => v.IsPreSelected)
                             .Select(v => v.Id)
                             .ToList())
                    {
                        attributesXml = addressAttributeParser.AddAddressAttribute(attributesXml,
                                                                                   attribute, selectedAttributeId.ToString());
                    }
                }
                break;

                case AttributeControlType.TextBox:
                case AttributeControlType.MultilineTextbox:
                {
                    var ctrlAttributes = form[controlId];
                    if (!String.IsNullOrEmpty(ctrlAttributes))
                    {
                        string enteredText = ctrlAttributes.Trim();
                        attributesXml = addressAttributeParser.AddAddressAttribute(attributesXml,
                                                                                   attribute, enteredText);
                    }
                }
                break;

                case AttributeControlType.Datepicker:
                case AttributeControlType.ColorSquares:
                case AttributeControlType.ImageSquares:
                case AttributeControlType.FileUpload:
                //not supported address attributes
                default:
                    break;
                }
            }

            return(attributesXml);
        }
Beispiel #15
0
        //address
        /// <summary>
        /// Prepare address model
        /// </summary>
        /// <param name="model">Model</param>
        /// <param name="address">Address</param>
        /// <param name="excludeProperties">A value indicating whether to exclude properties</param>
        /// <param name="addressSettings">Address settings</param>
        /// <param name="localizationService">Localization service (used to prepare a select list)</param>
        /// <param name="stateProvinceService">State service (used to prepare a select list). null to don't prepare the list.</param>
        /// <param name="addressAttributeService">Address attribute service. null to don't prepare the list.</param>
        /// <param name="addressAttributeParser">Address attribute parser. null to don't prepare the list.</param>
        /// <param name="addressAttributeFormatter">Address attribute formatter. null to don't prepare the formatted custom attributes.</param>
        /// <param name="loadCountries">A function to load countries  (used to prepare a select list). null to don't prepare the list.</param>
        /// <param name="prePopulateWithCustomerFields">A value indicating whether to pre-populate an address with customer fields entered during registration. It's used only when "address" parameter is set to "null"</param>
        /// <param name="customer">Customer record which will be used to pre-populate address. Used only when "prePopulateWithCustomerFields" is "true".</param>
        /// <param name="overrideAttributesXml">When specified we do not use attributes of an address; if null, then already saved ones are used</param>
        public static void PrepareModel(this AddressModel model,
                                        Address address, bool excludeProperties,
                                        AddressSettings addressSettings,
                                        ILocalizationService localizationService             = null,
                                        IStateProvinceService stateProvinceService           = null,
                                        IAddressAttributeService addressAttributeService     = null,
                                        IAddressAttributeParser addressAttributeParser       = null,
                                        IAddressAttributeFormatter addressAttributeFormatter = null,
                                        Func <IList <Country> > loadCountries = null,
                                        bool prePopulateWithCustomerFields    = false,
                                        Customer customer            = null,
                                        string overrideAttributesXml = "",
                                        Nop.Plugin.Misc.District.Services.IDistrictService districtService = null) //NOP 3.828
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

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

            if (!excludeProperties && address != null)
            {
                model.Id          = address.Id;
                model.FirstName   = address.FirstName;
                model.LastName    = address.LastName;
                model.Email       = address.Email;
                model.Company     = address.Company;
                model.CountryId   = address.CountryId;
                model.CountryName = address.Country != null
                    ? address.Country.GetLocalized(x => x.Name)
                    : null;

                model.StateProvinceId   = address.StateProvinceId;
                model.StateProvinceName = address.StateProvince != null
                    ? address.StateProvince.GetLocalized(x => x.Name)
                    : null;

                //NOP 3.828
                model.DistrictId   = address.DistrictId;
                model.DistrictName = address.District != null
                    ? address.District.Name
                    : null;

                if (model.DistrictId != null && districtService != null)
                {
                    model.StateProvinceMappingId = districtService.GetStateProvinceMappingId(model.DistrictId);
                }

                model.City          = address.City;
                model.Address1      = address.Address1;
                model.Address2      = address.Address2;
                model.ZipPostalCode = address.ZipPostalCode;
                model.PhoneNumber   = address.PhoneNumber;
                model.FaxNumber     = address.FaxNumber;
            }

            if (address == null && prePopulateWithCustomerFields)
            {
                if (customer == null)
                {
                    throw new Exception("Customer cannot be null when prepopulating an address");
                }
                model.Email         = customer.Email;
                model.FirstName     = customer.GetAttribute <string>(SystemCustomerAttributeNames.FirstName);
                model.LastName      = customer.GetAttribute <string>(SystemCustomerAttributeNames.LastName);
                model.Company       = customer.GetAttribute <string>(SystemCustomerAttributeNames.Company);
                model.Address1      = customer.GetAttribute <string>(SystemCustomerAttributeNames.StreetAddress);
                model.Address2      = customer.GetAttribute <string>(SystemCustomerAttributeNames.StreetAddress2);
                model.ZipPostalCode = customer.GetAttribute <string>(SystemCustomerAttributeNames.ZipPostalCode);
                model.City          = customer.GetAttribute <string>(SystemCustomerAttributeNames.City);
                //ignore country and state for prepopulation. it can cause some issues when posting pack with errors, etc
                //model.CountryId = customer.GetAttribute<int>(SystemCustomerAttributeNames.CountryId);
                //model.StateProvinceId = customer.GetAttribute<int>(SystemCustomerAttributeNames.StateProvinceId);
                model.PhoneNumber = customer.GetAttribute <string>(SystemCustomerAttributeNames.Phone);
                model.FaxNumber   = customer.GetAttribute <string>(SystemCustomerAttributeNames.Fax);
            }

            //countries and states
            if (addressSettings.CountryEnabled && loadCountries != null)
            {
                if (localizationService == null)
                {
                    throw new ArgumentNullException("localizationService");
                }

                model.AvailableCountries.Add(new SelectListItem {
                    Text = localizationService.GetResource("Address.SelectCountry"), Value = ""
                });
                foreach (var c in loadCountries())
                {
                    model.AvailableCountries.Add(new SelectListItem
                    {
                        Text     = c.GetLocalized(x => x.Name),
                        Value    = c.Id.ToString(),
                        Selected = c.Id == model.CountryId
                    });
                }

                if (addressSettings.StateProvinceEnabled)
                {
                    //states
                    if (stateProvinceService == null)
                    {
                        throw new ArgumentNullException("stateProvinceService");
                    }

                    var languageId = EngineContext.Current.Resolve <IWorkContext>().WorkingLanguage.Id;
                    var states     = stateProvinceService
                                     .GetStateProvincesByCountryId(model.CountryId.HasValue ? model.CountryId.Value : 0, languageId)
                                     .ToList();
                    if (states.Any())
                    {
                        model.AvailableStates.Add(new SelectListItem {
                            Text = localizationService.GetResource("Address.SelectState"), Value = ""
                        });

                        foreach (var s in states)
                        {
                            model.AvailableStates.Add(new SelectListItem
                            {
                                Text     = s.GetLocalized(x => x.Name),
                                Value    = s.Id.ToString(),
                                Selected = (s.Id == model.StateProvinceId)
                            });
                        }
                    }
                    else
                    {
                        bool anyCountrySelected = model.AvailableCountries.Any(x => x.Selected);
                        model.AvailableStates.Add(new SelectListItem
                        {
                            Text  = localizationService.GetResource(anyCountrySelected ? "Address.OtherNonUS" : "Address.SelectState"),
                            Value = ""
                        });
                    }


                    //NOP 3.828
                    if (districtService == null)
                    {
                        throw new ArgumentNullException("districtService");
                    }

                    var districts = districtService
                                    .GetDistrictsByStateProvinceId(model.StateProvinceMappingId.HasValue ? model.StateProvinceMappingId.Value : 0, languageId)
                                    .ToList();
                    if (districts.Any())
                    {
                        model.AvailableDistricts.Add(new SelectListItem {
                            Text = localizationService.GetResource("Address.SelectDistrict"), Value = ""
                        });

                        foreach (var s in districts)
                        {
                            model.AvailableDistricts.Add(new SelectListItem
                            {
                                Text     = s.Name,
                                Value    = s.Id.ToString(),
                                Selected = (s.Id == model.DistrictId)
                            });
                        }
                    }
                    else
                    {
                        bool anyStateSelected = model.AvailableDistricts.Any(x => x.Selected);
                        model.AvailableDistricts.Add(new SelectListItem
                        {
                            Text  = localizationService.GetResource(anyStateSelected ? "Address.OtherNonUS" : "Address.SelectDistrict"),
                            Value = ""
                        });
                    }
                }
            }

            //form fields
            model.CompanyEnabled         = addressSettings.CompanyEnabled;
            model.CompanyRequired        = addressSettings.CompanyRequired;
            model.StreetAddressEnabled   = addressSettings.StreetAddressEnabled;
            model.StreetAddressRequired  = addressSettings.StreetAddressRequired;
            model.StreetAddress2Enabled  = addressSettings.StreetAddress2Enabled;
            model.StreetAddress2Required = addressSettings.StreetAddress2Required;
            model.ZipPostalCodeEnabled   = addressSettings.ZipPostalCodeEnabled;
            model.ZipPostalCodeRequired  = addressSettings.ZipPostalCodeRequired;
            model.CityEnabled            = addressSettings.CityEnabled;
            model.CityRequired           = addressSettings.CityRequired;
            model.CountryEnabled         = addressSettings.CountryEnabled;
            model.StateProvinceEnabled   = addressSettings.StateProvinceEnabled;
            model.PhoneEnabled           = addressSettings.PhoneEnabled;
            model.PhoneRequired          = addressSettings.PhoneRequired;
            model.FaxEnabled             = addressSettings.FaxEnabled;
            model.FaxRequired            = addressSettings.FaxRequired;

            //customer attribute services
            if (addressAttributeService != null && addressAttributeParser != null)
            {
                PrepareCustomAddressAttributes(model, address, addressAttributeService, addressAttributeParser, overrideAttributesXml);
            }
            if (addressAttributeFormatter != null && address != null)
            {
                model.FormattedCustomAddressAttributes = addressAttributeFormatter.FormatAttributes(address.CustomAttributes);
            }
        }
Beispiel #16
0
        private static void PrepareCustomAddressAttributes(this AddressModel model,
                                                           Address address,
                                                           IAddressAttributeService addressAttributeService,
                                                           IAddressAttributeParser addressAttributeParser,
                                                           string overrideAttributesXml = "")
        {
            if (addressAttributeService == null)
            {
                throw new ArgumentNullException("addressAttributeService");
            }

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

            var attributes = addressAttributeService.GetAllAddressAttributes();

            foreach (var attribute in attributes)
            {
                var attributeModel = new AddressAttributeModel
                {
                    Id                   = attribute.Id,
                    Name                 = attribute.GetLocalized(x => x.Name),
                    IsRequired           = attribute.IsRequired,
                    AttributeControlType = attribute.AttributeControlType,
                };

                if (attribute.ShouldHaveValues())
                {
                    //values
                    var attributeValues = addressAttributeService.GetAddressAttributeValues(attribute.Id);
                    foreach (var attributeValue in attributeValues)
                    {
                        var attributeValueModel = new AddressAttributeValueModel
                        {
                            Id            = attributeValue.Id,
                            Name          = attributeValue.GetLocalized(x => x.Name),
                            IsPreSelected = attributeValue.IsPreSelected
                        };
                        attributeModel.Values.Add(attributeValueModel);
                    }
                }

                //set already selected attributes
                var selectedAddressAttributes = !String.IsNullOrEmpty(overrideAttributesXml) ?
                                                overrideAttributesXml :
                                                (address != null ? address.CustomAttributes : null);
                switch (attribute.AttributeControlType)
                {
                case AttributeControlType.DropdownList:
                case AttributeControlType.RadioList:
                case AttributeControlType.Checkboxes:
                {
                    if (!String.IsNullOrEmpty(selectedAddressAttributes))
                    {
                        //clear default selection
                        foreach (var item in attributeModel.Values)
                        {
                            item.IsPreSelected = false;
                        }

                        //select new values
                        var selectedValues = addressAttributeParser.ParseAddressAttributeValues(selectedAddressAttributes);
                        foreach (var attributeValue in selectedValues)
                        {
                            foreach (var item in attributeModel.Values)
                            {
                                if (attributeValue.Id == item.Id)
                                {
                                    item.IsPreSelected = true;
                                }
                            }
                        }
                    }
                }
                break;

                case AttributeControlType.ReadonlyCheckboxes:
                {
                    //do nothing
                    //values are already pre-set
                }
                break;

                case AttributeControlType.TextBox:
                case AttributeControlType.MultilineTextbox:
                {
                    if (!String.IsNullOrEmpty(selectedAddressAttributes))
                    {
                        var enteredText = addressAttributeParser.ParseValues(selectedAddressAttributes, attribute.Id);
                        if (enteredText.Any())
                        {
                            attributeModel.DefaultValue = enteredText[0];
                        }
                    }
                }
                break;

                case AttributeControlType.ColorSquares:
                case AttributeControlType.ImageSquares:
                case AttributeControlType.Datepicker:
                case AttributeControlType.FileUpload:
                default:
                    //not supported attribute control types
                    break;
                }

                model.CustomAddressAttributes.Add(attributeModel);
            }
        }
Beispiel #17
0
 public CommonController(ISearchTermService searchTermService, IPdfService pdfService, IMaintenanceService maintenanceService, IGenericAttributeService genericAttributeService,
                         IFulltextService fulltextService, IAddressService addressService, IAddressAttributeService addressAttributeService, IAddressAttributeParser addressAttributeParser,
                         IAddressAttributeFormatter addressAttributeFormatter)
 {
     this._searchTermService         = searchTermService;
     this._pdfService                = pdfService;
     this._maintenanceService        = maintenanceService;
     this._genericAttributeService   = genericAttributeService;
     this._fulltextService           = fulltextService;
     this._addressService            = addressService;
     this._addressAttributeService   = addressAttributeService;
     this._addressAttributeParser    = addressAttributeParser;
     this._addressAttributeFormatter = addressAttributeFormatter;
 }
 public AccountController(IAuthenticationService authenticationService,
     IDateTimeHelper dateTimeHelper,
     DateTimeSettings dateTimeSettings,
     TaxSettings taxSettings,
     ILocalizationService localizationService,
     IWorkContext workContext,
     IStoreContext storeContext,
     IStoreMappingService storeMappingService,
     ICustomerService customerService,
     ICustomerAttributeParser customerAttributeParser,
     ICustomerAttributeService customerAttributeService,
     IGenericAttributeService genericAttributeService,
     ICustomerRegistrationService customerRegistrationService,
     ITaxService taxService,
     RewardPointsSettings rewardPointsSettings,
     CustomerSettings customerSettings,
     AddressSettings addressSettings,
     ForumSettings forumSettings,
     OrderSettings orderSettings,
     IAddressService addressService,
     ICountryService countryService,
     IStateProvinceService stateProvinceService,
     IOrderService orderService,
     IPictureService pictureService,
     INewsLetterSubscriptionService newsLetterSubscriptionService,
     IShoppingCartService shoppingCartService,
     IOpenAuthenticationService openAuthenticationService,
     IDownloadService downloadService,
     IWebHelper webHelper,
     ICustomerActivityService customerActivityService,
     IAddressAttributeParser addressAttributeParser,
     IAddressAttributeService addressAttributeService,
     IAddressAttributeFormatter addressAttributeFormatter,
     MediaSettings mediaSettings,
     IWorkflowMessageService workflowMessageService,
     LocalizationSettings localizationSettings,
     CaptchaSettings captchaSettings,
     SecuritySettings securitySettings,
     ExternalAuthenticationSettings externalAuthenticationSettings,
     IMultitenantService vendorService,
     IGroupDealService groupDealService,
     ICategoryService categoryService,
     IVendorAddressService vendorAddressService,
     IProductService productService,
     IStoreService storeService,
     StoreInformationSettings storeInformationSettings)
 {
     this._authenticationService = authenticationService;
     this._dateTimeHelper = dateTimeHelper;
     this._dateTimeSettings = dateTimeSettings;
     this._taxSettings = taxSettings;
     this._localizationService = localizationService;
     this._workContext = workContext;
     this._storeContext = storeContext;
     this._storeMappingService = storeMappingService;
     this._customerService = customerService;
     this._customerAttributeParser = customerAttributeParser;
     this._customerAttributeService = customerAttributeService;
     this._genericAttributeService = genericAttributeService;
     this._customerRegistrationService = customerRegistrationService;
     this._taxService = taxService;
     this._rewardPointsSettings = rewardPointsSettings;
     this._customerSettings = customerSettings;
     this._addressSettings = addressSettings;
     this._forumSettings = forumSettings;
     this._orderSettings = orderSettings;
     this._addressService = addressService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._orderService = orderService;
     this._pictureService = pictureService;
     this._newsLetterSubscriptionService = newsLetterSubscriptionService;
     this._shoppingCartService = shoppingCartService;
     this._openAuthenticationService = openAuthenticationService;
     this._downloadService = downloadService;
     this._webHelper = webHelper;
     this._customerActivityService = customerActivityService;
     this._addressAttributeParser = addressAttributeParser;
     this._addressAttributeService = addressAttributeService;
     this._addressAttributeFormatter = addressAttributeFormatter;
     this._mediaSettings = mediaSettings;
     this._workflowMessageService = workflowMessageService;
     this._localizationSettings = localizationSettings;
     this._captchaSettings = captchaSettings;
     this._securitySettings = securitySettings;
     this._externalAuthenticationSettings = externalAuthenticationSettings;
     this._categories = new System.Collections.Generic.List<DTOs.Category>();
     this._vendorService = vendorService;
     this._groupDealService = groupDealService;
     this._categoryService = categoryService;
     this._vendorAddressService = vendorAddressService;
     this._productService = productService;
     this._storeService = storeService;
     this._storeInformationSettings = storeInformationSettings;
 }
        private static void PrepareCustomAddressAttributes(this AddressModel model, 
            Address address,
            IAddressAttributeService addressAttributeService,
            IAddressAttributeParser addressAttributeParser,
            string overrideAttributesXml = "")
        {
            if (addressAttributeService == null)
                throw new ArgumentNullException("addressAttributeService");

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

            var attributes = addressAttributeService.GetAllAddressAttributes();
            foreach (var attribute in attributes)
            {
                var attributeModel = new AddressAttributeModel
                {
                    Id = attribute.Id,
                    Name = attribute.GetLocalized(x => x.Name),
                    IsRequired = attribute.IsRequired,
                    AttributeControlType = attribute.AttributeControlType,
                };

                if (attribute.ShouldHaveValues())
                {
                    //values
                    var attributeValues = addressAttributeService.GetAddressAttributeValues(attribute.Id);
                    foreach (var attributeValue in attributeValues)
                    {
                        var attributeValueModel = new AddressAttributeValueModel
                        {
                            Id = attributeValue.Id,
                            Name = attributeValue.GetLocalized(x => x.Name),
                            IsPreSelected = attributeValue.IsPreSelected
                        };
                        attributeModel.Values.Add(attributeValueModel);
                    }
                }

                //set already selected attributes
                var selectedAddressAttributes = !String.IsNullOrEmpty(overrideAttributesXml) ?
                    overrideAttributesXml :
                    (address != null ? address.CustomAttributes : null);
                switch (attribute.AttributeControlType)
                {
                    case AttributeControlType.DropdownList:
                    case AttributeControlType.RadioList:
                    case AttributeControlType.Checkboxes:
                        {
                            if (!String.IsNullOrEmpty(selectedAddressAttributes))
                            {
                                //clear default selection
                                foreach (var item in attributeModel.Values)
                                    item.IsPreSelected = false;

                                //select new values
                                var selectedValues = addressAttributeParser.ParseAddressAttributeValues(selectedAddressAttributes);
                                foreach (var attributeValue in selectedValues)
                                    foreach (var item in attributeModel.Values)
                                        if (attributeValue.Id == item.Id)
                                            item.IsPreSelected = true;
                            }
                        }
                        break;
                    case AttributeControlType.ReadonlyCheckboxes:
                        {
                            //do nothing
                            //values are already pre-set
                        }
                        break;
                    case AttributeControlType.TextBox:
                    case AttributeControlType.MultilineTextbox:
                        {
                            if (!String.IsNullOrEmpty(selectedAddressAttributes))
                            {
                                var enteredText = addressAttributeParser.ParseValues(selectedAddressAttributes, attribute.Id);
                                if (enteredText.Count > 0)
                                    attributeModel.DefaultValue = enteredText[0];
                            }
                        }
                        break;
                    case AttributeControlType.ColorSquares:
                    case AttributeControlType.ImageSquares:
                    case AttributeControlType.Datepicker:
                    case AttributeControlType.FileUpload:
                    default:
                        //not supported attribute control types
                        break;
                }

                model.CustomAddressAttributes.Add(attributeModel);
            }
        }
Beispiel #20
0
 public UserStateManagementController(
     IUserStateManagementService userStateManagement,
     ICustomerService customerService,
     INewsLetterSubscriptionService newsLetterSubscriptionService,
     IGenericAttributeService genericAttributeService,
     ICustomerRegistrationService customerRegistrationService,
     ICustomerReportService customerReportService,
     IDateTimeHelper dateTimeHelper,
     ILocalizationService localizationService,
     DateTimeSettings dateTimeSettings,
     TaxSettings taxSettings,
     RewardPointsSettings rewardPointsSettings,
     ICountryService countryService,
     IStateProvinceService stateProvinceService,
     IAddressService addressService,
     CustomerSettings customerSettings,
     ITaxService taxService,
     IWorkContext workContext,
     IVendorService vendorService,
     IStoreContext storeContext,
     IPriceFormatter priceFormatter,
     IOrderService orderService,
     IExportManager exportManager,
     ICustomerActivityService customerActivityService,
     IPriceCalculationService priceCalculationService,
     IProductAttributeFormatter productAttributeFormatter,
     IPermissionService permissionService,
     IQueuedEmailService queuedEmailService,
     EmailAccountSettings emailAccountSettings,
     IEmailAccountService emailAccountService,
     ForumSettings forumSettings,
     IForumService forumService,
     IOpenAuthenticationService openAuthenticationService,
     AddressSettings addressSettings,
     IStoreService storeService,
     ICustomerAttributeParser customerAttributeParser,
     ICustomerAttributeService customerAttributeService,
     IAddressAttributeParser addressAttributeParser,
     IAddressAttributeService addressAttributeService,
     IAddressAttributeFormatter addressAttributeFormatter,
     IAffiliateService affiliateService,
     IWorkflowMessageService workflowMessageService)
     : base(customerService, newsLetterSubscriptionService, genericAttributeService,
            customerRegistrationService, customerReportService, dateTimeHelper,
            localizationService, dateTimeSettings, taxSettings, rewardPointsSettings,
            countryService, stateProvinceService, addressService, customerSettings,
            taxService, workContext, vendorService, storeContext, priceFormatter,
            orderService, exportManager, customerActivityService, priceCalculationService,
            productAttributeFormatter, permissionService, queuedEmailService,
            emailAccountSettings, emailAccountService, forumSettings,
            forumService, openAuthenticationService, addressSettings,
            storeService, customerAttributeParser, customerAttributeService,
            addressAttributeParser, addressAttributeService, addressAttributeFormatter,
            affiliateService, workflowMessageService)
 {
     this._customerService = customerService;
     this._newsLetterSubscriptionService = newsLetterSubscriptionService;
     this._genericAttributeService       = genericAttributeService;
     this._customerRegistrationService   = customerRegistrationService;
     this._customerReportService         = customerReportService;
     this._dateTimeHelper             = dateTimeHelper;
     this._localizationService        = localizationService;
     this._dateTimeSettings           = dateTimeSettings;
     this._taxSettings                = taxSettings;
     this._rewardPointsSettings       = rewardPointsSettings;
     this._countryService             = countryService;
     this._stateProvinceService       = stateProvinceService;
     this._addressService             = addressService;
     this._customerSettings           = customerSettings;
     this._taxService                 = taxService;
     this._workContext                = workContext;
     this._vendorService              = vendorService;
     this._storeContext               = storeContext;
     this._priceFormatter             = priceFormatter;
     this._orderService               = orderService;
     this._exportManager              = exportManager;
     this._customerActivityService    = customerActivityService;
     this._priceCalculationService    = priceCalculationService;
     this._productAttributeFormatter  = productAttributeFormatter;
     this._permissionService          = permissionService;
     this._queuedEmailService         = queuedEmailService;
     this._emailAccountSettings       = emailAccountSettings;
     this._emailAccountService        = emailAccountService;
     this._forumSettings              = forumSettings;
     this._forumService               = forumService;
     this._openAuthenticationService  = openAuthenticationService;
     this._addressSettings            = addressSettings;
     this._storeService               = storeService;
     this._customerAttributeParser    = customerAttributeParser;
     this._customerAttributeService   = customerAttributeService;
     this._addressAttributeParser     = addressAttributeParser;
     this._addressAttributeService    = addressAttributeService;
     this._addressAttributeFormatter  = addressAttributeFormatter;
     this._affiliateService           = affiliateService;
     this._workflowMessageService     = workflowMessageService;
     this._userStateManagementService = userStateManagement;
 }
Beispiel #21
0
 public CustomerController(ICustomerService customerService,
     INewsLetterSubscriptionService newsLetterSubscriptionService,
     IGenericAttributeService genericAttributeService,
     ICustomerRegistrationService customerRegistrationService,
     ICustomerReportService customerReportService, 
     IDateTimeHelper dateTimeHelper,
     ILocalizationService localizationService, 
     DateTimeSettings dateTimeSettings,
     TaxSettings taxSettings, 
     RewardPointsSettings rewardPointsSettings,
     ICountryService countryService, 
     IStateProvinceService stateProvinceService, 
     IAddressService addressService,
     CustomerSettings customerSettings,
     ITaxService taxService, 
     IWorkContext workContext,
     IVendorService vendorService,
     IStoreContext storeContext,
     IPriceFormatter priceFormatter,
     IOrderService orderService, 
     IExportManager exportManager,
     ICustomerActivityService customerActivityService,
     IPriceCalculationService priceCalculationService,
     IPermissionService permissionService, 
     IQueuedEmailService queuedEmailService,
     EmailAccountSettings emailAccountSettings,
     IEmailAccountService emailAccountService, 
     ForumSettings forumSettings,
     IForumService forumService, 
     IOpenAuthenticationService openAuthenticationService,
     AddressSettings addressSettings,
     IStoreService storeService,
     ICustomerAttributeParser customerAttributeParser,
     ICustomerAttributeService customerAttributeService,
     IAddressAttributeParser addressAttributeParser,
     IAddressAttributeService addressAttributeService,
     IAddressAttributeFormatter addressAttributeFormatter)
 {
     this._customerService = customerService;
     this._newsLetterSubscriptionService = newsLetterSubscriptionService;
     this._genericAttributeService = genericAttributeService;
     this._customerRegistrationService = customerRegistrationService;
     this._customerReportService = customerReportService;
     this._dateTimeHelper = dateTimeHelper;
     this._localizationService = localizationService;
     this._dateTimeSettings = dateTimeSettings;
     this._taxSettings = taxSettings;
     this._rewardPointsSettings = rewardPointsSettings;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._addressService = addressService;
     this._customerSettings = customerSettings;
     this._taxService = taxService;
     this._workContext = workContext;
     this._vendorService = vendorService;
     this._storeContext = storeContext;
     this._priceFormatter = priceFormatter;
     this._orderService = orderService;
     this._exportManager = exportManager;
     this._customerActivityService = customerActivityService;
     this._priceCalculationService = priceCalculationService;
     this._permissionService = permissionService;
     this._queuedEmailService = queuedEmailService;
     this._emailAccountSettings = emailAccountSettings;
     this._emailAccountService = emailAccountService;
     this._forumSettings = forumSettings;
     this._forumService = forumService;
     this._openAuthenticationService = openAuthenticationService;
     this._addressSettings = addressSettings;
     this._storeService = storeService;
     this._customerAttributeParser = customerAttributeParser;
     this._customerAttributeService = customerAttributeService;
     this._addressAttributeParser = addressAttributeParser;
     this._addressAttributeService = addressAttributeService;
     this._addressAttributeFormatter = addressAttributeFormatter;
 }
Beispiel #22
0
        //address
        /// <summary>
        /// Prepare address model
        /// </summary>
        /// <param name="model">Model</param>
        /// <param name="address">Address</param>
        /// <param name="excludeProperties">A value indicating whether to exclude properties</param>
        /// <param name="addressSettings">Address settings</param>
        /// <param name="localizationService">Localization service (used to prepare a select list)</param>
        /// <param name="stateProvinceService">State service (used to prepare a select list). null to don't prepare the list.</param>
        /// <param name="addressAttributeService">Address attribute service. null to don't prepare the list.</param>
        /// <param name="addressAttributeParser">Address attribute parser. null to don't prepare the list.</param>
        /// <param name="addressAttributeFormatter">Address attribute formatter. null to don't prepare the formatted custom attributes.</param>
        /// <param name="loadCountries">A function to load countries  (used to prepare a select list). null to don't prepare the list.</param>
        /// <param name="prePopulateWithCustomerFields">A value indicating whether to pre-populate an address with customer fields entered during registration. It's used only when "address" parameter is set to "null"</param>
        /// <param name="customer">Customer record which will be used to pre-populate address. Used only when "prePopulateWithCustomerFields" is "true".</param>
        public static void PrepareModel(this AddressModel model,
                                        Address address, bool excludeProperties,
                                        AddressSettings addressSettings,
                                        ILocalizationService localizationService   = null,
                                        IStateProvinceService stateProvinceService = null,
                                        IDiaChiService diachiService = null,
                                        IAddressAttributeService addressAttributeService     = null,
                                        IAddressAttributeParser addressAttributeParser       = null,
                                        IAddressAttributeFormatter addressAttributeFormatter = null,
                                        Func <IList <Country> > loadCountries = null,
                                        bool prePopulateWithCustomerFields    = false,
                                        Customer customer = null)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

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

            if (!excludeProperties && address != null)
            {
                model.Id          = address.Id;
                model.FirstName   = address.FirstName;
                model.LastName    = address.LastName;
                model.FullName    = string.Format("{0} {1}", address.FirstName, address.LastName);
                model.Email       = address.Email;
                model.Company     = address.Company;
                model.CountryId   = NhaXesController.CountryID;
                model.CountryName = address.Country != null
                    ? address.Country.GetLocalized(x => x.Name)
                    : null;

                model.StateProvinceId   = address.StateProvinceId;
                model.StateProvinceName = address.StateProvince != null
                    ? address.StateProvince.GetLocalized(x => x.Name)
                    : null;

                model.QuanHuyenId   = address.QuanHuyenId;
                model.City          = address.City;
                model.Address1      = address.Address1;
                model.Address2      = address.Address2;
                model.ZipPostalCode = address.ZipPostalCode;
                model.PhoneNumber   = address.PhoneNumber;
                model.FaxNumber     = address.FaxNumber;
            }

            if (address == null && prePopulateWithCustomerFields)
            {
                if (customer == null)
                {
                    throw new Exception("Customer cannot be null when prepopulating an address");
                }
                model.Email         = customer.Email;
                model.FirstName     = customer.GetAttribute <string>(SystemCustomerAttributeNames.FirstName);
                model.LastName      = customer.GetAttribute <string>(SystemCustomerAttributeNames.LastName);
                model.Company       = customer.GetAttribute <string>(SystemCustomerAttributeNames.Company);
                model.Address1      = customer.GetAttribute <string>(SystemCustomerAttributeNames.StreetAddress);
                model.Address2      = customer.GetAttribute <string>(SystemCustomerAttributeNames.StreetAddress2);
                model.ZipPostalCode = customer.GetAttribute <string>(SystemCustomerAttributeNames.ZipPostalCode);
                model.City          = customer.GetAttribute <string>(SystemCustomerAttributeNames.City);
                //ignore country and state for prepopulation. it can cause some issues when posting pack with errors, etc
                //model.CountryId = customer.GetAttribute<int>(SystemCustomerAttributeNames.CountryId);
                //model.StateProvinceId = customer.GetAttribute<int>(SystemCustomerAttributeNames.StateProvinceId);
                model.PhoneNumber = customer.GetAttribute <string>(SystemCustomerAttributeNames.Phone);
                model.FaxNumber   = customer.GetAttribute <string>(SystemCustomerAttributeNames.Fax);
            }

            //countries and states
            if (addressSettings.CountryEnabled && loadCountries != null)
            {
                if (localizationService == null)
                {
                    throw new ArgumentNullException("localizationService");
                }

                //model.AvailableCountries.Add(new SelectListItem { Text = localizationService.GetResource("Address.SelectCountry"), Value = "0" });
                foreach (var c in loadCountries())
                {
                    model.AvailableCountries.Add(new SelectListItem
                    {
                        Text     = c.GetLocalized(x => x.Name),
                        Value    = c.Id.ToString(),
                        Selected = c.Id == model.CountryId
                    });
                }

                if (addressSettings.StateProvinceEnabled)
                {
                    //states
                    if (stateProvinceService == null)
                    {
                        throw new ArgumentNullException("stateProvinceService");
                    }

                    var states = stateProvinceService
                                 .GetStateProvincesByCountryId(loadCountries().First().Id)
                                 .ToList();
                    if (states.Count > 0)
                    {
                        //model.AvailableStates.Add(new SelectListItem { Text = localizationService.GetResource("Address.SelectState"), Value = "0" });

                        foreach (var s in states)
                        {
                            model.AvailableStates.Add(new SelectListItem
                            {
                                Text     = s.GetLocalized(x => x.Name),
                                Value    = s.Id.ToString(),
                                Selected = (s.Id == model.StateProvinceId)
                            });
                        }
                    }
                    else
                    {
                        bool anyCountrySelected = model.AvailableCountries.Any(x => x.Selected);
                        model.AvailableStates.Add(new SelectListItem
                        {
                            Text  = localizationService.GetResource(anyCountrySelected ? "Address.OtherNonUS" : "Address.SelectState"),
                            Value = "0"
                        });
                    }
                    if (model.StateProvinceId.GetValueOrDefault(0) > 0)
                    {
                        var quanhuyens = diachiService.GetQuanHuyenByProvinceId(model.StateProvinceId.GetValueOrDefault(0));

                        foreach (var s in quanhuyens)
                        {
                            model.AvailableQuanHuyens.Add(new SelectListItem
                            {
                                Text     = s.Ten,
                                Value    = s.Id.ToString(),
                                Selected = (s.Id == model.QuanHuyenId)
                            });
                        }
                    }
                }
            }

            //form fields
            model.CompanyEnabled         = addressSettings.CompanyEnabled;
            model.CompanyRequired        = addressSettings.CompanyRequired;
            model.StreetAddressEnabled   = addressSettings.StreetAddressEnabled;
            model.StreetAddressRequired  = addressSettings.StreetAddressRequired;
            model.StreetAddress2Enabled  = addressSettings.StreetAddress2Enabled;
            model.StreetAddress2Required = addressSettings.StreetAddress2Required;
            model.ZipPostalCodeEnabled   = addressSettings.ZipPostalCodeEnabled;
            model.ZipPostalCodeRequired  = addressSettings.ZipPostalCodeRequired;
            model.CityEnabled            = addressSettings.CityEnabled;
            model.CityRequired           = addressSettings.CityRequired;
            model.CountryEnabled         = addressSettings.CountryEnabled;
            model.StateProvinceEnabled   = addressSettings.StateProvinceEnabled;
            model.PhoneEnabled           = addressSettings.PhoneEnabled;
            model.PhoneRequired          = addressSettings.PhoneRequired;
            model.FaxEnabled             = addressSettings.FaxEnabled;
            model.FaxRequired            = addressSettings.FaxRequired;

            //customer attribute services
            if (addressAttributeService != null && addressAttributeParser != null)
            {
                PrepareCustomAddressAttributes(model, address, addressAttributeService, addressAttributeParser);
            }
            if (addressAttributeFormatter != null && address != null)
            {
                model.FormattedCustomAddressAttributes = addressAttributeFormatter.FormatAttributes(address.CustomAttributes);
            }
        }
        public InvoicesController(IOrderService orderService,
            IOrderReportService orderReportService,
            IOrderProcessingService orderProcessingService,
            IPriceCalculationService priceCalculationService,
            IDateTimeHelper dateTimeHelper,
            IPriceFormatter priceFormatter,
            IDiscountService discountService,
            ILocalizationService localizationService,
            IWorkContext workContext,
            ICurrencyService currencyService,
            IEncryptionService encryptionService,
            IPaymentService paymentService,
            IMeasureService measureService,
            IPdfService pdfService,
            IAddressService addressService,
            ICountryService countryService,
            IStateProvinceService stateProvinceService,
            Nop.Services.Catalog.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,
            IShippingService shippingService,
            IStoreService storeService,
            IVendorService vendorService,
            IAddressAttributeParser addressAttributeParser,
            IAddressAttributeService addressAttributeService,
            IAddressAttributeFormatter addressAttributeFormatter,
            IAffiliateService affiliateService,
            IPictureService pictureService,
            CurrencySettings currencySettings,
            TaxSettings taxSettings,
            MeasureSettings measureSettings,
            AddressSettings addressSettings,
            ShippingSettings shippingSettings,
            IInvoiceService invoiceService,
            IGenericAttributeService genericAttributeService,
            IProductTemplateService productTemplateService,
            IStoreContext storeContext,
            ISettingService settingService,
            IGroupDealService groupDealService)
        {
            this._orderService = orderService;
            this._orderReportService = orderReportService;
            this._orderProcessingService = orderProcessingService;
            this._priceCalculationService = priceCalculationService;
            this._dateTimeHelper = dateTimeHelper;
            this._priceFormatter = priceFormatter;
            this._discountService = discountService;
            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._shippingService = shippingService;
            this._storeService = storeService;
            this._vendorService = vendorService;
            this._addressAttributeParser = addressAttributeParser;
            this._addressAttributeService = addressAttributeService;
            this._addressAttributeFormatter = addressAttributeFormatter;
            this._affiliateService = affiliateService;
            this._pictureService = pictureService;

            this._currencySettings = currencySettings;
            this._taxSettings = taxSettings;
            this._measureSettings = measureSettings;
            this._addressSettings = addressSettings;
            this._shippingSettings = shippingSettings;
            this._invoiceService = invoiceService;
            this._genericAttributeService = genericAttributeService;
            this._productTemplateService = productTemplateService;
            this._storeContext = storeContext;
            this._settingService = settingService;
            this._groupDealService = groupDealService;
        }
Beispiel #24
0
        public static void PrepareCustomAddressAttributes(this AddressModel model,
            Address address,
            IAddressAttributeService addressAttributeService,
            IAddressAttributeParser addressAttributeParser)
        {
            //this method is very similar to the same one in Nop.Web project
            if (addressAttributeService == null)
                throw new ArgumentNullException("addressAttributeService");

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

            var attributes = addressAttributeService.GetAllAddressAttributes();
            foreach (var attribute in attributes)
            {
                var attributeModel = new AddressModel.AddressAttributeModel
                {
                    Id = attribute.Id,
                    Name = attribute.Name,
                    IsRequired = attribute.IsRequired,
                    AttributeControlType = attribute.AttributeControlType,
                };

                if (attribute.ShouldHaveValues())
                {
                    //values
                    var attributeValues = addressAttributeService.GetAddressAttributeValues(attribute.Id);
                    foreach (var attributeValue in attributeValues)
                    {
                        var attributeValueModel = new AddressModel.AddressAttributeValueModel
                        {
                            Id = attributeValue.Id,
                            Name = attributeValue.Name,
                            IsPreSelected = attributeValue.IsPreSelected
                        };
                        attributeModel.Values.Add(attributeValueModel);
                    }
                }

                //set already selected attributes
                var selectedAddressAttributes = address != null ? address.CustomAttributes : null;
                switch (attribute.AttributeControlType)
                {
                    case AttributeControlType.DropdownList:
                    case AttributeControlType.RadioList:
                    case AttributeControlType.Checkboxes:
                        {
                            if (!String.IsNullOrEmpty(selectedAddressAttributes))
                            {
                                //clear default selection
                                foreach (var item in attributeModel.Values)
                                    item.IsPreSelected = false;

                                //select new values
                                var selectedValues = addressAttributeParser.ParseAddressAttributeValues(selectedAddressAttributes);
                                foreach (var attributeValue in selectedValues)
                                    foreach (var item in attributeModel.Values)
                                        if (attributeValue.Id == item.Id)
                                            item.IsPreSelected = true;
                            }
                        }
                        break;
                    case AttributeControlType.ReadonlyCheckboxes:
                        {
                            //do nothing
                            //values are already pre-set
                        }
                        break;
                    case AttributeControlType.TextBox:
                    case AttributeControlType.MultilineTextbox:
                        {
                            if (!String.IsNullOrEmpty(selectedAddressAttributes))
                            {
                                var enteredText = addressAttributeParser.ParseValues(selectedAddressAttributes, attribute.Id);
                                if (enteredText.Count > 0)
                                    attributeModel.DefaultValue = enteredText[0];
                            }
                        }
                        break;
                    case AttributeControlType.ColorSquares:
                    case AttributeControlType.Datepicker:
                    case AttributeControlType.FileUpload:
                    default:
                        //not supported attribute control types
                        break;
                }

                model.CustomAddressAttributes.Add(attributeModel);
            }
        }
 public CustomerController(IAuthenticationService authenticationService,
     IDateTimeHelper dateTimeHelper,
     DateTimeSettings dateTimeSettings,
     TaxSettings taxSettings,
     ILocalizationService localizationService,
     IWorkContext workContext,
     IStoreContext storeContext,
     IStoreMappingService storeMappingService,
     ICustomerService customerService,
     ICustomerAttributeParser customerAttributeParser,
     ICustomerAttributeService customerAttributeService,
     IGenericAttributeService genericAttributeService,
     ICustomerRegistrationService customerRegistrationService,
     ITaxService taxService,
     RewardPointsSettings rewardPointsSettings,
     CustomerSettings customerSettings,
     AddressSettings addressSettings,
     ForumSettings forumSettings,
     OrderSettings orderSettings,
     IAddressService addressService,
     ICountryService countryService,
     IStateProvinceService stateProvinceService,
     IOrderService orderService,
     IPictureService pictureService,
     INewsLetterSubscriptionService newsLetterSubscriptionService,
     IShoppingCartService shoppingCartService,
     IOpenAuthenticationService openAuthenticationService,
     IDownloadService downloadService,
     IWebHelper webHelper,
     ICustomerActivityService customerActivityService,
     IAddressAttributeParser addressAttributeParser,
     IAddressAttributeService addressAttributeService,
     IAddressAttributeFormatter addressAttributeFormatter,
     IReturnRequestService returnRequestService,
     IEventPublisher eventPublisher,
     MediaSettings mediaSettings,
     IWorkflowMessageService workflowMessageService,
     LocalizationSettings localizationSettings,
     CaptchaSettings captchaSettings,
     SecuritySettings securitySettings,
     ExternalAuthenticationSettings externalAuthenticationSettings,
     StoreInformationSettings storeInformationSettings)
 {
     this._authenticationService = authenticationService;
     this._dateTimeHelper = dateTimeHelper;
     this._dateTimeSettings = dateTimeSettings;
     this._taxSettings = taxSettings;
     this._localizationService = localizationService;
     this._workContext = workContext;
     this._storeContext = storeContext;
     this._storeMappingService = storeMappingService;
     this._customerService = customerService;
     this._customerAttributeParser = customerAttributeParser;
     this._customerAttributeService = customerAttributeService;
     this._genericAttributeService = genericAttributeService;
     this._customerRegistrationService = customerRegistrationService;
     this._taxService = taxService;
     this._rewardPointsSettings = rewardPointsSettings;
     this._customerSettings = customerSettings;
     this._addressSettings = addressSettings;
     this._forumSettings = forumSettings;
     this._orderSettings = orderSettings;
     this._addressService = addressService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._orderService = orderService;
     this._pictureService = pictureService;
     this._newsLetterSubscriptionService = newsLetterSubscriptionService;
     this._shoppingCartService = shoppingCartService;
     this._openAuthenticationService = openAuthenticationService;
     this._downloadService = downloadService;
     this._webHelper = webHelper;
     this._customerActivityService = customerActivityService;
     this._addressAttributeParser = addressAttributeParser;
     this._addressAttributeService = addressAttributeService;
     this._addressAttributeFormatter = addressAttributeFormatter;
     this._returnRequestService = returnRequestService;
     this._eventPublisher = eventPublisher;
     this._mediaSettings = mediaSettings;
     this._workflowMessageService = workflowMessageService;
     this._localizationSettings = localizationSettings;
     this._captchaSettings = captchaSettings;
     this._securitySettings = securitySettings;
     this._externalAuthenticationSettings = externalAuthenticationSettings;
     this._storeInformationSettings = storeInformationSettings;
 }
Beispiel #26
0
        public InvoicesController(IOrderService orderService,
                                  IOrderReportService orderReportService,
                                  IOrderProcessingService orderProcessingService,
                                  IPriceCalculationService priceCalculationService,
                                  IDateTimeHelper dateTimeHelper,
                                  IPriceFormatter priceFormatter,
                                  IDiscountService discountService,
                                  ILocalizationService localizationService,
                                  IWorkContext workContext,
                                  ICurrencyService currencyService,
                                  IEncryptionService encryptionService,
                                  IPaymentService paymentService,
                                  IMeasureService measureService,
                                  IPdfService pdfService,
                                  IAddressService addressService,
                                  ICountryService countryService,
                                  IStateProvinceService stateProvinceService,
                                  Nop.Services.Catalog.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,
                                  IShippingService shippingService,
                                  IStoreService storeService,
                                  IVendorService vendorService,
                                  IAddressAttributeParser addressAttributeParser,
                                  IAddressAttributeService addressAttributeService,
                                  IAddressAttributeFormatter addressAttributeFormatter,
                                  IAffiliateService affiliateService,
                                  IPictureService pictureService,
                                  CurrencySettings currencySettings,
                                  TaxSettings taxSettings,
                                  MeasureSettings measureSettings,
                                  AddressSettings addressSettings,
                                  ShippingSettings shippingSettings,
                                  IInvoiceService invoiceService,
                                  IGenericAttributeService genericAttributeService,
                                  IProductTemplateService productTemplateService,
                                  IStoreContext storeContext,
                                  ISettingService settingService,
                                  IGroupDealService groupDealService)
        {
            this._orderService            = orderService;
            this._orderReportService      = orderReportService;
            this._orderProcessingService  = orderProcessingService;
            this._priceCalculationService = priceCalculationService;
            this._dateTimeHelper          = dateTimeHelper;
            this._priceFormatter          = priceFormatter;
            this._discountService         = discountService;
            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._shippingService           = shippingService;
            this._storeService              = storeService;
            this._vendorService             = vendorService;
            this._addressAttributeParser    = addressAttributeParser;
            this._addressAttributeService   = addressAttributeService;
            this._addressAttributeFormatter = addressAttributeFormatter;
            this._affiliateService          = affiliateService;
            this._pictureService            = pictureService;

            this._currencySettings        = currencySettings;
            this._taxSettings             = taxSettings;
            this._measureSettings         = measureSettings;
            this._addressSettings         = addressSettings;
            this._shippingSettings        = shippingSettings;
            this._invoiceService          = invoiceService;
            this._genericAttributeService = genericAttributeService;
            this._productTemplateService  = productTemplateService;
            this._storeContext            = storeContext;
            this._settingService          = settingService;
            this._groupDealService        = groupDealService;
        }