Exemple #1
0
        public void DeleteAutomation(Automation automation, string driveName)
        {
            //remove file associated with automation
            var file = _fileManager.GetFileFolder(automation.FileId.ToString(), driveName);

            _fileManager.DeleteFileFolder(automation.FileId.ToString(), driveName);
            var folder = _fileManager.GetFileFolder(file.ParentId.ToString(), driveName);

            if (!folder.HasChild.Value)
            {
                _fileManager.DeleteFileFolder(folder.Id.ToString(), driveName);
            }
            else
            {
                _fileManager.AddBytesToFoldersAndDrive(new List <FileFolderViewModel> {
                    file
                });
            }

            //remove automation entity
            _repo.SoftDelete(automation.Id.Value);

            //remove automation version entity associated with automation
            var automationVersion = _automationVersionRepository.Find(null, q => q.AutomationId == automation.Id).Items?.FirstOrDefault();

            _automationVersionRepository.SoftDelete(automationVersion.Id.Value);
            DeleteExistingParameters(automation.Id);
        }
        public void DeleteAutomation(Automation automation)
        {
            var    fileToDelete = _storageFileRepository.GetOne(automation.FileId.Value);
            string driveId      = fileToDelete.StorageDriveId.ToString();

            //remove file associated with automation
            var file = _fileManager.GetFileFolder(automation.FileId.ToString(), driveId, "Files");

            _fileManager.DeleteFileFolder(automation.FileId.ToString(), driveId, "Files");
            var folder = _fileManager.GetFileFolder(file.ParentId.ToString(), driveId, "Folders");

            if (!folder.HasChild.Value)
            {
                _fileManager.DeleteFileFolder(folder.Id.ToString(), driveId, "Folders");
            }
            else
            {
                _fileManager.RemoveBytesFromFoldersAndDrive(new List <FileFolderViewModel> {
                    file
                });
            }

            //remove automation
            _repo.SoftDelete(automation.Id.Value);

            //remove automation version associated with automation
            var automationVersion = _automationVersionRepository.Find(null, q => q.AutomationId == automation.Id).Items?.FirstOrDefault();

            _automationVersionRepository.SoftDelete(automationVersion.Id.Value);
            DeleteExistingParameters(automation.Id);
        }
Exemple #3
0
        public bool DeleteAutomation(Guid automationId)
        {
            var automation = repo.GetOne(automationId);

            //remove automation version entity associated with automation
            var  automationVersion   = automationVersionRepository.Find(null, q => q.AutomationId == automationId).Items?.FirstOrDefault();
            Guid automationVersionId = (Guid)automationVersion.Id;

            automationVersionRepository.SoftDelete(automationVersionId);

            bool isDeleted = false;

            if (automation != null)
            {
                //remove binary object entity associated with automation
                binaryObjectRepository.SoftDelete(automation.BinaryObjectId);
                repo.SoftDelete(automation.Id.Value);

                isDeleted = true;
            }

            return(isDeleted);
        }