private void DeleteConfiguration(ConfigureDataListItem configListItem) { if (Messages.ShowQuestion("Are you sure you want to delete this configuration?", "Hold On", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No) { return; } ConfigurationBase configuration = ConfigurationsManager.GetConfiguration(configListItem.ConfigName); bool isDeleted = ConfigurationBase.Delete(configuration, out Exception ex); if (isDeleted) { containerFlowPanel.Controls.Remove(configListItem); ConfigurationsManager.RemoveConfiguration(configListItem, configuration); if (Configurations.Count == 0) { if (!containerFlowPanel.Controls.Contains(emptyListLabel)) { containerFlowPanel.Controls.Add(emptyListLabel); } emptyListLabel.Visible = true; } } else { Messages.DeleteDirectoryException(ex); } }
private bool ValidateName(string name) { bool isValid = true; if (name == "" || name[0] == ' ' || name[name.Length - 1] == ' ') { isValid = false; } if (isValid) { isValid = ConfigurationsManager.ValidateName(name); } if (isValid) { icrRegionNameLabel.ForeColor = Color.FromArgb(255, 68, 68, 68); icrRegionNameTextBox.ForeColor = Color.FromArgb(255, 68, 68, 68); } else { icrRegionNameLabel.ForeColor = Color.Crimson; icrRegionNameTextBox.ForeColor = Color.Crimson; } return(isValid); }
private void LoadConfigurations() { ConfigurationsManager configurationsManager = new ConfigurationsManager(); AppConfigurations = configurationsManager.GetConfigurations(); RefreshAppConfigurationsListBox(); }
private void DeleteConfigurationButton_Click(object sender, RoutedEventArgs e) { AppConfiguration configuration = AppConfigurationComboBox.SelectedItem as AppConfiguration; ConfigurationsManager configurationsManager = new ConfigurationsManager(); configurationsManager.DeleteConfiguration(configuration); LoadConfigurations(); }
private void SaveButton_Click(object sender, RoutedEventArgs e) { ConfigurationsManager configurationsManager = new ConfigurationsManager(); configurationsManager.SaveAppConfiguration(AppConfiguration); configurationsManager.SaveExplorerState(AppConfiguration, ExplorerState); MessageBox.Show("Configurations saved successfully."); }
public ConfigurationsController( ConfigurationsManager configurationsManager, ComponentsManager componentsManager) { this.configurationsManager = configurationsManager ?? throw new ArgumentNullException(nameof(configurationsManager)); this.componentsManager = componentsManager ?? throw new ArgumentNullException(nameof(componentsManager)); }
public ProfileController(IBaseRepository <ApplicationUserDtocs> profileRepository, IMapper mapper, UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IEmailSender emailSender) { _configurationsManager = new ConfigurationsManager(); _emailSender = emailSender; _mapper = mapper; _userManager = userManager; _signInManager = signInManager; //_profileManager = profileManager; _profileRepository = profileRepository; _profileManager = new ProfileManager(_profileRepository, _mapper, _userManager, _signInManager); }
private void AddConfigurationButton_Click(object sender, RoutedEventArgs e) { AppConfiguration configuration = new AppConfiguration(); ConfigurationEditForm configurationEditForm = new ConfigurationEditForm(); configurationEditForm.BindControls(configuration); if (configurationEditForm.ShowDialog(this, "Add Configuration") == true) { AppConfigurations.Add(configuration); ConfigurationsManager configurationsManager = new ConfigurationsManager(); ConnectorExplorerState connectorExplorerState = new ConnectorExplorerState(); configurationsManager.SaveExplorerState(configuration, connectorExplorerState); RefreshAppConfigurationsListBox(); } }
private void ConfigurationComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { this.AppConfiguration = AppConfigurationComboBox.SelectedItem as AppConfiguration; if (this.AppConfiguration == null) { return; } ConfigurationsManager configurationsManager = new ConfigurationsManager(); Sobiens.Connectors.Common.ConfigurationManager.GetInstance().AdministrativeConfiguration = new Entities.Settings.AppConfiguration(); Sobiens.Connectors.Common.ConfigurationManager.GetInstance().Configuration = this.AppConfiguration; ExplorerState = configurationsManager.GetExplorerState(this.AppConfiguration); RefreshGeneralConfigurationsListBox(); RefreshExcelTemplateListBox(); RefreshWordTemplateListBox(); }
private void MoveConfiguration(ConfigureDataListItem configListItem, bool isUp) { ConfigurationBase config = ConfigurationsManager.GetConfiguration(configListItem.ConfigName); int curIndex = containerFlowPanel.Controls.IndexOf(configListItem); int moveIndex = 0; if (isUp) { moveIndex = curIndex == 0? 0 : curIndex - 1; } else { moveIndex = curIndex == Configurations.Count - 1? curIndex : curIndex + 1; } containerFlowPanel.Controls.SetChildIndex(configListItem, moveIndex); Configurations.RemoveAt(curIndex); Configurations.Insert(moveIndex, config); config.ProcessingIndex = moveIndex; Configurations[curIndex].ProcessingIndex = curIndex; }
private void OnConfigControlButtonPressed(object sender, ControlButton controlButton) { ConfigureDataListItem configListItem = (ConfigureDataListItem)sender; switch (controlButton) { case ControlButton.Delete: DeleteConfiguration(configListItem); break; case ControlButton.MoveUp: MoveConfiguration(configListItem, true); break; case ControlButton.MoveDown: MoveConfiguration(configListItem, false); break; case ControlButton.Configure: ConfigurationBase configuration = ConfigurationsManager.GetConfiguration(configListItem.ConfigName); ConfigureConfiguration(configuration); break; } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigurationsManager conf = new ConfigurationsManager(); Installer.ConfigureServices(services, conf.ConnectionString); services.AddIdentity <ApplicationUser, IdentityRole <Guid> >() .AddEntityFrameworkStores <SQLContext>() .AddDefaultTokenProviders(); services.Configure <IdentityOptions>(options => { // Lockout settings options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromHours(24); options.Lockout.MaxFailedAccessAttempts = 10; options.Lockout.AllowedForNewUsers = true; // User settings options.User.RequireUniqueEmail = false; // Password settings options.Password.RequireDigit = false; options.Password.RequireNonAlphanumeric = false; options.Password.RequireLowercase = false; options.Password.RequireUppercase = false; options.Password.RequiredUniqueChars = 0; }); services.AddOptions(); services.AddScoped <IBaseRepository <ApplicationUserDtocs>, SQLRepository <ApplicationUserDtocs> >(); services.AddScoped <IBaseRepository <PersonalDiary>, SQLRepository <PersonalDiary> >(); services.AddScoped <IBaseRepository <ToDo>, SQLRepository <ToDo> >(); services.AddSingleton <IEmailSender, EmailSender>(); // configure strongly typed settings objects var appSettingsSection = Configuration.GetSection("Keys"); services.Configure <AppSettings>(appSettingsSection); // configure jwt authentication var appSettings = appSettingsSection.Get <AppSettings>(); var key = Encoding.ASCII.GetBytes(appSettings.Secret); services.AddAuthentication(x => { x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(x => { x.Events = new JwtBearerEvents { OnTokenValidated = context => { //var userService = context.HttpContext.RequestServices.GetRequiredService<ProfileManager>(); var userData = context.Principal.Identity.Name; if (userData == null) { // return unauthorized if user no longer exists context.Fail("Unauthorized"); } return(Task.CompletedTask); } }; x.RequireHttpsMetadata = false; x.SaveToken = true; x.TokenValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(key), ValidateIssuer = false, ValidateAudience = false }; }); //services.AddScoped<ProfileManager>(); //services.AddCors(); services.AddMvc().AddJsonOptions(options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore); services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddCors(options => { // BEGIN02 options.AddPolicy("AllowAllOrigins", builder => { builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod(); }); // END02 }); // backGround service // not used anymore services.AddSingleton <Microsoft.Extensions.Hosting.IHostedService, EmailTask>(); services.AddMvc(); services.AddCors(o => o.AddPolicy("CorsPolicy", builder => { builder .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials() .WithOrigins("http://localhost:4200"); })); services.AddSignalR(); services.AddSignalR(); services.AddAutoMapper(typeof(Startup)); }