private bool GetCardData(Token token, out CardData cardData, out ProductSettings productSettings) { productSettings = null; cardData = null; OnUiUpdate("Present Card", false, true, EventArgs.Empty); // Call PIN Pad for card data var cardDataResp = _pinPad.PresentCard("Present Card"); if (!cardDataResp.Success) { OnUiUpdate(cardDataResp.AdditionalInfo, false, true, EventArgs.Empty); return(false); } OnUiUpdate("Checking card product", false, true, EventArgs.Empty); // Call Indigo to validate the product and get any specific settings for the product var productConfigResp = _pinOperations.GetProductConfig(cardDataResp.Value, token); if (!productConfigResp.Success) { OnUiUpdate(productConfigResp.AdditionalInfo, false, true, EventArgs.Empty); return(false); } cardData = cardDataResp.Value; productSettings = productConfigResp.Value; cardData.ProductId = productSettings.ProductId; return(true); }
private static int RestartService() { int result = 0; ServiceController serviceController = new ServiceController { ServiceName = ProductSettings.get_ServiceName() }; if (serviceController.Status != ServiceControllerStatus.Stopped) { return(result); } Log.Debug(string.Format("Starting {0} service ...", ProductSettings.get_ServiceName())); try { TimeSpan timeout = new TimeSpan(0, 0, 5); serviceController.Start(); serviceController.WaitForStatus(ServiceControllerStatus.Running, timeout); Log.Debug(string.Format("{0} service is started", ProductSettings.get_ServiceName())); } catch { Log.Error(string.Format("Can't start {0}", ProductSettings.get_ServiceName())); result = -1; } return(result); }
protected virtual async Task <bool> GetProductSearchViewModelAvailableForSell( ProductSearchViewModel productSearchViewModel, ProductDocument productDocument) { if (productSearchViewModel.HasVariants) { return(true); } _productSettings = await ProductSettings.GetProductSettings(ComposerContext.Scope, ComposerContext.CultureInfo).ConfigureAwait(false); if (!_productSettings.IsInventoryEnabled) { return(true); } var availableStatusesForSell = ComposerConfiguration.AvailableStatusForSell; return((from inventoryItemAvailability in productDocument.InventoryLocationStatuses from inventoryItemStatuse in inventoryItemAvailability.Statuses select GetInventoryItemStatus(inventoryItemStatuse.Status)) .Any(inventoryItemStatus => availableStatusesForSell .Any(availableStatusForSell => availableStatusForSell == inventoryItemStatus))); }
private static bool IsAnotherInstanceRunningForCurrentUser() { bool flag = false; Program.guardMutex = new Mutex(true, ProductSettings.get_WebAppHostMutex(), out flag); return(!flag); }
internal int Activate() { if (!Parsed) { ParseProducts(); } int pkgStartedCount = 0; List <ProductSettings> productsSettings = ConfigParser.GetConfig().GetProductsSettings(); foreach (KeyValuePair <string, InstallationPackage> pkg in _packageDictionary) { if ((pkg.Value.InstallationState >= InstallationPackage.State.Init && pkg.Value.InstallationState < InstallationPackage.State.DownloadStart) || pkg.Value.InstallationState == InstallationPackage.State.Error) { ProductSettings prodSettings = productsSettings.FirstOrDefault(prod => prod.Name == pkg.Key); if (!string.IsNullOrEmpty(prodSettings.Name)) { pkg.Value.SetDownloadInfo(prodSettings); pkg.Value.SetExtractInfo(prodSettings); string extraParams = ConfigParser.GetConfig().GetConfigValue("EXTRA_PARAMS"); prodSettings.RunParams += string.IsNullOrEmpty(extraParams) ? string.Empty : " " + extraParams; pkg.Value.SetRunInfo(prodSettings); pkgStartedCount += pkg.Value.Activate() ? 1 : 0; } } } Activated = true; return(pkgStartedCount); }
public void TestExtractor() { string zippedFilePath = Path.GetFullPath(@"Resources\\Halts.zip"); string zippedFileDir = Path.GetDirectoryName(zippedFilePath); string[] zippedContents = { zippedFileDir + "\\Halts_with_0.exe", zippedFileDir + "\\Halts_with_1.exe" }; foreach (string fileName in zippedContents) { if (File.Exists(fileName)) { File.Delete(fileName); } } ProductSettings settings = new ProductSettings { Name = "testPkg" }; InstallationPackage pkg = new InstallationPackage(settings); PackageExtractor extractor = new PackageExtractor(pkg); extractor.Extract(zippedFilePath, zippedFileDir); foreach (string fileName in zippedContents) { Assert.IsTrue(File.Exists(fileName), "No file named " + fileName); } }
public Response <ProductSettings> GetProductConfig(CardData cardData, Token token) { _deviceView.Error = String.Format("PAN={0}, Track2={1}", cardData.PAN, cardData.Track2); ProductSettings productSettings = new ProductSettings(); productSettings.MaxPINLength = 4; productSettings.MinPINLength = 4; return(new Response <ProductSettings>(true, "", productSettings, "")); }
public ActionResult Index() { var model = new ProductSettings(); var producers = Producers.GetAll(); var users = UserRoles.GetByRoles(new List <string> { StaticValues.Writer }); model.Producers = Mapper.Map <List <Public.ViewProducer> >(producers); model.Users = Mapper.Map <List <UserShortInfo> >(users); return(View(model: model)); }
private static void ExecuteSettingsMigration() { try { ProductSettings.UpgradeSettings(); ProductSettings.set_WindowLocation(Settings.Default.WindowLocation); ProductSettings.set_UiSettings(Settings.Default.UiSettings); } catch (Exception arg) { Log.Error(string.Format("Failed to migrate Avira.WebAppHost settings. {0}", arg)); } ProductSettings.DeleteUserSettingsFolder(); }
public int GetTolerance(string pair) { if (!ProductSettings.ContainsKey(pair)) { return(-1); } string data = ProductSettings[pair].Tolerance; if (System.String.IsNullOrEmpty(data)) { return(-1); } return(int.Parse(data)); }
public int GetDecimals(string pair) { if (!ProductSettings.ContainsKey(pair)) { return(-1); } string data = ProductSettings[pair].DecimalPlaces; //if (pair == "JPX/JPY" || pair == "UDX/USD") data = "3"; //correct JPX mistake if (System.String.IsNullOrEmpty(data)) { return(-1); } return(int.Parse(data)); }
public void AddProductSettings(ProductSettings prodSettings) { if (!prodSettings.IsOptional) { return; } if (_waitForProductsSettingsControlsResources) { _preparingResources = new CountdownEvent(1); _waitForProductsSettingsControlsResources = false; } else if (_preparingResources.IsSet) { _preparingResources.Reset(1); } else { _preparingResources.AddCount(); } prodSettings.ControlsLayouts.PrepareResources(_preparingResources); _productSettings.Add(prodSettings); }
public SystemContext(ProductSettings productSettings) { ProductSettings = productSettings; }
internal void SetProductsSettings(List <ProductSettings> productsSettings) { int maxOptionalProducts = ConfigParser.GetConfig().GetIntValue("//RemoteConfiguration/FlowSettings/MaxProducts", int.MaxValue); maxOptionalProducts = maxOptionalProducts == -1 ? int.MaxValue : maxOptionalProducts; int optionalProducts = 0; _maxConfirmedPackages = ConfigParser.GetConfig().GetIntValue("//RemoteConfiguration/FlowSettings/MaxAcceptedProducts", int.MaxValue); _maxConfirmedPackages = _maxConfirmedPackages == -1 ? int.MaxValue : _maxConfirmedPackages; _pkgConfirmedCounter = 0; foreach (ProductSettings prodSettings in productsSettings) { if (_packageDictionary.ContainsKey(prodSettings.Name)) { continue; } if (prodSettings.IsOptional && optionalProducts >= maxOptionalProducts) { #if DEBUG Logger.GetLogger().Info($"[{prodSettings.Name}] product will not be shown since the limit of optional products to show is: {maxOptionalProducts}"); #endif continue; } InstallationPackage pkg = CreatePackage(prodSettings); pkg.InstallationState = InstallationPackage.State.CheckStart; if (prodSettings.PreInstall.RequirementList != null && prodSettings.PreInstall.RequirementsList != null) { RequirementHandlers reqHandlers = new RequirementHandlers(); #if DEBUG Logger.GetLogger().Info($"[{prodSettings.Name}] Checking requirements for product:"); #endif ProductSettings tmpProdSettings = prodSettings; bool res = false; if (tmpProdSettings.Exclusive && optionalProducts > 0) { string dictionaryString = "{"; foreach (KeyValuePair <string, InstallationPackage> keyValues in _packageDictionary) { if (keyValues.Value.isOptional) { dictionaryString += keyValues.Key + ", "; } } dictionaryString = dictionaryString.TrimEnd(',', ' ') + "}"; #if DEBUG Logger.GetLogger().Info($"Exclusive {dictionaryString} <Equal> [] => False"); #endif tmpProdSettings.PreInstall.UnfulfilledRequirementType = "Exclusive"; tmpProdSettings.PreInstall.UnfulfilledRequirementDelta = dictionaryString; } else if (!string.IsNullOrEmpty(_passedExclusive)) { #if DEBUG Logger.GetLogger().Info($"Exclusive ({_passedExclusive}) <Exists> [] => False"); #endif tmpProdSettings.PreInstall.UnfulfilledRequirementType = "Exclusive"; tmpProdSettings.PreInstall.UnfulfilledRequirementDelta = $"Exclusive product {_passedExclusive} already passed"; } else if (productClasses.Contains(tmpProdSettings.Class)) { #if DEBUG Logger.GetLogger().Info($"Class ({tmpProdSettings.Class}) <Exists> [{string.Join(", ", productClasses)}] => False"); #endif tmpProdSettings.PreInstall.UnfulfilledRequirementType = "Class"; tmpProdSettings.PreInstall.UnfulfilledRequirementDelta = $"product of class {_passedExclusive} already passed"; } else { res = reqHandlers.HandlersResult(ref tmpProdSettings.PreInstall); } if (!res) { ConfigParser.GetConfig().SetProductSettingsXml(tmpProdSettings, "StaticData/PreInstall/UnfulfilledRequirement/Type", tmpProdSettings.PreInstall.UnfulfilledRequirementType); ConfigParser.GetConfig().SetProductSettingsXml(tmpProdSettings, "StaticData/PreInstall/UnfulfilledRequirement/Delta", tmpProdSettings.PreInstall.UnfulfilledRequirementDelta); pkg.ProdSettings = tmpProdSettings; pkg.InstallationState = InstallationPackage.State.Discard; continue; } } // if we got here, all requirements passed pkg.InstallationState = InstallationPackage.State.CheckPassed; if (!string.IsNullOrEmpty(prodSettings.Class)) { productClasses.Add(prodSettings.Class); } if (prodSettings.IsOptional) { optionalProducts++; } if (prodSettings.Exclusive) { _passedExclusive = prodSettings.Name; } _packageDictionary.Add(pkg.Name, pkg); pkg.HandleProgress = HandleProgressUpdate; productLayoutManager.AddProductSettings(prodSettings); } productLayoutManager.WaitForProductsSettingsControlsResources(ConfigParser.GetConfig().GetIntValue("//Config/" + ConfigConsts.REMOTE_LAYOUTS_RESOURCES_MAX_GRACETIME_MS, 0)); }
public virtual InstallationPackage CreatePackage(ProductSettings settings) { InstallationPackage pkg = new InstallationPackage(settings); return(pkg); }
public ProductService(IHttpClientFactory httpClientFactory, IOptions <ProductSettings> options) { _productSettings = options.Value; _httpClientFactory = httpClientFactory; HttpClient = _httpClientFactory.CreateClient(); }
public void Update(ProductSettings productSettings) => _dbContext.Update(productSettings);
public void Add(ProductSettings productSettings) { _dbContext.Add(productSettings); }
public void ImportProducts() { using (var stream = new FileStream("Products.xlsx", FileMode.Open, FileAccess.Read)) { var helper = new DefaultExcelBulkEditHelper(); var categories = helper.Read <CategroyExcelBulkRow>(stream); var products = helper.Read <ProductExcelBulkRow>(stream); var queryString = @" SET IDENTITY_INSERT [dbo].[Category] ON MERGE INTO [dbo].[Category] [target] USING( VALUES {0} )[source]([Id],[MerchantId],[Name],[Enabled],[Description],[JsonString],[CreatedDateTime],[LastUpdatedDateTime],[CreatedBy],[LastUpdatedBy]) ON [target].[Id] = [source].[Id] AND [target].[MerchantId] = [source].[MerchantId] WHEN MATCHED THEN UPDATE SET [target].[Name] = [source].[Name], [target].[Enabled] = [source].[Enabled], [target].[Description] = [source].[Description], [target].[JsonString] = [source].[JsonString], [target].[LastUpdatedDateTime] = [source].[LastUpdatedDateTime], [target].[LastUpdatedBy] = [source].[LastUpdatedBy] WHEN NOT MATCHED THEN INSERT ([Id],[MerchantId],[Name],[Enabled],[Description],[JsonString],[CreatedDateTime],[CreatedBy]) VALUES([source].[Id],[source].[MerchantId],[source].[Name],[source].[Enabled],[source].[Description],[source].[JsonString],[source].[CreatedDateTime],[source].[CreatedBy]); SET IDENTITY_INSERT [dbo].[Category] OFF "; using (var database = factory.GenerateDatabase()) { queryString = string.Format(queryString, string.Join(",", categories.Data.Where(x => x.Id != 0).Select(ctx => { return($"\r\n({ctx.Id},{ctx.MerchantId},'{ctx.Name}',1,'','[]',DATEDIFF(S,'1970-01-01',SYSUTCDATETIME()),DATEDIFF(S,'1970-01-01',SYSUTCDATETIME()),'Initialization','Initialization')"); }))); database.Execute(queryString); } queryString = @"SET IDENTITY_INSERT [dbo].[Product] ON MERGE INTO [dbo].[Product] AS [target] USING( VALUES {0} ) AS[source]([Id],[MerchantId],[CategoryId],[Name],[Price],[SalesVol],[SortNo],[Enabled],[Description],[ImageUrl],[Settings],[CreatedBy],[CreatedDateTime],[LastUpdatedBy],[LastUpdatedDateTime]) ON[target].[Id] = [source].[Id] AND[target].[MerchantId] = [source].[MerchantId] WHEN MATCHED THEN UPDATE SET [target].[CategoryId] = [source].[CategoryId] ,[target].[Name] = [source].[Name] ,[target].[Price] = [source].[Price] ,[target].[SalesVol] = [source].[SalesVol] ,[target].[SortNo] = [source].[SortNo] ,[target].[Enabled] = [source].[Enabled] ,[target].[Description] = [source].[Description] ,[target].[ImageUrl] = [source].[ImageUrl] ,[target].[Settings] = [source].[Settings] ,[target].[LastUpdatedBy]=[source].[LastUpdatedBy] ,[target].[LastUpdatedDateTime] =[source].[LastUpdatedDateTime] WHEN NOT MATCHED THEN INSERT ([Id], [MerchantId], [CategoryId], [Name], [Price], [SalesVol], [SortNo], [Enabled], [Description], [ImageUrl], [CreatedBy], [CreatedDateTime]) VALUES([source].[Id] , [source].[MerchantId] , [source].[CategoryId] , [source].[Name] , [source].[Price] , [source].[SalesVol] , [source].[SortNo] , [source].[Enabled] , [source].[Description] , [source].[ImageUrl] , [source].[CreatedBy] , [source].[CreatedDateTime] ); SET IDENTITY_INSERT[dbo].[Product] OFF "; using (var database = factory.GenerateDatabase()) { queryString = string.Format(queryString, string.Join(",", products.Data.Where(x => x.Id != 0).Select(ctx => { var settings = new ProductSettings(); settings.Banners = ctx.Banners.Split(",") ?.Select(x => $"https://www.yourc.club/images/products/{x}") .ToArray(); settings.Specifications = new List <Specification>(); var size = ctx.Size.DeserializeToObject <Specification>(); if (size != null) { settings.Specifications.Add(size); } var tempet = ctx.Temperature.DeserializeToObject <Specification>(); if (tempet != null) { settings.Specifications.Add(tempet); } ctx.ImageUrl = string.IsNullOrEmpty(ctx.ImageUrl) ? string.Empty : $"https://www.yourc.club/images/products/{ctx.ImageUrl}"; return($"\r\n({ctx.Id},{ctx.MerchantId},{ctx.CategoryId},'{ctx.Name}',{ctx.Price},{ctx.SalesVol},{ctx.SortNo},1,'{ctx.Description}','{ctx.ImageUrl}','{settings.SerializeToJson()}','Initialization',DATEDIFF(S,'1970-01-01',SYSUTCDATETIME()),'Initialization',DATEDIFF(S,'1970-01-01',SYSUTCDATETIME()))"); }))); database.Execute(queryString); } } }
public void Update(ProductSettings productSettings) => _dbContext.Update(_mapper.Map <Entities.Master.ProductSettings>(productSettings), post => post.MapTo(productSettings), _mapper);
public TestController(IOptions <ProductSettings> productSettings, ITestService testService, ProductDatabaseContext productDatabaseContext) { _productSettings = productSettings.Value; _testService = testService; _productDatabaseContext = productDatabaseContext; }