Exemplo n.º 1
0
 /// <summary>
 /// Includes a collection of tolling events in the tolling events list's data source.
 /// </summary>
 /// <param name="far">true to include Final Audit Report events; otherwise, false to include Draft Audit Report events.</param>
 private void IncludeEvents(bool far)
 {
     if (_tollingEventsList != null)
     {
         var events = GetTollingEvents(far ? (AuditReportBase)_dar : _idr);
         if (events != null)
         {
             _tollingEventsList.DataSource = _tollingEventsList.DataSource.Union(events).ToList();
         }
         var messages = CmoAuditReview.GetTollingMessageIDs(CPProfile.Cid, CPProfile.ElectionCycle, far);
         if (messages != null)
         {
             _tollingEventsList.MessagesDataSource = _tollingEventsList.MessagesDataSource.Union(messages).ToDictionary(k => k.Key, v => v.Value);
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Handles the <see cref="TollingEventsList.UpdateDataSources"/> event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        protected void _tollingEventsList_UpdateDataSources(object sender, EventArgs e)
        {
            // tolling events list
            ScriptManager sm = ScriptManager.GetCurrent(this);

            if (!Page.IsPostBack || !this.IsDataBound || !_tollingEventsList.EnableViewState || (sm != null && sm.IsInAsyncPostBack))
            {
                AuditReportType type = _postElectionAuditNavigation.SelectedReportType;
                _tollingEventsList.Title = string.Format("{0} Tolling Event Details", _tollingEventsList.DisplayAllEvents ? "All" : CPConvert.ToString(type));
                switch (type)
                {
                case AuditReportType.FinalAuditReport:
                    _tollingEventsList.DataSource         = GetTollingEvents(_dar);
                    _tollingEventsList.MessagesDataSource = CmoAuditReview.GetTollingMessageIDs(CPProfile.Cid, CPProfile.ElectionCycle, true);
                    if (_tollingEventsList.DisplayAllEvents)
                    {
                        IncludeEvents(false);
                    }
                    break;

                case AuditReportType.DraftAuditReport:
                    _tollingEventsList.DataSource         = GetTollingEvents(_idr);
                    _tollingEventsList.MessagesDataSource = CmoAuditReview.GetTollingMessageIDs(CPProfile.Cid, CPProfile.ElectionCycle, false);
                    if (_tollingEventsList.DisplayAllEvents)
                    {
                        IncludeEvents(true);
                    }
                    break;

                default:
                    _tollingEventsList.DataSource         = GetTollingEvents(_idr);
                    _tollingEventsList.MessagesDataSource = CmoAuditReview.GetTollingMessageIDs(CPProfile.Cid, CPProfile.ElectionCycle, false);
                    if (_tollingEventsList.DisplayAllEvents)
                    {
                        IncludeEvents(true);
                    }
                    break;
                }
            }
        }
Exemplo n.º 3
0
        public ActionResult TollingEvents(AuditReportType id = AuditReportType.FinalAuditReport)
        {
            AuditReportBase source       = null,
                            secondSource = null;

            switch (id)
            {
            case AuditReportType.InitialDocumentationRequest:
                source = GetReport(AuditReportType.InitialDocumentationRequest);
                break;

            case AuditReportType.DraftAuditReport:
                source = GetReport(AuditReportType.DraftAuditReport);
                break;

            case AuditReportType.FinalAuditReport:
                source       = GetReport(AuditReportType.InitialDocumentationRequest);
                secondSource = GetReport(AuditReportType.DraftAuditReport);
                break;
            }
            return(PartialView(Mvc.Strings.Views.TollingEvents, AuditViewModelFactory.TollingEventsListFrom(source, CmoAuditReview.GetTollingMessageIDs(CPProfile.Cid, CPProfile.ElectionCycle, false), secondSource)));
        }