void PullTopic()
        {
            Dispatcher.BeginInvoke(delegate
            {
                progressIndicator.IsVisible = true;
                progressIndicator.Text = "Getting Receipt...";
            });

            Task.Run(new Action(() =>
            {
                try
                {
                    dues = DuesMobile.GetReceipt(SettingsMobile.Instance.User.MemberId, SettingsMobile.Instance.User.LoginId, invoiceId);
                    Dispatcher.BeginInvoke(delegate
                    {
                        InvoiceId.Text = dues.InvoiceId.ToString().Replace("-", "");
                        DueDate.Text = dues.PaidDuesForMonth.ToShortDateString();
                        DuesPaid.Text = dues.BasePrice.ToString("N2");
                        FeesPaid.Text = dues.Fees.ToString("N2");
                        TotalPaid.Text = dues.PriceAfterFees.ToString("N2");
                        ReceiptEmailedTo.Text = dues.EmailForReceipt;

                        progressIndicator.IsVisible = false;
                    });
                }
                catch (Exception exception)
                {
                    ErrorHandler.Save(exception, MobileTypeEnum.WP8);
                }
            }));


        }
 public static DuesReceipt GetReceiptForDues(Guid invoiceId)
 {
     DuesReceipt re = new DuesReceipt();
     try
     {
         PaymentGateway pg = new PaymentGateway();
         var invoice = pg.GetDisplayInvoice(invoiceId);
         var duesItem = invoice.DuesItems.FirstOrDefault();
         var mem = MemberCache.GetMemberDisplay(duesItem.MemberPaidId);
         re.InvoiceId = invoice.InvoiceId;
         var league = MemberCache.GetLeagueOfMember(duesItem.MemberPaidId);
         re.LeagueId = league.LeagueId;
         re.LeagueName = league.Name;
         re.BasePrice = duesItem.BasePrice;
         re.PriceAfterFees = duesItem.PriceAfterFees;
         re.Fees = duesItem.ProcessorFees;
         re.PaidDuesForMonth = duesItem.PaidForDate;
         re.MemberPaid = mem.DerbyName;
         re.EmailForReceipt = mem.Email;
     }
     catch (Exception exception)
     {
         ErrorDatabaseManager.AddException(exception, exception.GetType());
     }
     return re;
 }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            try
            {
                dues = new Portable.Classes.Controls.Dues.DuesReceipt();
                progressIndicator = SystemTray.ProgressIndicator;
                progressIndicator = new ProgressIndicator();
                SystemTray.SetProgressIndicator(this, progressIndicator);
                progressIndicator.IsIndeterminate = true;
                progressIndicator.Text = "Getting Receipt...";
                if (SettingsMobile.Instance.User == null)
                {
                    SqlFactory fact = new SqlFactory();
                    SettingsMobile.Instance.User = fact.GetProfile();
                }
                invoiceId = new Guid(this.NavigationContext.QueryString["ivId"]);
                PullTopic();
            }
            catch (Exception exception)
            {
                ErrorHandler.Save(exception, MobileTypeEnum.WP8);
            }

        }