/// <summary> /// Retrieves a generic collection of all certification documents on record for the specified candidate and election cycle. /// </summary> /// <param name="candidateID">The ID of the candidate whose certification documents are to be retrieved.</param> /// <param name="electionCycle">The election cycle in which to search.</param> /// <returns>A generic List collection of all certification documents on record for the specified candidate and election cycle.</returns> public CertificationHistory GetCertificationDocuments(string candidateID, string electionCycle) { using (CertificationDocumentTds ds = new CertificationDocumentTds()) { using (CertificationDocumentsTableAdapter ta = new CertificationDocumentsTableAdapter()) { ta.Fill(ds.CertificationDocuments, candidateID, electionCycle); } CertificationHistory c = new CertificationHistory(ds.CertificationDocuments.Count); foreach (CertificationDocumentTds.CertificationDocumentsRow row in ds.CertificationDocuments.Rows) { c.Documents.Add(new CertificationDocument(row.Number, row.LastUpdated) { PageCount = row.PageCount, StatusReason = CPConvert.ToDocumentStatusReason(row.ReasonCode.Trim()), Status = CPConvert.ToDocumentStatus(row.StatusCode.Trim()), DeliveryType = CPConvert.ToDeliveryType(row.DeliveryCode.Trim()), SubmissionType = CPConvert.ToSubmissionType(row.SubmissionCode.Trim()), ReceivedDate = row.IsReceivedDateNull() ? null : row.ReceivedDate as DateTime?, StatusDate = row.IsStatusDateNull() ? null : row.StatusDate as DateTime?, PostmarkDate = row.IsPostmarkDateNull() ? null : row.PostmarkDate as DateTime? }); } return(c); } }
/// <summary> /// Raises the <see mref="Load"/> event. /// </summary> /// <param name="args">An <see cref="EventArgs"/> object that contains the event data.</param> protected override void OnLoad(EventArgs args) { base.OnLoad(args); if (!Page.IsPostBack) { CertificationHistory ch = CPProfile.CertificationHistory; if (ch != null) { this.EnsureChildControls(); this.DataSource = ch.Documents; this.DataBind(); } } }