Beispiel #1
0
        public List <JobQueueViewModel> GetQueuesByAccountAndFunctionName(JobQueueViewModel model)
        {
            var queuesDbModels = new GetJobQueuesByAccountIdCommandHandler().Handle(new GetJobQueuesByAccountIdCommand
            {
                AccountId    = model.AccountId,
                IsForSpy     = model.IsForSpy,
                FunctionName = model.FunctionName
            });

            return(queuesDbModels.Select(queueModel => new JobQueueViewModel
            {
                AccountId = queueModel.AccountId,
                Id = queueModel.Id,
                FunctionName = queueModel.FunctionName,
                AddedDateTime = queueModel.AddedDateTime,
                IsForSpy = queueModel.IsForSpy,
                FriendId = queueModel.FriendId,
                FunctionStringName = new GetFunctionNameByNameQueryHandler(new DataBaseContext()).Handle(new GetFunctionNameByNameQuery
                {
                    FunctionName = queueModel.FunctionName
                }),
                JobId = queueModel.JobId,
                IsProcessed = queueModel.IsProcessed
            }).ToList());
        }
Beispiel #2
0
 public void MarkIsProcessedQueue(JobQueueViewModel model)
 {
     new MarkProcessedStatusCommandHandler().Handle(new MarkProcessedStatusCommand
     {
         AccountId    = model.AccountId,
         FunctionName = model.FunctionName,
         FriendId     = model.FriendId,
         IsForSpy     = model.IsForSpy
     });
 }
Beispiel #3
0
        public List <string> DeleteJobQueuesByAccountId(JobQueueViewModel model)
        {
            var jobsId = new DeleteQueueByAccountIdCommandHandler(new DataBaseContext()).Handle(new DeleteQueueByAccountIdCommand
            {
                AccountId    = model.AccountId,
                IsForSpy     = model.IsForSpy,
                FunctionName = model.FunctionName
            });

            return(jobsId);
        }
Beispiel #4
0
        public bool JobIsRun(JobQueueViewModel model)
        {
            var jobIsExist = new JobQueueIsExistQueryHandler(new DataBaseContext()).Handle(new JobQueueIsExistQuery
            {
                AccountId    = model.AccountId,
                FunctionName = model.FunctionName,
                IsForSpy     = model.IsForSpy,
                FriendId     = model.FriendId
            });

            return(jobIsExist);
        }
Beispiel #5
0
 public void AddToQueue(JobQueueViewModel model)
 {
     new AddToQueueCommandHandler().Handle(new AddToQueueCommand
     {
         AccountId      = model.AccountId,
         FunctionName   = model.FunctionName,
         IsUnique       = true,
         FriendId       = model.FriendId,
         IsForSpy       = model.IsForSpy,
         JobId          = model.JobId,
         LaunchDateTime = model.LaunchDateTime
     });
 }
Beispiel #6
0
        public static void Run(AccountViewModel account)
        {
            if (!new FunctionPermissionManager().HasPermissionsForSpy(FunctionName.AnalyzeFriends, account.FacebookId))
            {
                return;
            }

            var jobQueue = new JobQueueViewModel
            {
                AccountId    = account.Id,
                FunctionName = FunctionName.AnalyzeFriends,
                IsForSpy     = true
            };

            new JobQueueService().AddToQueue(jobQueue);
        }
Beispiel #7
0
        public List <JobQueueViewModel> GetQueuesByAccountId(JobQueueViewModel model)
        {
            var queuesDbModels = new GetJobQueuesByAccountIdCommandHandler().Handle(new GetJobQueuesByAccountIdCommand
            {
                AccountId = model.AccountId,
                IsForSpy  = model.IsForSpy
            });

            return(queuesDbModels.Select(queueModel => new JobQueueViewModel
            {
                AccountId = queueModel.AccountId,
                Id = queueModel.Id,
                FunctionName = queueModel.FunctionName,
                AddedDateTime = queueModel.AddedDateTime,
                IsForSpy = queueModel.IsForSpy,
                FriendId = queueModel.FriendId,
                IsProcessed = queueModel.IsProcessed
            }).ToList());
        }