Exemple #1
0
    public Stream Download(Guid processIdentifier)
    {
        if (processIdentifier == Guid.Empty)
        {
            throw new ArgumentException("The parameter cannot be empty.", nameof(processIdentifier));
        }

        Process currentProcess = processRepository.Get(processIdentifier);

        if (currentProcess == null)
        {
            throw new Exception($"Cannot found process with identifier {processIdentifier}");
        }
        if (currentProcess.Blob == null)
        {
            throw new Exception($"Current blob have not associated blob.");
        }

        Blob currentBlob = blobRepository.Get(currentProcess.Id);

        BlobContainerClient blobContainerClient = new BlobContainerClient(blobStorageOptions.Value.ConnectionString, blobStorageOptions.Value.BlobContainerName);

        blobContainerClient.CreateIfNotExists();

        BlobClient blobClient = new BlobClient(blobStorageOptions.Value.ConnectionString, blobStorageOptions.Value.BlobContainerName, currentBlob.FileName);

        return(blobClient.Download().Value.Content);
    }
Exemple #2
0
        public bool CanResume()
        {
            var process = _processRepository.Get(new CurrentProcessSpecification());

            if (process == null)
            {
                return(true);
            }
            else
            {
                return(process.Status == Status.Created || process.Status == Status.Started);
            }
        }
 public void Execute(string jobId, int processId)
 {
     using (Hangfire.Storage.IStorageConnection connection = JobStorage.Current.GetConnection())
     {
         Hangfire.Storage.JobData job = connection.GetJobData(jobId);
         var process = _processRepository.Get(processId);
         if (job.State == "Succeeded")
         {
             process.Status = ProcessStatus.Success;
         }
         else
         {
             process.Status = ProcessStatus.Failed;
         }
         UpdateProcess(process, process.Status);
     }
 }
Exemple #4
0
        public void Start()
        {
            var process = _processRepository.Get(new CurrentProcessSpecification());

            if (process == null)
            {
                process = Process.NewDefaultSalaryPaymentProcess();
            }

            if (process.Status == Status.Created)
            {
                process.Start();
                _processRepository.Add(process);
                _unitOfWork.Commit();
            }
        }
 public List <Process> GetProcesses()
 {
     return(_processRepository.Get().ToList());
 }
Exemple #6
0
        public async Task <List <Process> > Get()
        {
            var process = await _processRepository.Get();

            return(process);
        }