/// <summary> /// Retrieves a collection of all statement reviews from a <see cref="StatementReviewTds"/> dataset. /// </summary> /// <param name="ds">The dataset to read.</param> /// <param name="electionCycle">The election cycle pertaining to the dataset.</param> /// <returns>A collection of all statement reviews in the dataset.</returns> private StatementReviews ReadStatmentReviews(StatementReviewTds ds, string electionCycle) { Election election = GetElections(CPProviders.SettingsProvider.MinimumElectionCycle)[electionCycle]; StatementReviews sr = new StatementReviews(); if (election == null) { return(sr); } var s = this.GetStatements(electionCycle); foreach (StatementReviewTds.StatementReviewsRow row in ds.StatementReviews.Rows) { //fetch applicable dates and create a new StatementReview object as appropriate byte number = row.StatementNumber; if (!object.Equals(s, null) && s.ContainsKey(number)) { StatementReview review = new StatementReview(row.ElectionCycle.Trim(), ParseCommitteeID(row.CommitteeID), s[number]) { StartDate = row.IsStartDateNull() ? DateTime.MinValue : row.StartDate, EndDate = row.IsCompletionDateNull() ? DateTime.MinValue : row.CompletionDate, LastUpdated = row.LastUpdated, SentDate = row.IsSentDateNull() ? null : row.SentDate as DateTime?, CommitteeName = row.CommitteeName.Trim() }; // response due only if due date is after letter sent date if (!row.IsResponseDueDateNull() && review.SentDate.HasValue && (review.SentDate.Value < row.ResponseDueDate)) { SRResponseDeadline deadline = new SRResponseDeadline(row.ResponseDueDate.Date, review); if (!row.IsResponseReceivedDateNull()) { deadline.ResponseReceivedDate = row.ResponseReceivedDate; } if (!row.IsExtensionDueDateNull()) { deadline.GrantExtension(row.ExtensionDueDate.Date, null, Convert.ToUInt16(row.ExtensionsCount)); } review.ResponseDeadline = deadline; sr.ResponseDeadlines.Add(deadline); } sr.Reviews.Add(review); } } return(sr); }
/// <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"); } } } }