You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.1 KiB
40 lines
1.1 KiB
12 years ago
|
using System;
|
||
|
using System.Linq;
|
||
|
using NzbDrone.Core.Datastore;
|
||
11 years ago
|
using NzbDrone.Core.Messaging.Events;
|
||
11 years ago
|
|
||
12 years ago
|
|
||
12 years ago
|
namespace NzbDrone.Core.Jobs
|
||
12 years ago
|
{
|
||
12 years ago
|
public interface IScheduledTaskRepository : IBasicRepository<ScheduledTask>
|
||
12 years ago
|
{
|
||
12 years ago
|
ScheduledTask GetDefinition(Type type);
|
||
12 years ago
|
void SetLastExecutionTime(int id, DateTime executionTime);
|
||
12 years ago
|
}
|
||
|
|
||
12 years ago
|
public class ScheduledTaskRepository : BasicRepository<ScheduledTask>, IScheduledTaskRepository
|
||
12 years ago
|
{
|
||
|
|
||
11 years ago
|
public ScheduledTaskRepository(IDatabase database, IEventAggregator eventAggregator)
|
||
|
: base(database, eventAggregator)
|
||
12 years ago
|
{
|
||
|
}
|
||
|
|
||
12 years ago
|
public ScheduledTask GetDefinition(Type type)
|
||
12 years ago
|
{
|
||
11 years ago
|
return Query.Where(c => c.TypeName == type.FullName).Single();
|
||
12 years ago
|
}
|
||
|
|
||
12 years ago
|
public void SetLastExecutionTime(int id, DateTime executionTime)
|
||
|
{
|
||
|
var task = new ScheduledTask
|
||
|
{
|
||
|
Id = id,
|
||
|
LastExecution = executionTime
|
||
|
};
|
||
|
|
||
|
SetFields(task, scheduledTask => scheduledTask.LastExecution);
|
||
|
}
|
||
12 years ago
|
}
|
||
12 years ago
|
}
|