コード例 #1
0
ファイル: PostElection.aspx.cs プロジェクト: simoncwu/CAccess
        /// <summary>
        /// Binds the page to data contained in a post election audit report.
        /// </summary>
        /// <param name="report">The report to bind to.</param>
        private void DataBindToReport(AuditReportBase report)
        {
            this.EnsureChildControls();

            // report dates
            _reportSummary.DataSource = report;
            if (report != null)
            {
                _reportSummary.MessagesDataSource = CmoAuditReview.GetAuditReportMessageIDs(CPProfile.Cid, CPProfile.ElectionCycle);

                // inadequate response dates
                report = report.InadequateNotice;
                if (_inadequateSummary.Visible = report != null)
                {
                    _reportSummary.CssClass               = "left column two-up";
                    _inadequateSummary.DataSource         = report;
                    _inadequateSummary.MessagesDataSource = _reportSummary.MessagesDataSource;
                    _inadequateSummary.DataBind();
                }
            }
            _reportSummary.DataBind();

            // force display of title when report is null
            if (report == null)
            {
                _reportSummary.Title = CPConvert.ToString(_postElectionAuditNavigation.SelectedReportType);
            }
        }
コード例 #2
0
        /// <summary>
        /// Controls how data is retrieved and bound to the control.
        /// </summary>
        protected override void PerformSelect()
        {
            if (this.DataSourceID.Length == 0)
            {
                this.OnDataBinding(EventArgs.Empty);
            }
            var ds = this.DataSource;

            if (ds != null)
            {
                _viewState = new TollingEventsListViewState();
                Dictionary <int, string> mds = this.MessagesDataSource == null ? null : this.MessagesDataSource;
                foreach (var t in ds.OrderByDescending(t => t.TollingStartDate))
                {
                    string messageID;
                    _viewState.Events.Add(new TollingEventsListViewState.TollingEventListItem()
                    {
                        Description = t.Description,
                        StartDate   = t.StartDate,
                        EndDate     = t.TollingEndDate,
                        TollingDays = t.GetTollingDays(),
                        Deadline    = t.TollingDueDate,
                        EndReason   = CPConvert.ToString(t.TollingEndReason),
                        MessageID   = mds != null && mds.TryGetValue(t.IsInadequateResponse ? -t.TollingEventNumber : t.TollingEventNumber, out messageID) ? messageID : null
                    });
                }
            }
            this.MarkAsDataBound();
        }
コード例 #3
0
        /// <summary>
        /// Gets the submission type of a document as an HTML-formatted tooltip-enabled string.
        /// </summary>
        /// <param name="document">The <see cref="SubmissionDocument"/> to get a tooltip for.</param>
        internal string GetSubmissionTypeText(SubmissionDocument document)
        {
            SubmissionType type     = document.SubmissionType;
            string         cssClass = string.Empty;

            switch (type)
            {
            case SubmissionType.Regular:
                cssClass = this.RegularTooltipCssClass;
                break;

            case SubmissionType.Amendment:
                cssClass = this.AmendmentTooltipCssClass;
                break;

            case SubmissionType.Resubmission:
                cssClass = this.ResubmissionTooltipCssClass;
                break;

            case SubmissionType.InternalAmendment:
                cssClass = this.IAmendmentTooltipCssClass;
                break;

            case SubmissionType.Documentation:
                cssClass = this.DocumentationTooltipCssClass;
                break;
            }
            return(string.Format("{0} {1}", CPConvert.ToString(type), string.Format(Properties.Settings.Default.TooltipFormat, string.Format("{0} {1}", this.TooltipCssClass, cssClass))));
        }
コード例 #4
0
 private static DocumentStatusViewModel DocumentStatusFrom <T>(T source) where T : SubmissionDocument
 {
     return(source == null ? new DocumentStatusViewModel() : new DocumentStatusViewModel
     {
         DeliveryType = source.DeliveryType,
         PageCount = source.PageCount,
         PostmarkDate = source.PostmarkDate,
         ReceivedDate = source.ReceivedDate.HasValue ? source.ReceivedDate.Value : DateTime.MinValue,
         Status = CPConvert.ToString(source.Status),
         StatusDate = source.StatusDate,
         SubmissionType = source.SubmissionType
     });
 }
コード例 #5
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     if (!Page.IsPostBack)
     {
         ActiveCandidate ac = CPProfile.ActiveCandidate;
         if (ac != null)
         {
             // general candidate information
             this.CandidateName.Text = string.Format("{0} (ID: {1})", ac.Name, ac.ID);
             if (ac.Office != null)
             {
                 this.OfficeLabel.Text = ac.Office.ToString();
             }
             this.ClassificationLabel.Text = CPConvert.ToString(ac.Classification);
             Election ec = CPApplication.Elections[CPProfile.ElectionCycle];
             if (ec != null)
             {
                 FinancialSummary fs = FinancialSummary.GetFinancialSummary(CPProfile.Cid, CPProfile.ElectionCycle);
                 if (fs != null)
                 {
                     Statement lastStatement;
                     if (ec.Statements.TryGetValue(fs.LastStatementSubmitted, out lastStatement))
                     {
                         // receipts
                         this.NetContributionsLabel.Text = FormatCurrency(fs.NetContributions);
                     }
                     this.NumberOfContributorsLabel.Text  = string.Format("{0:N0}", fs.ContributorCount);
                     this.MiscellaneousReceiptsLabel.Text = FormatCurrency(fs.MiscellaneousReceipts);
                     this.MatchingClaimsLabel.Text        = FormatCurrency(fs.MatchingClaims);
                     this.LoansReceivedLabel.Text         = FormatCurrency(fs.LoansReceived);
                     // disbursements
                     this.NetExpendituresLabel.Text = FormatCurrency(fs.NetExpenditures);
                     this.LoansPaidLabel.Text       = FormatCurrency(fs.LoansPaid);
                     this.OustandingBillsLabel.Text = FormatCurrency(fs.OutstandingBills);
                     if (!_isTIE)
                     {
                         this.PublicFundsReceivedLabel.Text = FormatCurrency(fs.PublicFundsReceived);
                         this.PublicFundsReturnedLabel.Text = FormatCurrency(fs.PublicFundsReturned);
                     }
                 }
                 if (_isTIE)
                 {
                     FSClassificationCol.Visible = FSClassificationHeader.Visible = FSClassificationCell.Visible = false;
                     ContributorsPanel.CssClass  = null;
                 }
             }
         }
     }
 }
コード例 #6
0
 /// <summary>
 /// Raises the <see cref="GridView.RowDataBound"/> event.
 /// </summary>
 /// <param name="e">A <see cref="GridViewRowEventArgs"/> that contains event data.</param>
 protected override void OnRowDataBound(GridViewRowEventArgs e)
 {
     base.OnRowDataBound(e);
     // additional databinding because data values are not accessible until databinding events
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         SubmissionDocument document = e.Row.DataItem as SubmissionDocument;
         if (document != null)
         {
             // skip a column when grouping (first column is group-by column)
             e.Row.Cells[this.AllowGrouping ? 2 : 1].Text = GetSubmissionTypeText(document);
             // BUGFIX #58: Corrected typo in group condition detection when populating delivery type column
             e.Row.Cells[this.AllowGrouping ? 6 : 5].Text = CPConvert.ToString(document.DeliveryType);
         }
     }
 }
コード例 #7
0
 /// <summary>
 /// Renders a single threshold revision to the specified writer.
 /// </summary>
 /// <param name="writer">A <see cref="HtmlTextWriter"/> that represents the output stream to render HTML content on the client.</param>
 /// <param name="entry">The threshold revision entry to render.</param>
 /// <param name="current">Whether or not the entry being rendered is the most current revision.</param>
 private void RenderThreshold(HtmlTextWriter writer, ThresholdRevision entry, bool current)
 {
     if (writer == null || entry == null)
     {
         return;
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Tr);
     new TableCell()
     {
         CssClass = "expander"
     }.RenderControl(writer);
     new TableCell()
     {
         CssClass = "statementNumber", Text = current ? entry.Statement.ToDetailString() : null
     }.RenderControl(writer);
     new TableCell()
     {
         CssClass = "numActual", Text = entry.IsUndetermined ? "(n/a)" : entry.Number.ToString("N0")
     }.RenderControl(writer);
     new TableCell()
     {
         CssClass = "numRequired", Text = entry.IsUndetermined ? "(n/a)" : entry.NumberRequired.ToString("N0")
     }.RenderControl(writer);
     new TableCell()
     {
         CssClass = "amtActual", Text = entry.Funds.ToString("C")
     }.RenderControl(writer);
     new TableCell()
     {
         CssClass = "amtRequired", Text = entry.IsUndetermined ? "(n/a)" : entry.FundsRequired.ToString("C")
     }.RenderControl(writer);
     new TableCell()
     {
         CssClass = "version", Text = CPConvert.ToString(entry.Type)
     }.RenderControl(writer);
     new TableCell()
     {
         CssClass = "office", Text = entry.Office.ToAbbrevString()
     }.RenderControl(writer);
     new TableCell()
     {
         CssClass = "date", Text = entry.Date.ToString("d")
     }.RenderControl(writer);
     writer.RenderEndTag();
 }
コード例 #8
0
 private static DisclosureStatementViewModel DisclosureStatementFrom(DisclosureStatement source)
 {
     return(source == null ? new DisclosureStatementViewModel() : new DisclosureStatementViewModel
     {
         DeliveryType = source.DeliveryType,
         PageCount = source.PageCount,
         PostmarkDate = source.PostmarkDate,
         ReceivedDate = source.ReceivedDate.HasValue ? source.ReceivedDate.Value : DateTime.MinValue,
         Status = CPConvert.ToString(source.Status),
         StatusDate = source.StatusDate,
         SubmissionType = source.SubmissionType,
         IsSmallCampaign = source.SmallCampaign,
         Deferred = source.DeferredFiling,
         BackupDeliveryType = source.BackupDeliveryType,
         BackupPostmarkDate = source.BackupPostmarkDate,
         BackupReceivedDate = source.BackupReceivedDate,
         DataFormat = GetDataFormat(source)
     });
 }
コード例 #9
0
 public static BankAccountViewModel BankAccountSummaryFrom(BankAccount source, char committeeID)
 {
     return(source == null ? new BankAccountViewModel() : new BankAccountViewModel
     {
         CommitteeID = committeeID,
         ID = source.ID,
         BankName = source.BankName,
         FriendlyName = source.Name,
         AccountNumber = source.Number,
         Type = source.Type == BankAccountType.Other ? source.OtherTypeSpecification : CPConvert.ToString(source.Type),
         Balance = source.CurrentBalance,
         BalanceDate = source.CurrentBalanceDate
     });
 }
コード例 #10
0
 public static BankAccountViewModel BankAccountFrom(BankAccount source, char committeeID)
 {
     return(source == null ? new BankAccountViewModel() : new BankAccountViewModel
     {
         CommitteeID = committeeID,
         ID = source.ID,
         BankName = source.BankName,
         City = source.City,
         State = CPConvert.ParseStateCode(source.State),
         StateCode = source.State,
         Zip = source.Zip == null ? null : source.Zip.ToString(),
         AccountNumber = source.Number,
         FriendlyName = source.Name,
         OpenedDate = source.OpeningDate,
         ClosedDate = source.ClosingDate,
         Balance = source.CurrentBalance,
         BalanceDate = source.CurrentBalanceDate,
         Type = source.Type == BankAccountType.Other ? source.OtherTypeSpecification : CPConvert.ToString(source.Type),
         Purpose = source.Purpose == BankAccountPurpose.Other ? source.OtherPurposeSpecification : CPConvert.ToString(source.Purpose),
         DirectDeposit = source.HasDirectDeposit
     });
 }
コード例 #11
0
        /// <summary>
        /// Generates an item in a list of certification submissions in a repeater control.
        /// </summary>
        /// <param name="container">A reference to the containing <see cref="RepeaterItem"/> control.</param>
        void BuildItemTemplate(Control container)
        {
            Table docSummary = new Table()
            {
                BorderWidth = 0, CellPadding = 0, CellSpacing = 0
            };
            Table format_Backup = new Table()
            {
                BorderWidth = 0, CellPadding = 0, CellSpacing = 0
            };
            Panel docPanel = new Panel()
            {
                CssClass = "docSummary"
            };

            docPanel.Controls.Add(docSummary);
            container.Controls.Add(docPanel);
            Panel formatPanel = new Panel()
            {
                CssClass = "format-backup"
            };

            formatPanel.Controls.Add(format_Backup);
            container.Controls.Add(formatPanel);

            // basic properties
            docSummary.DataBinding += (sender, e) =>
            {
                DisclosureStatement item = (container as RepeaterItem).DataItem as DisclosureStatement;
                if (item == null)
                {
                    return;
                }
                TableRow tr = new TableRow();
                docSummary.Controls.Add(tr);
                tr.Controls.Add(new TableCell()
                {
                    CssClass = "expander"
                });
                tr.Controls.Add(new TableCell()
                {
                    CssClass = "cp-ReceivedDate", Text = string.Format(Properties.Resources.DateFormat, item.ReceivedDate)
                });
                tr.Controls.Add(new TableCell()
                {
                    CssClass = "cp-SubmissionType", Text = _gridTemplate.GetSubmissionTypeText(item)
                });
                tr.Controls.Add(new TableCell()
                {
                    CssClass = "cp-Status", Text = CPConvert.ToString(item.Status)
                });
                tr.Controls.Add(new TableCell()
                {
                    CssClass = "cp-StatusAsOf", Text = string.Format(Properties.Resources.DateFormat, item.StatusDate)
                });
                tr.Controls.Add(new TableCell()
                {
                    CssClass = "cp-PageCount", Text = item.PageCount == 0 && item.SubmittedOnline ? "(n/a)" : item.PageCount.ToString()
                });
                tr.Controls.Add(new TableCell()
                {
                    CssClass = "cp-DeliveryType", Text = CPConvert.ToString(item.DeliveryType)
                });
                tr.Controls.Add(new TableCell()
                {
                    CssClass = "cp-SmallDeferred", Text = item.SmallCampaign ? "* Small Campaign" : item.DeferredFiling ? "* Deferred Filing" : null
                });
            };

            // additional properties
            format_Backup.DataBinding += (sender, e) =>
            {
                // data format
                DisclosureStatement item = (container as RepeaterItem).DataItem as DisclosureStatement;
                if (item == null)
                {
                    return;
                }
                StringBuilder sb          = new StringBuilder();
                bool          multiFormat = false;
                sb.Append("<span class=\"label\">Submission Format:</span> ");
                foreach (SubmissionFormat f in Enum.GetValues(typeof(SubmissionFormat)))
                {
                    if (f == SubmissionFormat.None)
                    {
                        continue;
                    }
                    if (item.SubmissionFormats.HasFlag(f))
                    {
                        if (multiFormat)
                        {
                            sb.Append(", ");
                        }
                        sb.AppendFormat(f.ToString <SubmissionFormat>());
                        multiFormat = true;
                    }
                }
                TableRow tr = new TableRow();
                format_Backup.Controls.Add(tr);
                tr.Controls.Add(new TableCell()
                {
                    CssClass = "cp-ReceivedDate"
                });
                tr.Controls.Add(new TableCell()
                {
                    CssClass = "cp-DataFormat", Text = sb.ToString(), ColumnSpan = 2
                });
                tr.Controls.Add(new TableCell()
                {
                    CssClass = "cp-PostmarkDate", Text = item.PostmarkDate.HasValue ? "<span class=\"label\">Postmarked:</span> " + string.Format(Properties.Resources.DateFormat, item.PostmarkDate) : null
                });

                // backup documentation
                if (item.BackupReceived)
                {
                    tr = new TableRow()
                    {
                        CssClass = "cp-BackupDetails"
                    };
                    format_Backup.Controls.Add(tr);
                    tr.Controls.Add(new TableCell()
                    {
                        CssClass = "caption", Text = "Backup Documentation"
                    });
                    tr.Controls.Add(new TableCell()
                    {
                        CssClass = "cp-ReceivedDate", Text = "<span class=\"label\"Received:</span> " + string.Format(Properties.Resources.DateFormat, item.BackupReceivedDate)
                    });
                    tr.Controls.Add(new TableCell()
                    {
                        CssClass = "cp-DeliveryType", Text = "<span class=\"label\">Delivery Method:</span> " + CPConvert.ToString(item.BackupDeliveryType)
                    });
                    tr.Controls.Add(new TableCell()
                    {
                        CssClass = "cp-PostmarkDate", Text = item.BackupPostmarkDate.HasValue ? "<span class=\"label\">Postmarked:</span> " + string.Format(Properties.Resources.DateFormat, item.BackupPostmarkDate) : null
                    });
                }
            };
        }
コード例 #12
0
        /// <summary>
        /// Renders the contents of the control to the specified writer. This method is used primarily by control developers.
        /// </summary>
        /// <param name="writer">A <see cref="HtmlTextWriter"/> that represents the output stream to render HTML content on the client.</param>
        protected override void RenderContents(HtmlTextWriter writer)
        {
            ActiveCandidate candidate = this.DataSource;

            if (candidate == null)
            {
                writer.Write(this.EmptyValueText);
                return;
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "CandidateProfileSummary");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            // header
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "header");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            if (candidate.IsTerminated)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "terminated");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.Write("Candidate Information");
            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderEndTag();

            // candidate ID
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "top");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.Write("<label>ID</label>");
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(ExpanderLinkTextFormat, candidate.ID, PageUrlManager.CandidateProfilePageUrl, "View Full Candidate Profile");
            writer.RenderEndTag();
            writer.RenderEndTag();

            // candidate name
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.Write("<label>Name</label>");
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("<span>{0}</span>", candidate.Name);
            writer.RenderEndTag();
            writer.RenderEndTag();

            // Cert/FR date
            if (candidate.HasCertified || candidate.HasRegistered)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.RenderBeginTag(HtmlTextWriterTag.Th);
                writer.Write("<label>{0}</label>", candidate.HasCertified ? "Certification Date" : "Filer Registration Date");
                writer.RenderEndTag();
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.Write("<span>{0:MMMM d, yyyy}</span>", candidate.HasCertified ? candidate.CertificationDate : candidate.FilerRegistrationDate);
                writer.RenderEndTag();
                writer.RenderEndTag();
            }

            // termination date
            if (candidate.IsTerminated)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                writer.RenderBeginTag(HtmlTextWriterTag.Th);
                writer.Write("<label>Termination Date</label>");
                writer.RenderEndTag();
                writer.RenderBeginTag(HtmlTextWriterTag.Td);
                writer.Write("<span>{0:MMMM d, yyyy}</span>", candidate.TerminationDate);
                writer.RenderEndTag();
                writer.RenderEndTag();
            }

            // office sought
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.Write("<label>Office Sought</label>");
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("<span>{0}</span>", Page.Server.HtmlEncode(candidate.Office.ToString()));
            writer.RenderEndTag();
            writer.RenderEndTag();

            // classification
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.Write("<label>Classification</label>");
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("<span>{0}</span>", CPConvert.ToString(candidate.Classification));
            writer.RenderEndTag();
            writer.RenderEndTag();

            // e-mail
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "bottom");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.Write("<label>E-mail Address</label>");
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("<span>{0}</span>", string.IsNullOrEmpty(candidate.Email) ? EmptyValueText : string.Format("<a href=\"mailto:{0}\">{0}</a>", candidate.Email));
            writer.RenderEndTag();
            writer.RenderEndTag();

            // principal committee
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "newSection top bottom");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.Write("<label>Principal Committee</label>");
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(ExpanderLinkTextFormat, string.IsNullOrEmpty(candidate.PrincipalCommittee) ? EmptyValueText : candidate.PrincipalCommittee, PageUrlManager.CommitteeProfilePageUrl, "View Full Committee Profile");
            writer.RenderEndTag();
            writer.RenderEndTag();

            // CSU liaison
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "newSection top");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.Write("<label>CSU Liaison</label>");
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("<span>{0}</span>", candidate.CsuLiaisonName ?? this.EmptyLiaisonText);
            writer.RenderEndTag();
            writer.RenderEndTag();

            // audit liaison
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "bottom");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.Write("<label>Audit Liaison</label>");
            writer.RenderEndTag();
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("<span>{0}</span>", candidate.AuditorName ?? this.EmptyLiaisonText);
            writer.RenderEndTag();
            writer.RenderEndTag();

            // closing table tag
            writer.RenderEndTag();
        }
コード例 #13
0
 /// <summary>
 /// Converts the value of the specified <see cref="TrainingCourseType"/> to its equivalent <see cref="String"/> representation.
 /// </summary>
 /// <param name="type">A CFB training course type.</param>
 /// <returns>The <see cref="String"/> equivalent of the value of <paramref name="type"/>.</returns>
 public static string ToString(this TrainingCourseType type)
 {
     return(CPConvert.ToString(type));
 }
コード例 #14
0
        /// <summary>
        /// Event handler for updating control fields with the details of a campaign bank account.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        protected void ShowBankAccount(object sender, EventArgs e)
        {
            BankAccount ba;
            byte        id = 0;

            if (byte.TryParse(_bankAccountsList.SelectedValue.Substring(1), out id) && (id > 0))
            {
                string committeeID     = _bankAccountsList.SelectedValue.Substring(0, 1);
                AuthorizedCommittee ac = GetAuthorizedCommittee(committeeID);
                // fetch bank account
                if (!ac.BankAccounts.TryGetValue(id, out ba))
                {
                    _bankError.Text             = "Sorry, the requested bank account could not be retrieved.";
                    _bankError.Visible          = true;
                    _bankAccountDetails.Visible = false;
                    return;
                }
                if (ba == null)
                {
                    // error: no bank accounts
                    _bankError.Text             = string.Format("You do not currently have any bank accounts affiliated with your campaign for the {0} election", CPProfile.ElectionCycle);
                    _bankError.Visible          = true;
                    _bankAccountDetails.Visible = false;
                }
                else
                {
                    // show bank account data
                    _bankError.Visible          = false;
                    _bankAccountDetails.Visible = true;
                    _bankName.Value             = ba.BankName;
                    _bankCity.Value             = ba.City;
                    _bankState.Value            = ba.State;
                    _bankZip.Value        = (ba.Zip != null) ? ba.Zip.ToString() : null;
                    _dateOpened.Value     = ba.OpeningDate.HasValue ? ba.OpeningDate.Value.ToDateString() : null;
                    _dateClosed.Value     = ba.ClosingDate.HasValue ? ba.ClosingDate.Value.ToDateString() : null;
                    _balance.Value        = ba.CurrentBalance.ToString("C", CultureInfo.CurrentCulture);
                    _balanceDate.Value    = ba.CurrentBalanceDate.HasValue ? ba.CurrentBalanceDate.Value.ToDateString() : null;
                    _accountNumber.Value  = ba.Number;
                    _accountName.Value    = ba.Name;
                    _directDeposit.Value  = ba.HasDirectDeposit ? "Yes" : "No";
                    _accountType.Value    = ba.Type == BankAccountType.Other ? ba.OtherTypeSpecification : CPConvert.ToString(ba.Type);
                    _accountPurpose.Value = ba.Purpose == BankAccountPurpose.Other ? ba.OtherPurposeSpecification : CPConvert.ToString(ba.Purpose);
                }
            }
            else
            {
                _bankAccountDetails.Visible = false;
            }
            _bankAccountsUpdatePanel.Update();
        }
コード例 #15
0
        /// <summary>
        /// Updates control fields with an active candidate's profile information.
        /// </summary>
        /// <param name="ac">The active candidate profile to display.</param>
        private void ShowCandidate(ActiveCandidate ac)
        {
            if (ac == null)
            {
                _errorMessage.Text    = string.Format("You do not currently have an active candidate profile for the {0} election.", CPProfile.ElectionCycle);
                _errorMessage.Visible = true;
                _details.Visible      = false;
            }
            else
            {
                PostalAddress address;

                // basic candidate info
                _ID.Value         = ac.ID;
                _salutation.Value = CPConvert.ToString(ac.Honorific);
                _lastName.Value   = ac.LastName;
                _firstName.Value  = ac.FirstName;
                _mi.Value         = ac.MiddleInitial.HasValue ? ac.MiddleInitial.Value.ToString() : null;
                address           = ac.Address;
                if (!object.Equals(address, null))
                {
                    _streetNumber.Value = address.StreetNumber;
                    _streetName.Value   = address.StreetName;
                    _apartment.Value    = address.Apartment;
                    _city.Value         = address.City;
                    _state.Value        = CPConvert.ParseStateCode(address.State);
                    if (!object.Equals(address.Zip, null))
                    {
                        _zip.Value = address.Zip.ToString();
                    }
                }
                if (!object.Equals(ac.DaytimePhone, null))
                {
                    _daytimePhone.Value = ac.DaytimePhone.ToString();
                }
                if (!object.Equals(ac.EveningPhone, null))
                {
                    _eveningPhone.Value = ac.EveningPhone.ToString();
                }
                if (!object.Equals(ac.Fax, null))
                {
                    _fax.Value = ac.Fax.ToString();
                }
                if (!string.IsNullOrEmpty(ac.Email))
                {
                    _email.Value = string.Format("<a href=\"mailto:{0}\">{0}</a>", ac.Email);
                }

                // employer info
                Entity employer = ac.Employer;
                if (!object.Equals(employer, null))
                {
                    _empName.Value = employer.Name;
                    address        = employer.Address;
                    if (!object.Equals(address, null))
                    {
                        _empStreetNumber.Value = address.StreetNumber;
                        _empStreetName.Value   = address.StreetName;
                        _empCity.Value         = address.City;
                        _empState.Value        = CPConvert.ParseStateCode(address.State);
                        if (!object.Equals(address.Zip, null))
                        {
                            _empZip.Value = address.Zip.ToString();
                        }
                    }
                    if (!object.Equals(employer.DaytimePhone, null))
                    {
                        _empPhone.Value = employer.DaytimePhone.ToString();
                    }
                    if (!object.Equals(employer.Fax, null))
                    {
                        _empFax.Value = employer.Fax.ToString();
                    }
                }

                // candidate activation info
                if (ac.FilerRegistrationDate.HasValue)
                {
                    _frDate.Value = ac.FilerRegistrationDate.Value.ToDateString();
                }
                else
                {
                    _frDate.Value = "(n/a)";
                }
                _party.Value = ac.PoliticalParty;
                if (_isTIE)
                {
                    _office.Visible = _certDate.Visible = _terminationDate.Visible = _boroDistrict.Visible = _classification.Visible = _ddAuth.Visible = _rrddAuth.Visible = false;
                }
                else
                {
                    _office.Value = CPConvert.ToString(ac.Office.Type);
                    if (ac.CertificationDate.HasValue)
                    {
                        _certDate.Value = ac.CertificationDate.Value.ToDateString();
                    }
                    else
                    {
                        _certDate.Value = "(n/a)";
                    }
                    if (ac.IsTerminated)
                    {
                        _terminationDate.Value   = ac.TerminationDate.Value.ToDateString();
                        _terminationDate.Visible = true;
                    }
                    if (_boroDistrict.Visible = (ac.Office.Type == NycPublicOfficeType.BoroughPresident) || (ac.Office.Type == NycPublicOfficeType.CityCouncilMember))
                    {
                        NycBorough borough;
                        byte       district;
                        if (ac.Office.TryGetBorough(out borough))
                        {
                            _boroDistrict.LabelText = "Borough";
                            _boroDistrict.Value     = CPConvert.ToString(borough);
                        }
                        else if (ac.Office.TryGetDistrict(out district))
                        {
                            _boroDistrict.LabelText = "District";
                            _boroDistrict.Value     = district.ToString();
                        }
                    }
                    _classification.Value = CPConvert.ToString(ac.Classification);
                    _ddAuth.Value         = ac.IsDirectDepositAuthorized ? "Yes" : "No";
                    if (_rrddAuth.Visible = HasRRAccounts(ac))
                    {
                        _rrddAuth.Value = ac.IsRRDirectDepositAuthorized ? "Yes" : "No";
                    }
                }
                _lastUpdated.Text = "Data last modified: " + ac.LastUpdated.ToDateString();
            }
        }
コード例 #16
0
        /// <overview>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </overview>
        protected override void CreateChildControls()
        {
            base.CreateChildControls();
            _plan = PaymentPlan.GetPaymentPlan(CPProfile.Cid, CPProfile.ElectionCycle);
            if (_plan == null)
            {
                return;
            }
            CultureInfo        enCulture = CultureInfo.CreateSpecificCulture("en-US");
            Table              table;
            bool               altColor;
            PaymentInstallment current = _plan.Schedule.Current;

            // overview
            // overview: next payment
            Panel overview = MakeSectionPanel(Properties.Resources.OverviewTitle);

            overview.CssClass += " cp-PaymentPlanOverviewPanel";
            table              = MakeSectionTable();
            table.CssClass    += " cp-leftcolumn";
            overview.Controls.Add(table);
            table.Rows.Add(MakeLabeledDataRow(
                               "Next due date",
                               (current == null) ? "(n/a)" : current.DueDate.ToString(Properties.Resources.DateFormat)
                               ));
            table.Rows.Add(MakeLabeledDataRow(
                               "Payment amount:",
                               (current == null) ? "(n/a)" : current.AmountDue.ToString("C", enCulture)
                               ));
            // overview: plan dates
            table           = MakeSectionTable();
            table.CssClass += " cp-leftcolumn";
            overview.Controls.Add(table);
            table.Rows.Add(MakeLabeledDataRow(
                               "Initial payment:",
                               _plan.FirstPaymentDate.ToString(Properties.Resources.DateFormat)
                               ));
            table.Rows.Add(MakeLabeledDataRow(
                               "Final payment:",
                               _plan.FinalPaymentDueDate.ToString(Properties.Resources.DateFormat)
                               ));
            // overview: totals
            table = MakeSectionTable();
            overview.Controls.Add(table);
            table.Rows.Add(MakeLabeledDataRow(
                               "Total amount:",
                               _plan.Total.ToString("C", enCulture)
                               ));
            table.Rows.Add(MakeLabeledDataRow(
                               "Amount outstanding:",
                               _plan.GetBalance().ToString("C", enCulture)
                               ));
            if (_plan.PastDueBalance > 0)
            {
                table.Rows.Add(MakeLabeledDataRow("Balance past due:", _plan.PastDueBalance.ToString("C", enCulture)));
            }

            // schedule
            Panel schedule = MakeSectionPanel(Properties.Resources.ScheduleTitle);

            schedule.CssClass += " cp-PaymentPlanSchedulePanel";
            table              = MakeSectionTable();
            schedule.Controls.Add(table);
            table.Rows.Add(MakeHeaderRow("Payment Schedule", "Start Date", "End Date"));
            foreach (PaymentPlanSummary summary in _plan.Summaries)
            {
                table.Rows.Add(MakeDataRow(
                                   string.Format("{0} {1} {2} of {3}", summary.PaymentCount, CPConvert.ToString(_plan.Period),
                                                 (summary.PaymentCount > 0) ? "payments" : "payment",
                                                 summary.PeriodPaymentAmount.ToString("C", enCulture)), summary.FirstPaymentDate.ToString(Properties.Resources.DateFormat), summary.FinalPaymentDueDate.ToString(Properties.Resources.DateFormat)
                                   ));
            }

            // balances
            Panel balances = MakeSectionPanel(Properties.Resources.BalancesTitle);

            balances.CssClass += " cp-PaymentPlanBalancesPanel";
            table              = MakeSectionTable();
            balances.Controls.Add(table);
            table.Rows.Add(MakeHeaderRow("Payment #", "Due Date", "Amount Due", "Amount Paid"));
            altColor = false;
            foreach (PaymentInstallment installment in _plan.Installments)
            {
                uint?amountPaid = installment.AmountPaid;
                table.Rows.Add(MakeDataRow(altColor,
                                           installment.Number.ToString(),
                                           installment.DueDate.ToString(Properties.Resources.DateFormat),
                                           installment.AmountDue.ToString("C", enCulture),
                                           (amountPaid == null) ? "--" : ((uint)amountPaid).ToString("C", enCulture)
                                           ));
            }

            // history
            Panel history = MakeSectionPanel(Properties.Resources.HistoryTitle);

            history.CssClass += " cp-PaymentPlanHistoryPanel";
            table             = MakeSectionTable();
            history.Controls.Add(table);
            table.Rows.Add(MakeHeaderRow("Date", "Amount"));
            altColor = false;
            foreach (PlanPayment payment in _plan.Payments)
            {
                table.Rows.Add(MakeDataRow(altColor,
                                           payment.Date.ToString(Properties.Resources.DateFormat),
                                           payment.Amount.ToString("C", enCulture)
                                           ));
                altColor = !altColor;
            }

            _container          = new Panel();
            _container.CssClass = "PaymentPlanWebPart";
            _container.Controls.Add(overview);
            _container.Controls.Add(schedule);
            balances.CssClass += " cp-leftcolumn";
            _container.Controls.Add(balances);
            _container.Controls.Add(history);
            this.Controls.Add(_container);
        }
コード例 #17
0
        /// <summary>
        /// Renders the HTML opening tag of the control to the specified writer.
        /// </summary>
        /// <param name="writer">A <see cref="HtmlTextWriter"/> that represents the output stream to render HTML content on the client.</param>
        public override void RenderBeginTag(HtmlTextWriter writer)
        {
            // control container
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "cp-ThresholdHistoryControl");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // control label
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "cp-TrainingCourse ms-listviewtable");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-gb");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "8");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            writer.RenderBeginTag(HtmlTextWriterTag.Table);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-gb");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-bold ms-descriptiontext");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write("Course : {0}", this.CourseType == TrainingCourseType.Unknown ? "All Training Courses" : CPConvert.ToString(this.CourseType));
            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderEndTag();
        }
コード例 #18
0
        /// <summary>
        /// Controls how data is retrieved and bound to the control.
        /// </summary>
        protected override void PerformSelect()
        {
            AuditReportBase ds = this.DataSource;

            if (ds != null)
            {
                // alternate titles for IDR
                switch (ds.AuditReportType)
                {
                case AuditReportType.InitialDocumentationRequest:
                    this.SentTitle       = "Request Sent";
                    this.SecondSentTitle = "Second Request Sent";
                    break;

                case AuditReportType.IdrInadequateResponse:
                case AuditReportType.IdrAdditionalInadequateResponse:
                case AuditReportType.DarInadequateResponse:
                case AuditReportType.DarAdditionalInadequateResponse:
                    this.SentTitle       = "Notice Sent";
                    this.SecondSentTitle = "Second Notice Sent";
                    break;
                }
                this.Title          = ds.IsInadequateNotice ? "Inadequate Response Notice" : CPConvert.ToString(ds.AuditReportType);
                this.SentDate       = ds.SentDate;
                this.SecondSentDate = ds.SecondSentDate;
                this.DueDate        = ds.DueDate;
                this.ResponseDate   = ds.ResponseReceivedDate;
                this.PostmarkDate   = ds.ResponseSubmittedDate;
                string messageID;
                this.MessageID = this.MessagesDataSource != null && this.MessagesDataSource.TryGetValue(ds.AuditReportType, out messageID) ? messageID : null;
            }
            else
            {
                this.Title           = DefaultTitle;
                this.SentTitle       = DefaultSentTitle;
                this.SecondSentTitle = DefaultSecondSentTitle;
                this.SentDate        = this.SecondSentDate = this.DueDate = this.ResponseDate = this.PostmarkDate = null;
                this.MessageID       = null;
            }
            this.MarkAsDataBound();
        }
コード例 #19
0
        /// <summary>
        /// Renders the contents of the control to the specified writer.
        /// </summary>
        /// <param name="writer">A <see cref="HtmlTextWriter"/> that represents the output stream to render HTML content on the client.</param>
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (!this.HasSessions)
            {
                if (this.EmptyVisible)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "8");
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "emptydata");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.Write(this.EmptyDataText);
                    writer.RenderEndTag();
                    writer.RenderEndTag();
                }
                return;
            }

            // header row
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-viewheadertr");
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "sidemargin compliant");
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "trainee");
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.Write("Trainee Name");
            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "relation");
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.Write("Relationship");
            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "date");
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.Write("Course Date");
            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "attcomp");
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.Write("Attended");
            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "attcomp");
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.Write("Completed");
            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "sidemargin");
            writer.RenderBeginTag(HtmlTextWriterTag.Th);
            writer.RenderEndTag();
            writer.RenderEndTag();

            // session rows
            var ds           = this.DataSource;
            var transferDate = CPProviders.DataProvider.GetWebTransferDate(CPProfile.ElectionCycle) ?? DateTime.Today;

            foreach (var trainee in ds.Trainees.Values.OrderBy(t => t.FormalName))
            {
                foreach (var registration in from r in ds.Registrations.Registrations
                         join s in _sessions on r.SessionID equals s.ID
                         where r.TraineeID == trainee.ID
                         orderby s.Date descending
                         select r)
                {
                    var  session      = _sessions.Where(s => s.ID == registration.SessionID).First();
                    bool undetermined = session.Date >= transferDate.Date.AddDays(-1); // undetermined until a day after the last transfer
                    if (session.Date > DateTime.Now)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "upcoming");
                    }
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    // margin
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "sidemargin compliant");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    if (!undetermined && ds.ComplianceAchievedBy(registration))
                    {
                        writer.Write(this.CompliantIndicatorText);
                    }
                    writer.RenderEndTag();
                    // trainee name
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "trainee");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.Write(trainee.GetFullName(true));
                    writer.RenderEndTag();
                    // relationship
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "relation");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.Write(CPConvert.ToString(trainee.CampaignRelationship));
                    writer.RenderEndTag();
                    // course date
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "date");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.Write(session.Date.ToShortDateString());
                    writer.RenderEndTag();
                    // attendance status
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "attcomp");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    if (!undetermined)
                    {
                        RenderPassFail(writer, registration.Attended);
                    }
                    writer.RenderEndTag();
                    // completion status
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "attcomp");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    if (!undetermined)
                    {
                        RenderPassFail(writer, registration.Completed);
                    }
                    writer.RenderEndTag();
                    // margin
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "sidemargin");
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    writer.RenderEndTag();
                    writer.RenderEndTag();
                }
            }
        }
コード例 #20
0
        /// <summary>
        /// Updates control fields with an authorized committee's details.
        /// </summary>
        /// <param name="ac">The authorized committee to display.</param>
        private void ShowCommittee(AuthorizedCommittee ac)
        {
            PostalAddress address;

            if (ac == null)
            {
                _errorMessage.Text        = string.Format("You do not currently have any committees authorized for the {0} election.", CPProfile.ElectionCycle);
                _errorMessage.Visible     = true;
                _committeeDetails.Visible = false;
            }
            else
            {
                // show committee data
                _committeeDetails.Visible = true;
                // committee info
                _principal.Value       = ac.IsPrincipal ? "Yes" : "No";
                _active.Value          = ac.IsActive ? "Yes" : "No";
                _boeDate.Value         = (ac.BoeDate != null) ? ((DateTime)ac.BoeDate).ToDateString() : null;
                _terminationDate.Value = (_terminationDate.Visible = (ac.TerminationDate != null)) ? ((DateTime)ac.TerminationDate).ToDateString() : null;

                // address info
                address = ac.Address;
                if (address != null)
                {
                    _StreetNumber.Value = address.StreetNumber;
                    _StreetName.Value   = address.StreetName;
                    _Apartment.Value    = address.Apartment;
                    _City.Value         = address.City;
                    _State.Value        = CPConvert.ParseStateCode(address.State);
                    _Zip.Value          = (address.Zip != null) ? address.Zip.ToString() : null;
                }
                else
                {
                    _StreetNumber.Value = _StreetName.Value = _Apartment.Value = _City.Value = _State.Value = _Zip.Value = null;
                }

                // last election info
                _lastDate.Value     = (ac.LastElectionDate != null) ? ((DateTime)ac.LastElectionDate).ToDateString() : null;
                _lastOffice.Value   = ac.LastElectionOffice;
                _lastDistrict.Value = ac.LastElectionDistrict;
                _lastParty.Value    = ac.LastPrimaryParty;

                // mailing address info
                address = ac.MailingAdress;
                if (address != null)
                {
                    _mailingLine1.Value        = address.AddressLine1;
                    _mailingStreetNumber.Value = address.StreetNumber;
                    _mailingStreetName.Value   = address.StreetName;
                    _mailingApartment.Value    = address.Apartment;
                    _mailingCity.Value         = address.City;
                    _mailingState.Value        = CPConvert.ParseStateCode(address.State);
                    _mailingZip.Value          = (address.Zip != null) ? address.Zip.ToString() : null;
                }
                else
                {
                    _mailingLine1.Value = _mailingStreetNumber.Value = _mailingStreetName.Value = _mailingApartment.Value = _mailingCity.Value = _mailingState.Value = _mailingZip.Value = null;
                }

                // contact info
                _daytimePhone.Value = (ac.DaytimePhone != null) ? ac.DaytimePhone.ToString() : null;
                _eveningPhone.Value = (ac.EveningPhone != null) ? ac.EveningPhone.ToString() : null;
                _fax.Value          = (ac.Fax != null) ? ac.Fax.ToString() : null;
                _email.Value        = (!string.IsNullOrWhiteSpace(ac.Email)) ? string.Format("<a href=\"mailto:{0}\">{0}</a>", ac.Email) : null;
                if (!string.IsNullOrWhiteSpace(ac.WebsiteUrl))
                {
                    string url = ac.WebsiteUrl;
                    if (!url.StartsWith("http://"))
                    {
                        url = "http://" + url;
                    }
                    _webUrl.Value = string.Format("<a href=\"{0}\" target=\"_blank\">{0}</a>", url);
                }
                else
                {
                    _webUrl.Value = null;
                }

                // treasurer info
                Entity treasurer = ac.Treasurer;
                if (treasurer != null)
                {
                    _salutation.Value   = CPConvert.ToString(treasurer.Honorific);
                    _lastName.Value     = treasurer.LastName;
                    _firstName.Value    = treasurer.FirstName;
                    _mi.Value           = treasurer.MiddleInitial.HasValue ? treasurer.MiddleInitial.Value.ToString() : null;
                    _contactOrder.Value = treasurer.ContactOrder.ToString();
                    address             = treasurer.Address;
                    if (address != null)
                    {
                        _treasStreetNumber.Value = address.StreetNumber;
                        _treasStreetName.Value   = address.StreetName;
                        _treasApartment.Value    = address.Apartment;
                        _treasCity.Value         = address.City;
                        _treasState.Value        = CPConvert.ParseStateCode(address.State);
                        _treasZip.Value          = (address.Zip != null) ? address.Zip.ToString() : null;
                    }
                    else
                    {
                        _treasStreetNumber.Value = _treasStreetName.Value = _treasApartment.Value = _treasCity.Value = _treasState.Value = _treasZip.Value = null;
                    }
                    _treasDaytimePhone.Value = (treasurer.DaytimePhone != null) ? treasurer.DaytimePhone.ToString() : null;
                    _treasEveningPhone.Value = (treasurer.EveningPhone != null) ? treasurer.EveningPhone.ToString() : null;
                    _treasFax.Value          = (treasurer.Fax != null) ? treasurer.Fax.ToString() : null;
                    _treasEmail.Value        = !string.IsNullOrWhiteSpace(treasurer.Email) ? string.Format("<a href=\"mailto:{0}\">{0}</a>", treasurer.Email) : null;

                    // treasurer employer info
                    Entity employer = treasurer.Employer;
                    if (employer != null)
                    {
                        _empName.Value = employer.LastName;
                        address        = employer.Address;
                        if (address != null)
                        {
                            _empStreetNumber.Value = address.StreetNumber;
                            _empStreetName.Value   = address.StreetName;
                            _empCity.Value         = address.City;
                            _empState.Value        = CPConvert.ParseStateCode(address.State);
                            _empZip.Value          = (address.Zip != null) ? address.Zip.ToString() : null;
                        }
                        else
                        {
                            _empStreetNumber.Value = _empStreetName.Value = _empCity.Value = _empState.Value = _empZip.Value = null;
                        }
                        _empPhone.Value = (employer.DaytimePhone != null) ? employer.DaytimePhone.ToString() : null;
                        _empFax.Value   = (employer.Fax != null) ? employer.Fax.ToString() : null;
                    }
                    else
                    {
                        _empName.Value = _empStreetNumber.Value = _empStreetName.Value = _empCity.Value = _empState.Value = _empZip.Value = _empPhone.Value = _empFax.Value = _empPhone.Value = _empFax.Value = null;
                    }
                }
                else
                {
                    _treasStreetNumber.Value = _treasStreetName.Value = _treasApartment.Value = _treasCity.Value = _treasState.Value = _treasZip.Value = _treasDaytimePhone.Value = _treasEveningPhone.Value = _treasFax.Value = null;
                }

                // update liaison list
                _liaisonError.Visible   = false;
                _liaisonDetails.Visible = false;
                ListItem item = _liaisonList.Items[0];
                _liaisonList.Items.Clear();
                _liaisonList.Items.Add(item);
                foreach (Liaison l in ac.Liaisons.Values)
                {
                    string name = l.Name;
                    if (l.LiaisonType == LiaisonType.Consultant)
                    {
                        name += " *";
                    }
                    _liaisonList.Items.Add(new ListItem(name, ac.ID + l.ID.ToString()));
                }

                // update bank accounts list
                _bankError.Visible          = false;
                _bankAccountDetails.Visible = false;
                item = _bankAccountsList.Items[0];
                _bankAccountsList.Items.Clear();
                _bankAccountsList.Items.Add(item);
                foreach (BankAccount ba in ac.BankAccounts.Values)
                {
                    _bankAccountsList.Items.Add(new ListItem(string.Format("{0} ({1})", ba.BankName, ba.Number), ac.ID + ba.ID.ToString()));
                }
            }
        }
コード例 #21
0
ファイル: PostElection.aspx.cs プロジェクト: simoncwu/CAccess
        /// <summary>
        /// Handles the <see cref="TollingEventsList.UpdateDataSources"/> event.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        protected void _tollingEventsList_UpdateDataSources(object sender, EventArgs e)
        {
            // tolling events list
            ScriptManager sm = ScriptManager.GetCurrent(this);

            if (!Page.IsPostBack || !this.IsDataBound || !_tollingEventsList.EnableViewState || (sm != null && sm.IsInAsyncPostBack))
            {
                AuditReportType type = _postElectionAuditNavigation.SelectedReportType;
                _tollingEventsList.Title = string.Format("{0} Tolling Event Details", _tollingEventsList.DisplayAllEvents ? "All" : CPConvert.ToString(type));
                switch (type)
                {
                case AuditReportType.FinalAuditReport:
                    _tollingEventsList.DataSource         = GetTollingEvents(_dar);
                    _tollingEventsList.MessagesDataSource = CmoAuditReview.GetTollingMessageIDs(CPProfile.Cid, CPProfile.ElectionCycle, true);
                    if (_tollingEventsList.DisplayAllEvents)
                    {
                        IncludeEvents(false);
                    }
                    break;

                case AuditReportType.DraftAuditReport:
                    _tollingEventsList.DataSource         = GetTollingEvents(_idr);
                    _tollingEventsList.MessagesDataSource = CmoAuditReview.GetTollingMessageIDs(CPProfile.Cid, CPProfile.ElectionCycle, false);
                    if (_tollingEventsList.DisplayAllEvents)
                    {
                        IncludeEvents(true);
                    }
                    break;

                default:
                    _tollingEventsList.DataSource         = GetTollingEvents(_idr);
                    _tollingEventsList.MessagesDataSource = CmoAuditReview.GetTollingMessageIDs(CPProfile.Cid, CPProfile.ElectionCycle, false);
                    if (_tollingEventsList.DisplayAllEvents)
                    {
                        IncludeEvents(true);
                    }
                    break;
                }
            }
        }
コード例 #22
0
        /// <summary>
        /// Raises the <see cref="Control.DataBinding"/> event.
        /// </summary>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        protected override void OnDataBinding(EventArgs e)
        {
            _rowsArray.Clear();
            string cid = CPProfile.Cid;

            // generate HTML for each public funds determination record
            foreach (PublicFundsDetermination item in this.DataSource)
            {
                string downloadLink = item.MessageID > 0 ? string.Format("<a class=\"pdf-file\" href=\"{0}\" title=\"{1}\">{1}</a>", PageUrlManager.GetMessageUrl(CmoMessage.ToUniqueID(cid, item.MessageID)), "View Letter") : null;
                if (item.PaymentIssued)
                {
                    _rowsArray.Add(string.Format(PaymentRowHtmlTemplate, item.Date, item.PaymentAmount, CPConvert.ToString(item.PaymentMethod), CPConvert.ToString(item.ElectionType), downloadLink));
                }
                else
                {
                    _rowsArray.Add(string.Format(NonPaymentRowHtmlTemplate, item.Date, CPConvert.ToString(item.ElectionType), downloadLink));
                }
            }

            // generate HTML for public funds summary
            _footerHtml = string.Format(FooterHtmlTemplate, this.DataSource.PaymentCount, this.DataSource.TotalPaymentAmount);
        }
コード例 #23
0
        /// <summary>
        /// Event handler for updating control fields with a campaign liaison's details.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An <see cref="EventArgs"/> object that contains the event data.</param>
        protected void ShowLiaison(object sender, EventArgs e)
        {
            Liaison       l;
            PostalAddress address;
            byte          id = 0;

            if (byte.TryParse(_liaisonList.SelectedValue.Substring(1), out id) && (id > 0))
            {
                string committeeID     = _liaisonList.SelectedValue.Substring(0, 1);
                AuthorizedCommittee ac = GetAuthorizedCommittee(committeeID);
                // fetch liaison
                if (!ac.Liaisons.TryGetValue(id, out l))
                {
                    _liaisonError.Text      = "Sorry, the requested campaign contact could not be retrieved.";
                    _liaisonError.Visible   = true;
                    _liaisonDetails.Visible = false;
                    return;
                }
                if (l == null)
                {
                    // error: no liaisons
                    _liaisonError.Text      = string.Format("You do not currently have any campaign liaisons or consultants for the {0} election.", CPProfile.ElectionCycle);
                    _liaisonError.Visible   = true;
                    _liaisonDetails.Visible = false;
                }
                else
                {
                    // show liaison data
                    _liaisonError.Visible       = false;
                    _liaisonDetails.Visible     = true;
                    _liaisonType.Value          = l.LiaisonType.ToString <LiaisonType>();
                    _liaisonOrder.Value         = CPConvert.ToString(l.ContactOrder);
                    _liaisonSalutation.Value    = CPConvert.ToString(l.Honorific);
                    _liaisonLastName.Value      = l.LastName;
                    _liaisonFirstName.Value     = l.FirstName;
                    _liaisonMiddleInitial.Value = l.MiddleInitial.HasValue ? l.MiddleInitial.Value.ToString() : null;
                    address = l.Address;
                    if (address != null)
                    {
                        _liaisonStreetNumber.Value = address.StreetNumber;
                        _liaisonStreetName.Value   = address.StreetName;
                        _liaisonApartment.Value    = address.Apartment;
                        _liaisonCity.Value         = address.City;
                        _liaisonState.Value        = CPConvert.ParseStateCode(address.State);
                        _liaisonZip.Value          = (address.Zip != null) ? address.Zip.ToString() : null;
                    }
                    else
                    {
                        _liaisonStreetNumber.Value = _liaisonStreetName.Value = _liaisonApartment.Value = _liaisonCity.Value = _liaisonState.Value = _liaisonZip.Value = null;
                    }
                    _liaisonDaytimePhone.Value = (l.DaytimePhone != null) ? l.DaytimePhone.ToString() : null;
                    _liaisonEveningPhone.Value = (l.EveningPhone != null) ? l.EveningPhone.ToString() : null;
                    _liaisonFax.Value          = (l.Fax != null) ? l.Fax.ToString() : null;
                    _liaisonEmail.Value        = l.Email;
                    _liaisonManagerial.Value   = l.HasManagerialControl ? "Yes" : "No";
                    _liaisonVG.Value           = l.IsVGLiaison ? "Yes" : "No";
                    _entityName.Visible        = l.LiaisonType == LiaisonType.Consultant;
                    _entityName.Value          = l.EntityName;
                }
            }
            else
            {
                _liaisonDetails.Visible = false;
            }
            _liaisonUpdatePanel.Update();
        }