Esempio n. 1
0
        // GET: Audit/PostElection
        public ActionResult Index()
        {
            var  idr              = GetReport(AuditReportType.InitialDocumentationRequest);
            var  dar              = GetReport(AuditReportType.DraftAuditReport);
            var  far              = GetReport(AuditReportType.FinalAuditReport);
            var  cid              = CPProfile.Cid;
            var  ec               = CPProfile.ElectionCycle;
            var  training         = CPProfile.TrainingStatus;
            bool trainingComplete = training != null && training.AuditComplianceAchieved;
            var  model            = AuditViewModelFactory.PostElectionFrom(
                idr: idr,
                dar: dar,
                far: far,
                agencyPhone: CPProviders.SettingsProvider.AgencyPhoneNumber,
                darTollingDays: idr != null ? idr.TollingDaysIncurred : InitialDocumentationRequest.CountDarTollingDaysIncurred(cid, ec),
                farTollingDays: dar != null ? dar.TollingDaysIncurred : DraftAuditReport.CountFarTollingDaysIncurred(cid, ec),
                darIssueDate: DraftAuditReport.GetOriginalIssuanceDate(cid, ec),
                farIssueDate: FinalAuditReport.GetOriginalIssuanceDate(cid, ec),
                farOffsetMonths: trainingComplete ? FinalAuditReport.TrainingCompliantFarTargetOffsetMonths : 0,
                suspended: CPProfile.PESuspension != null);

            return(View(model));
        }
Esempio n. 2
0
        /// <summary>
        /// Raises the <see cref="Control.Load"/> event.
        /// </summary>
        /// <param name="e">The <see cref="EventArgs"/> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.EnsureChildControls();

            // detect DAR/FAR availability
            _idr = CPProfile.InitialDocumentationRequest;
            _dar = CPProfile.DraftAuditReport;
            _far = CPProfile.FinalAuditReport;

            // detect post election audit report navigation info
            if (!Page.IsPostBack || !this.IsDataBound || !_postElectionAuditNavigation.EnableViewState)
            {
                _postElectionAuditNavigation.DarPresent        = _dar != null;
                _postElectionAuditNavigation.DarTollingPresent = _idr != null && _idr.TollingEvents.Count > 0;
                _postElectionAuditNavigation.FarPresent        = _far != null;
                _postElectionAuditNavigation.FarTollingPresent = _dar != null && _dar.TollingEvents.Count > 0;
            }

            // populate immediate page data
            if (!Page.IsPostBack || !this.IsDataBound)
            {
                // DAR issue dates
                int darTollingDays = _idr != null ? _idr.TollingDaysIncurred : InitialDocumentationRequest.CountDarTollingDaysIncurred(CPProfile.Cid, CPProfile.ElectionCycle);
                _darTollingDaysLabel.Text = darTollingDays.ToString();
                DateTime?issueDate = DraftAuditReport.GetOriginalIssuanceDate(CPProfile.Cid, CPProfile.ElectionCycle);
                if (issueDate.HasValue)
                {
                    _darOriginalIssueDateLabel.Text = issueDate.Value.ToShortDateString();
                    _darCurrentIssueDateLabel.Text  = issueDate.Value.AddDays(darTollingDays).ToShortDateString();
                }

                // FAR issue dates
                int farTollingDays = _dar != null ? _dar.TollingDaysIncurred : DraftAuditReport.CountFarTollingDaysIncurred(CPProfile.Cid, CPProfile.ElectionCycle);
                _farTollingDaysLabel.Text   = farTollingDays.ToString();
                _totalTollingDaysLabel.Text = (darTollingDays + farTollingDays).ToString();
                issueDate = CPProfile.FarIssuanceDate;
                if (issueDate.HasValue)
                {
                    _farOriginalIssueDateLabel.Text = issueDate.Value.ToShortDateString();
                    // BUGFIX #54: FAR Original Date is wrong when Audit Training Compliance status is achieved
                    TrainingStatus training = CPProfile.TrainingStatus;
                    if (this.TrainingCompliance.Visible = this.TrainingComplianceReference.Visible = training != null && training.AuditComplianceAchieved)
                    {
                        issueDate = issueDate.Value.AddMonths(FinalAuditReport.TrainingCompliantFarTargetOffsetMonths);
                    }
                    _farCurrentIssueDateLabel.Text = issueDate.Value.AddDays(darTollingDays + farTollingDays).ToShortDateString();
                }

                // immediate report data
                switch (_postElectionAuditNavigation.SelectedReportType)
                {
                case AuditReportType.DraftAuditReport:
                    DataBindToReport(_dar);
                    // check for "no findings" condition
                    _reportSummary.NoFindingsOverride = _dar == null && _far != null;
                    break;

                case AuditReportType.FinalAuditReport:
                    DataBindToReport(_far);
                    break;

                default:
                    _idr = CPProfile.InitialDocumentationRequest;
                    DataBindToReport(_idr);
                    break;
                }

                // current status/suspension check
                if (CPProfile.PESuspension != null)
                {
                    _currentStatus.Text            = SuspensionText;
                    _currentStatus.CssClass        = "campaign";
                    _darCurrentIssueDateLabel.Text = _farCurrentIssueDateLabel.Text = "(n/a)";
                }
                else if (_far != null)
                {
                    _currentStatus.Text     = FinalAuditCompleteText;
                    _currentStatus.CssClass = null;
                }
                else
                {
                    bool responseReceived = false;
                    InadequateEventBase inadequate;
                    if (_dar != null)
                    {
                        inadequate = _dar.InadequateNotice;
                        if (inadequate != null)
                        {
                            responseReceived    = inadequate.ResponseReceived;
                            _currentStatus.Text = responseReceived ? UnderReviewText : DarInadequatePendingText;
                        }
                        else
                        {
                            responseReceived    = _dar.ResponseReceived;
                            _currentStatus.Text = responseReceived ? UnderReviewText : DarPendingText;
                        }
                    }
                    else if (_idr != null)
                    {
                        inadequate = _idr.InadequateNotice;
                        if (inadequate != null)
                        {
                            responseReceived    = inadequate.ResponseReceived;
                            _currentStatus.Text = responseReceived ? UnderReviewText : IdrInadequatePendingText;
                        }
                        else
                        {
                            responseReceived    = _idr.ResponseReceived;
                            _currentStatus.Text = responseReceived ? UnderReviewText : IdrPendingText;
                        }
                    }
                    if (!responseReceived)
                    {
                        _currentStatus.CssClass = "campaign";
                    }
                }
                _tollingEventsList.DataBind();

                this.MarkAsDataBound();
            }
        }