Exemplo n.º 1
0
        protected async Task <IList <SocialAccount> > GetTwitterSocialAccounts(IJobExecutionContext context)
        {
            IList <SocialAccount> result = new List <SocialAccount>();
            var siteId = context.JobDetail.GetCustomData <int>();

            if (siteId == 0)
            {
                return(result);
            }

            await UnitOfWorkManager.RunWithoutTransaction(siteId, async() =>
            {
                result = await SocialAccountService.GetAccountsAsync(SocialUserSource.Twitter);
            });

            return(result);
        }
Exemplo n.º 2
0
        protected async Task <IList <SocialAccount> > GetFacebookSocialAccounts(IJobExecutionContext context)
        {
            IList <SocialAccount> result = new List <SocialAccount>();
            var siteId = context.JobDetail.GetCustomData <int>();

            if (siteId == 0)
            {
                return(result);
            }

            await UnitOfWorkManager.RunWithoutTransaction(siteId, async() =>
            {
                result = await SocialAccountService.GetAccountsAsync(SocialUserSource.Facebook);
                //result = result.Where(t => t.Id == 430031).ToList();
            });

            return(result);
        }
Exemplo n.º 3
0
        protected async Task <SocialAccount> GetTwitterSocialAccount(IJobExecutionContext context)
        {
            var siteSocicalAccount = context.JobDetail.GetCustomData <SiteSocialAccount>();

            if (siteSocicalAccount == null)
            {
                return(null);
            }

            int    siteId        = siteSocicalAccount.SiteId;
            string twitterUserId = siteSocicalAccount.TwitterUserId;

            SocialAccount socialAccount = null;
            await UnitOfWorkManager.RunWithoutTransaction(siteId, async() =>
            {
                socialAccount = await SocialAccountService.GetAccountAsync(SocialUserSource.Twitter, twitterUserId);
            });

            return(socialAccount);
        }