private void deleteItem_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { var userConfig = (GrabConfiguration)gv.GetFocusedRow(); if (userConfig == null) { return; } if (!AskQuestion(string.Format("Delete {0}?" + "{1}This action will PERMANENTLY delete all configuration files." + "{1}Are you sure you want to do this?", userConfig.Name, Environment.NewLine))) { return; } try { var delCommand = new DeleteConfiguration(); delCommand.Execute(userConfig); gv.DeleteRow(gv.FocusedRowHandle); SetMenusEnabled(); } catch (Exception ex) { Log.Error(string.Format("Failed to delete user configuration.{0}{1}", Environment.NewLine, ex.Message), ex); XtraMessageBox.Show(string.Format("Failed to delete user configuration.{0}{1}", Environment.NewLine, ex.Message), "Error"); } finally { SplashManager.CloseSplashScreen(); } }
public IActionResult DeleteDialog(string name, string group) { using (this.DbContext) { var trigger = this.DbContext.QuartzTriggers.FirstOrDefault(o => o.TriggerName == name && o.TriggerGroup == group); var dialog = new DeleteConfiguration(trigger); return(this.Dialog(dialog)); } }
public void SetUp() { _createConfiguration = new CreateConfigurationFake(); _createApplication = new CreateApplicationFake(); _deleteConfiguration = new DeleteConfiguration(); _getConfigurationByNameAndApplication = new GetConfigurationByNameAndApplication(); Runner.SqlCompact("Lemonade").Down(); Runner.SqlCompact("Lemonade").Up(); }
public void Delete(DeleteConfiguration configuration) { using (var sqlConnection = new SqlConnection(_connectionString)) { const string sql = @"DELETE Configuration FROM Configuration c INNER JOIN Flag f ON c.Flag_Id = f.Id_Flag INNER JOIN [User] u ON c.User_Id = u.Id_User WHERE u.UserName = @username AND f.Name in @names"; sqlConnection.Execute(sql, new { username = configuration.User, names = configuration.Features }); } }
public static string GetDatabaseRecordTaskName(DeleteConfiguration configuration) { switch (configuration.Type) { case OngoingTaskType.Backup: return(PutServerWideBackupConfigurationCommand.GetTaskName(configuration.TaskName)); case OngoingTaskType.Replication: return(PutServerWideExternalReplicationCommand.GetTaskName(configuration.TaskName)); default: throw new ArgumentOutOfRangeException(); } }
private static void Run(Options options) { // 'parse' the commandline options var config = new DeleteConfiguration(options); // Run the Delete/Purge var errors = DeleteService.Delete(config); if (errors.Any()) { ConsoleHelpers.WriteErrors(errors); _returnCode = FAILURE; } }
public void Delete() { var mockRepo = new Mock <IConfigurationGateway>(); var controller = new FlagConfigurationController(mockRepo.Object); var deleteConfiguration = new DeleteConfiguration { User = "******", Features = new [] { "Flag1", "Flag2" } }; controller.Delete(deleteConfiguration); mockRepo.Verify(s => s.Delete(deleteConfiguration)); }
public void Delete_NotFailWhenTryCleanPropertyOfDeletedInstanceTest() { //Тут очень важна последовательность конфига, окуратнее исправляйте тест. //Смысл теста в том, что через каскадное удаление объект в котором предполагалась очистка ссылки, удаляется перед, этим. // А в момент очистки ссылки он заново записывется, обычно с тем же ID, что в последствии вызывает различные проблемы, // например не возможно удалить объект, на который имеется ссылка из этого, или не удается этот записать, так как удален // тот на который мы ссылаемся. Повторюсь, мы не должны были его записывать. var delConfig = new DeleteConfiguration(); delConfig.AddHibernateDeleteInfo <DependDeleteItem>() .AddDeleteCascadeDependence(x => x.CleanLink); delConfig.AddHibernateDeleteInfo <AlsoDeleteItem>() .AddClearDependence <DependDeleteItem>(x => x.CleanLink); delConfig.AddHibernateDeleteInfo <RootDeleteItem>() .AddDeleteDependence <DependDeleteItem>(x => x.DeleteLink) .AddDeleteDependence <AlsoDeleteItem>(x => x.Root); using (var uow = UnitOfWorkFactory.CreateWithoutRoot()) { var root = new RootDeleteItem(); var item1 = new AlsoDeleteItem() { Root = root }; var item2 = new DependDeleteItem() { DeleteLink = root, CleanLink = item1 }; uow.Save(root); uow.Save(item1); uow.Save(item2); uow.Commit(); var deletion = new DeleteCore(delConfig, uow); var cancellation = new System.Threading.CancellationToken(); deletion.PrepareDeletion(typeof(RootDeleteItem), root.Id, cancellation); Assert.That(deletion.ItemsToDelete, Is.EqualTo(3)); deletion.RunDeletion(cancellation); Assert.That(deletion.DeletionExecuted, Is.EqualTo(true)); var dependDeleteItems = uow.GetAll <DependDeleteItem>().ToList(); Assert.That(dependDeleteItems.Count, Is.EqualTo(0)); } }
public void Delete([FromBody] DeleteConfiguration configuration) { _configurationGateway.Delete(configuration); }
public DeleteCore(DeleteConfiguration configuration, IUnitOfWork uow = null) { this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); this.uow = uow; }
public DeleteServerWideTaskCommand(DeleteConfiguration configuration, string uniqueRequestId) : base(uniqueRequestId) { Name = ClusterStateMachine.ServerWideConfigurationKey.GetKeyByType(configuration.Type); Value = configuration; }
public DeleteEntityGUIService(DeleteConfiguration configuration, INavigationManager navigation, IInteractiveQuestion interactive) { this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); this.navigation = navigation ?? throw new ArgumentNullException(nameof(navigation)); this.interactive = interactive ?? throw new ArgumentNullException(nameof(interactive)); }
public ReplaceEntity(DeleteConfiguration configuration) { this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); }