Esempio n. 1
0
        /// <summary>
        /// Handles the DoWork event of the bw control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="DoWorkEventArgs"/> instance containing the event data.</param>
        protected void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            using (_contributionReport = new ContributionReport(ReportOptions.Current, this))
            {
                _contributionReport.Resume        = this.Resume;
                _contributionReport.ResumeRunDate = this.ResumeRunDate;
                try
                {
                    _wasCancelled   = false;
                    _isRunning      = true;
                    _resultsSummary = _contributionReport.RunReport();
                }
                catch (Exception ex)
                {
                    App.LogException(ex);
                    throw;
                }
                finally
                {
                    _isRunning    = false;
                    _wasCancelled = _contributionReport.IsCancelled;
                }

                _contributionReport = null;
            }

            e.Result = _resultsSummary?.NumberOfGivingUnits > 0;
        }
Esempio n. 2
0
        public ResultsSummaryPage(ResultsSummary resultsSummary)
        {
            InitializeComponent();

            resultsSummary = resultsSummary ?? new ResultsSummary(new System.Collections.Generic.List <Client.FinancialStatementGeneratorRecipient>());

            lblNumberOfGivingUnits.Content = resultsSummary.NumberOfGivingUnits;
            lblTotalGivingAmount.Content   = resultsSummary.TotalAmount.ToString("C");

            pnlPaperlessStatements.Visibility                 = resultsSummary.PaperlessStatementsCount.HasValue ? Visibility.Visible : Visibility.Collapsed;
            lblNumberOfPaperlessStatements.Content            = resultsSummary.PaperlessStatementsCount;
            lblPaperlessStatementsTotalAmount.Content         = resultsSummary.PaperlessStatementTotalAmount?.ToString("C");
            lblPaperlessStatementsNumberOfIndividuals.Content = resultsSummary.PaperlessStatementsIndividualCount;
            if (resultsSummary.PaperStatementsSummaryList.Any())
            {
                resultsSummary.PaperStatementsSummaryList.LastOrDefault().BottomSeparatorVisibility = Visibility.Collapsed;
                pnlPaperStatementStatistics.Visibility = Visibility.Visible;
            }
            else
            {
                pnlPaperStatementStatistics.Visibility = Visibility.Collapsed;
            }

            rptReportStatistics.ItemsSource = resultsSummary.PaperStatementsSummaryList;
        }
Esempio n. 3
0
        public ResultsSummaryPage(ResultsSummary resultsSummary)
        {
            InitializeComponent();

            resultsSummary = resultsSummary ?? new ResultsSummary(new System.Collections.Generic.List <Client.FinancialStatementGeneratorRecipient>(),
                                                                  DateTime.Now,
                                                                  DateTime.Now,
                                                                  DateTime.Now);

            lblReportDates.Content = $"{resultsSummary.ReportStartDate:d} to {resultsSummary.ReportEndDate:d}";

            lblNumberOfGivingUnits.Content = resultsSummary.NumberOfGivingUnits;
            lblTotalGivingAmount.Content   = resultsSummary.TotalAmount.ToString("C");

            pnlPaperlessStatements.Visibility                 = resultsSummary.PaperlessStatementsCount.HasValue ? Visibility.Visible : Visibility.Collapsed;
            lblNumberOfPaperlessStatements.Content            = resultsSummary.PaperlessStatementsCount;
            lblPaperlessStatementsTotalAmount.Content         = resultsSummary.PaperlessStatementTotalAmount?.ToString("C");
            lblPaperlessStatementsNumberOfIndividuals.Content = resultsSummary.PaperlessStatementsIndividualCount;
            if (resultsSummary.PaperStatementsSummaryList.Any())
            {
                resultsSummary.PaperStatementsSummaryList.LastOrDefault().BottomSeparatorVisibility = Visibility.Collapsed;
                pnlPaperStatementStatistics.Visibility = Visibility.Visible;
            }
            else
            {
                pnlPaperStatementStatistics.Visibility = Visibility.Collapsed;
            }

            rptReportStatistics.ItemsSource = resultsSummary.PaperStatementsSummaryList;

            // Run Metrics
            lblStartDateTime.Content = resultsSummary.StartDateTime.ToString("g");
            lblEndDateTime.Content   = resultsSummary.EndDateTime.ToString("g");
            lblDuration.Content      = string.Format("{0:%h}h {0:%m}m {0:%s}s", resultsSummary.Duration);

            // Output the Results
            resultsSummary.SaveResultsToFile();
        }
Esempio n. 4
0
        /// <summary>
        /// Shows the results summary.
        /// </summary>
        /// <param name="resultsSummary">The results summary.</param>
        private void ShowResultsSummary(ResultsSummary resultsSummary)
        {
            ResultsSummaryPage resultsSummaryPage = new ResultsSummaryPage(resultsSummary);

            NavigationService.Navigate(resultsSummaryPage);
        }