コード例 #1
0
ファイル: ServiceActions.cs プロジェクト: RomanBushuev/Murr
 public long CreateService(string serviceName, string serviceVersion)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         return(KarmaDownloaderFunctions.CreateService(connection, serviceName, serviceVersion));
     }
 }
コード例 #2
0
 public IReadOnlyCollection <KarmaDownloadJob> GetKarmaDownloadJob()
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         return(KarmaDownloaderFunctions.DownloadKarmaDownloadJobs(connection).Select(z => _mapper.Map <KarmaDownloadJob>(z)).ToList());
     }
 }
コード例 #3
0
 public void InsertPipelineTasks(long startTaskId, long nextTaskId)
 {
     using (var connection = new NpgsqlConnection(_connection))
     {
         KarmaDownloaderFunctions.InsertPipelineTasks(connection, startTaskId, nextTaskId);
     }
 }
コード例 #4
0
ファイル: ServiceActions.cs プロジェクト: RomanBushuev/Murr
 public void FinishedService(string serviceName)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         KarmaDownloaderFunctions.ChangeServiceStatus(connection, serviceName, (long)ServiceStatuses.Finisehd);
     }
 }
コード例 #5
0
ファイル: ServiceActions.cs プロジェクト: RomanBushuev/Murr
 public async Task SetHealthCheckAsync(long serviceId, DateTime dateTime)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         await KarmaDownloaderFunctions.SetHealthCheckAsync(connection, serviceId, dateTime);
     }
 }
コード例 #6
0
 public CalculationJson GetCalculationJson(long taskTemplateId)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         return(_mapper.Map <CalculationJson>(KarmaDownloaderFunctions.GetTaskTemplates(connection, taskTemplateId)));
     }
 }
コード例 #7
0
        public long Cancelling(long taskId)
        {
            using (IDbConnection connection = new NpgsqlConnection(_connection))
            {
                var result = KarmaDownloaderFunctions.ChangeTaskStatus(connection,
                                                                       taskId,
                                                                       (long)TaskStatuses.Creating,
                                                                       (long)TaskStatuses.Cancelling);

                if (result == 0)
                {
                    result = KarmaDownloaderFunctions.ChangeTaskStatus(connection,
                                                                       taskId,
                                                                       (long)TaskStatuses.Created,
                                                                       (long)TaskStatuses.Cancelling);
                }

                if (result == 0)
                {
                    result = KarmaDownloaderFunctions.ChangeTaskStatus(connection,
                                                                       taskId,
                                                                       (long)TaskStatuses.Running,
                                                                       (long)TaskStatuses.Cancelling);
                }

                return(result);
            }
        }
コード例 #8
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);
     }
 }
コード例 #9
0
ファイル: ServiceActions.cs プロジェクト: RomanBushuev/Murr
 public IReadOnlyCollection <KarmaService> GetKarmaServices()
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         var result = KarmaDownloaderFunctions.DownloadKarmaServices(connection);
         return(result.Select(z => _mapper.Map <KarmaService>(z)).ToList());
     }
 }
コード例 #10
0
 public long CreateTaskAction(TaskStatuses taskStatuses, string taskTemplateTitle,
                              long taskTemplateFolderId, string jsonParameters, TaskTypes taskTypes)
 {
     using (var connection = new NpgsqlConnection(_connection))
     {
         return(KarmaDownloaderFunctions.InsertTask(connection, taskTemplateTitle, taskTemplateFolderId,
                                                    jsonParameters, (long)taskTypes, (long)taskStatuses));
     }
 }
コード例 #11
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);
     }
 }
コード例 #12
0
 public DateTime?GetDate(long taskId, string attribute)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         return(KarmaDownloaderFunctions.GetTaskDate(connection,
                                                     taskId,
                                                     attribute.Trim().ToUpper()));
     }
 }
コード例 #13
0
 public decimal?GetNumber(long taskId, string attribute)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         return(KarmaDownloaderFunctions.GetTaskDecimal(connection,
                                                        taskId,
                                                        attribute.Trim().ToUpper()));
     }
 }
コード例 #14
0
ファイル: ServiceActions.cs プロジェクト: RomanBushuev/Murr
 public DateTime?GetDate(string serviceName, string attribute)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         return(KarmaDownloaderFunctions.GetServiceDate(connection,
                                                        serviceName,
                                                        attribute.Trim().ToUpper()));
     }
 }
コード例 #15
0
ファイル: ServiceActions.cs プロジェクト: RomanBushuev/Murr
 public decimal?GetNumber(string serviceName, string attribute)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         return(KarmaDownloaderFunctions.GetServiceDecimal(connection,
                                                           serviceName,
                                                           attribute.Trim().ToUpper()));
     }
 }
コード例 #16
0
ファイル: ServiceActions.cs プロジェクト: RomanBushuev/Murr
 public void SetAttribute(string serviceName, string attribute, DateTime date)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         KarmaDownloaderFunctions.InsertServiceDate(connection,
                                                    serviceName,
                                                    attribute.Trim().ToUpper(),
                                                    date);
     }
 }
コード例 #17
0
ファイル: ServiceActions.cs プロジェクト: RomanBushuev/Murr
 public void SetAttribute(string serviceName, string attribute, decimal number)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         KarmaDownloaderFunctions.InsertServiceNumeric(connection,
                                                       serviceName,
                                                       attribute.Trim().ToUpper(),
                                                       number);
     }
 }
コード例 #18
0
 public long ErrorJob(long taskId)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         return(KarmaDownloaderFunctions.ChangeTaskStatus(connection,
                                                          taskId,
                                                          (long)TaskStatuses.Running,
                                                          (long)TaskStatuses.Error));
     }
 }
コード例 #19
0
 public void SetAttribute(long taskId, string attribute, string text)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         KarmaDownloaderFunctions.InsertTaskString(connection,
                                                   taskId,
                                                   attribute.Trim().ToUpper(),
                                                   text);
     }
 }
コード例 #20
0
 public void SetAttribute(long taskId, string attribute, decimal number)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         connection.Open();
         KarmaDownloaderFunctions.InsertTaskNumeric(connection,
                                                    taskId,
                                                    attribute.Trim().ToUpper(),
                                                    number);
     }
 }
コード例 #21
0
 public void SetAttribute(long taskId, string attribute, DateTime dateTime, string text)
 {
     using (IDbConnection connection = new NpgsqlConnection(_connection))
     {
         connection.Open();
         KarmaDownloaderFunctions.InsertTaskDateText(connection, taskId,
                                                     attribute.Trim().ToUpper(),
                                                     dateTime,
                                                     text);
     }
 }
コード例 #22
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);
     }
 }