Exemple #1
0
        public static BulletinHub.Entity.Data.Task Create(TaskCommand command, Action <BulletinHub.Entity.Data.Task> action)
        {
            var result = new BulletinHub.Entity.Data.Task();

            BCT.Execute(c =>
            {
                result.TargetDate  = DateTime.Now;
                result.CommandEnum = command;
                action?.Invoke(result);
                result.StateEnum = BulletinHub.Entity.Data.TaskState.Enabled;
                c.SaveChanges();
            });
            return(result);
        }
 public static BulletinHub.Entity.Data.Task Next()
 {
     BulletinHub.Entity.Data.Task task = null;
     BCT.Execute(c =>
     {
         var date = DateTime.Now;
         task     = c.TempDB.Tasks.OrderBy(q => q.TargetDate).FirstOrDefault(q => (q.State == (int)TaskState.Created || q.State == (int)TaskState.Enabled) && q.TargetDate < date);
         if (task.BulletinId == Guid.Empty)
         {
             task.SetError("Task BoardId is empty");
             task = Next();
         }
     });
     return(task);
 }