예제 #1
0
        public virtual async Task <IActionResult> ContactAttributeChange(IFormCollection form,
                                                                         [FromServices] IContactAttributeParser contactAttributeParser)
        {
            var attributeXml = await _commonViewModelService.ParseContactAttributes(form);

            var enabledAttributeIds  = new List <string>();
            var disabledAttributeIds = new List <string>();
            var attributes           = await _contactAttributeService.GetAllContactAttributes(_storeContext.CurrentStore.Id);

            foreach (var attribute in attributes)
            {
                var conditionMet = await contactAttributeParser.IsConditionMet(attribute, attributeXml);

                if (conditionMet.HasValue)
                {
                    if (conditionMet.Value)
                    {
                        enabledAttributeIds.Add(attribute.Id);
                    }
                    else
                    {
                        disabledAttributeIds.Add(attribute.Id);
                    }
                }
            }

            return(Json(new
            {
                enabledattributeids = enabledAttributeIds.ToArray(),
                disabledattributeids = disabledAttributeIds.ToArray()
            }));
        }
 public ContactAttributeController(IContactAttributeService contactAttributeService,
                                   IContactAttributeParser contactAttributeParser,
                                   ILanguageService languageService,
                                   ILocalizationService localizationService,
                                   IWorkContext workContext,
                                   ICurrencyService currencyService,
                                   ICustomerActivityService customerActivityService,
                                   IMeasureService measureService,
                                   IPermissionService permissionService,
                                   IStoreService storeService,
                                   IStoreMappingService storeMappingService,
                                   ICustomerService customerService,
                                   IAclService aclService)
 {
     this._contactAttributeService = contactAttributeService;
     this._contactAttributeParser  = contactAttributeParser;
     this._languageService         = languageService;
     this._localizationService     = localizationService;
     this._workContext             = workContext;
     this._customerActivityService = customerActivityService;
     this._permissionService       = permissionService;
     this._storeService            = storeService;
     this._storeMappingService     = storeMappingService;
     this._customerService         = customerService;
     this._aclService = aclService;
 }
 public ContactAttributeFormatter(IWorkContext workContext,
                                  IContactAttributeParser contactAttributeParser,
                                  IDownloadService downloadService,
                                  IWebHelper webHelper)
 {
     _workContext            = workContext;
     _contactAttributeParser = contactAttributeParser;
     _downloadService        = downloadService;
     _webHelper = webHelper;
 }
예제 #4
0
 public ContactAttributeViewModelService(IContactAttributeService contactAttributeService,
                                         IContactAttributeParser contactAttributeParser,
                                         ILocalizationService localizationService,
                                         IWorkContext workContext,
                                         ICustomerActivityService customerActivityService)
 {
     _contactAttributeService = contactAttributeService;
     _contactAttributeParser  = contactAttributeParser;
     _localizationService     = localizationService;
     _workContext             = workContext;
     _customerActivityService = customerActivityService;
 }
예제 #5
0
 public ContactAttributeViewModelService(IContactAttributeService contactAttributeService,
                                         IContactAttributeParser contactAttributeParser,
                                         ITranslationService translationService,
                                         IWorkContext workContext,
                                         ICustomerActivityService customerActivityService)
 {
     _contactAttributeService = contactAttributeService;
     _contactAttributeParser  = contactAttributeParser;
     _translationService      = translationService;
     _workContext             = workContext;
     _customerActivityService = customerActivityService;
 }