public long CreateService(string serviceName, string serviceVersion) { using (IDbConnection connection = new NpgsqlConnection(_connection)) { return(KarmaDownloaderFunctions.CreateService(connection, serviceName, serviceVersion)); } }
public IReadOnlyCollection <KarmaDownloadJob> GetKarmaDownloadJob() { using (IDbConnection connection = new NpgsqlConnection(_connection)) { return(KarmaDownloaderFunctions.DownloadKarmaDownloadJobs(connection).Select(z => _mapper.Map <KarmaDownloadJob>(z)).ToList()); } }
public void InsertPipelineTasks(long startTaskId, long nextTaskId) { using (var connection = new NpgsqlConnection(_connection)) { KarmaDownloaderFunctions.InsertPipelineTasks(connection, startTaskId, nextTaskId); } }
public void FinishedService(string serviceName) { using (IDbConnection connection = new NpgsqlConnection(_connection)) { KarmaDownloaderFunctions.ChangeServiceStatus(connection, serviceName, (long)ServiceStatuses.Finisehd); } }
public async Task SetHealthCheckAsync(long serviceId, DateTime dateTime) { using (IDbConnection connection = new NpgsqlConnection(_connection)) { await KarmaDownloaderFunctions.SetHealthCheckAsync(connection, serviceId, dateTime); } }
public CalculationJson GetCalculationJson(long taskTemplateId) { using (IDbConnection connection = new NpgsqlConnection(_connection)) { return(_mapper.Map <CalculationJson>(KarmaDownloaderFunctions.GetTaskTemplates(connection, taskTemplateId))); } }
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); } }
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); } }
public IReadOnlyCollection <KarmaService> GetKarmaServices() { using (IDbConnection connection = new NpgsqlConnection(_connection)) { var result = KarmaDownloaderFunctions.DownloadKarmaServices(connection); return(result.Select(z => _mapper.Map <KarmaService>(z)).ToList()); } }
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)); } }
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); } }
public DateTime?GetDate(long taskId, string attribute) { using (IDbConnection connection = new NpgsqlConnection(_connection)) { return(KarmaDownloaderFunctions.GetTaskDate(connection, taskId, attribute.Trim().ToUpper())); } }
public decimal?GetNumber(long taskId, string attribute) { using (IDbConnection connection = new NpgsqlConnection(_connection)) { return(KarmaDownloaderFunctions.GetTaskDecimal(connection, taskId, attribute.Trim().ToUpper())); } }
public DateTime?GetDate(string serviceName, string attribute) { using (IDbConnection connection = new NpgsqlConnection(_connection)) { return(KarmaDownloaderFunctions.GetServiceDate(connection, serviceName, attribute.Trim().ToUpper())); } }
public decimal?GetNumber(string serviceName, string attribute) { using (IDbConnection connection = new NpgsqlConnection(_connection)) { return(KarmaDownloaderFunctions.GetServiceDecimal(connection, serviceName, attribute.Trim().ToUpper())); } }
public void SetAttribute(string serviceName, string attribute, DateTime date) { using (IDbConnection connection = new NpgsqlConnection(_connection)) { KarmaDownloaderFunctions.InsertServiceDate(connection, serviceName, attribute.Trim().ToUpper(), date); } }
public void SetAttribute(string serviceName, string attribute, decimal number) { using (IDbConnection connection = new NpgsqlConnection(_connection)) { KarmaDownloaderFunctions.InsertServiceNumeric(connection, serviceName, attribute.Trim().ToUpper(), number); } }
public long ErrorJob(long taskId) { using (IDbConnection connection = new NpgsqlConnection(_connection)) { return(KarmaDownloaderFunctions.ChangeTaskStatus(connection, taskId, (long)TaskStatuses.Running, (long)TaskStatuses.Error)); } }
public void SetAttribute(long taskId, string attribute, string text) { using (IDbConnection connection = new NpgsqlConnection(_connection)) { KarmaDownloaderFunctions.InsertTaskString(connection, taskId, attribute.Trim().ToUpper(), text); } }
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); } }
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); } }
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); } }