1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-30 19:56:54 +00:00
Sonarr/NzbDrone.Core/Jobs/JobRepository.cs

41 lines
1.1 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
using NzbDrone.Common.Messaging;
using NzbDrone.Core.Datastore;
2013-03-05 05:37:33 +00:00
namespace NzbDrone.Core.Jobs
{
public interface IScheduledTaskRepository : IBasicRepository<ScheduledTask>
{
ScheduledTask GetDefinition(Type type);
2013-05-10 23:53:50 +00:00
void SetLastExecutionTime(int id, DateTime executionTime);
}
public class ScheduledTaskRepository : BasicRepository<ScheduledTask>, IScheduledTaskRepository
{
public ScheduledTaskRepository(IDatabase database, IMessageAggregator messageAggregator)
2013-05-05 21:24:33 +00:00
: base(database, messageAggregator)
{
}
public ScheduledTask GetDefinition(Type type)
{
2013-05-10 23:53:50 +00:00
return Query.Single(c => c.TypeName == type.FullName);
}
2013-05-10 23:53:50 +00:00
public void SetLastExecutionTime(int id, DateTime executionTime)
{
var task = new ScheduledTask
{
Id = id,
LastExecution = executionTime
};
SetFields(task, scheduledTask => scheduledTask.LastExecution);
}
}
2013-03-25 03:51:32 +00:00
}