Esempio n. 1
0
 /// <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)
     {
         StatementOfNeedHistory sonh = CPProfile.StatementOfNeedHistory;
         this.EnsureChildControls();
         if (sonh.Primary.Documents.Count > 0)
         {
             _primary.DataSource = sonh.Primary.Documents;
             _primary.DataBind();
         }
         else
         {
             _primary.Visible = false;
         }
         if (sonh.General.Documents.Count > 0)
         {
             _general.DataSource = sonh.General.Documents;
             _general.DataBind();
         }
         else
         {
             _general.Visible = false;
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Retrieves a generic collection of all statements of need on record for the specified candidate and election cycle.
 /// </summary>
 /// <param name="candidateID">The ID of the candidate whose statements of need are to be retrieved.</param>
 /// <param name="electionCycle">The election cycle in which to search.</param>
 /// <returns>A generic List collection of all statements of need on record for the specified candidate and election cycle.</returns>
 public StatementOfNeedHistory GetStatementsOfNeed(string candidateID, string electionCycle)
 {
     using (StatementOfNeedTds ds = new StatementOfNeedTds())
     {
         using (StatementsOfNeedTableAdapter ta = new StatementsOfNeedTableAdapter())
         {
             ta.Fill(ds.StatementsOfNeed, candidateID, electionCycle);
         }
         StatementOfNeedHistory c = new StatementOfNeedHistory(ds.StatementsOfNeed.Count);
         foreach (StatementOfNeedTds.StatementsOfNeedRow row in ds.StatementsOfNeed.Rows)
         {
             c.Add(new StatementOfNeed(row.Number, row.LastUpdated, DocumentType.StatementOfNeedGeneral == CPConvert.ToDocumentType(row.TypeCode.Trim()))
             {
                 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);
     }
 }