Esempio n. 1
0
 public IReadOnlyCollection <KarmaDownloadJob> GetKarmaDownloadJob()
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         return(KarmaDownloaderFunctions.DownloadKarmaDownloadJobs(connection).Select(z => _mapper.Map <KarmaDownloadJob>(z)).ToList());
     }
 }
Esempio n. 2
0
 public TaskStatuses GetStatus(long taskId)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         var job = _mapper.Map <KarmaDownloadJob>(KarmaDownloaderFunctions.DownloadKarmaDownloadJobs(connection).FirstOrDefault(z => z.TaskId == taskId));
         return(job.TaskStatuses);
     }
 }
Esempio n. 3
0
 public void UpdateSaverJson(long taskId, SaverJson saverJson)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         var dbSaverJson = _mapper.Map <DbSaverJson>(saverJson);
         var job         = KarmaDownloaderFunctions.DownloadKarmaDownloadJobs(connection).FirstOrDefault(z => z.TaskId == taskId);
         KarmaDownloaderFunctions.UpdateSaverTemplates(connection, job.SaverTemplateId.Value, saverJson);
     }
 }
Esempio n. 4
0
 public SaverJson GetSaverJson(long taskId)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         //взять
         var job = KarmaDownloaderFunctions.DownloadKarmaDownloadJobs(connection).FirstOrDefault(z => z.TaskId == taskId);
         if (job is not null && job.SaverTemplateId.HasValue)
         {
             return(_mapper.Map <SaverJson>(KarmaDownloaderFunctions.GetSaverTemplates(connection, job.SaverTemplateId.Value)));
         }
         return(null);
     }
 }