Esempio n. 1
0
        private void AddProductSettingEntity(ProductEntity product, string settingName, string settingValue)
        {
            ProductSettingsRepository productSettingsRepository = new ProductSettingsRepository();
            ProductSettingsEntity     productSettings           = new ProductSettingsEntity()
            {
                IdProductSetting  = Guid.NewGuid(),
                PRODUCT_IdProduct = product.IdProduct,
                SettingName       = settingName,
                SettingValue      = settingValue
            };

            //productSettings.PRODUCT = product;
            productSettingsRepository.Add(productSettings);
            //productSettingsRepository.Save();
        }
Esempio n. 2
0
        private string GetSetting(string settingName, string IdCampaign)
        {
            string value = string.Empty;
            ProductSettingsRepository repository    = new ProductSettingsRepository();
            CampaignRepository        cmprepository = new CampaignRepository();
            Guid IdProduct = (from cam in cmprepository.GetAll() where cam.IdCampaign == new Guid(IdCampaign) select cam.PRODUCT_IdProduct).FirstOrDefault();
            List <ProductSettingsEntity> settings = repository.GetProductSettingsByIdProduct(IdProduct);

            switch (settingName)
            {
            case "Key":
            {
                foreach (var setting in settings)
                {
                    if (setting.SettingName == "sendinBlueApiKey")
                    {
                        value = setting.SettingValue;
                    }
                }
            }
            break;

            case "Folder":
            {
                foreach (var setting in settings)
                {
                    if (setting.SettingName == "sendinBlueFolder")
                    {
                        value = setting.SettingValue;
                    }
                }
            }
            break;

            case "List":
            {
                foreach (var setting in settings)
                {
                    if (setting.SettingName == "sendinBlueListId")
                    {
                        value = setting.SettingValue;
                    }
                }
            }
            break;
            }
            return(value);
        }
Esempio n. 3
0
        /// <summary>
        /// Retrieve the Product Settings ViewModel
        /// </summary>
        /// <param name="scope"></param>
        /// <param name="cultureInfo"></param>
        /// <returns></returns>
        public virtual async Task <ProductSettingsViewModel> GetProductSettings(string scope, CultureInfo cultureInfo)
        {
            if (string.IsNullOrWhiteSpace(scope))
            {
                throw new ArgumentException(GetMessageOfNullWhiteSpace(), nameof(scope));
            }
            if (cultureInfo == null)
            {
                throw new ArgumentNullException(nameof(cultureInfo));
            }

            var overtureProductSettings = await ProductSettingsRepository.GetProductSettings(scope);

            var productSettingsViewModel = ViewModelMapper.MapTo <ProductSettingsViewModel>(overtureProductSettings, cultureInfo);

            return(productSettingsViewModel);
        }
Esempio n. 4
0
        public string GetSetting(string setting, string idCampaign)
        {
            string value = string.Empty;
            ProductSettingsRepository    repository = new ProductSettingsRepository();
            CampaignEntity               campaign   = CampaignRepository.FindById(new Guid(idCampaign));
            ProductEntity                product    = ProductRepository.FindById(campaign.PRODUCT_IdProduct);
            List <ProductSettingsEntity> settings   = repository.GetProductSettingsByIdProduct(product.IdProduct);

            switch (setting)
            {
            case "ApiKey":
            {
                foreach (var item in settings)
                {
                    value = item.SettingName.Equals("pushApiToken") ? item.SettingValue : value;
                }
            }
            break;
            }

            return(value);
        }