private void FormSettings_FormClosing(object sender, FormClosingEventArgs e) { using (CustomSettings settings = new CustomSettings()) { settings.SaveWindowPlacement(this); } }
public OutstandingInvoiceService(IUnitOfWorkFactory unitOfWorkFactory, IXmlHelper XmlHelper, IUrlHelper urlHelper) : base(unitOfWorkFactory) { this.unitOfWork = unitOfWorkFactory; customSettings = new CustomSettings(); this.xmlHelper = XmlHelper; this.UrlHelper = urlHelper; }
protected void SendOrderCancellationEmail(IUnitOfWork unitOfWork, CustomerOrder cart) { dynamic expandoObjects = new ExpandoObject(); this.PopulateOrderEmailModel(expandoObjects, cart, unitOfWork); EmailList orCreateByName = unitOfWork.GetTypedRepository <IEmailListRepository>().GetOrCreateByName("OrderCancellation", "Order Cancellation"); List <string> list = BuildEmailValues(cart.Id, unitOfWork).Split(new char[] { ',' }).ToList <string>(); EmailList emailList = unitOfWork.GetRepository <EmailList>().GetTable().Expand((EmailList x) => x.EmailTemplate).FirstOrDefault((EmailList x) => x.Id == orCreateByName.Id); if (emailList != null) { SendEmailParameter sendEmailParameter = new SendEmailParameter(); CustomSettings customSettings = new CustomSettings(); string htmlTemplate = GetHtmlTemplate(emailList); sendEmailParameter.Body = this.EmailService.Value.ParseTemplate(htmlTemplate, expandoObjects); string defaultEmailAddress = customSettings.DefaultEmailAddress; string approverEmail = SiteContext.Current.IsUserInRole("Administrator") ? SiteContext.Current.UserProfileDto.Email : !string.IsNullOrEmpty(cart.ApproverUserProfile.Email) ? cart.ApproverUserProfile.Email : defaultEmailAddress;// BUSA-625 : To Add Reject Button to order Approve page. If Admin rejects the order, then Admin email's address should be in From address. sendEmailParameter.Subject = emailList.Subject; sendEmailParameter.ToAddresses = list; sendEmailParameter.FromAddress = approverEmail; sendEmailParameter.ReplyToAddresses = new List <string>(); sendEmailParameter.ExtendedProperties = new NameValueCollection(); this.EmailService.Value.SendEmail(sendEmailParameter, unitOfWork); } }
public CustomSettings UpdateExchanges(SettingsViewModel settings) { try { var newSettings = new CustomSettings(); var model = _requests.GetAssets(settings.LastExchange); _fileManager.WriteAssetsToExcel(_directoryManager.AsstesUpdateLocation, model); newSettings.Btc = model.Btc; newSettings.Exchange = model.ExchangeName; newSettings.LowerBorder = settings.LowerBorder; newSettings.UpperBorder = settings.UpperBorder; newSettings.UpperWidth = settings.UpperWidth; newSettings.LowerWidth = settings.LowerWidth; var json = _fileManager.ConvertCustomSettings(newSettings); _directoryManager.UpdateCustomSettings(json); return(newSettings); } catch (Exception e) { throw new Exception(e.Message); } }
public override UpdateCartResult Execute(IUnitOfWork unitOfWork, UpdateCartParameter parameter, UpdateCartResult result) { if (result.GetCartResult.IsAuthenticated) { int productCount = 0; int maxSampleQtyofProduct = 0; decimal?thisProductByCustomer = 0; CustomSettings customSettings = new CustomSettings(); foreach (var orderLine in result.GetCartResult.Cart.OrderLines) { var isSampleProduct = unitOfWork.GetRepository <CustomProperty>().GetTable().Where(x => x.ParentId == orderLine.ProductId && x.Name == "isSampleProduct" && x.Value.ToUpper() == "TRUE").Count(); if (isSampleProduct > 0) { string maxSampleQty = unitOfWork.GetRepository <CustomProperty>().GetTable().Where(x => x.ParentId == orderLine.ProductId && x.Name == "maxSampleQty").Select(x => x.Value).FirstOrDefault() ?? "0"; maxSampleQtyofProduct = Convert.ToInt32(maxSampleQty); if (maxSampleQtyofProduct > 0) { if (orderLine.QtyOrdered > maxSampleQtyofProduct) { return(this.CreateErrorServiceResult <UpdateCartResult>(result, SubCode.CartServiceProductCantBeAddedToCart, string.Format(MessageProvider_Brasseler.CurrentBrasseler.ProductShipTo_LevelValidation, maxSampleQtyofProduct, orderLine.Product.ErpNumber))); } thisProductByCustomer = Convert.ToInt32(unitOfWork.GetRepository <SampleProductTracking>().GetTable().Where(sp => sp.CustomerId == result.GetCartResult.GetShipToResult.ShipTo.Id && (sp.ProductId == orderLine.ProductId)).Select(s => (decimal?)s.QtyOrdered).Sum() ?? 0); if (Convert.ToInt32(thisProductByCustomer + orderLine.QtyOrdered) > maxSampleQtyofProduct) { return(this.CreateErrorServiceResult <UpdateCartResult>(result, SubCode.CartServiceProductCantBeAddedToCart, string.Format(MessageProvider_Brasseler.CurrentBrasseler.ProductShipTo_LevelValidation, maxSampleQtyofProduct, orderLine.Product.ErpNumber))); } } productCount = productCount + Convert.ToInt32(orderLine.QtyOrdered); if (productCount > customSettings.MaxSamplePerOrder) { return(this.CreateErrorServiceResult <UpdateCartResult>(result, SubCode.CartServiceProductCantBeAddedToCart, string.Format(MessageProvider_Brasseler.CurrentBrasseler.Sample_OrderLevelValidation, customSettings.MaxSamplePerOrder.ToString()))); } else { decimal?totalSamplesByCustomer = Decimal.Zero; var firstSampleproductByCustomer = unitOfWork.GetRepository <SampleProductTracking>().GetTable().Where(sp => sp.CustomerId == result.GetCartResult.GetShipToResult.ShipTo.Id).OrderByDescending(t => t.CreatedOn).FirstOrDefault(); if (firstSampleproductByCustomer != null && DateTimeOffset.Now.Date <= firstSampleproductByCustomer.TenureEnd) { totalSamplesByCustomer = unitOfWork.GetRepository <SampleProductTracking>().GetTable().Where(sp => sp.CustomerId == result.GetCartResult.GetShipToResult.ShipTo.Id && (sp.CreatedOn >= firstSampleproductByCustomer.TenureStart && sp.CreatedOn <= firstSampleproductByCustomer.TenureEnd)).Select(s => (decimal?)s.QtyOrdered).Sum(); } if (totalSamplesByCustomer != null) { if ((productCount + Convert.ToInt32(totalSamplesByCustomer) > customSettings.MaxSampleOrderInGivenTimeFrame)) { return(this.CreateErrorServiceResult <UpdateCartResult>(result, SubCode.CartServiceProductCantBeAddedToCart, string.Format(MessageProvider_Brasseler.CurrentBrasseler.Sample_TenureLevelValidation, customSettings.MaxSampleOrderInGivenTimeFrame, customSettings.MaxTimeToLimitUserForSampleOrder, totalSamplesByCustomer))); } } } } } } return(this.NextHandler.Execute(unitOfWork, parameter, result)); }
public void RegisterCustomSettings() { bool ScanningFloats = false; int index = 0; foreach (string key in customSettingKeys) { if (customSettingStringValues != null && customSettingStringValues.Count > index && CustomSettings.LookupStringSetting(key) == null) { Log.Warning("Registering custom setting from " + LabelCap + " " + key + " " + customSettingStringValues[index]); CustomSettings.SetStringSetting(key, customSettingStringValues[index]); index++; continue; } else { index = 0; ScanningFloats = true; } if (ScanningFloats && customSettingFloatValues != null && customSettingFloatValues.Count > index && CustomSettings.LookupFloatSetting(key) <= 0) { Log.Warning("Registering custom setting from " + LabelCap + " " + key + " " + customSettingFloatValues[index]); CustomSettings.SetFloatSetting(key, customSettingFloatValues[index]); index++; continue; } } }
public SyndicationController(ApiHttpClient apiClient, CustomSettings settings, LoadJobsService jobsService, UrlBuilderService urlBuilder, ReferrerService referrerService) : base(apiClient, settings) { _referrerService = referrerService; _urlBuilder = urlBuilder; _jobsService = jobsService; }
public void Setup() { ICustomSettings customSettings = new CustomSettings(); IUrlDefinitions urlDefinitions = new UrlDefinitions(customSettings); uut = new AddressLaundering(urlDefinitions); }
protected virtual void OnEnable() { CustomSettings <TData> settings = OnGetSettings(); Drawer = new CustomSettingsDrawer <TData>(settings); Drawer.Enable(); }
public void SerializeandSave(string fileName, CustomSettings records) { if (records == null) { return; } var serializer = new XmlSerializer(records.GetType()); if (Path.GetDirectoryName(fileName) == null || !Directory.Exists(Path.GetDirectoryName(fileName))) { Directory.CreateDirectory(Path.GetDirectoryName(fileName)); } if (File.Exists(fileName)) { File.Delete(fileName); } var stream = new StreamWriter(fileName); serializer.Serialize(stream, records); stream.Close(); stream.Dispose(); }
public ProductsController( IProductRepo productRepo, IOptionsSnapshot <CustomSettings> settings) { _settings = settings.Value; _productRepo = productRepo; }
public AccountController(ApiHttpClient apiClient, CustomSettings settings, LoadJobsService jobsService, UpdateApplicantService updateApplicantService, UpdateApplicantFileService updateApplicantFileService) : base(apiClient, settings) { _updateApplicantFileService = updateApplicantFileService; _updateApplicantService = updateApplicantService; _jobsService = jobsService; }
private string CustomSettingsContent() { var path = Path.Combine(_env, _customSettings); try { if (!File.Exists(path)) { var myFile = File.Create(path); myFile.Close(); var defaultSettings = new CustomSettings(); var defaultJson = _fileManager.ConvertCustomSettings(defaultSettings); File.WriteAllText(path, defaultJson); } string json; using (var content = new StreamReader(path)) { json = content.ReadToEnd(); } return(json); } catch (Exception e) { throw new Exception(e.Message); } }
private void FormSettings_Load(object sender, EventArgs e) { using (CustomSettings settings = new CustomSettings()) { settings.RestoreWindowPlacement(this); } }
public async Task <IActionResult> SaveCustomSettings([FromBody] CustomSettings settings) { EnsureArg.IsNotNull(settings, nameof(settings)); await settingsService.SaveCustomSettings(settings); return(new OkResult()); }
private void DataToControls(CustomSettings config = null) { if (config != null) //only done once { foreach (DSMHost h in config.DSMHosts.Items) { comboBox1.Items.Add(h.Host); } dataGridView1.DataSource = config.List; } if (!string.IsNullOrEmpty(Default.AutoRefreshServer)) { if (_config.DSMHosts.Items.ContainsKey(Default.AutoRefreshServer)) { checkBox1.CheckState = CheckState.Checked; comboBox1.Enabled = true; comboBox1.SelectedIndex = -1; comboBox1.Text = Default.AutoRefreshServer; } } else { checkBox1.CheckState = CheckState.Unchecked; comboBox1.Enabled = false; comboBox1.SelectedIndex = -1; } if (!string.IsNullOrEmpty(Default.CacheFolder)) { chkCacheFolder.CheckState = CheckState.Checked; txtFolder.Text = Default.CacheFolder; } else { chkCacheFolder.CheckState = CheckState.Unchecked; txtFolder.Text = Path.Combine(GetFolderPath(SpecialFolder.MyDocuments), Application.ProductName); } optAnalyzerDbKeep.Checked = Default.KeepAnalyzerDb; optAnalyzerDbRemove.Checked = !Default.KeepAnalyzerDb; txtKeep.Text = Default.KeepAnalyzerDbCount.ToString(); txtDPAPI.Text = Default.DPAPIVector; txtDiffExeArgs.Text = Default.DiffArgs; txtDiffTool.Text = Default.DiffExe; cmbMaxCompare.Text = Default.MaximumComparable.ToString(); optLoginAsRoot.Checked = true; optSudo.Checked = Default.RmExecutionMode == ConsoleCommandMode.Sudo; optInteractiveSudo.Checked = Default.RmExecutionMode == ConsoleCommandMode.InteractiveSudo; txtProxyHost.Text = _proxy.Host; txtProxyPort.Text = _proxy.Port.ToString(); txtProxyUser.Text = _proxy.UserName; cmbProxy.Text = _proxy.ProxyType; ProxyControls(Default.UseProxy); }
private void SynoReportClient_Load(object sender, EventArgs e) { try { FileInfo source = null; string entropy = "Is a gift a gift without wrapping?"; if (!string.IsNullOrEmpty(Default.DPAPIVector) && !string.IsNullOrWhiteSpace(Default.DPAPIVector)) { try { source = new FileInfo(Default.DPAPIVector); } catch (ArgumentException) { //don't care if it's not a filename } if (source != null && source.Exists) { using (var sr = new StreamReader(source.FullName)) { entropy = sr.ReadToEnd(); } } else { entropy = Default.DPAPIVector; } } WrappedPassword <DSMAuthentication> .SetEntropy(entropy); WrappedPassword <DSMAuthenticationKeyFile> .SetEntropy(entropy); WrappedPassword <DefaultProxy> .SetEntropy(entropy); CustomSettings.Initialize(GetSection <CustomSettings>); PopulateServerTree(); volumeHistoricChart1.Configuration = Profile; chartGrid1.Configuration = Profile; duplicateCandidatesView1.MaximumComparable = Default.MaximumComparable; if (string.IsNullOrEmpty(Default.AutoRefreshServer) == false) { string tag = Default.AutoRefreshServer; if (Profile.DSMHosts.Items.ContainsKey(tag)) { Task.Factory.StartNew(() => SynoReportClient_CacheUpdate(tag)); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public OutstandingInvoicesV1Controller(IXmlHelper XmlHelper, ICookieManager cookieManager, IUnitOfWorkFactory unitOfWorkFactory, OutstandingInvoiceService OutstandingInvoiceService) : base(cookieManager) { this.unitOfWork = unitOfWorkFactory.GetUnitOfWork(); this.xmlHelper = XmlHelper; this.OutstandingInvoiceService = OutstandingInvoiceService; customSettings = new CustomSettings(); }
public UdpClient() { _settings = _settingsLoader.ReadXml(); _datagramCollector = new DatagramCollector(); _datagramReceiver = new DatagramReceiver(_settings, _datagramCollector); Console.WriteLine("-----------------------------"); Console.WriteLine($" IP {_settings.IPAddress}, Port {_settings.Port} "); }
public UserHS(IOptions <CustomSettings> customSettingsOption, ILogger <UserHS> logger, IUserService userService) { _customSettings = customSettingsOption.Value; _logger = logger; _userService = userService; }
public void Setup() { ICustomSettings customSettings = new CustomSettings(); IUrlDefinitions urlDefinitions = new UrlDefinitions(customSettings); IAddressLaunderer addressLaunderer = new AddressLaundering(urlDefinitions); uut = new AddressCoordinates(addressLaunderer, urlDefinitions); }
/// <summary> /// Saves the custom settings. /// </summary> /// <param name="settings">The settings.</param> /// <returns></returns> public async Task SaveCustomSettings(CustomSettings settings) { EnsureArg.IsNotNull(settings, nameof(settings)); var file = await GetSettings(); file.CustomSettings = settings; await settingsSource.Save(file); }
internal Preferences(CustomSettings config) { InitializeComponent(); _config = config; DataToControls(_config); }
public ProductsController( ILogger <ProductsController> logger, IProductRepo productRepo, IOptionsMonitor <CustomSettings> settings) { _settings = settings.CurrentValue; _logger = logger; _productRepo = productRepo; }
public void Sync() { if (!_settings.SyncWithHra) { _logger.Info("Syncing with HRA is off "); return; } var reportGenerationConfigurationFilePath = _settings.MedicareSyncCustomSettingsPath + "EventTestSync.xml"; var customSettings = _customSettingXmlSerializer.Deserialize(reportGenerationConfigurationFilePath); if (customSettings == null || !customSettings.LastTransactionDate.HasValue) { customSettings = new CustomSettings { LastTransactionDate = DateTime.Today }; } var fromTime = customSettings.LastTransactionDate ?? DateTime.Today; //get all tags for IsHealthPlan is true var orgName = _settings.OrganizationNameForHraQuestioner; var tags = _corporateAccountRepository.GetHealthPlanTags(); if (tags != null && tags.Any()) { foreach (var tag in tags) { _logger.Info("Medicare Event Test Sync for tag : " + tag); // get todays Events For the Tag var eventIds = _eventRepository.GetEventsByTag(fromTime, tag); if (eventIds.Any()) { _logger.Info("Medicare Event Count : " + eventIds.Count + " " + String.Join(",", eventIds)); var pairs = _eventTestRepository.GetTestAliasesByEventIds(eventIds).ToList(); var model = new MedicareEventTestSyncModel { Tag = tag, EventTestAliases = pairs, OrganizationName = orgName, TimeToken = DateTime.UtcNow.ToLongTimeString().Encrypt() }; try { var result = _medicareApiService.PostAnonymous <bool>(_settings.MedicareApiUrl + MedicareApiUrl.SyncEventTest, model); if (!result) { _logger.Info("Medicare Event Test Sync FAILED for tag : " + tag); } } catch (Exception exception) { _logger.Error(" error occur Medicare Event Test Sync for tag: " + tag + " Message: " + exception.Message + "\n stack Trace: " + exception.StackTrace); } } } } customSettings.LastTransactionDate = DateTime.Today; _customSettingXmlSerializer.SerializeandSave(reportGenerationConfigurationFilePath, customSettings); }
public void InvalidGEDCOMFormats() { CustomSettings test = new CustomSettings(); test.ClearNonGEDCOMDateSettings(); FactDate target; // invalid GEDCOM format dates test.SetNonGEDCOMDateSettings(NonGEDCOMFormatSelected.DD_MM_YYYY, "dd/mm/yyyy", "/"); target = new FactDate("5/6/2018"); Assert.AreEqual(new DateTime(2018, 6, 5), target.StartDate); Assert.AreEqual(new DateTime(2018, 6, 5), target.EndDate); target = new FactDate("BET 5/6/2018 AND 7/6/2018"); Assert.AreEqual(new DateTime(2018, 6, 5), target.StartDate); Assert.AreEqual(new DateTime(2018, 6, 7), target.EndDate); test.SetNonGEDCOMDateSettings(NonGEDCOMFormatSelected.MM_DD_YYYY, "mm/dd/yyyy", "/"); target = new FactDate("5/6/2018"); Assert.AreEqual(new DateTime(2018, 5, 6), target.StartDate); Assert.AreEqual(new DateTime(2018, 5, 6), target.EndDate); test.SetNonGEDCOMDateSettings(NonGEDCOMFormatSelected.DD_MM_YYYY, "dd/mm/yyyy", "."); target = new FactDate("5.6.2018"); Assert.AreEqual(new DateTime(2018, 6, 5), target.StartDate); Assert.AreEqual(new DateTime(2018, 6, 5), target.EndDate); test.SetNonGEDCOMDateSettings(NonGEDCOMFormatSelected.MM_DD_YYYY, "mm/dd/yyyy", "."); target = new FactDate("5.6.2018"); Assert.AreEqual(new DateTime(2018, 5, 6), target.StartDate); Assert.AreEqual(new DateTime(2018, 5, 6), target.EndDate); test.SetNonGEDCOMDateSettings(NonGEDCOMFormatSelected.DD_MM_YYYY, "dd/mm/yyyy", "-"); target = new FactDate("5-6-2018"); Assert.AreEqual(new DateTime(2018, 6, 5), target.StartDate); Assert.AreEqual(new DateTime(2018, 6, 5), target.EndDate); test.SetNonGEDCOMDateSettings(NonGEDCOMFormatSelected.MM_DD_YYYY, "mm/dd/yyyy", "-"); target = new FactDate("5-6-2018"); Assert.AreEqual(new DateTime(2018, 5, 6), target.StartDate); Assert.AreEqual(new DateTime(2018, 5, 6), target.EndDate); test.SetNonGEDCOMDateSettings(NonGEDCOMFormatSelected.DD_MM_YYYY, "dd/mm/yyyy", " "); target = new FactDate("5 6 2018"); Assert.AreEqual(new DateTime(2018, 6, 5), target.StartDate); Assert.AreEqual(new DateTime(2018, 6, 5), target.EndDate); test.SetNonGEDCOMDateSettings(NonGEDCOMFormatSelected.MM_DD_YYYY, "mm/dd/yyyy", " "); target = new FactDate("5 6 2018"); Assert.AreEqual(new DateTime(2018, 5, 6), target.StartDate); Assert.AreEqual(new DateTime(2018, 5, 6), target.EndDate); test.SetNonGEDCOMDateSettings(NonGEDCOMFormatSelected.DD_MM_YYYY, "dd/mm/yyyy", "/"); target = new FactDate("AFT 4/6/2018"); Assert.AreEqual(new DateTime(2018, 6, 5), target.StartDate); Assert.AreEqual(MAXDATE, target.EndDate); }
public ProductsController( IProductRepo productRepo, IOptionsSnapshot <CustomSettings> settings, ILogger <ProductsController> logger) { _settings = settings.Value; _productRepo = productRepo; Logger = logger; }
public PaymentService_Brasseler(IUnitOfWorkFactory unitOfWorkFactory, IPaymentGatewayFactory paymentGatewayFactory, ICustomerService customerService, IUserProfileUtilities userProfileUtilities, PaymentSettings paymentSettings, ICartOrderProviderFactory cartOrderProviderFactory, CustomSettings customSettings) : base(unitOfWorkFactory) { this.paymentGatewayFactory = paymentGatewayFactory; this.customerService = customerService; this.userProfileUtilities = userProfileUtilities; this.paymentSettings = paymentSettings; this.cartOrderProviderFactory = cartOrderProviderFactory; this.customSettings = customSettings; }
public UdpServer() { _settings = _settingsLoader.ReadXml(); _datagramGenerator = new DatagramGenerator(_settings.DiapasonMin, _settings.DiapasonMax); _datagramSender = new DatagramSender(_settings, _datagramGenerator); Console.WriteLine("-----------------------------"); Console.WriteLine($"Diapason: Min {_settings.DiapasonMin}, Max {_settings.DiapasonMax} "); Console.WriteLine($" IP {_settings.IPAddress}, Port {_settings.Port} "); }
public TellAFriendService_Brasseler(IUnitOfWorkFactory unitOfWorkFactory, IEmailService emailService, IEmailTemplateUtilities emailTemplateUtilities, IContentManagerUtilities contentManagerUtilities) : base(unitOfWorkFactory, emailService) { this.UnitOfWorkFactory = unitOfWorkFactory; this.UnitOfWork = unitOfWorkFactory.GetUnitOfWork(); this.EmailService = emailService; this.EmailTemplateUtilities = emailTemplateUtilities; this.ContentManagerUtilities = contentManagerUtilities; customSettings = new CustomSettings(); }
public OptionsController(IOptions<CustomSettings> settings) { this.settings = settings.Value; }
public OptionsComponent(IOptions<CustomSettings> settings) { this.settings = settings.Value; }