Пример #1
0
        private void BindVoteItem(VoteInfo vote)
        {
            int num = 0;

            if (vote != null)
            {
                this.lblVoteName.Text = vote.VoteName;
                System.Collections.Generic.IList <VoteItemInfo> voteItems = CommentBrowser.GetVoteItems(this.voteId);
                for (int i = 0; i < voteItems.Count; i++)
                {
                    if (vote.VoteCounts != 0)
                    {
                        voteItems[i].Percentage = voteItems[i].ItemCount / vote.VoteCounts * 100m;
                        num += voteItems[i].ItemCount;
                    }
                    else
                    {
                        voteItems[i].Percentage = 0m;
                    }
                }
                this.rptVoteItem.DataSource = voteItems;
                this.rptVoteItem.DataBind();
                if (this.lblTotal != null)
                {
                    this.lblTotal.Text = num.ToString();
                }
            }
        }