/// <summary> /// Counts the number of post election audit tolling days incurred by a candidate for a specific election cycle. /// </summary> /// <param name="candidateID">The ID of the desired candidate.</param> /// <param name="electionCycle">The desired election cycle.</param> /// <param name="isFar">true to count Final Audit Report tolling days; otherwise, false to count Draft Audit Report tolling days.</param> /// <returns>The number of tolling days incurred that match the criteria specified.</returns> public int CountTollingDaysIncurred(string candidateID, string electionCycle, bool isFar) { using (PostElectionTableAdapter ta = new PostElectionTableAdapter()) { int?tollingDays = null; ta.GetTollingDays(candidateID, electionCycle, isFar, ref tollingDays); return(tollingDays ?? 0); } }
/// <summary> /// Retrieves the date when post-election tolling events begin for a specific election cycle. /// </summary> /// <param name="electionCycle">The desired election cycle.</param> /// <returns>The date when post-election tolling events begin for the specified election cycle if found; otherwise, null.</returns> public DateTime?GetTollingStartDate(string electionCycle) { using (PostElectionTableAdapter ta = new PostElectionTableAdapter()) { DateTime?startDate = null; ta.GetTollingStartDate(electionCycle, ref startDate); return(startDate); } }
/// <summary> /// Updates the post election dates corresponding to a CMO post election audit message in CFIS. /// </summary> /// <param name="message">The post election audit message to update.</param> /// <returns>true if the post election dates were successfully updated in CFIS; otherwise, false.</returns> private bool UpdatePostElectionDates(CmoMessage message) { if (message == null) { return(false); } AuditReportType type; if (message.IsInitialDocumentationRequest) { type = AuditReportType.InitialDocumentationRequest; } else if (message.IsIdrInadequateResponseLetter) { type = AuditReportType.IdrInadequateResponse; } else if (message.IsIdrAdditionalInadequateLetter) { type = AuditReportType.IdrAdditionalInadequateResponse; } else if (message.IsDarInadequateResponseLetter) { type = AuditReportType.DarInadequateResponse; } else if (message.IsDarAdditionalInadequateLetter) { type = AuditReportType.DarAdditionalInadequateResponse; } else { return(false); } using (PostElectionTableAdapter ta = new PostElectionTableAdapter()) { object retObj; // SQL error code as object int retVal; // SQL error code int? eventNumber = message.TollingEventNumber; // number of event generated or source tolling event, as appropriate retObj = ta.UpdatePostElectionDates(message.CandidateID, message.ElectionCycle, CPConvert.ToCfisCode(type), message.PostElectionAuditRequestType == AuditRequestType.SecondRequest || message.PostElectionAuditRequestType == AuditRequestType.SecondRepost ? "Y" : "N", ref eventNumber); if (retObj != null && int.TryParse(retObj.ToString(), out retVal)) { if (retVal == 0) { // save event number for tolling letters if (eventNumber.HasValue && message.IsTollingLetter) { message.TollingEventNumber = eventNumber; SetCmoMessageTolling(message); } return(true); } } return(false); } }