Esempio n. 1
0
        /// <summary>
        /// Converts the value of the specified <see cref="TollingEndReason"/> to its equivalent <see cref="String"/> representation.
        /// </summary>
        /// <param name="reason">A tolling event end reason.</param>
        /// <returns>The <see cref="String"/> equivalent of the value of <paramref name="reason"/>.</returns>
        public static string ToString(TollingEndReason reason)
        {
            switch (reason)
            {
            case TollingEndReason.AllegedViolationNotice:
                return("Notice of Alleged Violation");

            case TollingEndReason.Error:
                return("Disposition Error");

            case TollingEndReason.DraftAuditReport:
                return("Draft Audit Report Issued");

            case TollingEndReason.Extension:
                return("Extension Granted");

            case TollingEndReason.FinalAuditReport:
                return("Final Audit Report Issued");

            case TollingEndReason.NoResponse:
                return("No Response Received");

            case TollingEndReason.ResponseReceived:
                return("Response Received");

            case TollingEndReason.AgreementExpired:
                return("Agreement Expired");

            default:
                return(string.Empty);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Retrieves a collection of post election events that affect tolling for the Draft Audit Report or Final Audit Report.
        /// </summary>
        /// <param name="candidateID">The ID of the candidate whose events are to be retrieved.</param>
        /// <param name="electionCycle">The election cycle in which to search.</param>
        /// <param name="far">true to retrieve events for the Final Audit Report; otherwise, false to retreive events for the Draft Audit Report.</param>
        /// <returns>A collection of tolling events that affect Draft Audit Report tolling.</returns>
        public List <TollingEvent> GetTollingEvents(string candidateID, string electionCycle, bool far)
        {
            DateTime?minStartDate = GetTollingStartDate(electionCycle);

            using (PostElectionTds ds = new PostElectionTds())
            {
                using (TollingEventsTableAdapter ta = new TollingEventsTableAdapter())
                {
                    ta.Fill(ds.TollingEvents, candidateID, electionCycle, far);
                }
                List <TollingEvent> events = new List <TollingEvent>(ds.TollingEvents.Count);
                foreach (PostElectionTds.TollingEventsRow row in ds.TollingEvents)
                {
                    if (row.IsStartDateNull())
                    {
                        continue;
                    }
                    TollingLetter letter = GetTollingLetter(row.SourceCode.Trim(), row.EventCode.Trim(), row.TypeCode.Trim()) ?? new TollingLetter(byte.MinValue)
                    {
                        SourceCode = new TollingCode(TollingCodeType.SourceCode, byte.MinValue)
                        {
                            Code = row.SourceCode.Trim()
                        },
                        EventCode = new TollingCode(TollingCodeType.EventCode, byte.MinValue)
                        {
                            Code = row.EventCode.Trim()
                        },
                        TypeCode = new TollingCode(TollingCodeType.TypeCode, byte.MinValue)
                        {
                            Code = row.TypeCode.Trim()
                        },
                        Description = row.Description,
                        Title       = row.Description
                    };
                    // first fetch end reason to determine end date inclusion in tolling days
                    TollingEndReason reason = CPConvert.ToTollingEndReason(row.EndReasonCode.Trim());
                    events.Add(new TollingEvent(row.StartDate, row.IsEndDateNull() ? DateTime.Now : row.EndDate)
                    {
                        Description          = letter.Description,
                        Title                = letter.Title,
                        TollingEventNumber   = row.EventNumber,
                        TollingLetter        = letter,
                        TollingStartDate     = minStartDate.HasValue && row.StartDate < minStartDate ? minStartDate.Value : row.StartDate,
                        TollingEndDate       = row.IsEndDateNull() ? null : (DateTime?)row.EndDate,
                        TollingDueDate       = row.IsDueDateNull() ? null : (DateTime?)row.DueDate,
                        TollingEndReason     = reason,
                        ReferenceEventNumber = row.RefEventNumber
                    });
                }
                return(events);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Retrieves a collection of Post Election Draft Audit Response Inadequate Response events for a specific candidate and election cycle.
        /// </summary>
        /// <param name="candidateID">The ID of the candidate whose DAR Inadequate Response events are to be retrieved.</param>
        /// <param name="electionCycle">The election cycle in which to search.</param>
        /// <param name="retrievalType">The type of inadequate event criteria to use for retrieval.</param>
        /// <returns>A collection of Post Election Draft Audit Response Inadequate Response events matching the specified criteria.</returns>
        public List <DarInadequateEvent> GetDarInadequateEvents(string candidateID, string electionCycle, InadequateEventRetrieval retrievalType)
        {
            // interpret retrieval type
            bool?additionals;

            switch (retrievalType)
            {
            case InadequateEventRetrieval.InitialEvent:
                additionals = false;
                break;

            case InadequateEventRetrieval.AdditionalEvents:
                additionals = true;
                break;

            default:
                additionals = null;
                break;
            }

            // determine minimum start date
            DateTime?minStartDate = GetTollingStartDate(electionCycle);

            // retrieve and parse data
            using (PostElectionTds ds = new PostElectionTds())
            {
                using (InadequateEventsTableAdapter ta = new InadequateEventsTableAdapter())
                {
                    ta.Fill(ds.InadequateEvents, candidateID, electionCycle, true, additionals);
                }
                List <DarInadequateEvent> events = new List <DarInadequateEvent>();
                foreach (PostElectionTds.InadequateEventsRow row in ds.InadequateEvents)
                {
                    TollingLetter letter = GetTollingLetter(row.SourceCode.Trim(), row.EventCode.Trim(), row.TypeCode.Trim()) ?? new TollingLetter(byte.MinValue)
                    {
                        SourceCode = new TollingCode(TollingCodeType.SourceCode, byte.MinValue)
                        {
                            Code = row.SourceCode.Trim()
                        },
                        EventCode = new TollingCode(TollingCodeType.EventCode, byte.MinValue)
                        {
                            Code = row.EventCode.Trim()
                        },
                        TypeCode = new TollingCode(TollingCodeType.TypeCode, byte.MinValue)
                        {
                            Code = row.TypeCode.Trim()
                        },
                        Description = row.Description,
                        Title       = row.Description
                    };
                    // first fetch end reason to determine end date inclusion in tolling days
                    TollingEndReason   reason     = CPConvert.ToTollingEndReason(row.EndReasonCode.Trim());
                    DarInadequateEvent inadequate = new DarInadequateEvent(row.SentDate, row.IsAdditionalFlagNull() ? false : row.AdditionalFlag)
                    {
                        ReceiptDate           = row.IsReceiptDateNull() ? null : (DateTime?)row.ReceiptDate,
                        SecondSentDate        = row.IsSecondSentDateNull() ? null : (DateTime?)row.SecondSentDate,
                        SecondReceiptDate     = row.IsSecondReceiptDateNull() ? null : (DateTime?)row.SecondReceiptDate,
                        ResponseSubmittedDate = row.IsResponseSubmittedDateNull() ? null : (DateTime?)row.ResponseSubmittedDate,
                        // tolling event properties
                        Description        = letter.Description,
                        Title              = letter.Title,
                        TollingEventNumber = row.EventNumber,
                        TollingLetter      = letter,
                        TollingStartDate   = minStartDate.HasValue && row.StartDate < minStartDate ? minStartDate.Value : row.StartDate,
                        TollingEndDate     = row.IsEndDateNull() ? null : (DateTime?)row.EndDate,
                        TollingEndReason   = reason
                    };
                    inadequate.ResponseDeadline = new DarInadequateDeadline(row.DueDate, inadequate)
                    {
                        ResponseReceivedDate = row.IsResponseReceivedDateNull() ? null : (DateTime?)row.ResponseReceivedDate,
                        SecondDueDate        = row.IsSecondDueDateNull() ? null : (DateTime?)row.SecondDueDate
                    };
                    events.Add(inadequate);
                }
                return(events);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Retrieves the Post Election Draft Audit Report Inadequate Response event for a specific candidate and election cycle.
        /// </summary>
        /// <param name="candidateID">The ID of the candidate whose DAR Inadequate Response event is to be retrieved.</param>
        /// <param name="electionCycle">The election cycle in which to search.</param>
        /// <param name="published">Whether or not to retrieve published data.</param>
        /// <returns>The Post Election Draft Audit Report Inadequate Response event for the candidate and election cycle specified if found; otherwise, null.</returns>
        public DarInadequateEvent GetDarInadequateEvent(string candidateID, string electionCycle, bool published)
        {
            DarInadequateEvent inadequate = null;

            using (PostElectionTds ds = new PostElectionTds())
            {
                if (published)
                {
                    DateTime?minStartDate = GetTollingStartDate(electionCycle);
                    using (InadequateEventsTableAdapter ta = new InadequateEventsTableAdapter())
                    {
                        ta.Fill(ds.InadequateEvents, candidateID, electionCycle, true, false);
                    }
                    foreach (PostElectionTds.InadequateEventsRow row in ds.InadequateEvents)
                    {
                        TollingLetter letter = GetTollingLetter(row.SourceCode.Trim(), row.EventCode.Trim(), row.TypeCode.Trim()) ?? new TollingLetter(byte.MinValue)
                        {
                            SourceCode = new TollingCode(TollingCodeType.SourceCode, byte.MinValue)
                            {
                                Code = row.SourceCode.Trim()
                            },
                            EventCode = new TollingCode(TollingCodeType.EventCode, byte.MinValue)
                            {
                                Code = row.EventCode.Trim()
                            },
                            TypeCode = new TollingCode(TollingCodeType.TypeCode, byte.MinValue)
                            {
                                Code = row.TypeCode.Trim()
                            },
                            Description = row.Description,
                            Title       = row.Description
                        };
                        // first fetch end reason to determine end date inclusion in tolling days
                        TollingEndReason reason = CPConvert.ToTollingEndReason(row.EndReasonCode.Trim());
                        inadequate = new DarInadequateEvent(row.SentDate)
                        {
                            ReceiptDate           = row.IsReceiptDateNull() ? null : (DateTime?)row.ReceiptDate,
                            SecondSentDate        = row.IsSecondSentDateNull() ? null : (DateTime?)row.SecondSentDate,
                            SecondReceiptDate     = row.IsSecondReceiptDateNull() ? null : (DateTime?)row.SecondReceiptDate,
                            ResponseSubmittedDate = row.IsResponseSubmittedDateNull() ? null : (DateTime?)row.ResponseSubmittedDate,
                            // tolling event properties
                            Description        = letter.Description,
                            Title              = letter.Title,
                            TollingEventNumber = row.EventNumber,
                            TollingLetter      = letter,
                            TollingStartDate   = minStartDate.HasValue && row.StartDate < minStartDate ? minStartDate.Value : row.StartDate,
                            TollingEndDate     = row.IsEndDateNull() ? null : (DateTime?)row.EndDate,
                            TollingEndReason   = reason
                        };
                        inadequate.ResponseDeadline = new DarInadequateDeadline(row.DueDate, inadequate)
                        {
                            ResponseReceivedDate = row.IsResponseReceivedDateNull() ? null : (DateTime?)row.ResponseReceivedDate,
                            SecondDueDate        = row.IsSecondDueDateNull() ? null : (DateTime?)row.SecondDueDate
                        };
                        break;
                    }
                }
                else
                {
                    using (InadequateEventsDirectTableAdapter ta = new InadequateEventsDirectTableAdapter())
                    {
                        ta.Fill(ds.InadequateEventsDirect, candidateID, electionCycle, true, false);
                    }
                    foreach (PostElectionTds.InadequateEventsDirectRow row in ds.InadequateEventsDirect)
                    {
                        inadequate = new DarInadequateEvent(row.SentDate)
                        {
                            ReceiptDate           = row.IsReceiptDateNull() ? null : (DateTime?)row.ReceiptDate,
                            SecondSentDate        = row.IsSecondSentDateNull() ? null : (DateTime?)row.SecondSentDate,
                            SecondReceiptDate     = row.IsSecondReceiptDateNull() ? null : (DateTime?)row.SecondReceiptDate,
                            ResponseSubmittedDate = row.IsResponseSubmittedDateNull() ? null : (DateTime?)row.ResponseSubmittedDate,
                        };
                        inadequate.ResponseDeadline = new DarInadequateDeadline(row.DueDate, inadequate)
                        {
                            ResponseReceivedDate = row.IsResponseReceivedDateNull() ? null : (DateTime?)row.ResponseReceivedDate,
                            SecondDueDate        = row.IsSecondDueDateNull() ? null : (DateTime?)row.SecondDueDate
                        };
                        break;
                    }
                }
            }
            return(inadequate);
        }