Ejemplo 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;
        }
Ejemplo n.º 2
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>
        /// <exception cref="System.NotImplementedException"></exception>
        protected void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            ContributionReport contributionReport = new ContributionReport(ReportOptions.Current);

            contributionReport.OnProgress += contributionReport_OnProgress;

            _statementCount = contributionReport.RunReport();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the Click event of the btnResumeYes control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void btnResumeYes_Click(object sender, RoutedEventArgs e)
        {
            var lastRunGeneratorConfig = ContributionReport.GetSavedGeneratorConfigFromLastRun();

            var nextPage = new ProgressPage(true, lastRunGeneratorConfig.RunDate);

            ReportOptions.LoadFromConfig(lastRunGeneratorConfig);
            this.NavigationService.Navigate(nextPage);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Handles the Loaded event of the startPage control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void startPage_Loaded(object sender, RoutedEventArgs e)
        {
            btnStart.Visibility          = Visibility.Visible;
            pnlPromptToResume.Visibility = Visibility.Collapsed;
            txtIntro.Visibility          = Visibility.Visible;

            var lastRunGeneratorConfig = ContributionReport.GetSavedGeneratorConfigFromLastRun();

            if (lastRunGeneratorConfig != null)
            {
                if (lastRunGeneratorConfig.ReportsCompleted)
                {
                    // last run completed successfully.
                    return;
                }

                var lastRunDate = lastRunGeneratorConfig.RunDate;

                ContributionReport.EnsureIncompletedSavedRecipientListCompletedStatus(lastRunDate);

                var savedRecipientList = ContributionReport.GetSavedRecipientList(lastRunDate);
                if (savedRecipientList == null)
                {
                    return;
                }

                var lastIncomplete = savedRecipientList.FirstOrDefault(a => a.IsComplete == false);
                if (lastIncomplete != null)
                {
                    pnlPromptToResume.Visibility = Visibility.Visible;
                    btnStart.Visibility          = Visibility.Hidden;
                    var fullName = $"{lastIncomplete.NickName} {lastIncomplete.LastName}";
                    if (fullName.Trim().IsNullOrWhiteSpace())
                    {
                        fullName = $"GroupId: {lastIncomplete.GroupId}";
                    }
                    lblPromptToResume.Text = $"It appears that a previous generation session is active. The last attempted recipient was {fullName}. Do you wish to continue with this session?";
                    txtIntro.Visibility    = Visibility.Collapsed;
                    return;
                }
                else if (!lastRunGeneratorConfig.ReportsCompleted)
                {
                    pnlPromptToResume.Visibility = Visibility.Visible;
                    btnStart.Visibility          = Visibility.Hidden;
                    lblPromptToResume.Text       = $"It appears that a previous generation session has not completed. Do you wish to continue with this session?";
                    txtIntro.Visibility          = Visibility.Collapsed;
                    return;
                }
            }
        }
Ejemplo n.º 5
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>
        /// <exception cref="System.NotImplementedException"></exception>
        protected void bw_DoWork( object sender, DoWorkEventArgs e )
        {
            ContributionReport contributionReport = new ContributionReport( ReportOptions.Current );
            contributionReport.OnProgress += contributionReport_OnProgress;

            var doc = contributionReport.RunReport();

            if ( doc != null )
            {
                ShowProgress( 0, 0, "Rendering PDF..." );
                byte[] pdfData = doc.Draw();
                e.Result = pdfData;
            }
            else
            {
                e.Result = null;
            }
        }
Ejemplo n.º 6
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>
        /// <exception cref="System.NotImplementedException"></exception>
        protected void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            ContributionReport contributionReport = new ContributionReport(ReportOptions.Current);

            contributionReport.OnProgress += contributionReport_OnProgress;

            var doc = contributionReport.RunReport();

            if (doc != null)
            {
                ShowProgress(0, 0, "Rendering PDF...");
                byte[] pdfData = doc.Draw();
                e.Result = pdfData;
            }
            else
            {
                e.Result = null;
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Handles the OnProgress event of the contributionReport control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="ContributionReport.ProgressEventArgs"/> instance containing the event data.</param>
 protected void contributionReport_OnProgress( object sender, ContributionReport.ProgressEventArgs e )
 {
     ShowProgress( e.Position, e.Max, e.ProgressMessage );
 }