public void AddProductConfigurationRows()
 {
     var model = new ConfigurationModel();
     var flavorNameA = "TestFlavor";
     var flavorNameB = "TestFlavor2";
     var productA = "ProductA";
     var productB = "ProductB";
     model.Flavors = new List<ConfigurationModel.FlavorOptions>
     {
         new ConfigurationModel.FlavorOptions
         {
             FlavorName = flavorNameA, IncludedProductTitles = new List<string> { productA }
         },
         new ConfigurationModel.FlavorOptions
         {
             FlavorName = flavorNameB, IncludedProductTitles = new List<string> { productB }
         }
     };
     var product = new ConfigurationModel.Product {Title = productB};
     model.Products = new List<ConfigurationModel.Product>
     {
         new ConfigurationModel.Product {Title = productA},
         product
     };
     var controller = new ConfigurationController(model);
     var testView = new ConfigViewForTests();
     controller.PopulateWithModelSettings(testView);
     TestThatViewHasProduct(testView, model.Products[0]);
     TestThatViewHasProduct(testView, model.Products[1]);
     TestThatProductIsSelectedForTheseFlavors(testView, model.Products[0], new List<string> { flavorNameA });
     TestThatProductIsSelectedForTheseFlavors(testView, model.Products[1], new List<string> { flavorNameB });
 }
Пример #2
0
        public GameConfiguration()
        {
            if (File.Exists(StaticPathProvider.ConfigFile))
            {
                try
                {
                    _dataModel = DataModel<ConfigurationModel>.FromFile(StaticPathProvider.ConfigFile);
                }
                catch (DataLoadException)
                {
                    GameLogger.Instance.Log(MessageType.Error, "Error trying to load the configuration file of the game. Resetting file.");

                    _dataModel = ConfigurationModel.Default;
                    Save();
                }
            }
            else
            {
                GameLogger.Instance.Log(MessageType.Warning, "Configuration file not found. Creating new one.");

                _dataModel = ConfigurationModel.Default;
                Save();
            }

            GameInstance.Exiting += OnGameExiting;
            GameModePathProvider.CustomPath = _dataModel.CustomGameModeBasePath;

            FileObserver.Instance.StartFileObserve(StaticPathProvider.ConfigFile, ReloadFile);
        }
Пример #3
0
        public ActionResult Configure()
        {
            //load settings for a chosen store scope
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var authorizeNetPaymentSettings = _settingService.LoadSetting<ForteSettings>(storeScope);

            var model = new ConfigurationModel();
            model.UseSandbox = authorizeNetPaymentSettings.UseSandbox;
            model.TransactModeId = Convert.ToInt32(authorizeNetPaymentSettings.TransactMode);
            model.TransactionKey = authorizeNetPaymentSettings.TransactionKey;
            model.Username = authorizeNetPaymentSettings.Username;
            model.Password = authorizeNetPaymentSettings.Password;
            model.MerchantKey = authorizeNetPaymentSettings.MerchantKey;
            model.GatewayUrl = authorizeNetPaymentSettings.GatewayUrl;
            model.AdditionalFee = authorizeNetPaymentSettings.AdditionalFee;
            model.AdditionalFeePercentage = authorizeNetPaymentSettings.AdditionalFeePercentage;
            //model.TransactModeValues = authorizeNetPaymentSettings.TransactMode.ToSelectList();

            model.ActiveStoreScopeConfiguration = storeScope;
            if (storeScope > 0)
            {
                model.UseSandbox_OverrideForStore = _settingService.SettingExists(authorizeNetPaymentSettings, x => x.UseSandbox, storeScope);
                model.TransactModeId_OverrideForStore = _settingService.SettingExists(authorizeNetPaymentSettings, x => x.TransactMode, storeScope);
                model.TransactionKey_OverrideForStore = _settingService.SettingExists(authorizeNetPaymentSettings, x => x.TransactionKey, storeScope);
                model.Username_OverrideForStore = _settingService.SettingExists(authorizeNetPaymentSettings, x => x.Username, storeScope);
                model.Password_OverrideForStore = _settingService.SettingExists(authorizeNetPaymentSettings, x => x.Password, storeScope);
                model.MerchantKey_OverrideForStore = _settingService.SettingExists(authorizeNetPaymentSettings, x => x.MerchantKey, storeScope);
                model.GatewayUrl_OverrideForStore = _settingService.SettingExists(authorizeNetPaymentSettings, x => x.GatewayUrl, storeScope);
                model.AdditionalFee_OverrideForStore = _settingService.SettingExists(authorizeNetPaymentSettings, x => x.AdditionalFee, storeScope);
                model.AdditionalFeePercentage_OverrideForStore = _settingService.SettingExists(authorizeNetPaymentSettings, x => x.AdditionalFeePercentage, storeScope);
            }

            return View("~/Plugins/Tameion.BridgePay/Views/BridgePay/Configure.cshtml", model);
        }
 public void AddTaskSelections()
 {
     var model = new ConfigurationModel();
     model.Tasks = new ConfigurationModel.TasksToExecuteSettings
     {
         GatherFiles = true,
         BuildSelfExtractingDownloadPackage = true,
         Compile = true,
         OutputFolder = "C:/temp",
         RememberSettings = true,
         SelfExtractingStyle = "SfxFw",
         WriteInstallerXml = true,
         WriteDownloadsXml = true
     };
     var controller = new ConfigurationController(model);
     var testView = new ConfigViewForTests();
     // Assert defaults to ensure a valid test
     Assert.False(testView.GatherFiles || testView.Compile || testView.BuildSelfExtractingDownloadPackage ||
                  testView.RememberSettings || testView.WriteInstallerXml || testView.WriteDownloadsXml, "Expected all booleans to default to false, test invalid");
     controller.PopulateWithModelSettings(testView);
     Assert.True(testView.GatherFiles && testView.Compile && testView.BuildSelfExtractingDownloadPackage &&
                      testView.RememberSettings && testView.WriteInstallerXml && testView.WriteDownloadsXml, "Expected all booleans to be set to true");
     Assert.That(testView.OutputFolder, Is.EqualTo(model.Tasks.OutputFolder));
     Assert.That(testView.SelfExtractingStyle, Is.EqualTo(model.Tasks.SelfExtractingStyle));
 }
        public ActionResult Configure()
        {
            //load settings for a chosen store scope
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var bPayPaymentSettings = _settingService.LoadSetting<BPayPaymentSettings>(storeScope);

            var model = new ConfigurationModel();
            model.DescriptionText = bPayPaymentSettings.DescriptionText;
            //locales
            AddLocales(_languageService, model.Locales, (locale, languageId) =>
            {
                locale.DescriptionText = bPayPaymentSettings.GetLocalizedSetting(x => x.DescriptionText, languageId, false, false);
            });
            model.AdditionalFee = bPayPaymentSettings.AdditionalFee;
            model.AdditionalFeePercentage = bPayPaymentSettings.AdditionalFeePercentage;
            model.ShippableProductRequired = bPayPaymentSettings.ShippableProductRequired;
            model.BillerCode = bPayPaymentSettings.BillerCode;
            model.RefNumberBaseOn = bPayPaymentSettings.RefNumberBaseOn;

            model.ActiveStoreScopeConfiguration = storeScope;
            if (storeScope > 0)
            {
                model.DescriptionText_OverrideForStore = _settingService.SettingExists(bPayPaymentSettings, x => x.DescriptionText, storeScope);
                model.AdditionalFee_OverrideForStore = _settingService.SettingExists(bPayPaymentSettings, x => x.AdditionalFee, storeScope);
                model.AdditionalFeePercentage_OverrideForStore = _settingService.SettingExists(bPayPaymentSettings, x => x.AdditionalFeePercentage, storeScope);
                model.ShippableProductRequired_OverrideForStore = _settingService.SettingExists(bPayPaymentSettings, x => x.ShippableProductRequired, storeScope);
                model.BillerCode_OverrideForStore = _settingService.SettingExists(bPayPaymentSettings, x => x.BillerCode, storeScope);
                model.RefNumberBaseOn_OverrideForStore = _settingService.SettingExists(bPayPaymentSettings, x => x.RefNumberBaseOn, storeScope);
            }

            return View("~/Plugins/Payments.BPay/Views/PaymentBPay/Configure.cshtml", model);
        }
 public void SingleFeatureNoOptionsAddsFeature()
 {
     var simpleScript =
         @"// Fills in details for download packages automatically.
         // This instance created AUTOMATICALLY during a previous run.
         function AutomatePackages()
         {
             SetElement(""FlavorName1"", ""NAME"");
             SetElement(""FlavorUrl1"", ""URL"");
             NextStage();
             NextStage();
         }";
     var configuration = new ConfigurationModel();
     var scriptFile = Path.Combine(TestFolder, "test.js");
     var installerFile = Path.Combine(TestFolder, "installer.xml");
     File.WriteAllText(scriptFile, simpleScript);
     configuration.FileLocation = installerFile;
     configuration.Save();
     JavaScriptConverter.ConvertJsToXml(scriptFile, installerFile);
     var serializer = new XmlSerializer(typeof (ConfigurationModel));
     using (var textReader = new StreamReader(installerFile))
     {
         var model = (ConfigurationModel)serializer.Deserialize(textReader);
         Assert.That(model.Flavors, Is.Not.Null);
         Assert.That(model.Flavors.Count, Is.EqualTo(1));
         Assert.That(model.Flavors.First().FlavorName, Is.EqualTo("NAME"));
         Assert.That(model.Flavors.First().DownloadURL, Is.EqualTo("URL"));
     }
 }
 public void AddFlavorWorks()
 {
     var model = new ConfigurationModel();
     var flavorName = "TestFlavor";
     model.Flavors = new List<ConfigurationModel.FlavorOptions> { new ConfigurationModel.FlavorOptions { FlavorName = flavorName}};
     var controller = new ConfigurationController(model);
     var testView = new ConfigViewForTests();
     controller.PopulateWithModelSettings(testView);
     TestThatViewHasFlavor(testView, model.Flavors[0]);
 }
        public MainPivotPage()
        {
            InitializeComponent();

            configuration = (ConfigurationModel)Resources["appSettings"];
            infoRectangle.Fill = tokenBrush[Colors.Black];

            InitializeTimer();
            InitializeWebClient();
        }
 public void CanPersistBasicModel()
 {
     var model = new ConfigurationModel();
     model.Version = "1.0";
     var serializer = new XmlSerializer(typeof(ConfigurationModel));
     using (var textWriter = new StringWriter())
     {
         serializer.Serialize(textWriter, model);
         Assert.That(textWriter.ToString(), Is.StringContaining("<MasterInstaller"), "Did not write out the MasterInstaller element");
         Assert.That(textWriter.ToString(), Is.StringContaining("Version=\"1.0\""), "Did not write out the version attribute");
     }
 }
 private static bool CheckLegacyBitmapSetting(ConfigurationModel model, string bitmapFilePath, IConfigurationView view)
 {
     if (model.General.ListBackground.ImagePath.Contains(Path.DirectorySeparatorChar.ToString()))
     {
         if (!File.Exists(model.General.ListBackground.ImagePath))
         {
             view.LogErrorLine(string.Format("Bitmap path '{0}' specified in XML node /MasterInstaller/General/ListBackground does not exist. This may be legacy data. Bitmaps should be stored in the '{1}' folder and referenced by file name only.",
                 model.General.ListBackground.ImagePath, bitmapFilePath));
             return false;
         }
     }
     return true;
 }
Пример #11
0
 private void ReloadFile(object sender, FileSystemEventArgs e)
 {
     try
     {
         _dataModel = DataModel<ConfigurationModel>.FromFile(StaticPathProvider.ConfigFile);
         GameModePathProvider.CustomPath = _dataModel.CustomGameModeBasePath;
         ConfigFileLoaded?.Invoke(this, EventArgs.Empty);
     }
     catch (DataLoadException)
     {
         GameLogger.Instance.Log(MessageType.Error, "Error trying to load the configuration file of the game.");
     }
     catch (IOException)
     {
         GameLogger.Instance.Log(MessageType.Error, "Failed to access the contents of the file.");
     }
 }
 public static void Compile(ConfigurationModel model, string certificatePassword, string masterInstallerPath, IConfigurationView view)
 {
     var _utilsPath = Path.Combine(masterInstallerPath, "Utils");
     var cppFilePath = Path.Combine(masterInstallerPath, "Code and Projects");
     var bitmapFilePath = Path.Combine(cppFilePath, "Bitmaps");
     if (CheckLegacyBitmapSetting(model, bitmapFilePath, view))
     {
         var tempFolder = CreateTempCompilationFolder(model);
         GenerateConfigGeneralCpp(cppFilePath, model);
         GenerateConfigDisksCpp(cppFilePath, model);
         GenerateProductsCpp(cppFilePath, model);
         /*
     ProcessConfigFile(xmlDoc, CppFilePath + "\\ConfigFunctions.xsl", CppFilePath + "\\ConfigFunctions.cpp");
     ProcessConfigFile(xmlDoc, CppFilePath + "\\ConfigGlobals.xsl", CppFilePath + "\\AutoGlobals.h");
     ProcessConfigFile(xmlDoc, CppFilePath + "\\ConfigResources.xsl", CppFilePath + "\\AutoResources.rc");
          */
     }
 }
Пример #13
0
        public RenderingSets(ConfigurationModel appModel)
        {
            AppModel = appModel;
            CanSaveAs = (OptionApi.GetBool("ShowRenderingSetManagementDialog") && OptionApi.GetBool("EnableUserRenderingSets")) || IsAdminMode();
            string currentSetName = RenderingSetUtil.CurrentRenderingSet;

            if (string.Compare(currentSetName, customRenderingSetName, true) == 0)
            {
                _sets.Add(BuildRenderingSet(null));
            }

            var sets = Workshare.Interop.Options.RenderingSetManager.GetRenderingSetFileList();
            foreach (string s in sets)
            {
                _sets.Add(BuildRenderingSet(s));
            }

            SelectedSet = _sets.Where(set => string.Compare(set.Name, currentSetName, true) == 0).FirstOrDefault();

            if (SelectedSet == null && _sets.Count > 0)
                SelectedSet = _sets[0];

        }
        public PresetConfigurationViewModel(ApplicationStateModel applicationStateModel, ConfigurationModel configurationModel)
        {
            _applicationStateModel = applicationStateModel;
            _configurationModel    = configurationModel;

            _leftPresetViewModel  = new PresetViewModel(applicationStateModel, configurationModel);
            _rightPresetViewModel = new PresetViewModel(applicationStateModel, configurationModel);
        }
 public BirackoMjestoService(ConfigurationModel configuration)
 {
     _configuration = configuration;
 }
 public KandidatService(ConfigurationModel configuration)
 {
     _configuration = configuration;
 }
Пример #17
0
 public HomeController(ILogger <HomeController> logger, IOptions <ConfigurationModel> configuration)
 {
     _logger        = logger;
     _configuration = configuration.Value;
 }
 private static void GenerateProductsCpp(string cppFilePath, ConfigurationModel model)
 {
     var externalFunctions = new StringBuilder();
     externalFunctions.AppendLine("// External functions:");
     var productConfigurations = new StringBuilder();
     productConfigurations.AppendLine("// List of software products in this package.");
     productConfigurations.AppendLine("static SoftwareProduct Products[] =\n{");
     var preInstallDeps = new StringBuilder();
     var postInstallationTests = new StringBuilder();
     foreach (var product in model.Products)
     {
         GenerateProductExternalFunctions(product, externalFunctions);
         GenerateProductPrerequisites(product, preInstallDeps);
         GenerateProductRequires(product, postInstallationTests);
         productConfigurations.AppendLine("\t{");
         GenerateProductStringVariable(product.Tag, "Name used in dependency lists", productConfigurations);
         GenerateProductStringVariable(product.Title, "Title", productConfigurations);
         GenerateProductStringVariable(product.ProductCode, "MSI Product Code", productConfigurations);
         GenerateProductStringVariable(product.Version, "Version for Product Key test", productConfigurations);
         GenerateProductStringVariable(null, "Feature (Obsolete)", productConfigurations);
         GenerateProductIntVariable(product.KeyId, "-1", "Product Key ID", productConfigurations);
         GenerateProductBoolVariable(product.List, "Flag saying if product should be offered to user (m_kOneOfOurs)",
             productConfigurations);
         // The IsContainer flag is obsolete and not present in any existing config files, but we will write it out as false for now
         GenerateProductBoolVariable(false, "IsContainer (Obsolete, always false)",
             productConfigurations);
         GenerateProductStringVariable(null, "Critical file condition flag (Obsolete)", productConfigurations);
         GenerateProductStringVariable(product.CriticalFile, "Critical file (was critical file condition true)", productConfigurations);
         GenerateProductStringVariable(null, "Critical file condition false (Obsolete)", productConfigurations);
         GenerateProductIntVariable(product.CDNumber, "CD index (zero-based)", productConfigurations);
         GenerateProductStringVariable(null, "MinOS (Obsolete)", productConfigurations);
         GenerateProductStringVariable(null, "MaxOS (Obsolete)", productConfigurations);
         GenerateProductBoolVariable(product.MustBeAdmin, "Must be admin to install", productConfigurations);
         GenerateProductBoolVariable(product.FlushReboot, "Flag to say if pending reboot must be executed first", productConfigurations);
         GenerateProductBoolVariable(false, "flag related to reboot and PendingFileRenameOperations reg setting (Obsolete)", productConfigurations);
         GenerateProductBoolVariable(false, "flag related to reboot and wininit.ini (Obsolete)", productConfigurations);
         GenerateProductBoolVariable(false, "flag related to killing hanging windows before installation (Obsolete)", productConfigurations);
         GenerateProductFunctionVariable(product.Preinstall, "Preinstallation function", productConfigurations);
         GenerateProductStringVariable(null, "No External Preinstallation function (Obsolete)", productConfigurations);
         GenerateProductBoolVariable(false, "Flag to say if we may ignore returned error code from Preinstall function (Obsolete)", productConfigurations);
         GenerateProductInstallVariables(product, productConfigurations);
         GenerateProductIntVariable(0, "Success code override (Obsolete)", productConfigurations);
         GenerateProductBoolVariable(product.MustNotDelayReboot, "Flag to say if pending reboot must be executed right after installation", productConfigurations);
         GenerateProductStringVariable(product.DownloadURL, "Download Web URL", productConfigurations);
         GenerateProductStringVariable(product.Commentary, "Commentary during installation", productConfigurations);
         GenerateProductStringVariable(product.StatusWindow, "What to do with status window during installation", productConfigurations);
         GenerateProductBoolVariable(false, "StatusPauseWin98 flag (Obsolete)", productConfigurations);
         GenerateProductTestPresenceVariables(product.TestPresence, productConfigurations);
         GenerateProductPostInstallationVariables(product.PostInstall, productConfigurations);
         GenerateProductPathVariable(product.Help != null ? product.Help.HelpFile : null, "Help tag", productConfigurations);
         GenerateProductBoolVariable(product.Help != null && product.Help.Internal, "Help tag", productConfigurations);
         productConfigurations.AppendLine("\t},");
     }
     productConfigurations.AppendLine("};");
     CompleteDependencyArrays(preInstallDeps, postInstallationTests);
     File.WriteAllText(Path.Combine(cppFilePath, "ConfigProducts.cpp"), GeneratedCppHeaderString + externalFunctions + productConfigurations + preInstallDeps + postInstallationTests);
 }
 private static void GenerateProductTestPresenceVariables(ConfigurationModel.TestPresenceOptions testPresenceOptions, StringBuilder productConfigurations)
 {
     if (testPresenceOptions != null)
     {
         GenerateProductFunctionVariable(testPresenceOptions.TestFunction, "TestPresence function", productConfigurations);
         GenerateProductFunctionVariable(null, "No TestPresence command (Obsolete)", productConfigurations);
         GenerateProductStringVariable(testPresenceOptions.Version, "TestPresence version parameter", productConfigurations);
     }
     else
     {
         GenerateProductFunctionVariable(null, "No TestPresence function", productConfigurations);
         GenerateProductFunctionVariable(null, "No TestPresence command (Obsolete)", productConfigurations);
         GenerateProductStringVariable(null, "No TestPresence version parameter", productConfigurations);
     }
 }
Пример #20
0
        public async Task <IActionResult> Configure(ConfigurationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(await Configure());
            }

            //load settings for a chosen store scope
            var storeId           = GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var mailChimpSettings = _settingService.LoadSetting <MailChimpSettings>(storeId);

            //update stores if the list was changed
            if (!string.IsNullOrEmpty(model.ListId) && !model.ListId.Equals(Guid.Empty.ToString()) && !model.ListId.Equals(mailChimpSettings.ListId))
            {
                (storeId > 0 ? new[] { storeId } : _storeService.GetAllStores().Select(store => store.Id)).ToList()
                .ForEach(id => _synchronizationRecordService.CreateOrUpdateRecord(EntityType.Store, id, OperationType.Update));
            }

            //prepare webhook
            if (!string.IsNullOrEmpty(mailChimpSettings.ApiKey))
            {
                var listId          = !string.IsNullOrEmpty(model.ListId) && !model.ListId.Equals(Guid.Empty.ToString()) ? model.ListId : string.Empty;
                var webhookPrepared = await _mailChimpManager.PrepareWebhook(listId);

                //display warning if webhook is not prepared
                if (!webhookPrepared && !string.IsNullOrEmpty(listId))
                {
                    WarningNotification(_localizationService.GetResource("Plugins.Misc.MailChimp.Webhook.Warning"));
                }
            }

            //save settings
            mailChimpSettings.ApiKey            = model.ApiKey;
            mailChimpSettings.PassEcommerceData = model.PassEcommerceData;
            mailChimpSettings.ListId            = model.ListId;
            _settingService.SaveSetting(mailChimpSettings, x => x.ApiKey, clearCache: false);
            _settingService.SaveSetting(mailChimpSettings, x => x.PassEcommerceData, clearCache: false);
            _settingService.SaveSettingOverridablePerStore(mailChimpSettings, x => x.ListId, model.ListId_OverrideForStore, storeId, false);
            _settingService.ClearCache();

            //create or update synchronization task
            var task = _scheduleTaskService.GetTaskByType(MailChimpDefaults.SynchronizationTask);

            if (task == null)
            {
                task = new ScheduleTask
                {
                    Type    = MailChimpDefaults.SynchronizationTask,
                    Name    = MailChimpDefaults.SynchronizationTaskName,
                    Seconds = MailChimpDefaults.DefaultSynchronizationPeriod * 60 * 60
                };
                _scheduleTaskService.InsertTask(task);
            }

            var synchronizationPeriodInSeconds = model.SynchronizationPeriod * 60 * 60;
            var synchronizationEnabled         = model.AutoSynchronization;

            if (task.Enabled != synchronizationEnabled || task.Seconds != synchronizationPeriodInSeconds)
            {
                //task parameters was changed
                task.Enabled = synchronizationEnabled;
                task.Seconds = synchronizationPeriodInSeconds;
                _scheduleTaskService.UpdateTask(task);
                WarningNotification(_localizationService.GetResource("Plugins.Misc.MailChimp.Fields.AutoSynchronization.Restart"));
            }

            SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved"));

            return(await Configure());
        }
        public void LoadFronJSON_LegacyFormat_DataIsCorrect()
        {
            ConfigurationModel config = ConfigurationModel.LoadFromJSON(@"..\..\Resources\LegacyConfigSettings.json", testProvider);

            ConfirmOverrideConfigMatchesExpectation(config);
        }
 public void DeleteFlavorWorks()
 {
     var deleteFlavor = new ConfigurationModel.FlavorOptions { FlavorName = "DeletedFlavor", DownloadURL = "localhost" };
     var model = new ConfigurationModel();
     var flavorName = "TestFlavor";
     model.Flavors = new List<ConfigurationModel.FlavorOptions>
     {
         new ConfigurationModel.FlavorOptions { FlavorName = flavorName },
         deleteFlavor
     };
     var controller = new ConfigurationController(model);
     var testView = new ConfigViewForTests();
     controller.PopulateWithModelSettings(testView);
     TestThatViewHasFlavor(testView, model.Flavors[0]);
     TestThatViewHasFlavor(testView, model.Flavors[1]);
     // SUT
     controller.DeleteLastFlavor(testView);
     TestThatViewHasFlavor(testView, model.Flavors[0]);
     TestThatViewDoesNotHaveFlavor(testView, deleteFlavor);
 }
 public ConfigurationController(ConfigurationModel model)
 {
     _model = model;
 }
        public ActionResult Configure()
        {
            ConfigurationModel model = new ConfigurationModel();

            return View("~/Plugins/Misc.MultipleParents/Views/Configure.cshtml", model);
        }
Пример #25
0
 public ConfigurationWindow(IGestureRecognizer rec, GesturePack gestures)
 {
     // Take advantage of closure to get reference to the uninitialized view
     model = new ConfigurationModel(new ModelToViewAdapter(() => { return view; }), rec, gestures);
     view = new ConfigurationView(new ViewToModelAdapter(() => { return model;  }));
 }
 private void TestThatViewHasProduct(ConfigViewForTests testView, ConfigurationModel.Product product)
 {
     CollectionAssert.Contains(testView.productNames, product.Title);
 }
 private void TestThatViewHasFlavor(ConfigViewForTests testView, ConfigurationModel.FlavorOptions flavorOptions)
 {
     CollectionAssert.Contains(testView.flavorNames, flavorOptions.FlavorName);
     CollectionAssert.Contains(testView.flavorUrls, flavorOptions.DownloadURL);
 }
Пример #28
0
        public ActionResult Configure()
        {
            //load settings for a chosen store scope
            var          storeScope = GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var          todoPagoPaymentSettings = _settingService.LoadSetting <TodoPagoPaymentSettings>(storeScope);
            ActionResult result;
            double       version;

            var model = new ConfigurationModel
            {
                //Configuracion general
                //Titulo = todoPagoPaymentSettings.Titulo,
                //Descripcion = todoPagoPaymentSettings.Descripcion,
                AmbienteId     = Convert.ToInt32(todoPagoPaymentSettings.Ambiente),
                AmbienteValues = todoPagoPaymentSettings.Ambiente.GetSelectList(),
                SegmentoId     = Convert.ToInt32(todoPagoPaymentSettings.Segmento),
                SegmentoValues = todoPagoPaymentSettings.Segmento.GetSelectList(),
                //DeadLine = todoPagoPaymentSettings.DeadLine,
                //FormularioId = Convert.ToInt32(todoPagoPaymentSettings.Formulario),
                //FormularioValues = todoPagoPaymentSettings.Formulario.GetSelectList(),
                SetCuotas       = todoPagoPaymentSettings.SetCuotas,
                MaxCuotasId     = Convert.ToInt32(todoPagoPaymentSettings.MaxCuotas),
                MaxCuotasValues = todoPagoPaymentSettings.MaxCuotas.GetSelectList(),

                SetTimeout = todoPagoPaymentSettings.SetTimeout,
                Timeout    = todoPagoPaymentSettings.Timeout,

                Chart      = todoPagoPaymentSettings.Chart,
                GoogleMaps = todoPagoPaymentSettings.GoogleMaps,

                Hibrido = todoPagoPaymentSettings.Hibrido,

                UrlBannerBilletera = todoPagoPaymentSettings.UrlBannerBilletera,

                User     = todoPagoPaymentSettings.User,
                Password = todoPagoPaymentSettings.Password,

                //Ambiente Developer
                ApiKeyDeveloper   = todoPagoPaymentSettings.ApiKeyDeveloper,
                SecurityDeveloper = todoPagoPaymentSettings.SecurityDeveloper,
                MerchantDeveloper = todoPagoPaymentSettings.MerchantDeveloper,

                //Ambiente Production
                ApiKeyProduction   = todoPagoPaymentSettings.ApiKeyProduction,
                SecurityProduction = todoPagoPaymentSettings.SecurityProduction,
                MerchantProduction = todoPagoPaymentSettings.MerchantProduction,

                //Estdos del pedido
                TransaccionIniciadaId      = Convert.ToInt32(todoPagoPaymentSettings.TransaccionIniciada),
                TransaccionIniciadaValues  = todoPagoPaymentSettings.TransaccionIniciada.GetSelectList(),
                TransaccionAprobadaId      = Convert.ToInt32(todoPagoPaymentSettings.TransaccionAprobada),
                TransaccionAprobadaValues  = todoPagoPaymentSettings.TransaccionAprobada.GetSelectList(),
                TransaccionRechazadaId     = Convert.ToInt32(todoPagoPaymentSettings.TransaccionRechazada),
                TransaccionRechazadaValues = todoPagoPaymentSettings.TransaccionRechazada.GetSelectList(),
                TransaccionOfflineId       = Convert.ToInt32(todoPagoPaymentSettings.TransaccionOffline),
                TransaccionOfflineValues   = todoPagoPaymentSettings.TransaccionOffline.GetSelectList(),

                ActiveStoreScopeConfiguration = storeScope
            };

            if (String.IsNullOrEmpty(model.UrlBannerBilletera))
            {
                model.UrlBannerBilletera = "https://todopago.com.ar/sites/todopago.com.ar/files/billetera/pluginstarjeta1.jpg";
            }

            if (storeScope > 0)
            {
                //Configuracion general
                //model.Titulo_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.Titulo, storeScope);
                //model.Descripcion_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.Descripcion, storeScope);
                model.AmbienteId_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.Ambiente, storeScope);
                model.SegmentoId_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.Segmento, storeScope);
                //model.DeadLine_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.DeadLine, storeScope);
                //model.FormularioId_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.Formulario, storeScope);
                model.SetCuotas_OverrideForStore   = _settingService.SettingExists(todoPagoPaymentSettings, x => x.SetCuotas, storeScope);
                model.MaxCuotasId_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.MaxCuotas, storeScope);

                model.SetTimeout_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.SetTimeout, storeScope);
                model.Timeout_OverrideForStore    = _settingService.SettingExists(todoPagoPaymentSettings, x => x.Timeout, storeScope);

                model.Chart_OverrideForStore      = _settingService.SettingExists(todoPagoPaymentSettings, x => x.Chart, storeScope);
                model.GoogleMaps_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.GoogleMaps, storeScope);

                model.Hibrido_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.Hibrido, storeScope);

                model.UrlBannerBilletera_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.UrlBannerBilletera, storeScope);

                model.User_OverrideForStore     = _settingService.SettingExists(todoPagoPaymentSettings, x => x.User, storeScope);
                model.Password_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.Password, storeScope);

                //Ambiente Developer
                model.ApiKeyDeveloper_OverrideForStore   = _settingService.SettingExists(todoPagoPaymentSettings, x => x.ApiKeyDeveloper, storeScope);
                model.SecurityDeveloper_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.SecurityDeveloper, storeScope);
                model.MerchantDeveloper_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.MerchantDeveloper, storeScope);

                //Ambiente Production
                model.ApiKeyProduction_OverrideForStore   = _settingService.SettingExists(todoPagoPaymentSettings, x => x.ApiKeyProduction, storeScope);
                model.SecurityProduction_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.SecurityProduction, storeScope);
                model.MerchantProduction_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.MerchantProduction, storeScope);

                //Estdos del pedido
                model.TransaccionIniciadaId_OverrideForStore  = _settingService.SettingExists(todoPagoPaymentSettings, x => x.TransaccionIniciada, storeScope);
                model.TransaccionAprobadaId_OverrideForStore  = _settingService.SettingExists(todoPagoPaymentSettings, x => x.TransaccionAprobada, storeScope);
                model.TransaccionRechazadaId_OverrideForStore = _settingService.SettingExists(todoPagoPaymentSettings, x => x.TransaccionRechazada, storeScope);
                model.TransaccionOfflineId_OverrideForStore   = _settingService.SettingExists(todoPagoPaymentSettings, x => x.TransaccionOffline, storeScope);
            }

            // check plugin is installed
            var processor = _paymentService.LoadPaymentMethodBySystemName("Payments.TodoPago") as TodoPagoPaymentProcessor;

            if (processor == null || !processor.IsPaymentMethodActive(_paymentSettings) || !processor.PluginDescriptor.Installed)
            {
                ViewBag.getDescriptionError = "El plugin se encuentra desactivado, actívelo para continuar.";
            }
            else
            {
                ViewBag.versionTodoPago = processor.PluginDescriptor.Version;
            }

            Double.TryParse(Nop.Core.NopVersion.CurrentVersion, out version);

            if (version >= 3.8)
            {
                result = View("~/Plugins/Payments.TodoPago/Views/PaymentTodoPago/Configure.cshtml", model);
            }
            else
            {
                result = View("~/Plugins/Payments.TodoPago/Views/PaymentTodoPago/Configure37.cshtml", model);
            }

            return(result);
        }
        public void Constructor_EnumerbleIsNull_DoesNotThrow()
        {
            ConfigurationModel configs = new ConfigurationModel();

            new IssueReporterManager(configs, null);
        }
 private static ConfigurationModel GetDefaultConfig()
 {
     return(ConfigurationModel.LoadFromJSON(null, testProvider));
 }
 public ReportController(IOptions <ConfigurationModel> configuration)
 {
     Configuration = configuration.Value;
 }
Пример #32
0
        public ActionResult Configure(ConfigurationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Configure());
            }

            //load settings for a chosen store scope
            var storeScope           = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var ogonePaymentSettings = _settingService.LoadSetting <OgonePaymentSettings>(storeScope);

            //save settings
            ogonePaymentSettings.PSPId                 = model.PSPId;
            ogonePaymentSettings.SHAInPassPhrase       = _encryptionService.EncryptText(model.SHAInPassPhrase);
            ogonePaymentSettings.SHAOutPassPhrase      = _encryptionService.EncryptText(model.SHAOutPassPhrase);
            ogonePaymentSettings.AdditionalFee         = model.AdditionalFee;
            ogonePaymentSettings.HashAllParameters     = model.HashAllParameters;
            ogonePaymentSettings.HashingAlgorithm      = (HashingAlgorithm)model.HashingAlgorithmId;
            ogonePaymentSettings.OgoneGatewayUrl       = model.OgoneGatewayUrl;
            ogonePaymentSettings.TemplateUrl           = model.TemplateUrl;
            ogonePaymentSettings.TemplateTitle         = model.TemplateTitle;
            ogonePaymentSettings.BackgroundColor       = model.BackgroundColor;
            ogonePaymentSettings.TextColor             = model.TextColor;
            ogonePaymentSettings.TableBackgroundColor  = model.TableBackgroundColor;
            ogonePaymentSettings.TableTextColor        = model.TableTextColor;
            ogonePaymentSettings.ButtonBackgroundColor = model.ButtonBackgroundColor;
            ogonePaymentSettings.ButtonTextColor       = model.ButtonTextColor;
            ogonePaymentSettings.FontFamily            = model.FontFamily;
            ogonePaymentSettings.LogoUrl               = model.LogoUrl;
            ogonePaymentSettings.ParamVar              = model.ParamVar;
            ogonePaymentSettings.OrderIdPrefix         = model.OrderIdPrefix;
            ogonePaymentSettings.PmList                = model.PmList;
            ogonePaymentSettings.ExclPmList            = model.ExclPmList;

            /* We do not clear cache after each setting update.
             * This behavior can increase performance because cached settings will not be cleared
             * and loaded from database after each update */
            if (model.PSPId_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.PSPId, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.PSPId, storeScope);
            }

            if (model.SHAInPassPhrase_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.SHAInPassPhrase, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.SHAInPassPhrase, storeScope);
            }

            if (model.SHAOutPassPhrase_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.SHAOutPassPhrase, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.SHAOutPassPhrase, storeScope);
            }

            if (model.AdditionalFee_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.AdditionalFee, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.AdditionalFee, storeScope);
            }

            if (model.HashAllParameters_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.HashAllParameters, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.HashAllParameters, storeScope);
            }

            if (model.HashingAlgorithmId_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.HashingAlgorithm, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.HashingAlgorithm, storeScope);
            }

            if (model.OgoneGatewayUrl_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.OgoneGatewayUrl, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.OgoneGatewayUrl, storeScope);
            }

            if (model.TemplateUrl_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.TemplateUrl, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.TemplateUrl, storeScope);
            }

            if (model.TemplateTitle_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.TemplateTitle, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.TemplateTitle, storeScope);
            }

            if (model.BackgroundColor_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.BackgroundColor, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.BackgroundColor, storeScope);
            }

            if (model.TextColor_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.TextColor, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.TextColor, storeScope);
            }

            if (model.TableBackgroundColor_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.TableBackgroundColor, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.TableBackgroundColor, storeScope);
            }

            if (model.TableTextColor_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.TableTextColor, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.TableTextColor, storeScope);
            }

            if (model.ButtonBackgroundColor_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.ButtonBackgroundColor, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.ButtonBackgroundColor, storeScope);
            }

            if (model.ButtonTextColor_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.ButtonTextColor, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.ButtonTextColor, storeScope);
            }

            if (model.FontFamily_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.FontFamily, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.FontFamily, storeScope);
            }

            if (model.LogoUrl_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.LogoUrl, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.LogoUrl, storeScope);
            }

            if (model.ParamVar_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.ParamVar, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.LogoUrl, storeScope);
            }

            if (model.OrderIdPrefix_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.OrderIdPrefix, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.OrderIdPrefix, storeScope);
            }

            if (model.PmList_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.PmList, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.PmList, storeScope);
            }

            if (model.ExclPmList_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(ogonePaymentSettings, x => x.ExclPmList, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(ogonePaymentSettings, x => x.ExclPmList, storeScope);
            }

            //now clear settings cache
            _settingService.ClearCache();

            return(Configure());
        }
        public void TestFeatureProductSelection()
        {
            var flavorName1 = "flavorA";
            var flavorName2 = "flavorB";
            var url1 = "http://a.com";
            var url2 = "http://b.com";
            var complexScript =
                @"// Fills in details for download packages automatically.
                // This instance created AUTOMATICALLY during a previous run.
                function AutomatePackages()
                {
                " +
                string.Format(@"SetElement(""FlavorName1"", ""{0}"");
                    SetElement(""FlavorUrl1"", ""{1}"");
                    AddFlavor();
                    SetElement(""FlavorName2"", ""{2}"");
                    SetElement(""FlavorUrl2"", ""{3}"");

                    NextStage();

                    SelectElement(""IncludedF1P1"", true);
                    SelectElement(""IncludedF1P2"", false);

                    SelectElement(""IncludedF2P1"", false);
                    SelectElement(""IncludedF2P2"", true);

                    NextStage();", flavorName1, url1, flavorName2, url2) +
                    @"
                }";

            var configuration = new ConfigurationModel();
            // The configuration needs to have 2 Products for the given JavaScript
            configuration.Products = new List<ConfigurationModel.Product>();
            var mainProduct = "Main Product";
            configuration.Products.Add(new ConfigurationModel.Product { Title = mainProduct });
            var dependency = "Dependency";
            configuration.Products.Add(new ConfigurationModel.Product { Title = dependency });
            var scriptFile = Path.Combine(TestFolder, "test.js");
            var installerFile = Path.Combine(TestFolder, "installer.xml");
            File.WriteAllText(scriptFile, complexScript);
            configuration.FileLocation = installerFile;
            configuration.Save();
            JavaScriptConverter.ConvertJsToXml(scriptFile, installerFile);
            var serializer = new XmlSerializer(typeof(ConfigurationModel));
            using (var textReader = new StreamReader(installerFile))
            {
                var model = (ConfigurationModel)serializer.Deserialize(textReader);
                Assert.That(model.Flavors, Is.Not.Null);
                Assert.That(model.Flavors.Count, Is.EqualTo(2));
                var firstFlavor = model.Flavors[0];
                var secondFlavor = model.Flavors[1];
                Assert.That(firstFlavor.FlavorName, Is.EqualTo(flavorName1));
                Assert.That(firstFlavor.DownloadURL, Is.EqualTo(url1));
                Assert.That(firstFlavor.IncludedProductTitles[0], Is.EqualTo(mainProduct));
                Assert.That(secondFlavor.FlavorName, Is.EqualTo(flavorName2));
                Assert.That(secondFlavor.DownloadURL, Is.EqualTo(url2));
                Assert.That(secondFlavor.IncludedProductTitles[0], Is.EqualTo(dependency));
            }
        }
Пример #34
0
 public FirefoxConfigurationViewModel(IConfigurationService service)
 {
     _service = service;
     model    = _service.Load();
 }
 private void TestThatProductIsSelectedForTheseFlavors(ConfigViewForTests testView, ConfigurationModel.Product product, List<string> list)
 {
     CollectionAssert.AreEquivalent(testView.enabledFlavorsForProduct[product.Title], list);
 }
        public ActionResult Configure(ConfigurationModel model)
        {
            //load settings for a chosen store scope
            var storeScope     = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var sliderSettings = _settingService.LoadSetting <SliderSettings>(storeScope);

            sliderSettings.Picture1Id = model.Picture1Id;
            sliderSettings.Text1      = model.Text1;
            sliderSettings.Link1      = model.Link1;
            sliderSettings.Picture2Id = model.Picture2Id;
            sliderSettings.Text2      = model.Text2;
            sliderSettings.Link2      = model.Link2;
            sliderSettings.Picture3Id = model.Picture3Id;
            sliderSettings.Text3      = model.Text3;
            sliderSettings.Link3      = model.Link3;
            sliderSettings.Picture4Id = model.Picture4Id;
            sliderSettings.Text4      = model.Text4;
            sliderSettings.Link4      = model.Link4;
            sliderSettings.Picture5Id = model.Picture5Id;
            sliderSettings.Text5      = model.Text5;
            sliderSettings.Link5      = model.Link5;

            /* We do not clear cache after each setting update.
             * This behavior can increase performance because cached settings will not be cleared
             * and loaded from database after each update */
            if (model.Picture1Id_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Picture1Id, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Picture1Id, storeScope);
            }

            if (model.Text1_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Text1, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Text1, storeScope);
            }

            if (model.Link1_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Link1, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Link1, storeScope);
            }

            if (model.Picture2Id_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Picture2Id, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Picture2Id, storeScope);
            }

            if (model.Text2_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Text2, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Text2, storeScope);
            }

            if (model.Link2_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Link2, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Link2, storeScope);
            }

            if (model.Picture3Id_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Picture3Id, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Picture3Id, storeScope);
            }

            if (model.Text3_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Text3, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Text3, storeScope);
            }

            if (model.Link3_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Link3, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Link3, storeScope);
            }

            if (model.Picture4Id_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Picture4Id, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Picture4Id, storeScope);
            }

            if (model.Text4_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Text4, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Text4, storeScope);
            }

            if (model.Link4_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Link4, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Link4, storeScope);
            }

            if (model.Picture5Id_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Picture5Id, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Picture5Id, storeScope);
            }

            if (model.Text5_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Text5, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Text5, storeScope);
            }

            if (model.Link5_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(sliderSettings, x => x.Link5, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(sliderSettings, x => x.Link5, storeScope);
            }

            //now clear settings cache
            _settingService.ClearCache();

            SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved"));
            return(Configure());
        }
        public ActionResult Configure(ConfigurationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Configure());
            }

            //load settings for a chosen store scope
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var cashOnDeliveryPaymentSettings = _settingService.LoadSetting <CashOnDeliveryPaymentSettings>(storeScope);

            //save settings
            cashOnDeliveryPaymentSettings.DescriptionText          = model.DescriptionText;
            cashOnDeliveryPaymentSettings.AdditionalFee            = model.AdditionalFee;
            cashOnDeliveryPaymentSettings.AdditionalFeePercentage  = model.AdditionalFeePercentage;
            cashOnDeliveryPaymentSettings.ShippableProductRequired = model.ShippableProductRequired;

            /* We do not clear cache after each setting update.
             * This behavior can increase performance because cached settings will not be cleared
             * and loaded from database after each update */
            if (model.DescriptionText_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(cashOnDeliveryPaymentSettings, x => x.DescriptionText, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(cashOnDeliveryPaymentSettings, x => x.DescriptionText, storeScope);
            }

            if (model.AdditionalFee_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(cashOnDeliveryPaymentSettings, x => x.AdditionalFee, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(cashOnDeliveryPaymentSettings, x => x.AdditionalFee, storeScope);
            }

            if (model.AdditionalFeePercentage_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(cashOnDeliveryPaymentSettings, x => x.AdditionalFeePercentage, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(cashOnDeliveryPaymentSettings, x => x.AdditionalFeePercentage, storeScope);
            }

            if (model.ShippableProductRequired_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(cashOnDeliveryPaymentSettings, x => x.ShippableProductRequired, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(cashOnDeliveryPaymentSettings, x => x.ShippableProductRequired, storeScope);
            }

            //now clear settings cache
            _settingService.ClearCache();

            //localization. no multi-store support for localization yet.
            foreach (var localized in model.Locales)
            {
                cashOnDeliveryPaymentSettings.SaveLocalizedSetting(x => x.DescriptionText,
                                                                   localized.LanguageId,
                                                                   localized.DescriptionText);
            }

            SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved"));

            return(Configure());
        }
Пример #38
0
        public async Task <IActionResult> Configure(bool showtour = false)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageTaxSettings))
            {
                return(AccessDeniedView());
            }

            var taxCategories = await _taxCategoryService.GetAllTaxCategoriesAsync();

            if (!taxCategories.Any())
            {
                var errorModel = new ConfigurationModel
                {
                    TaxCategoriesCanNotLoadedError = string.Format(
                        await _localizationService.GetResourceAsync(
                            "Plugins.Tax.FixedOrByCountryStateZip.TaxCategoriesCanNotLoaded"),
                        Url.Action("Categories", "Tax"))
                };

                return(View("~/Plugins/Tax.FixedOrByCountryStateZip/Views/Configure.cshtml", errorModel));
            }

            var model = new ConfigurationModel {
                CountryStateZipEnabled = _countryStateZipSettings.CountryStateZipEnabled
            };

            //stores
            model.AvailableStores.Add(new SelectListItem {
                Text = "*", Value = "0"
            });
            var stores = await _storeService.GetAllStoresAsync();

            foreach (var s in stores)
            {
                model.AvailableStores.Add(new SelectListItem {
                    Text = s.Name, Value = s.Id.ToString()
                });
            }
            //tax categories
            foreach (var tc in taxCategories)
            {
                model.AvailableTaxCategories.Add(new SelectListItem {
                    Text = tc.Name, Value = tc.Id.ToString()
                });
            }
            //countries
            var countries = await _countryService.GetAllCountriesAsync(showHidden : true);

            foreach (var c in countries)
            {
                model.AvailableCountries.Add(new SelectListItem {
                    Text = c.Name, Value = c.Id.ToString()
                });
            }
            //states
            model.AvailableStates.Add(new SelectListItem {
                Text = "*", Value = "0"
            });
            var defaultCountry = countries.FirstOrDefault();

            if (defaultCountry != null)
            {
                var states = await _stateProvinceService.GetStateProvincesByCountryIdAsync(defaultCountry.Id);

                foreach (var s in states)
                {
                    model.AvailableStates.Add(new SelectListItem {
                        Text = s.Name, Value = s.Id.ToString()
                    });
                }
            }

            //show configuration tour
            if (showtour)
            {
                var customer = await _workContext.GetCurrentCustomerAsync();

                var hideCard = await _genericAttributeService.GetAttributeAsync <bool>(customer, NopCustomerDefaults.HideConfigurationStepsAttribute);

                var closeCard = await _genericAttributeService.GetAttributeAsync <bool>(customer, NopCustomerDefaults.CloseConfigurationStepsAttribute);

                if (!hideCard && !closeCard)
                {
                    ViewBag.ShowTour = true;
                }
            }

            return(View("~/Plugins/Tax.FixedOrByCountryStateZip/Views/Configure.cshtml", model));
        }
        public async Task <IActionResult> Configure(ConfigurationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(await Configure());
            }

            //load settings for a chosen store scope
            var storeScope = await this.GetActiveStoreScopeConfiguration(_storeService, _workContext);

            var cashOnDeliveryPaymentSettings = _settingService.LoadSetting <CashOnDeliveryPaymentSettings>(storeScope);

            //save settings
            cashOnDeliveryPaymentSettings.DescriptionText          = model.DescriptionText;
            cashOnDeliveryPaymentSettings.AdditionalFee            = model.AdditionalFee;
            cashOnDeliveryPaymentSettings.AdditionalFeePercentage  = model.AdditionalFeePercentage;
            cashOnDeliveryPaymentSettings.ShippableProductRequired = model.ShippableProductRequired;

            /* We do not clear cache after each setting update.
             * This behavior can increase performance because cached settings will not be cleared
             * and loaded from database after each update */
            if (model.DescriptionText_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                await _settingService.SaveSetting(cashOnDeliveryPaymentSettings, x => x.DescriptionText, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                await _settingService.DeleteSetting(cashOnDeliveryPaymentSettings, x => x.DescriptionText, storeScope);
            }

            if (model.AdditionalFee_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                await _settingService.SaveSetting(cashOnDeliveryPaymentSettings, x => x.AdditionalFee, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                await _settingService.DeleteSetting(cashOnDeliveryPaymentSettings, x => x.AdditionalFee, storeScope);
            }

            if (model.AdditionalFeePercentage_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                await _settingService.SaveSetting(cashOnDeliveryPaymentSettings, x => x.AdditionalFeePercentage, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                await _settingService.DeleteSetting(cashOnDeliveryPaymentSettings, x => x.AdditionalFeePercentage, storeScope);
            }

            if (model.ShippableProductRequired_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                await _settingService.SaveSetting(cashOnDeliveryPaymentSettings, x => x.ShippableProductRequired, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                await _settingService.DeleteSetting(cashOnDeliveryPaymentSettings, x => x.ShippableProductRequired, storeScope);
            }

            //now clear settings cache
            await _settingService.ClearCache();

            SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved"));

            return(await Configure());
        }
Пример #40
0
        public IContentStore CreateContentStore(AbsolutePath localCacheRoot)
        {
            var redisContentLocationStoreFactory = CreateRedisCacheFactory(localCacheRoot, out var redisContentLocationStoreConfiguration);

            var localMachineLocation = _arguments.PathTransformer.GetLocalMachineLocation(localCacheRoot);

            ReadOnlyDistributedContentSession <AbsolutePath> .ContentAvailabilityGuarantee contentAvailabilityGuarantee;
            if (string.IsNullOrEmpty(_distributedSettings.ContentAvailabilityGuarantee))
            {
                contentAvailabilityGuarantee =
                    ReadOnlyDistributedContentSession <AbsolutePath> .ContentAvailabilityGuarantee
                    .FileRecordsExist;
            }
            else if (!Enum.TryParse(_distributedSettings.ContentAvailabilityGuarantee, true, out contentAvailabilityGuarantee))
            {
                throw new ArgumentException($"Unable to parse {nameof(_distributedSettings.ContentAvailabilityGuarantee)}: [{_distributedSettings.ContentAvailabilityGuarantee}]");
            }

            PinConfiguration pinConfiguration = null;

            if (_distributedSettings.IsPinBetterEnabled)
            {
                pinConfiguration = new PinConfiguration();
                ApplyIfNotNull(_distributedSettings.PinRisk, v => pinConfiguration.PinRisk                 = v);
                ApplyIfNotNull(_distributedSettings.MachineRisk, v => pinConfiguration.MachineRisk         = v);
                ApplyIfNotNull(_distributedSettings.FileRisk, v => pinConfiguration.FileRisk               = v);
                ApplyIfNotNull(_distributedSettings.MaxIOOperations, v => pinConfiguration.MaxIOOperations = v);

                pinConfiguration.IsPinCachingEnabled = _distributedSettings.IsPinCachingEnabled;

                ApplyIfNotNull(_distributedSettings.PinCacheReplicaCreditRetentionMinutes, v => pinConfiguration.PinCachePerReplicaRetentionCreditMinutes = v);
                ApplyIfNotNull(_distributedSettings.PinCacheReplicaCreditRetentionDecay, v => pinConfiguration.PinCacheReplicaCreditRetentionFactor       = v);
            }

            var contentHashBumpTime          = TimeSpan.FromMinutes(_distributedSettings.ContentHashBumpTimeMinutes);
            var lazyTouchContentHashBumpTime = _distributedSettings.IsTouchEnabled ? (TimeSpan?)contentHashBumpTime : null;

            if (redisContentLocationStoreConfiguration.ReadMode == ContentLocationMode.LocalLocationStore)
            {
                // LocalLocationStore has its own internal notion of lazy touch/registration. We disable the lazy touch in distributed content store
                // because it can conflict with behavior of the local location store.
                lazyTouchContentHashBumpTime = null;
            }

            var contentStoreSettings = FromDistributedSettings(_distributedSettings);

            ConfigurationModel configurationModel = null;

            if (_arguments.Configuration.LocalCasSettings.CacheSettingsByCacheName.TryGetValue(_arguments.Configuration.LocalCasSettings.CasClientSettings.DefaultCacheName, out var namedCacheSettings))
            {
                configurationModel = new ConfigurationModel(new ContentStoreConfiguration(new MaxSizeQuota(namedCacheSettings.CacheSizeQuotaString)));
            }

            var bandwidthCheckedCopier = new BandwidthCheckedCopier(_arguments.Copier, BandwidthChecker.Configuration.FromDistributedContentSettings(_distributedSettings), _logger);

            _logger.Debug("Creating a distributed content store for Autopilot");
            var contentStore =
                new DistributedContentStore <AbsolutePath>(
                    localMachineLocation,
                    (announcer, evictionSettings, checkLocal, trimBulk) =>
                    ContentStoreFactory.CreateContentStore(_fileSystem, localCacheRoot, announcer, distributedEvictionSettings: evictionSettings,
                                                           contentStoreSettings: contentStoreSettings, trimBulkAsync: trimBulk, configurationModel: configurationModel),
                    redisContentLocationStoreFactory,
                    _arguments.Copier,
                    bandwidthCheckedCopier,
                    _arguments.PathTransformer,
                    _arguments.CopyRequester,
                    contentAvailabilityGuarantee,
                    localCacheRoot,
                    _fileSystem,
                    _distributedSettings.RedisBatchPageSize,
                    new DistributedContentStoreSettings()
            {
                CleanRandomFilesAtRoot          = _distributedSettings.CleanRandomFilesAtRoot,
                TrustedHashFileSizeBoundary     = _distributedSettings.TrustedHashFileSizeBoundary,
                ParallelHashingFileSizeBoundary = _distributedSettings.ParallelHashingFileSizeBoundary,
                MaxConcurrentCopyOperations     = _distributedSettings.MaxConcurrentCopyOperations,
                PinConfiguration                     = pinConfiguration,
                RetryIntervalForCopies               = _distributedSettings.RetryIntervalForCopies,
                MaxRetryCount                        = _distributedSettings.MaxRetryCount,
                TimeoutForProactiveCopies            = TimeSpan.FromMinutes(_distributedSettings.TimeoutForProactiveCopiesMinutes),
                ProactiveCopyMode                    = (ProactiveCopyMode)Enum.Parse(typeof(ProactiveCopyMode), _distributedSettings.ProactiveCopyMode),
                PushProactiveCopies                  = _distributedSettings.PushProactiveCopies,
                ProactiveCopyOnPin                   = _distributedSettings.ProactiveCopyOnPin,
                MaxConcurrentProactiveCopyOperations = _distributedSettings.MaxConcurrentProactiveCopyOperations,
                ProactiveCopyLocationsThreshold      = _distributedSettings.ProactiveCopyLocationsThreshold,
                MaximumConcurrentPutFileOperations   = _distributedSettings.MaximumConcurrentPutFileOperations,
            },
                    replicaCreditInMinutes: _distributedSettings.IsDistributedEvictionEnabled?_distributedSettings.ReplicaCreditInMinutes: null,
                    enableRepairHandling: _distributedSettings.IsRepairHandlingEnabled,
                    contentHashBumpTime: lazyTouchContentHashBumpTime,
                    clock: SystemClock.Instance,
                    contentStoreSettings: contentStoreSettings);

            _logger.Debug("Created Distributed content store.");
            return(contentStore);
        }
Пример #41
0
 public NativePay(ConfigurationModel modoel)
 {
     WxPayConfig = modoel;
 }
Пример #42
0
 public OpcinaService(ConfigurationModel configuration)
 {
     _configuration = configuration;
 }
Пример #43
0
        public ActionResult Configure(ConfigurationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Configure());
            }

            //load settings for a chosen store scope
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var todoPagoPaymentSettings = _settingService.LoadSetting <TodoPagoPaymentSettings>(storeScope);

            //save settings
            todoPagoPaymentSettings.Titulo      = model.Titulo;
            todoPagoPaymentSettings.Descripcion = model.Descripcion;
            todoPagoPaymentSettings.Ambiente    = (Ambiente)model.AmbienteId;
            todoPagoPaymentSettings.Segmento    = (Segmento)model.SegmentoId;
            //todoPagoPaymentSettings.DeadLine = model.DeadLine;
            //todoPagoPaymentSettings.Formulario = (Formulario)model.FormularioId;
            todoPagoPaymentSettings.SetCuotas = model.SetCuotas;
            todoPagoPaymentSettings.MaxCuotas = (MaxCuotas)model.MaxCuotasId;

            todoPagoPaymentSettings.SetTimeout = model.SetTimeout;

            if (todoPagoPaymentSettings.SetTimeout)
            {
                if (!String.IsNullOrEmpty(model.Timeout))
                {
                    long n;
                    if (Int64.TryParse(model.Timeout, out n))
                    {
                        // It's a number!
                        todoPagoPaymentSettings.Timeout = model.Timeout;
                    }
                    else
                    {
                        todoPagoPaymentSettings.Timeout    = String.Empty;
                        todoPagoPaymentSettings.SetTimeout = false;
                    }
                }
                else
                {
                    todoPagoPaymentSettings.Timeout    = String.Empty;
                    todoPagoPaymentSettings.SetTimeout = false;
                }
            }
            else
            {
                todoPagoPaymentSettings.Timeout = String.Empty;
            }

            todoPagoPaymentSettings.Chart      = model.Chart;
            todoPagoPaymentSettings.GoogleMaps = model.GoogleMaps;

            todoPagoPaymentSettings.Hibrido = model.Hibrido;

            todoPagoPaymentSettings.UrlBannerBilletera = model.UrlBannerBilletera;

            todoPagoPaymentSettings.User     = model.User;
            todoPagoPaymentSettings.Password = model.Password;

            todoPagoPaymentSettings.ApiKeyDeveloper   = model.ApiKeyDeveloper;
            todoPagoPaymentSettings.SecurityDeveloper = model.SecurityDeveloper;
            todoPagoPaymentSettings.MerchantDeveloper = model.MerchantDeveloper;

            todoPagoPaymentSettings.ApiKeyProduction   = model.ApiKeyProduction;
            todoPagoPaymentSettings.SecurityProduction = model.SecurityProduction;
            todoPagoPaymentSettings.MerchantProduction = model.MerchantProduction;

            todoPagoPaymentSettings.TransaccionIniciada  = (OrderStatus)model.TransaccionIniciadaId;
            todoPagoPaymentSettings.TransaccionAprobada  = (OrderStatus)model.TransaccionAprobadaId;
            todoPagoPaymentSettings.TransaccionRechazada = (OrderStatus)model.TransaccionRechazadaId;
            todoPagoPaymentSettings.TransaccionOffline   = (OrderStatus)model.TransaccionOfflineId;


            /* We do not clear cache after each setting update.
             * This behavior can increase performance because cached settings will not be cleared
             * and loaded from database after each update */
            if (model.Titulo_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.Titulo, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.Titulo, storeScope);
            }

            if (model.Descripcion_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.Descripcion, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.Descripcion, storeScope);
            }

            if (model.AmbienteId_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.Ambiente, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.Ambiente, storeScope);
            }

            if (model.SegmentoId_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.Segmento, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.Segmento, storeScope);
            }

            // if (model.DeadLine_OverrideForStore || storeScope == 0)
            // _settingService.SaveSetting(todoPagoPaymentSettings, x => x.DeadLine, storeScope, false);
            //else if (storeScope > 0)
            //_settingService.DeleteSetting(todoPagoPaymentSettings, x => x.DeadLine, storeScope);

            //if (model.FormularioId_OverrideForStore || storeScope == 0)
            //_settingService.SaveSetting(todoPagoPaymentSettings, x => x.Formulario, storeScope, false);
            //else if (storeScope > 0)
            //_settingService.DeleteSetting(todoPagoPaymentSettings, x => x.Formulario, storeScope);

            if (model.SetCuotas_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.SetCuotas, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.SetCuotas, storeScope);
            }

            if (model.MaxCuotasId_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.MaxCuotas, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.MaxCuotas, storeScope);
            }

            if (model.SetTimeout_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.SetTimeout, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.SetTimeout, storeScope);
            }

            if (model.Timeout_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.Timeout, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.Timeout, storeScope);
            }

            if (model.SetTimeout_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.Chart, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.Chart, storeScope);
            }

            if (model.SetTimeout_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.GoogleMaps, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.GoogleMaps, storeScope);
            }

            if (model.SetTimeout_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.Hibrido, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.Hibrido, storeScope);
            }

            if (model.UrlBannerBilletera_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.UrlBannerBilletera, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.UrlBannerBilletera, storeScope);
            }

            if (model.User_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.User, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.User, storeScope);
            }

            if (model.Password_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.Password, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.Password, storeScope);
            }

            if (model.ApiKeyDeveloper_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.ApiKeyDeveloper, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.ApiKeyDeveloper, storeScope);
            }

            if (model.SecurityDeveloper_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.SecurityDeveloper, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.SecurityDeveloper, storeScope);
            }

            if (model.MerchantDeveloper_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.MerchantDeveloper, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.MerchantDeveloper, storeScope);
            }

            if (model.ApiKeyProduction_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.ApiKeyProduction, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.ApiKeyProduction, storeScope);
            }

            if (model.SecurityProduction_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.SecurityProduction, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.SecurityProduction, storeScope);
            }

            if (model.MerchantProduction_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.MerchantProduction, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.MerchantProduction, storeScope);
            }

            if (model.TransaccionIniciadaId_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.TransaccionIniciada, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.TransaccionIniciada, storeScope);
            }

            if (model.TransaccionAprobadaId_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.TransaccionAprobada, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.TransaccionAprobada, storeScope);
            }

            if (model.TransaccionRechazadaId_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.TransaccionRechazada, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.TransaccionRechazada, storeScope);
            }

            if (model.TransaccionOfflineId_OverrideForStore || storeScope == 0)
            {
                _settingService.SaveSetting(todoPagoPaymentSettings, x => x.TransaccionOffline, storeScope, false);
            }
            else if (storeScope > 0)
            {
                _settingService.DeleteSetting(todoPagoPaymentSettings, x => x.TransaccionOffline, storeScope);
            }

            //now clear settings cache
            _settingService.ClearCache();

            SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved"));

            return(Configure());
        }
 private static string CreateTempCompilationFolder(ConfigurationModel model)
 {
     var folderRoot = Path.GetDirectoryName(model.FileLocation);
     var tempFolder = Path.Combine(folderRoot, "setup.exeComingSoon");
     Directory.CreateDirectory(tempFolder);
     return tempFolder;
 }
        public IContentStore CreateContentStore(
            AbsolutePath localCacheRoot,
            NagleQueue <ContentHash> evictionAnnouncer              = null,
            ProactiveReplicationArgs replicationSettings            = null,
            DistributedEvictionSettings distributedEvictionSettings = null,
            bool checkLocalFiles        = true,
            TrimBulkAsync trimBulkAsync = null)
        {
            var contentConnectionStringProvider          = new HostConnectionStringProvider(_arguments.Host, _redisContentSecretNames.RedisContentSecretName, _logger);
            var machineLocationsConnectionStringProvider = new HostConnectionStringProvider(_arguments.Host, _redisContentSecretNames.RedisMachineLocationsSecretName, _logger);

            var redisContentLocationStoreConfiguration = new RedisContentLocationStoreConfiguration
            {
                RedisBatchPageSize    = _distributedSettings.RedisBatchPageSize,
                BlobExpiryTimeMinutes = _distributedSettings.BlobExpiryTimeMinutes,
                MaxBlobCapacity       = _distributedSettings.MaxBlobCapacity,
                MaxBlobSize           = _distributedSettings.MaxBlobSize
            };

            ApplyIfNotNull(_distributedSettings.ReplicaCreditInMinutes, v => redisContentLocationStoreConfiguration.ReplicaPenaltyInMinutes = v);
            ApplyIfNotNull(_distributedSettings.LocationEntryExpiryMinutes, v => redisContentLocationStoreConfiguration.LocationEntryExpiry = TimeSpan.FromMinutes(v));
            ApplyIfNotNull(_distributedSettings.MachineExpiryMinutes, v => redisContentLocationStoreConfiguration.MachineExpiry             = TimeSpan.FromMinutes(v));

            redisContentLocationStoreConfiguration.ReputationTrackerConfiguration.Enabled = _distributedSettings.IsMachineReputationEnabled;

            if (_distributedSettings.IsContentLocationDatabaseEnabled)
            {
                var dbConfig = new RocksDbContentLocationDatabaseConfiguration(localCacheRoot / "LocationDb")
                {
                    StoreClusterState = _distributedSettings.StoreClusterStateInDatabase
                };

                redisContentLocationStoreConfiguration.Database = dbConfig;
                if (_distributedSettings.ContentLocationDatabaseGcIntervalMinutes != null)
                {
                    dbConfig.LocalDatabaseGarbageCollectionInterval = TimeSpan.FromMinutes(_distributedSettings.ContentLocationDatabaseGcIntervalMinutes.Value);
                }

                ApplyKeyVaultSettingsForLlsAsync(redisContentLocationStoreConfiguration, localCacheRoot).GetAwaiter().GetResult();
            }

            if (_distributedSettings.IsRedisGarbageCollectionEnabled)
            {
                redisContentLocationStoreConfiguration.GarbageCollectionConfiguration = new RedisGarbageCollectionConfiguration()
                {
                    MaximumEntryLastAccessTime = TimeSpan.FromMinutes(30)
                };
            }
            else
            {
                redisContentLocationStoreConfiguration.GarbageCollectionConfiguration = null;
            }

            var localMachineLocation = _arguments.PathTransformer.GetLocalMachineLocation(localCacheRoot);
            var contentHashBumpTime  = TimeSpan.FromMinutes(_distributedSettings.ContentHashBumpTimeMinutes);

            var redisContentLocationStoreFactory = new RedisContentLocationStoreFactory(
                contentConnectionStringProvider,
                machineLocationsConnectionStringProvider,
                SystemClock.Instance,
                contentHashBumpTime,
                _keySpace,
                localMachineLocation,
                configuration: redisContentLocationStoreConfiguration
                );

            ReadOnlyDistributedContentSession <AbsolutePath> .ContentAvailabilityGuarantee contentAvailabilityGuarantee;
            if (string.IsNullOrEmpty(_distributedSettings.ContentAvailabilityGuarantee))
            {
                contentAvailabilityGuarantee =
                    ReadOnlyDistributedContentSession <AbsolutePath> .ContentAvailabilityGuarantee
                    .FileRecordsExist;
            }
            else if (!Enum.TryParse(_distributedSettings.ContentAvailabilityGuarantee, true, out contentAvailabilityGuarantee))
            {
                throw new ArgumentException($"Unable to parse {nameof(_distributedSettings.ContentAvailabilityGuarantee)}: [{_distributedSettings.ContentAvailabilityGuarantee}]");
            }

            PinConfiguration pinConfiguration = null;

            if (_distributedSettings.IsPinBetterEnabled)
            {
                pinConfiguration = new PinConfiguration();
                if (_distributedSettings.PinRisk.HasValue)
                {
                    pinConfiguration.PinRisk = _distributedSettings.PinRisk.Value;
                }
                if (_distributedSettings.MachineRisk.HasValue)
                {
                    pinConfiguration.MachineRisk = _distributedSettings.MachineRisk.Value;
                }
                if (_distributedSettings.FileRisk.HasValue)
                {
                    pinConfiguration.FileRisk = _distributedSettings.FileRisk.Value;
                }
                if (_distributedSettings.MaxIOOperations.HasValue)
                {
                    pinConfiguration.MaxIOOperations = _distributedSettings.MaxIOOperations.Value;
                }
                pinConfiguration.UsePinCache = _distributedSettings.IsPinCachingEnabled;
                if (_distributedSettings.PinCacheReplicaCreditRetentionMinutes.HasValue)
                {
                    pinConfiguration.PinCacheReplicaCreditRetentionMinutes = _distributedSettings.PinCacheReplicaCreditRetentionMinutes.Value;
                }
                if (_distributedSettings.PinCacheReplicaCreditRetentionDecay.HasValue)
                {
                    pinConfiguration.PinCacheReplicaCreditRetentionDecay = _distributedSettings.PinCacheReplicaCreditRetentionDecay.Value;
                }
            }

            var lazyTouchContentHashBumpTime = _distributedSettings.IsTouchEnabled ? (TimeSpan?)contentHashBumpTime : null;

            if (redisContentLocationStoreConfiguration.ReadMode == ContentLocationMode.LocalLocationStore)
            {
                // LocalLocationStore has its own internal notion of lazy touch/registration. We disable the lazy touch in distributed content store
                // because it can conflict with behavior of the local location store.
                lazyTouchContentHashBumpTime = null;
            }

            var contentStoreSettings = FromDistributedSettings(_distributedSettings);

            ConfigurationModel configurationModel = null;

            if (_arguments.Configuration.LocalCasSettings.CacheSettingsByCacheName.TryGetValue(_arguments.Configuration.LocalCasSettings.CasClientSettings.DefaultCacheName, out var namedCacheSettings))
            {
                configurationModel = new ConfigurationModel(new ContentStoreConfiguration(new MaxSizeQuota(namedCacheSettings.CacheSizeQuotaString)));
            }

            _logger.Debug("Creating a distributed content store for Autopilot");
            var contentStore =
                new DistributedContentStore <AbsolutePath>(
                    localMachineLocation,
                    (announcer, evictionSettings, checkLocal, trimBulk) =>
                    ContentStoreFactory.CreateContentStore(_fileSystem, localCacheRoot, announcer, distributedEvictionSettings: evictionSettings,
                                                           contentStoreSettings: contentStoreSettings, trimBulkAsync: trimBulk, configurationModel: configurationModel),
                    redisContentLocationStoreFactory,
                    _arguments.Copier,
                    _arguments.Copier,
                    _arguments.PathTransformer,
                    contentAvailabilityGuarantee,
                    localCacheRoot,
                    _fileSystem,
                    _distributedSettings.RedisBatchPageSize,
                    new DistributedContentStoreSettings()
            {
                UseTrustedHash                  = _distributedSettings.UseTrustedHash,
                CleanRandomFilesAtRoot          = _distributedSettings.CleanRandomFilesAtRoot,
                TrustedHashFileSizeBoundary     = _distributedSettings.TrustedHashFileSizeBoundary,
                ParallelHashingFileSizeBoundary = _distributedSettings.ParallelHashingFileSizeBoundary,
                MaxConcurrentCopyOperations     = _distributedSettings.MaxConcurrentCopyOperations,
                PinConfiguration                = pinConfiguration,
            },
                    replicaCreditInMinutes: _distributedSettings.IsDistributedEvictionEnabled?_distributedSettings.ReplicaCreditInMinutes: null,
                    enableRepairHandling: _distributedSettings.IsRepairHandlingEnabled,
                    contentHashBumpTime: lazyTouchContentHashBumpTime,
                    contentStoreSettings: contentStoreSettings);

            _logger.Debug("Created Distributed content store.");
            return(contentStore);
        }
 private static void GenerateProductRequires(ConfigurationModel.Product product, StringBuilder postInstallTests)
 {
     if (product.Requires != null)
     {
         GenerateRequirementArrayEntries(product.Tag, product.Requires, postInstallTests);
     }
 }
        public void Constructor_NoNullInputs_DoesNotThrow()
        {
            ConfigurationModel configs = new ConfigurationModel();

            new IssueReporterManager(configs, Enumerable.Empty <IIssueReporting>());
        }
Пример #48
0
        /// <summary>
        /// Выполнить.
        /// </summary>
        /// <param name="parameter">Параметр.</param>
        protected override void Execute(MainWindowVM parameter)
        {
            if (!parameter.Data.Any())
            {
                MessageBox.Show("Отсутвуют данные для обучения!\n" +
                                "Загрузите данные.");

                return;
            }

            var countOfLayerNeurons = int.Parse(parameter.CountOfHiddenLayerNeurons);

            //if (countOfLayerNeurons.Equals(0))
            //{
            //    MessageBox.Show("Операция для 0 нейронов не реализована.");

            //    return;
            //}

            var alphaString      = string.Empty;
            var epsilonString    = string.Empty;
            var epochCountString = parameter.EpochCount;

            if (parameter.Alpha.Contains("."))
            {
                alphaString = parameter.Alpha.Replace(".", ",");
            }
            else
            {
                alphaString = parameter.Alpha;
            }

            if (!double.TryParse(alphaString, out var alpha))
            {
                MessageBox.Show("Параметры имеют неверный формат!", "Ошибка",
                                MessageBoxButton.OK, MessageBoxImage.Error);

                return;
            }

            if (parameter.Epsilon.Contains("."))
            {
                epsilonString = parameter.Epsilon.Replace(".", ",");
            }
            else
            {
                epsilonString = parameter.Epsilon;
            }

            if (!double.TryParse(epsilonString, out var epsilon))
            {
                MessageBox.Show("Параметры имеют неверный формат!", "Ошибка",
                                MessageBoxButton.OK, MessageBoxImage.Error);

                return;
            }

            if (!int.TryParse(epochCountString, out var epochCount))
            {
                MessageBox.Show("Параметры имеют неверный формат!", "Ошибка",
                                MessageBoxButton.OK, MessageBoxImage.Error);

                return;
            }

            var configuration = new ConfigurationModel()
            {
                Alpha      = alpha,
                Epsilon    = epsilon,
                EpochCount = epochCount
            };

            var learningUtil = new LearningUtil(parameter.Data, countOfLayerNeurons, configuration);

            learningUtil.Start();
        }
Пример #49
0
        public async Task <IActionResult> Configure()
        {
            //load settings for a chosen store scope
            var storeId           = GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var mailChimpSettings = _settingService.LoadSetting <MailChimpSettings>(storeId);

            //prepare model
            var model = new ConfigurationModel
            {
                ApiKey                        = mailChimpSettings.ApiKey,
                PassEcommerceData             = mailChimpSettings.PassEcommerceData,
                ListId                        = mailChimpSettings.ListId,
                ListId_OverrideForStore       = storeId > 0 && _settingService.SettingExists(mailChimpSettings, settings => settings.ListId, storeId),
                ActiveStoreScopeConfiguration = storeId
            };

            //check whether synchronization is in progress
            model.SynchronizationStarted = _cacheManager.Get <int?>(MailChimpDefaults.OperationNumberCacheKey).HasValue;

            //prepare account info
            if (!string.IsNullOrEmpty(mailChimpSettings.ApiKey))
            {
                model.AccountInfo = await _mailChimpManager.GetAccountInfo();
            }

            //prepare available lists
            if (!string.IsNullOrEmpty(mailChimpSettings.ApiKey))
            {
                model.AvailableLists = await _mailChimpManager.GetAvailableLists() ?? new List <SelectListItem>();
            }

            var defaultListId = mailChimpSettings.ListId;

            if (!model.AvailableLists.Any())
            {
                //add the special item for 'there are no lists' with empty guid value
                model.AvailableLists.Add(new SelectListItem
                {
                    Text  = _localizationService.GetResource("Plugins.Misc.MailChimp.Fields.List.NotExist"),
                    Value = Guid.Empty.ToString()
                });
                defaultListId = Guid.Empty.ToString();
            }
            else if (string.IsNullOrEmpty(mailChimpSettings.ListId) || mailChimpSettings.ListId.Equals(Guid.Empty.ToString()))
            {
                defaultListId = model.AvailableLists.FirstOrDefault()?.Value;
            }

            //set the default list
            model.ListId             = defaultListId;
            mailChimpSettings.ListId = defaultListId;
            _settingService.SaveSettingOverridablePerStore(mailChimpSettings, settings => settings.ListId, model.ListId_OverrideForStore, storeId);

            //synchronization task
            var task = _scheduleTaskService.GetTaskByType(MailChimpDefaults.SynchronizationTask);

            if (task != null)
            {
                model.SynchronizationPeriod = task.Seconds / 60 / 60;
                model.AutoSynchronization   = task.Enabled;
            }

            return(View("~/Plugins/Misc.MailChimp/Views/Configure.cshtml", model));
        }
Пример #50
0
        public IActionResult Configure(string testTaxResult = null)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageTaxSettings))
                return AccessDeniedView();

            //prepare common properties
            var model = new ConfigurationModel
            {
                AccountId = _avalaraTaxSettings.AccountId,
                LicenseKey = _avalaraTaxSettings.LicenseKey,
                CompanyCode = _avalaraTaxSettings.CompanyCode,
                UseSandbox = _avalaraTaxSettings.UseSandbox,
                CommitTransactions = _avalaraTaxSettings.CommitTransactions,
                ValidateAddress = _avalaraTaxSettings.ValidateAddress,
                TaxOriginAddressTypeId = (int)_avalaraTaxSettings.TaxOriginAddressType,
                EnableLogging = _avalaraTaxSettings.EnableLogging,
                TestTaxResult = testTaxResult
            };
            model.IsConfigured = !string.IsNullOrEmpty(_avalaraTaxSettings.AccountId) && !string.IsNullOrEmpty(_avalaraTaxSettings.LicenseKey);
            model.TaxOriginAddressTypes = TaxOriginAddressType.DefaultTaxAddress.ToSelectList(false)
                .Select(type => new SelectListItem(type.Text, type.Value)).ToList();
            model.HideGeneralBlock = _genericAttributeService.GetAttribute<bool>(_workContext.CurrentCustomer, AvalaraTaxDefaults.HideGeneralBlock);
            model.HideLogBlock = _genericAttributeService.GetAttribute<bool>(_workContext.CurrentCustomer, AvalaraTaxDefaults.HideLogBlock);

            //prepare address model
            _baseAdminModelFactory.PrepareCountries(model.TestAddress.AvailableCountries);
            _baseAdminModelFactory.PrepareStatesAndProvinces(model.TestAddress.AvailableStates, model.TestAddress.CountryId);

            //prepare tax transaction log model
            model.TaxTransactionLogSearchModel.SetGridPageSize();

            //get active account companies
            var activeCompanies = model.IsConfigured ? _avalaraTaxManager.GetAccountCompanies() : null;
            if (activeCompanies?.Any() ?? false)
            {
                model.Companies = activeCompanies.OrderBy(company => company.isDefault ?? false ? 0 : 1).Select(company => new SelectListItem
                {
                    Text = company.isTest ?? false ? $"{company.name} (Test)" : company.name,
                    Value = company.companyCode
                }).ToList();
            }

            var defaultCompanyCode = _avalaraTaxSettings.CompanyCode;
            if (!model.Companies.Any())
            {
                //add the special item for 'there are no companies' with empty guid value
                var noCompaniesText = _localizationService.GetResource("Plugins.Tax.Avalara.Fields.Company.NotExist");
                model.Companies.Add(new SelectListItem { Text = noCompaniesText, Value = Guid.Empty.ToString() });
                defaultCompanyCode = Guid.Empty.ToString();
            }
            else if (string.IsNullOrEmpty(_avalaraTaxSettings.CompanyCode) || _avalaraTaxSettings.CompanyCode.Equals(Guid.Empty.ToString()))
                defaultCompanyCode = model.Companies.FirstOrDefault()?.Value;

            //set the default company
            model.CompanyCode = defaultCompanyCode;
            _avalaraTaxSettings.CompanyCode = defaultCompanyCode;
            _settingService.SaveSetting(_avalaraTaxSettings);

            //display warning in case of company currency differ from the primary store currency
            var primaryCurrency = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId);
            var selectedCompany = activeCompanies?.FirstOrDefault(company => company.companyCode.Equals(defaultCompanyCode));
            if (!selectedCompany?.baseCurrencyCode?.Equals(primaryCurrency?.CurrencyCode, StringComparison.InvariantCultureIgnoreCase) ?? false)
            {
                var warning = string.Format(_localizationService.GetResource("Plugins.Tax.Avalara.Fields.Company.Currency.Warning"),
                    selectedCompany.name, selectedCompany.baseCurrencyCode, primaryCurrency?.CurrencyCode);
                _notificationService.WarningNotification(warning);
            }

            return View("~/Plugins/Tax.Avalara/Views/Configuration/Configure.cshtml", model);
        }
Пример #51
0
 private ConfigurationModel GetModel()
 {
     var model = new ConfigurationModel();
     var authenticationInfo = _authenticationProvider.GetAuthenticationInfo();
     if (authenticationInfo.IsAuthenticated)
     {
         model.IsAuthenticated = true;
         model.UserName = authenticationInfo.UserName;
         model.UserId = authenticationInfo.UserId;
         var optedOutUserIds = _optoutUserService.GetOptedOutUserIds();
         model.IsOptedOut = optedOutUserIds.Contains(authenticationInfo.UserId);
     }
     return model;
 }
 public IzbornaJedinicaController(IOptions <ConfigurationModel> configuration)
 {
     _configuration = configuration.Value;
 }
        public ActionResult Configure(ConfigurationModel model)
        {
            if (!ModelState.IsValid)
                return Configure();

            //load settings for a chosen store scope
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var bPayPaymentSettings = _settingService.LoadSetting<BPayPaymentSettings>(storeScope);

            if (string.IsNullOrWhiteSpace(model.BillerCode))
            {
                ModelState.AddModelError("BillerCode", "Biller code Required!");
                return Configure();
            }
            // get valid values for RefNumberBaseOn
            List<string> allowdValueforRefNumberBaseOn = new List<string>();          
            foreach (var item in model.RefNumberBaseOnTypeList)
            {
                allowdValueforRefNumberBaseOn.Add(item.Value.ToLower());
            }
            if (string.IsNullOrWhiteSpace(model.RefNumberBaseOn) || (!allowdValueforRefNumberBaseOn.Contains(model.RefNumberBaseOn.ToLower())))
            {
                ModelState.AddModelError("RefNumberBaseOn", "Required! Allowed Value (OrderNumber or CustomerNumber)");
                return Configure();
            }
            //save settings
            bPayPaymentSettings.DescriptionText = model.DescriptionText;
            bPayPaymentSettings.AdditionalFee = model.AdditionalFee;
            bPayPaymentSettings.AdditionalFeePercentage = model.AdditionalFeePercentage;
            bPayPaymentSettings.ShippableProductRequired = model.ShippableProductRequired;
            bPayPaymentSettings.BillerCode = model.BillerCode;
            bPayPaymentSettings.RefNumberBaseOn = model.RefNumberBaseOn;

            /* We do not clear cache after each setting update.
             * This behavior can increase performance because cached settings will not be cleared 
             * and loaded from database after each update */
            if (model.DescriptionText_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bPayPaymentSettings, x => x.DescriptionText, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bPayPaymentSettings, x => x.DescriptionText, storeScope);

            if (model.AdditionalFee_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bPayPaymentSettings, x => x.AdditionalFee, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bPayPaymentSettings, x => x.AdditionalFee, storeScope);

            if (model.AdditionalFeePercentage_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bPayPaymentSettings, x => x.AdditionalFeePercentage, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bPayPaymentSettings, x => x.AdditionalFeePercentage, storeScope);

            if (model.ShippableProductRequired_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bPayPaymentSettings, x => x.ShippableProductRequired, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bPayPaymentSettings, x => x.ShippableProductRequired, storeScope);

            if (model.BillerCode_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bPayPaymentSettings, x => x.BillerCode, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bPayPaymentSettings, x => x.BillerCode, storeScope);

            if (model.RefNumberBaseOn_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bPayPaymentSettings, x => x.RefNumberBaseOn, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bPayPaymentSettings, x => x.RefNumberBaseOn, storeScope);

            //now clear settings cache
            _settingService.ClearCache();

            //localization. no multi-store support for localization yet.
            foreach (var localized in model.Locales)
            {
                bPayPaymentSettings.SaveLocalizedSetting(x => x.DescriptionText,
                    localized.LanguageId,
                    localized.DescriptionText);
            }

            SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved"));

            return Configure();
        }
Пример #54
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="LocalCache" /> class backed by <see cref="TwoContentStore"/> implemented as <see cref="StreamPathContentStore"/>
        /// </summary>
        public static LocalCache CreateStreamPathContentStoreInProcMemoizationStoreCache(ILogger logger,
                                                                                         AbsolutePath rootPathForStream,
                                                                                         AbsolutePath rootPathForPath,
                                                                                         MemoizationStoreConfiguration memoConfig,
                                                                                         ConfigurationModel configurationModelForStream = null,
                                                                                         ConfigurationModel configurationModelForPath   = null,
                                                                                         IClock clock         = null,
                                                                                         bool checkLocalFiles = true)
        {
            var fileSystem = new PassThroughFileSystem(logger);

            clock = clock ?? SystemClock.Instance;

            var contentStoreSettings = new ContentStoreSettings()
            {
                CheckFiles = checkLocalFiles
            };

            Func <IContentStore> contentStoreFactory = () => new StreamPathContentStore(
                () => new FileSystemContentStore(fileSystem, clock, rootPathForStream, configurationModelForStream, settings: contentStoreSettings),
                () => new FileSystemContentStore(fileSystem, clock, rootPathForPath, configurationModelForPath, settings: contentStoreSettings));
            var memoizationStoreFactory = CreateInProcessLocalMemoizationStoreFactory(logger, clock, memoConfig);

            return(new LocalCache(fileSystem, contentStoreFactory, memoizationStoreFactory, LoadPersistentCacheGuid(rootPathForStream, fileSystem)));
        }
        public void TestTasksConversion()
        {
            var flavorName1 = "flavorA";
            var url1 = "http://a.com";
            var outputPath = "D:/Test";
            var sfxStyle = "Hmm";
            var complexScript =
                @"// Fills in details for download packages automatically.
                // This instance created AUTOMATICALLY during a previous run.
                function AutomatePackages()
                {
                " +
                string.Format(@"SetElement(""FlavorName1"", ""{0}"");
                    SetElement(""FlavorUrl1"", ""{1}"");
                    NextStage();
                    SelectElement(""IncludedF1P1"", true);
                    NextStage();

                    SetElement(""OutputPath"", ""{2}"");
                    SelectElement(""WriteXml"", true);
                    SelectElement(""WriteDownloadsXml"", true);
                    SelectElement(""Compile"", true);
                    SelectElement(""GatherFiles"", true);
                    SelectElement(""BuildSfx"", true);
                    SetElement(""SfxStyle"", ""{3}"");
                    SetElement(""SaveSettings"", true);", flavorName1, url1, outputPath, sfxStyle) +
                @"
                }";

            var configuration = new ConfigurationModel();
            configuration.Products = new List<ConfigurationModel.Product>();
            var mainProduct = "Main Product";
            configuration.Products.Add(new ConfigurationModel.Product {Title = mainProduct});
            var scriptFile = Path.Combine(TestFolder, "test.js");
            var installerFile = Path.Combine(TestFolder, "installer.xml");
            File.WriteAllText(scriptFile, complexScript);
            configuration.Tasks = new ConfigurationModel.TasksToExecuteSettings();
            configuration.FileLocation = installerFile;
            configuration.Save();
            // Prove that values started as false
            Assert.That(configuration.Tasks.BuildSelfExtractingDownloadPackage, Is.False, "Setup did not initiate values to false, test invalid");
            Assert.That(configuration.Tasks.Compile, Is.False, "Setup did not initiate values to false, test invalid");
            Assert.That(configuration.Tasks.GatherFiles, Is.False, "Setup did not initiate values to false, test invalid");
            Assert.That(configuration.Tasks.WriteDownloadsXml, Is.False, "Setup did not initiate values to false, test invalid");
            Assert.That(configuration.Tasks.WriteInstallerXml, Is.False, "Setup did not initiate values to false, test invalid");
            Assert.That(configuration.Tasks.RememberSettings, Is.False, "Setup did not initiate values to false, test invalid");
            // SUT
            JavaScriptConverter.ConvertJsToXml(scriptFile, installerFile);
            var serializer = new XmlSerializer(typeof (ConfigurationModel));
            using (var textReader = new StreamReader(installerFile))
            {
                var model = (ConfigurationModel) serializer.Deserialize(textReader);
                Assert.That(model.Tasks.OutputFolder, Is.EqualTo(outputPath));
                Assert.That(model.Tasks.BuildSelfExtractingDownloadPackage, Is.True);
                Assert.That(model.Tasks.Compile, Is.True);
                Assert.That(model.Tasks.GatherFiles, Is.True);
                Assert.That(model.Tasks.WriteDownloadsXml, Is.True);
                Assert.That(model.Tasks.WriteInstallerXml, Is.True);
                Assert.That(model.Tasks.RememberSettings, Is.True);
            }
        }
 private ConfigurationPropertyWithOptionsModelDefinition GetPropertyWithOption(ConfigurationModel def)
 {
     return((ConfigurationPropertyWithOptionsModelDefinition)def.ConfigurationProperties[nameof(PropertyWithOptionTestClass.OptionProperty)]);
 }
        public ActionResult Configure(ConfigurationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Configure());
            }

            //load settings for a chosen store scope
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var payPalStandardPaymentSettings = _settingService.LoadSetting <PayPalStandardPaymentSettings>(storeScope);

            //save settings
            payPalStandardPaymentSettings.UseSandbox                = model.UseSandbox;
            payPalStandardPaymentSettings.BusinessEmail             = model.BusinessEmail;
            payPalStandardPaymentSettings.PdtToken                  = model.PdtToken;
            payPalStandardPaymentSettings.PdtValidateOrderTotal     = model.PdtValidateOrderTotal;
            payPalStandardPaymentSettings.AdditionalFee             = model.AdditionalFee;
            payPalStandardPaymentSettings.AdditionalFeePercentage   = model.AdditionalFeePercentage;
            payPalStandardPaymentSettings.PassProductNamesAndTotals = model.PassProductNamesAndTotals;
            payPalStandardPaymentSettings.EnableIpn                 = model.EnableIpn;
            payPalStandardPaymentSettings.IpnUrl          = model.IpnUrl;
            payPalStandardPaymentSettings.AddressOverride = model.AddressOverride;
            payPalStandardPaymentSettings.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage = model.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage;

            /* We do not clear cache after each setting update.
             * This behavior can increase performance because cached settings will not be cleared
             * and loaded from database after each update */
            if (model.UseSandbox_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.UseSandbox, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.UseSandbox, storeScope);
            }

            if (model.BusinessEmail_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.BusinessEmail, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.BusinessEmail, storeScope);
            }

            if (model.PdtToken_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.PdtToken, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.PdtToken, storeScope);
            }

            if (model.PdtValidateOrderTotal_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.PdtValidateOrderTotal, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.PdtValidateOrderTotal, storeScope);
            }

            if (model.AdditionalFee_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.AdditionalFee, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.AdditionalFee, storeScope);
            }

            if (model.AdditionalFeePercentage_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.AdditionalFeePercentage, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.AdditionalFeePercentage, storeScope);
            }

            if (model.PassProductNamesAndTotals_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.PassProductNamesAndTotals, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.PassProductNamesAndTotals, storeScope);
            }

            if (model.EnableIpn_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.EnableIpn, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.EnableIpn, storeScope);
            }

            if (model.IpnUrl_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.IpnUrl, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.IpnUrl, storeScope);
            }

            if (model.AddressOverride_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.AddressOverride, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.AddressOverride, storeScope);
            }

            if (model.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage_OverrideForStore || String.IsNullOrEmpty(storeScope))
            {
                _settingService.SaveSetting(payPalStandardPaymentSettings, x => x.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage, storeScope, false);
            }
            else if (!String.IsNullOrEmpty(storeScope))
            {
                _settingService.DeleteSetting(payPalStandardPaymentSettings, x => x.ReturnFromPayPalWithoutPaymentRedirectsToOrderDetailsPage, storeScope);
            }

            //now clear settings cache
            _settingService.ClearCache();

            SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved"));

            return(Configure());
        }
 public void TestBadBitmapPathLogged()
 {
     var model = new ConfigurationModel { FileLocation = Path.GetTempFileName()};
     var testPath = "C:\\Test.bmp";
     model.General = new ConfigurationModel.GeneralOptions { ListBackground = new ConfigurationModel.ListBackgroundOptions { ImagePath = testPath}};
     var controller = new ConfigurationController(model);
     var testView = new ConfigViewForTests();
     testView.Compile = true;
     try
     {
         controller.ExecuteTasks(testView);
         // The warning message complains about legacy projects when the bitmap has any path separaters
         TestMessageLogged(testView, "legacy data");
         // The warning message should contain the image path
         TestMessageLogged(testView, testPath);
     }
     finally
     {
         try
         {
             File.Delete(model.FileLocation);
         }
         catch (Exception)
         {
             // We tried to delete it, but this test shouldn't fail if we couldn't
         }
     }
 }
Пример #59
0
        public ActionResult Configure(ConfigurationModel model)
        {
            if (!ModelState.IsValid)
                return Configure();

            //load settings for a chosen store scope
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var bridgePaySettings = _settingService.LoadSetting<ForteSettings>(storeScope);

            //save settings
            bridgePaySettings.UseSandbox = model.UseSandbox;
            bridgePaySettings.TransactMode = (TransactionMode)model.TransactModeId;
            bridgePaySettings.TransactionKey = model.TransactionKey;
            bridgePaySettings.Username = model.Username;
            bridgePaySettings.Password = model.Password;
            bridgePaySettings.MerchantKey = model.MerchantKey;
            bridgePaySettings.GatewayUrl = model.GatewayUrl;
            bridgePaySettings.AdditionalFee = model.AdditionalFee;
            bridgePaySettings.AdditionalFeePercentage = model.AdditionalFeePercentage;

            /* We do not clear cache after each setting update.
             * This behavior can increase performance because cached settings will not be cleared 
             * and loaded from database after each update */
            if (model.UseSandbox_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bridgePaySettings, x => x.UseSandbox, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bridgePaySettings, x => x.UseSandbox, storeScope);

            //if (model.TransactModeId_OverrideForStore || storeScope == 0)
            //    _settingService.SaveSetting(bridgePaySettings, x => x.TransactMode, storeScope, false);
            //else if (storeScope > 0)
            //    _settingService.DeleteSetting(bridgePaySettings, x => x.TransactMode, storeScope);

            if (model.TransactionKey_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bridgePaySettings, x => x.TransactionKey, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bridgePaySettings, x => x.TransactionKey, storeScope);

            if (model.Username_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bridgePaySettings, x => x.Username, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bridgePaySettings, x => x.Username, storeScope);

            if (model.Password_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bridgePaySettings, x => x.Password, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bridgePaySettings, x => x.Password, storeScope);

            if (model.MerchantKey_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bridgePaySettings, x => x.MerchantKey, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bridgePaySettings, x => x.MerchantKey, storeScope);

            if (model.GatewayUrl_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bridgePaySettings, x => x.GatewayUrl, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bridgePaySettings, x => x.GatewayUrl, storeScope);

            if (model.AdditionalFee_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bridgePaySettings, x => x.AdditionalFee, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bridgePaySettings, x => x.AdditionalFee, storeScope);

            if (model.AdditionalFeePercentage_OverrideForStore || storeScope == 0)
                _settingService.SaveSetting(bridgePaySettings, x => x.AdditionalFeePercentage, storeScope, false);
            else if (storeScope > 0)
                _settingService.DeleteSetting(bridgePaySettings, x => x.AdditionalFeePercentage, storeScope);

            //now clear settings cache
            _settingService.ClearCache();

            SuccessNotification(_localizationService.GetResource("Admin.Plugins.Saved"));

            return Configure();
        }
Пример #60
0
        public async Task SaveConfig()
        {
            var connected = CrossConnectivity.Current.IsConnected;

            if (connected)
            {
                // bool isNumeric = int.TryParse(MobileNumberplaceholderDisplay, out int n);

                if (_selectedLanguage.Culture != null && _selectedLanguage.Name != null && _countryDetails != null && _branchDetails != null && PhotoQualityButtons != null && !string.IsNullOrEmpty(MobileNumber))
                {
                    SetActivityIndicatorBlurred(true);
                    ActOpacity      = 1;
                    MainStackLayout = false;
                    PackingCygestPageLayoutOpacity = 0.4;
                    Status = "Saving data...";
                    _configurationModel = _dataAccess.GetAllConfigData();

                    var configurationModel = new ConfigurationModel
                    {
                        Id           = _countryDetails.Id,
                        Country      = _countryDetails.Name,
                        TelCode      = TelCode,
                        MobileNumber = MobileNumber,
                        Language     = _selectedLanguage.Name,
                        CultureInfo  = _selectedLanguage.Culture,
                        PhotoQuality = PhotoQualityButtons,
                        Branch       = _branchDetails.Name,
                        BranchCode   = _branchDetails.Code
                    };

                    if (_configurationModel.Count != 0)
                    {
                        configurationModel.Id = 1;
                        _dataAccess.UpdateConfigurationData(configurationModel);
                    }
                    else
                    {
                        _dataAccess.InsertConfig(configurationModel);
                    }
                    await GetGenericDetailsAsync();

                    await _pageService.DisplayAlert(LblSave, LblSaveSuccessfully, LblOk);

                    HandleTranslation(_selectedLanguage.Culture);

                    LowRed    = Localize.GetString("LowRed", _selectedLanguage.Culture);
                    MediumRed = Localize.GetString("MediumRed", _selectedLanguage.Culture);
                    HighRed   = Localize.GetString("HighRed", _selectedLanguage.Culture);
                    Low       = Localize.GetString("Low", _selectedLanguage.Culture);
                    Medium    = Localize.GetString("Medium", _selectedLanguage.Culture);
                    High      = Localize.GetString("High", _selectedLanguage.Culture);

                    if (InstanceVariablePhotoQuality.Equals("Low"))
                    {
                        LowClickImageSource    = ImageSource.FromFile(LowRed);
                        MediumClickImageSource = ImageSource.FromFile(Medium);
                        HighClickImageSource   = ImageSource.FromFile(High);

                        InstanceVariablePhotoQuality = "Low";
                    }
                    else if (InstanceVariablePhotoQuality.Equals("Medium"))
                    {
                        LowClickImageSource    = ImageSource.FromFile(Low);
                        MediumClickImageSource = ImageSource.FromFile(MediumRed);
                        HighClickImageSource   = ImageSource.FromFile(High);

                        InstanceVariablePhotoQuality = "Medium";
                    }
                    else if (InstanceVariablePhotoQuality.Equals("High"))
                    {
                        LowClickImageSource    = ImageSource.FromFile(Low);
                        MediumClickImageSource = ImageSource.FromFile(Medium);
                        HighClickImageSource   = ImageSource.FromFile(HighRed);

                        InstanceVariablePhotoQuality = "High";
                    }
                    else
                    {
                        LowClickImageSource    = ImageSource.FromFile(Low);
                        MediumClickImageSource = ImageSource.FromFile(Medium);
                        HighClickImageSource   = ImageSource.FromFile(High);
                    }

                    NewConfig = false;
                }
                else
                {
                    await _pageService.DisplayAlert(LblError, LblSaveError, LblOk);
                }
                SetActivityIndicatorBlurred(false);
                MainStackLayout = true;
                PackingCygestPageLayoutOpacity = 1;
            }
            else
            {
                await _pageService.DisplayAlert(LblNoNetwork, LblPleaseEnableYourNetwork, "ok");
            }
        }