Пример #1
0
 public FormsAuthenticationService(HttpContextBase httpContext,
     ICustomerService customerService,
     CustomerSettings customerSettings)
 {
     _httpContext = httpContext;
     _customerService = customerService;
     _customerSettings = customerSettings;
     _expirationTimeSpan = FormsAuthentication.Timeout;
 }
 public CustomerRegistrationService(ICustomerService customerService,
     IEncryptionService encryptionService,
     INewsLetterSubscriptionService newsLetterSubscriptionService,
     ILocalizationService localizationService,
     IStoreService storeService,
     RewardPointsSettings rewardPointsSettings,
     CustomerSettings customerSettings)
 {
     _customerService = customerService;
     _encryptionService = encryptionService;
     _newsLetterSubscriptionService = newsLetterSubscriptionService;
     _localizationService = localizationService;
     _storeService = storeService;
     _rewardPointsSettings = rewardPointsSettings;
     _customerSettings = customerSettings;
 }
Пример #3
0
 public CommonController(IStoreContext storeContext,
     IWebHelper webHelper,
     CustomerSettings customerSettings,
     IWorkContext workContext,
     IPermissionService permissionService,
     ILanguageService languageService,
     LocalizationSettings localizationSettings,
     ICurrencyService currencyService
     )
 {
     _storeContext = storeContext;
     _webHelper = webHelper;
     _customerSettings = customerSettings;
     _workContext = workContext;
     _permissionService = permissionService;
     _languageService = languageService;
     _localizationSettings = localizationSettings;
     _currencyService = currencyService;
 }
Пример #4
0
        /// <summary>
        /// Lấy về tên hiển thị ra giao diện cho người dùng, ( thường là "Chào, xxx" ở góc phải trên ),
        /// tùy vào cấu hình mà tên hiển thị này có thể là user name, email, full name.
        /// Cho phép tùy chọn cắt chuỗi nếu chuỗi tên dài hơn giới hạn số ký tự
        /// </summary>
        public static string FormatUserName(this Customer customer, CustomerSettings customerSettings = null,
            IGenericAttributeService genericAttributeService = null, bool stripTooLong = false, int maxLength = 0)
        {
            if (customer == null) return string.Empty;

            var engine = EngineContext.Current;
            string result = string.Empty;
            if (customer.IsGuest())
                result = engine.Resolve<ILocalizationService>().GetResource("Customer.Guest", false);
            else
            {
                if (customerSettings == null)
                    customerSettings = engine.Resolve<CustomerSettings>();
                switch (customerSettings.CustomerNameFormat)
                {
                    case CustomerNameFormat.ShowEmails:
                        result = customer.Email;
                        break;
                    case CustomerNameFormat.ShowUsernames:
                        result = customer.Username;
                        break;
                    case CustomerNameFormat.ShowFirstName:
                    case CustomerNameFormat.ShowFullNames:
                        if (genericAttributeService == null)
                            genericAttributeService = engine.Resolve<IGenericAttributeService>();
                        if (customerSettings.CustomerNameFormat == CustomerNameFormat.ShowFullNames)
                            result = customer.GetFullName(genericAttributeService);
                        else
                            result = customer.GetAttribute<string>(SystemCustomerAttributeNames.FirstName,
                                genericAttributeService);
                        break;
                }
            }
            if (result == null) result = string.Empty;
            if (stripTooLong && maxLength > 0)
                result = CommonHelper.EnsureMaximumLength(result, maxLength);
            return result;
        }
Пример #5
0
 public DeleteGuestsTask(ICustomerService customerService, CustomerSettings customerSettings)
 {
     _customerService = customerService;
     _customerSettings = customerSettings;
 }