protected void comment_Click(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                MembershipUser user = Membership.GetUser();

                //ImageButton button = sender as ImageButton;
                //string upDown = button.CommandArgument;
                LoadBored();

                short weight = Convert.ToInt16(this.comWt.Value);
                //could be the vote or score ID depending on weight value
                int sourceID = Convert.ToInt32(comCd.Value);

                //A weight of 100 is a reply to
                if (weight == 100)
                {
                    _board.ReplyToVote(sourceID, Membership.GetUser(), txtComment.Text);
                }
                else
                {
                    Score score = _board.FindScore(true, sourceID);
                    if (score == null)
                    {
                        score = _board.FindScore(false, sourceID);
                    }

                    if (score != null)
                    {
                        score.AddVote(user, txtComment.Text, weight);
                    }
                }

                if (weight != 0 && weight < 100)
                {
                    BindAll();
                    upOut.Update();
                }
                else
                {
                    BindComments();
                    upOut.Update();
                }
            }
            else
            {
                MPESignup.Show();
            }

            txtComment.Text = string.Empty;
            upComBox.Update();
        }
Пример #2
0
        public void ReplyToVote(int voteID, MembershipUser user, string comment)
        {
            Vote vote = FindVote(voteID);

            if (vote != null)
            {
                Score score = vote.Parent;

                string originalUser = string.Format("<strong>@{0}</strong>:  ", vote.UserName);

                score.AddVote(user, originalUser + comment, 0);
            }
        }