private RockConfig LoadConfigurationFromSystemSetting(RockConfig rockConfig) { // Login and setup options for REST calls var restClient = new RestClient(rockConfig.RockBaseUrl); restClient.LoginToRock(rockConfig.Username, rockConfig.Password); var getStatementGeneratorConfig = new RestRequest($"api/Attributes?$filter=Guid eq guid'{Rock.Client.SystemGuid.Attribute.STATEMENT_GENERATOR_CONFIG}'"); var storedSetting = restClient.Execute <List <Rock.Client.Attribute> >(getStatementGeneratorConfig).Data.FirstOrDefault(); if (null == storedSetting) { return(rockConfig); } //Deserializing Json object from string var savedConfig = storedSetting.DefaultValue.FromJsonOrNull <RockConfig>(); savedConfig.Username = rockConfig.Username; savedConfig.Password = rockConfig.Password; savedConfig.RockBaseUrl = rockConfig.RockBaseUrl; // Reload the report options ReportOptions.LoadFromConfig(savedConfig); return(savedConfig); }
/// <summary> /// Handles the Click event of the btnResumeYes control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void btnResumeYes_Click(object sender, RoutedEventArgs e) { var lastRunGeneratorConfig = ContributionReport.GetSavedGeneratorConfigFromLastRun(); var nextPage = new ProgressPage(true, lastRunGeneratorConfig.RunDate); ReportOptions.LoadFromConfig(lastRunGeneratorConfig); this.NavigationService.Navigate(nextPage); }