public void RecoverAccount(long accountId, IBackgroundJobService backgroundJobService) { new RecoverUserCommandHandler(new DataBaseContext()).Handle(new RecoverUserCommand { AccountId = accountId }); var account = new GetAccountByIdQueryHandler(new DataBaseContext()).Handle(new GetAccountByIdQuery { UserId = accountId }); new CookieService().RefreshCookies(new AccountViewModel { Id = accountId, Login = account.Login, Password = account.Password, Proxy = account.Proxy, ProxyLogin = account.ProxyLogin, ProxyPassword = account.ProxyPassword, UserAgentId = account.UserAgentId }, forSpy: false, backgroundJob: backgroundJobService); if (account.GroupSettingsId == null) { return; } var settings = _accountSettingsManager.GetSettings((long)account.GroupSettingsId); var accountViewModel = new AccountViewModel { Id = account.Id, AuthorizationDataIsFailed = account.AuthorizationDataIsFailed, Cookie = account.Cookie.CookieString, IsDeleted = account.IsDeleted, ProxyDataIsFailed = account.ProxyDataIsFailed, GroupSettingsId = account.GroupSettingsId, Name = account.Name, Proxy = account.Proxy, FacebookId = account.FacebookId, Login = account.Login, PageUrl = account.PageUrl, Password = account.Password, ProxyLogin = account.ProxyLogin, ProxyPassword = account.ProxyPassword, ConformationDataIsFailed = account.ConformationIsFailed, UserAgentId = account.UserAgentId }; var model = new AddOrUpdateAccountModel() { Account = accountViewModel, NewSettings = settings, OldSettings = null }; backgroundJobService.AddOrUpdateAccountJobs(model); }
private static void UpdateJobsTask(IBackgroundJobService backgroundJobService, AccountViewModel account, GroupSettingsViewModel newSettings, GroupSettingsViewModel oldSettings) { var model = new AddOrUpdateAccountModel { Account = account, NewSettings = newSettings, OldSettings = oldSettings }; backgroundJobService.AddOrUpdateAccountJobs(model); }