Пример #1
0
        protected override async Task <Result> InitializeInternal()
        {
            this.cancellationTokenSource = new CancellationTokenSource();

            this.startTime = DateTimeOffset.Now;

            this.user = await this.GetCurrentAccount();

            if (this.user != null)
            {
                if (!string.IsNullOrEmpty(ChannelSession.Settings.JustGivingPageShortName))
                {
                    IEnumerable <JustGivingFundraiser> fundraisers = await this.GetCurrentFundraisers();

                    this.fundraiser = fundraisers.FirstOrDefault(f => f.pageShortName.Equals(ChannelSession.Settings.JustGivingPageShortName));
                }

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                AsyncRunner.RunAsyncBackground(this.BackgroundDonationCheck, this.cancellationTokenSource.Token, 60000);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

                this.TrackServiceTelemetry("JustGiving");
                return(new Result());
            }
            return(new Result(Resources.JustGivingUserDataFailed));
        }
Пример #2
0
        public async Task <IEnumerable <JustGivingDonation> > GetRecentDonations(JustGivingFundraiser fundraiser)
        {
            try
            {
                JustGivingDonationGroup group = await this.GetAsync <JustGivingDonationGroup>($"fundraising/pages/{fundraiser.pageShortName}/donations");

                if (group != null && group.donations != null)
                {
                    return(group.donations);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
            return(new List <JustGivingDonation>());
        }
        protected override async Task <Result> InitializeInternal()
        {
            this.cancellationTokenSource = new CancellationTokenSource();

            this.startTime = DateTimeOffset.Now;

            this.user = await this.GetCurrentAccount();

            if (this.user != null)
            {
                if (!string.IsNullOrEmpty(ChannelSession.Settings.JustGivingPageShortName))
                {
                    IEnumerable <JustGivingFundraiser> fundraisers = await this.GetCurrentFundraisers();

                    this.fundraiser = fundraisers.FirstOrDefault(f => f.pageShortName.Equals(ChannelSession.Settings.JustGivingPageShortName));
                }

                AsyncRunner.RunBackgroundTask(this.cancellationTokenSource.Token, 60000, this.BackgroundDonationCheck);
                this.TrackServiceTelemetry("JustGiving");
                return(new Result());
            }
            return(new Result("Unable to get User data"));
        }
Пример #4
0
 public void SetFundraiser(JustGivingFundraiser fundraiser)
 {
     this.fundraiser = fundraiser;
 }