/// <summary> /// Binds the page to data contained in a post election audit report. /// </summary> /// <param name="report">The report to bind to.</param> private void DataBindToReport(AuditReportBase report) { this.EnsureChildControls(); // report dates _reportSummary.DataSource = report; if (report != null) { _reportSummary.MessagesDataSource = CmoAuditReview.GetAuditReportMessageIDs(CPProfile.Cid, CPProfile.ElectionCycle); // inadequate response dates report = report.InadequateNotice; if (_inadequateSummary.Visible = report != null) { _reportSummary.CssClass = "left column two-up"; _inadequateSummary.DataSource = report; _inadequateSummary.MessagesDataSource = _reportSummary.MessagesDataSource; _inadequateSummary.DataBind(); } } _reportSummary.DataBind(); // force display of title when report is null if (report == null) { _reportSummary.Title = CPConvert.ToString(_postElectionAuditNavigation.SelectedReportType); } }
private AuditReportBase GetReport(AuditReportType type) { string key = string.Join(type.GetType().FullName, "_", type.ToString()); AuditReportBase report = null; if (ViewData.ContainsKey(key)) { report = ViewData[key] as AuditReportBase; } if (report == null) { switch (type) { case AuditReportType.InitialDocumentationRequest: report = CPProfile.InitialDocumentationRequest; break; case AuditReportType.DraftAuditReport: report = CPProfile.DraftAuditReport; break; case AuditReportType.FinalAuditReport: report = CPProfile.FinalAuditReport; break; } if (report != null) { ViewData[key] = report; } } return(report); }
public static PostElectionSummaryViewModel PostElectionSummaryFrom(AuditReportBase source, IDictionary <AuditReportType, string> messageIDs) { var inadequate = source != null ? source.InadequateNotice : null; var model = new PostElectionSummaryViewModel { ReportResponse = source == null ? null : PostElectionResponseFrom(source, messageIDs), InadequateResponse = inadequate == null ? null : PostElectionResponseFrom(inadequate, messageIDs) }; return(model); }
private static PostElectionResponseViewModel PostElectionResponseFrom(AuditReportBase source, IDictionary <AuditReportType, string> messageIDs) { return(source == null ? new PostElectionResponseViewModel() : new PostElectionResponseViewModel { ReportTypeText = source.IsInadequateNotice ? "Notice" : source.AuditReportType == AuditReportType.InitialDocumentationRequest ? "Request" : "Report", SentDate = source.SentDate, SecondSentDate = source.SecondSentDate, DueDate = source.DueDate, ReceivedDate = source.ResponseReceivedDate, PostmarkedDate = source.ResponseSubmittedDate, MessageID = messageIDs != null && messageIDs.ContainsKey(source.AuditReportType) ? messageIDs[source.AuditReportType] : null, Overdue = source.DueDate.HasValue && DateTime.Today > source.DueDate.Value, ReportType = source.AuditReportType, IsInadequate = source.IsInadequateNotice }); }
public static TollingEventsListViewModel TollingEventsListFrom(AuditReportBase source, IDictionary <int, string> messageIDs, AuditReportBase secondSource = null) { if (secondSource == null) { return(source == null ? new TollingEventsListViewModel() : new TollingEventsListViewModel { ReportType = source.AuditReportType, Events = from t in source.TollingEvents select TollingEventFrom(t, messageIDs.ContainsKey(t.TollingEventNumber)?messageIDs[t.TollingEventNumber] : null) }); } var allEvents = TollingEventsListFrom(source, messageIDs); allEvents.Events = allEvents.Events.Concat(TollingEventsListFrom(secondSource, messageIDs).Events); allEvents.ReportType = null; return(allEvents); }
/// <summary> /// Controls how data is retrieved and bound to the control. /// </summary> protected override void PerformSelect() { AuditReportBase ds = this.DataSource; if (ds != null) { // alternate titles for IDR switch (ds.AuditReportType) { case AuditReportType.InitialDocumentationRequest: this.SentTitle = "Request Sent"; this.SecondSentTitle = "Second Request Sent"; break; case AuditReportType.IdrInadequateResponse: case AuditReportType.IdrAdditionalInadequateResponse: case AuditReportType.DarInadequateResponse: case AuditReportType.DarAdditionalInadequateResponse: this.SentTitle = "Notice Sent"; this.SecondSentTitle = "Second Notice Sent"; break; } this.Title = ds.IsInadequateNotice ? "Inadequate Response Notice" : CPConvert.ToString(ds.AuditReportType); this.SentDate = ds.SentDate; this.SecondSentDate = ds.SecondSentDate; this.DueDate = ds.DueDate; this.ResponseDate = ds.ResponseReceivedDate; this.PostmarkDate = ds.ResponseSubmittedDate; string messageID; this.MessageID = this.MessagesDataSource != null && this.MessagesDataSource.TryGetValue(ds.AuditReportType, out messageID) ? messageID : null; } else { this.Title = DefaultTitle; this.SentTitle = DefaultSentTitle; this.SecondSentTitle = DefaultSecondSentTitle; this.SentDate = this.SecondSentDate = this.DueDate = this.ResponseDate = this.PostmarkDate = null; this.MessageID = null; } this.MarkAsDataBound(); }
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))); }
public static PostElectionViewModel PostElectionFrom(AuditReportBase idr, AuditReportBase dar, AuditReportBase far, string agencyPhone, int darTollingDays, int farTollingDays, DateTime?darIssueDate, DateTime?farIssueDate, int farOffsetMonths, bool suspended) { var current = far ?? dar ?? idr; // auto-select most recent one var model = new PostElectionViewModel { AgencyPhoneNumber = agencyPhone, DarOriginalDeadline = darIssueDate, DarTollingDays = darTollingDays, DarTargetDeadline = darIssueDate.HasValue ? (DateTime?)darIssueDate.Value.AddDays(darTollingDays) : null, FarOriginalDeadline = farIssueDate, FarTollingDays = farTollingDays, FarTargetDeadline = farIssueDate.HasValue ? (DateTime?)farIssueDate.Value.AddMonths(farOffsetMonths).AddDays(darTollingDays + farTollingDays) : null, HasTrainingCompliance = farOffsetMonths != 0, TotalTollingDays = darTollingDays + farTollingDays, Suspended = suspended, Stage = current != null ? current.AuditReportType : AuditReportType.InitialDocumentationRequest }; if (suspended) { model.CurrentStatus = PostElectionStatus.Suspended; } else if (far != null) { model.CurrentStatus = PostElectionStatus.FinalAuditComplete; } else if (current != null) { if (current.InadequateNotice != null) { current = current.InadequateNotice; } if (current.ResponseReceived) { model.CurrentStatus = PostElectionStatus.UnderReview; } else { switch (current.AuditReportType) { case AuditReportType.DarInadequateResponse: case AuditReportType.DarAdditionalInadequateResponse: model.CurrentStatus = PostElectionStatus.PendingDarInadequate; break; case AuditReportType.IdrInadequateResponse: case AuditReportType.IdrAdditionalInadequateResponse: model.CurrentStatus = PostElectionStatus.PendingIdrInadequate; break; case AuditReportType.DraftAuditReport: model.CurrentStatus = PostElectionStatus.PendingDar; break; case AuditReportType.InitialDocumentationRequest: model.CurrentStatus = PostElectionStatus.PendingIdr; break; } } } return(model); }
/// <summary> /// Retrieves the tolling events from a post election audit report. /// </summary> /// <param name="report">The report to analyze.</param> /// <returns>The tolling events contained in <paramref name="report"/> if not null; otherwise, null.</returns> private TollingEventCollection GetTollingEvents(AuditReportBase report) { return(report == null ? null : report.TollingEvents); }
/// <summary> /// Posts a CMO message for viewing by C-Access accounts and . /// </summary> /// <param name="candidateID">The CFIS ID of the candidate recipient of the message to post.</param> /// <param name="messageID">The ID of the message to post.</param> /// <param name="version">The version of the message to post.</param> /// <param name="notify">true if posted message notifications should be sent; otherwise, false.</param> /// <returns>true if the message was succesfully posted; otherwise, false.</returns> /// <remarks>For Post Election Audit messages, posting will fail if the CFIS dates were unsuccessfully updated, the post election audit workflow would be disrupted, or a response was already received.</remarks> public bool PostCmoMessage(string candidateID, int messageID, byte[] version, bool notify) { CmoMessage message = GetCmoMessage(candidateID, messageID); if (message != null) { if (!message.IsPosted) { if (RequiresPostElectionDateUpdate(message)) { // check for post election audit workflow violation AuditReportBase pear = null; if (message.IsInitialDocumentationRequest) { pear = GetInitialDocumentationRequest(candidateID, message.ElectionCycle, false); } else if (message.IsIdrInadequateResponseLetter) { pear = GetIdrInadequateEvent(candidateID, message.ElectionCycle, false); } else if (message.IsDraftAuditReport) { pear = GetDraftAuditReport(candidateID, message.ElectionCycle, false); } if (pear != null && (pear.ResponseReceived || !HasValidPostElectionRequestType(message, pear.IsSecondRequest))) { return(false); } // update CFIS dates for post election audit messages if (!UpdatePostElectionDates(message)) { return(false); } } using (Data.CmoEntities context = new Data.CmoEntities()) { var ret = context.CmoPostMessage(candidateID, messageID, version).FirstOrDefault(); if (ret.HasValue && ret.Value > 0) { // secure all attachments if ((CmoRepository.Repository != null) && message.HasAttachment) { CmoRepository.Repository.LockDown(message); } message.Reload(); // send notification if (notify) { // BUGFIX #60: To prevent timeout of long-running email notification operations, failed recipient notification // will be included in the internal carbon-copy, and sending will be executed asynchronously. Func <CmoMessage, LoadCandidateEventHandler, IEnumerable <CPUser>, bool> notifyAsync = CmoPostedMessageNotice.SendFor; notifyAsync.BeginInvoke(message, this.GetCandidate, null, null, null); } return(true); } } } } return(false); }