Ejemplo n.º 1
0
        private void AddPKZone(XmlDocument xmlDoc)
        {
            int num = DataConverter.CLng(GetNodeInnerText(xmlDoc, "//commentid"));

            if (num > 0)
            {
                CommentPKZoneInfo commentPKZoneInfo = new CommentPKZoneInfo();
                commentPKZoneInfo.CommentId  = num;
                commentPKZoneInfo.Content    = GetNodeInnerText(xmlDoc, "//content");
                commentPKZoneInfo.Position   = DataConverter.CLng(GetNodeInnerText(xmlDoc, "//position"));
                commentPKZoneInfo.IP         = this.GetClientIP();
                commentPKZoneInfo.UpdateTime = DateTime.Now;
                if (string.IsNullOrEmpty(PEContext.Current.User.UserName))
                {
                    commentPKZoneInfo.UserName = "******";
                }
                else
                {
                    commentPKZoneInfo.UserName = PEContext.Current.User.UserName;
                }
                CommentPKZone.Add(commentPKZoneInfo);
            }
            if (num > 0)
            {
                this.XmlResponseWriter.WriteElementString("status", "ok");
            }
            else
            {
                this.XmlResponseWriter.WriteElementString("status", "err");
            }
        }
        protected void OkButton_Click(object sender, EventArgs e)
        {
            int num  = BasePage.RequestInt32("CommentID");
            int num2 = BasePage.RequestInt32("ID");
            CommentPKZoneInfo commentPKZoneInfo = new CommentPKZoneInfo();

            commentPKZoneInfo.CommentId  = num;
            commentPKZoneInfo.Title      = base.Request["ItemTitle"];
            commentPKZoneInfo.Content    = base.Request["ItemContent"];
            commentPKZoneInfo.Position   = DataConverter.CLng(base.Request["RadlPosition"]);
            commentPKZoneInfo.IP         = PEContext.Current.UserHostAddress;
            commentPKZoneInfo.UpdateTime = DateTime.Now;
            if (!string.IsNullOrEmpty(PEContext.Current.User.UserName))
            {
                commentPKZoneInfo.UserName = PEContext.Current.User.UserName;
            }
            else
            {
                commentPKZoneInfo.UserName = "******";
            }
            CommentPKZone.Add(commentPKZoneInfo);
            DynamicPage.WriteSuccessMsg("<li>添加辩论成功!</li>", string.Concat(new object[] { "CommentPKZoneManage.aspx?Id=", num2, "&CommentID=", num.ToString(), "&Title=", base.Server.UrlEncode(base.Request["Title"]) }));
        }
        protected void InitComment()
        {
            if (this.m_GeneralId == 0)
            {
                BaseUserControl.WriteErrMsg("<li>没有找到隶属信息评论,请返回!</li>");
            }
            else
            {
                string s = BaseUserControl.RequestString("Title");
                this.LblTitle.Text = s;
                string returnurl = this.ViewFile + "?GeneralID=" + this.m_GeneralId.ToString() + "&title=" + base.Server.UrlEncode(s);
                int    commentId = BaseUserControl.RequestInt32("CommentID");
                switch (BaseUserControl.RequestString("Action"))
                {
                case "Delete":
                    if (Comment.Delete(commentId))
                    {
                        BaseUserControl.WriteSuccessMsg("<li>删除指定信息评论成功!</li>", returnurl);
                    }
                    break;

                case "Audited":
                    if (Comment.SetStatus(commentId, true))
                    {
                        BaseUserControl.WriteSuccessMsg("<li>指定信息评论审核成功!</li>", returnurl);
                    }
                    break;

                case "UnAudited":
                    if (Comment.SetStatus(commentId, false))
                    {
                        BaseUserControl.WriteSuccessMsg("<li>已取消指定评论审核!</li>", returnurl);
                    }
                    break;

                case "Premier":
                    if (Comment.Elite(commentId, true))
                    {
                        BaseUserControl.WriteSuccessMsg("<li>设定指定评论精华成功!</li>", returnurl);
                    }
                    break;

                case "UnPremier":
                    if (Comment.Elite(commentId, false))
                    {
                        BaseUserControl.WriteSuccessMsg("<li>已取消指定评论精华!</li>", returnurl);
                    }
                    break;

                case "AddPKZone":
                {
                    CommentPKZoneInfo commentPKZoneInfo = new CommentPKZoneInfo();
                    commentPKZoneInfo.CommentId  = commentId;
                    commentPKZoneInfo.Content    = base.Request["ItemContent"];
                    commentPKZoneInfo.Position   = DataConverter.CLng(base.Request["RadlPosition"]);
                    commentPKZoneInfo.IP         = PEContext.Current.UserHostAddress;
                    commentPKZoneInfo.UpdateTime = DateTime.Now;
                    commentPKZoneInfo.UserName   = "******";
                    CommentPKZone.Add(commentPKZoneInfo);
                    BaseUserControl.WriteSuccessMsg("<li>感谢您的参与,添加辩论成功!</li>", returnurl);
                    break;
                }
                }
                this.CommentBindData();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string str5;

            this.Path = base.BasePath;
            this.Path = this.Page.Request.Url.Scheme + "://" + this.Page.Request.Url.Authority + this.Path;
            int    commentId = BasePage.RequestInt32("CommentID");
            int    num2      = BasePage.RequestInt32("ID");
            string s         = base.Request["Title"];

            if (((str5 = BasePage.RequestString("Action")) != null) && (str5 == "AddPKZone"))
            {
                CommentPKZoneInfo commentPKZoneInfo = new CommentPKZoneInfo();
                commentPKZoneInfo.CommentId  = commentId;
                commentPKZoneInfo.Content    = base.Request["ItemContent"];
                commentPKZoneInfo.Position   = DataConverter.CLng(base.Request["RadlPosition"]);
                commentPKZoneInfo.IP         = PEContext.Current.UserHostAddress;
                commentPKZoneInfo.UpdateTime = DateTime.Now;
                commentPKZoneInfo.UserName   = "******";
                CommentPKZone.Add(commentPKZoneInfo);
                DynamicPage.WriteSuccessMsg("<li>感谢您的参与,添加辩论成功!</li>", string.Concat(new object[] { "CommentPKZoneManage.aspx?Id=", num2, "&CommentID=", commentId.ToString(), "&Title=", base.Server.UrlEncode(s) }));
            }
            if (!base.IsPostBack)
            {
                if (commentId == 0)
                {
                    DynamicPage.WriteErrMsg("<li>没有找到隶属信息评论,请返回!</li>", string.Concat(new object[] { "CommentPKZoneManage.aspx?Id=", num2, "&CommentID=", commentId.ToString(), "&Title=", base.Server.UrlEncode(s) }));
                }
                else
                {
                    CommentInfo extendCommentInfo = Comment.GetExtendCommentInfo(commentId);
                    if (extendCommentInfo.IsNull)
                    {
                        DynamicPage.WriteErrMsg("<li>没有找到隶属信息评论,请返回!</li>", string.Concat(new object[] { "CommentPKZoneManage.aspx?Id=", num2, "&CommentID=", commentId.ToString(), "&Title=", base.Server.UrlEncode(s) }));
                    }
                    else
                    {
                        string str2 = CommentPKZone.GetPKCount(commentId, 1).ToString();
                        string str3 = CommentPKZone.GetPKCount(commentId, -1).ToString();
                        string str4 = CommentPKZone.GetPKCount(commentId, 0).ToString();
                        this.LblTitle.Text             = "<a href='" + base.BasePath + "Item/" + BasePage.RequestInt32("ID").ToString() + ".aspx'>" + s + "</a>";
                        this.LblUserName.Text          = extendCommentInfo.UserName;
                        this.LblContent.Text           = extendCommentInfo.Content;
                        this.LblTime.Text              = extendCommentInfo.UpdateDateTime.ToString();
                        this.LblSustain.Text           = str2;
                        this.LblOppose.Text            = str3;
                        this.LblSustain2.Text          = str2;
                        this.LblOppose2.Text           = str3;
                        this.LblNeutralismNetizen.Text = str4;
                        this.AgreePagerBindData();
                        this.OpposePagerBindData();
                        this.NeutralismPagerBindData();
                        this.LblItemTitle.Text = s;
                        if (extendCommentInfo.Content.Length > 30)
                        {
                            this.LblItemContent.Text = extendCommentInfo.Content.Substring(0, 30) + "..";
                        }
                        else
                        {
                            this.LblItemContent.Text = extendCommentInfo.Content;
                        }
                        if (!string.IsNullOrEmpty(PEContext.Current.User.UserName))
                        {
                            this.LblState.Text = PEContext.Current.User.UserName;
                        }
                        else
                        {
                            this.LblState.Text = "匿名发表";
                        }
                    }
                }
            }
        }