示例#1
0
        protected void LoadCommentDetails()
        {
            CommentManagementBO bo = new CommentManagementBO();
            UserManagementBO userBO = new UserManagementBO();
            CommentVO vo = bo.GetComment(commentID);
            comVO = vo;

            //Give comment space for its depth
            for (int i = 0; i < commentDepth; i++) {
                spacingLabel.Text = spacingLabel.Text + "<td width=\"25px\"></td>";
            }

            commentRating = vo.Rating;
            string username = userBO.GetUser(vo.UserID).Username;

            userLink.Text = username;

            commentInfo.Text = " rated at " +
                                commentRating + " points, posted " +
                                bo.FormatePostTime(vo.PostDate);

            commentContents.Text = "<p>" + vo.CommentContents + "</p>";

            //Choose which controls to display
            if(Session["login"] == null){
                editButton.Visible = false;
                deleteButton.Visible = false;
                replyButton.Visible = false;
            }
            else if (!username.Equals(Session["login"].ToString())) {
                editButton.Visible = false;
                deleteButton.Visible = false;
            }

            //Change vote image based on whether or not it's been voted on
            if(Session["login"] != null){
                int i = bo.CheckIfVoted(commentID, userBO.GetUser(Session["login"].ToString()).UserID);
                if (i == 1) {
                    upArrow.ImageUrl = "~/Images/uparrow_voted.png";
                }
                else if (i == -1) {
                    downArrow.ImageUrl = "~/Images/downarrow_voted.png";
                }
            }
        }