public void Run(IRunJobModel runModel) { var account = runModel.Account; var forSpy = runModel.ForSpy; var friend = runModel.Friend; if (account.GroupSettingsId == null) { return; } }
public void Run(IRunJobModel runModel) { var account = runModel.Account; var forSpy = runModel.ForSpy; var friend = runModel.Friend; if (account.GroupSettingsId == null) { return; } if (!new FunctionPermissionManager().HasPermissions(FunctionName.InviteToGroups, (long)account.GroupSettingsId)) { return; } var settings = new GroupService(new NoticeService()).GetSettings((long)account.GroupSettingsId); var inviteTheNewGroupLaunchTime = new TimeSpan(settings.RetryTimeInviteTheGroupsHour, settings.RetryTimeInviteTheGroupsMin, settings.RetryTimeInviteTheGroupsSec); var model = new CreateBackgroundJobModel { Account = account, FunctionName = FunctionName.InviteToGroups, LaunchTime = inviteTheNewGroupLaunchTime, CheckPermissions = true, IsForSpy = forSpy }; new JobStateService().DeleteJobState(new JobStateViewModel { AccountId = account.Id, FunctionName = FunctionName.InviteToGroups, FriendId = friend.Id, IsForSpy = forSpy }); var jobIsSuccessfullyCreated = new BackgroundJobService().CreateBackgroundJob(model); if (!jobIsSuccessfullyCreated) { return; } new JobQueueService().AddToQueue(new JobQueueViewModel { AccountId = account.Id, FunctionName = FunctionName.InviteToGroups, FriendId = friend.Id, IsForSpy = forSpy }); }
public void Run(IRunJobModel runModel) { var account = runModel.Account; var friend = runModel.Friend; var forSpy = runModel.ForSpy; if (account.GroupSettingsId == null) { return; } var settings = new GroupService(new NoticeService()).GetSettings((long)account.GroupSettingsId); var winkFriendsLaunchTime = new TimeSpan(settings.RetryTimeForWinkFriendsHour, settings.RetryTimeForWinkFriendsMin, settings.RetryTimeForWinkFriendsSec); var model = new CreateBackgroundJobModel { Account = account, FunctionName = FunctionName.Wink, LaunchTime = winkFriendsLaunchTime, CheckPermissions = true, IsForSpy = forSpy }; new JobStateService().DeleteJobState(new JobStateViewModel { AccountId = account.Id, FunctionName = FunctionName.Wink, IsForSpy = forSpy }); var jobIsSuccessfullyCreated = new BackgroundJobService().CreateBackgroundJob(model); if (!jobIsSuccessfullyCreated) { return; } new JobQueueService().AddToQueue(new JobQueueViewModel { AccountId = account.Id, FunctionName = FunctionName.Wink, IsForSpy = forSpy }); }
public void Execute(IRunJobModel model) { _runJob.Run(model); }