示例#1
0
 /// <summary>
 /// Retrieves a collection of all completed Doing Business reviews on record for the specified candidate and election cycle.
 /// </summary>
 /// <param name="candidateID">The ID of the candidate whose Doing Business reviews are to be retrieved.</param>
 /// <param name="electionCycle">The election cycle in which to search.</param>
 /// <returns>A collection of all completed Doing Business reviews for the specified candidate and election cycle.</returns>
 public DoingBusinessReviews GetDoingBusinessReviews(string candidateID, string electionCycle)
 {
     using (DoingBusinessReviewTds ds = new DoingBusinessReviewTds())
     {
         using (DoingBusinessReviewsTableAdapter ta = new DoingBusinessReviewsTableAdapter())
         {
             ta.Fill(ds.DoingBusinessReviews, candidateID, electionCycle);
         }
         Election             election = GetElections(CPProviders.SettingsProvider.MinimumElectionCycle)[electionCycle];
         DoingBusinessReviews dbr      = new DoingBusinessReviews();
         if (election == null)
         {
             return(dbr);
         }
         var s = this.GetStatements(electionCycle);
         foreach (DoingBusinessReviewTds.DoingBusinessReviewsRow row in ds.DoingBusinessReviews.Rows)
         {
             byte number = row.StatementNumber;
             if (!object.Equals(s, null) && s.ContainsKey(number))
             {
                 DoingBusinessReview review = new DoingBusinessReview(row.ElectionCycle.Trim(), ParseCommitteeID(row.CommitteeID), s[number])
                 {
                     StartDate     = row.IsStartDateNull() ? DateTime.MinValue : row.StartDate,
                     EndDate       = row.IsCompletionDateNull() ? DateTime.MinValue : row.CompletionDate,
                     CommitteeName = row.CommitteeName.Trim(),
                     LastUpdated   = row.LastUpdated,
                     SentDate      = row.IsSentDateNull() ? null : row.SentDate as DateTime?
                 };
                 // response due if due date is after letter sent date
                 if (!row.IsResponseDueDateNull() && review.SentDate.HasValue && (review.SentDate.Value < row.ResponseDueDate))
                 {
                     DbrResponseDeadline deadline = new DbrResponseDeadline(row.ResponseDueDate.Date, review);
                     if (!row.IsResponseReceivedDateNull())
                     {
                         deadline.ResponseReceivedDate = row.ResponseReceivedDate;
                     }
                     review.ResponseDeadline = deadline;
                     dbr.ResponseDeadlines.Add(deadline);
                 }
                 dbr.Reviews.Add(review);
             }
         }
         return(dbr);
     }
 }
示例#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");
                    }
                }
            }
        }