Exemple #1
0
        public BackgroundTask ScheduleTask(BackgroundTaskTypeEnum type, DateTime scheduled, Guid?districtRef, string data, string domain)
        {
            if (!CanScheduleTask(type))
            {
                throw new ChalkableSecurityException();
            }
            var task = new BackgroundTask
            {
                Created     = DateTime.UtcNow,
                Data        = data,
                Id          = Guid.NewGuid(),
                Scheduled   = scheduled,
                DistrictRef = districtRef,
                State       = BackgroundTaskStateEnum.Created,
                Type        = type,
                Domain      = domain
            };

            DoUpdate(u => new BackgroundTaskDataAccess(u).Insert(task));
            return(task);
        }
Exemple #2
0
 private bool CanScheduleTask(BackgroundTaskTypeEnum type)
 {
     return(BaseSecurity.IsSysAdmin(Context) || type == BackgroundTaskTypeEnum.GenerateReport);
 }
Exemple #3
0
 public BackgroundTask ScheduleTask(BackgroundTaskTypeEnum type, DateTime scheduled, Guid?districtRef, string data,
                                    string domain)
 {
     throw new NotImplementedException();
 }
Exemple #4
0
 public AllDistrictsProducer(string configSectionName, BackgroundTaskTypeEnum type)
     : base(configSectionName)
 {
     this.type = type;
 }