Пример #1
0
 /// <summary>
 /// Retrieves all compliance visits on record for the specified candidate and election cycle.
 /// </summary>
 /// <param name="candidateID">The ID of the candidate whose compliance visits are to be retrieved.</param>
 /// <param name="electionCycle">The election cycle in which to search.</param>
 /// <returns>A <see cref="ComplianceVisits"/> collection of all compliance visits on record for the specified candidate and election cycle.</returns>
 public ComplianceVisits GetComplianceVisits(string candidateID, string electionCycle)
 {
     using (ComplianceVisitTds ds = new ComplianceVisitTds())
     {
         using (ComplianceVisitsTableAdapter ta = new ComplianceVisitsTableAdapter())
         {
             ta.Fill(ds.ComplianceVisits, candidateID, electionCycle);
         }
         ComplianceVisits c = new ComplianceVisits();
         foreach (ComplianceVisitTds.ComplianceVisitsRow row in ds.ComplianceVisits.Rows)
         {
             short number = row.Number;
             //fetch applicable dates and create a new ComplianceVisit object as appropriate
             ComplianceVisit visit = new ComplianceVisit(row.ElectionCycle.Trim(), ParseCommitteeID(row.CommitteeID), number > byte.MaxValue ? byte.MaxValue : Convert.ToByte(number), row.AppointmentDate.Date)
             {
                 LastUpdated   = row.LastUpdated,
                 SentDate      = (row.IsLetterCertifiedDateNull()) ? (row.IsLetterSentDateNull()) ? null : row.LetterSentDate as DateTime? : row.LetterCertifiedDate,
                 CommitteeName = row.CommitteeName.Trim()
             };
             // response due if due date is after letter sent date
             if (!row.IsResponseDueDateNull() && visit.SentDate.HasValue && (visit.SentDate.Value < row.ResponseDueDate))
             {
                 CVResponseDeadline deadline = new CVResponseDeadline(row.ResponseDueDate.Date, visit);
                 if (!row.IsResponseReceivedDateNull())
                 {
                     deadline.ResponseReceivedDate = row.ResponseReceivedDate;
                 }
                 if (!row.IsExtensionDueDateNull() && !row.IsExtensionGrantedDateNull())
                 {
                     deadline.GrantExtension(row.ExtensionDueDate.Date, row.ExtensionGrantedDate, null);
                 }
                 visit.ResponseDeadline = deadline;
                 c.ResponseDeadlines.Add(deadline);
             }
             c.Visits.Add(visit);
         }
         return(c);
     }
 }
Пример #2
0
        /// <summary>
        /// Raises the <see cref="GridView.RowDataBound"/> event.
        /// </summary>
        /// <param name="e">A <see cref="GridViewRowEventArgs"/> that contains the event data.</param>
        protected override void OnRowDataBound(GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DoingBusinessReview dbr         = e.Row.DataItem as DoingBusinessReview;
                StatementReview     sr          = e.Row.DataItem as StatementReview;
                ComplianceVisit     cv          = e.Row.DataItem as ComplianceVisit;
                AuditReviewBase     review      = e.Row.DataItem as AuditReviewBase;
                int responseReceivedColumnIndex = cv != null ? 3 : 2;
                int numColumnIndex = 0;
                if (this.AllowGrouping)
                {
                    responseReceivedColumnIndex++;
                    numColumnIndex++;
                }

                // number details
                if (dbr != null)
                {
                    e.Row.Cells[numColumnIndex].Text = string.Format("{0} ({1:d})", dbr.Number, dbr.Statement.DueDate);
                }
                else if (sr != null)
                {
                    e.Row.Cells[numColumnIndex].Text = string.Format("{0} ({1:d})", sr.Number, sr.Statement.DueDate);
                }
                if (review != null)
                {
                    if (review.ResponseRequired)
                    {
                        // response deadline
                        ResponseDeadlineBase deadline = review.ResponseDeadline;
                        if (deadline.ExtensionGranted)
                        {
                            if (deadline.ExtensionDate.HasValue)
                            {
                                e.Row.Cells[responseReceivedColumnIndex].Text = string.Format("{0:MM/dd/yyyy}<br />Originally due {1:MM/dd/yyyy}<br />Extension granted {2:MM/dd/yyyy}", deadline.Date, deadline.OriginalDueDate, deadline.ExtensionDate);
                            }
                            else
                            {
                                e.Row.Cells[responseReceivedColumnIndex].Text = string.Format("{0:d}<br />Originally due {1:d}<br />Extensions granted: {2}", deadline.Date, deadline.OriginalDueDate, deadline.ExtensionNumber);
                            }
                        }
                        else
                        {
                            e.Row.Cells[responseReceivedColumnIndex].Text = string.Format(this.DateFormat, deadline.Date);
                        }

                        // response status
                        e.Row.Cells[responseReceivedColumnIndex + 1].Text = review.ResponseReceived ? (dbr != null ? Properties.Resources.ResponseReceivedText : string.Format(this.ResponseReceivedFormat, review.ResponseReceivedDate)) : this.ResponseNotReceivedText;

                        // response extension - disabled indefinitely
                        //string.Format("{0} <a href=\"{1}\" title=\"Request Response Extension\">(Request Extension)</a>", this.ResponseNotReceivedText, PageUrlManager.GetExtensionRequestUrl(ExtensionType.StatementReview, sr.StatementNumber));
                        //string.Format("{0} {1}", this.ResponseNotReceivedText, MakeExtensionRequestLink(ExtensionType.ComplianceVisitReview, cv.Number));
                    }
                    else
                    {
                        e.Row.Cells[responseReceivedColumnIndex].Text = e.Row.Cells[responseReceivedColumnIndex + 1].Text = this.NoResponseRequiredText;
                    }

                    // add link to view CMO message if available
                    string messageID;
                    if (this.MessageIDDataSource != null && this.MessageIDDataSource.TryGetValue(review.Number, out messageID))
                    {
                        e.Row.Cells[responseReceivedColumnIndex + 2].Text = string.Format("<a class=\"pdf-file\" href=\"{0}\" title=\"{1}\">{1}</a>", PageUrlManager.GetMessageUrl(messageID), "View Review");
                    }
                }
            }
        }